private ContentMetaModel PrepareContentMetaModel(ContentMetaDescriptor descriptor)
        {
            string           type = descriptor.Type;
            ContentMetaModel contentMetaModel1;

            if (!(type == "Application"))
            {
                if (!(type == "Patch"))
                {
                    if (type == "AddOnContent")
                    {
                        NintendoAddOnContentExtendedHeader extendedHeader    = (NintendoAddOnContentExtendedHeader)descriptor.ExtendedHeader;
                        AddOnContentContentMetaModel       contentMetaModel2 = new AddOnContentContentMetaModel();
                        contentMetaModel2.RequiredApplicationVersion = extendedHeader.RequiredApplicationVersion;
                        contentMetaModel2.SetUInt64ApplicationId(extendedHeader.ApplicationId);
                        contentMetaModel2.Tag   = extendedHeader.Tag;
                        contentMetaModel2.Index = this.GetAddOnContentIndex(descriptor, extendedHeader);
                        contentMetaModel1       = (ContentMetaModel)contentMetaModel2;
                        this.m_ModelType        = typeof(AddOnContentContentMetaModel);
                    }
                    else
                    {
                        contentMetaModel1 = new ContentMetaModel();
                    }
                }
                else
                {
                    NintendoPatchExtendedHeader extendedHeader    = (NintendoPatchExtendedHeader)descriptor.ExtendedHeader;
                    PatchContentMetaModel       contentMetaModel2 = new PatchContentMetaModel();
                    contentMetaModel2.RequiredSystemVersion = extendedHeader.RequiredSystemVersion;
                    contentMetaModel2.SetUInt64ApplicationId(extendedHeader.ApplicationId);
                    contentMetaModel1 = (ContentMetaModel)contentMetaModel2;
                    this.m_ModelType  = typeof(PatchContentMetaModel);
                }
            }
            else
            {
                NintendoApplicationExtendedHeader extendedHeader    = (NintendoApplicationExtendedHeader)descriptor.ExtendedHeader;
                ApplicationContentMetaModel       contentMetaModel2 = new ApplicationContentMetaModel();
                contentMetaModel2.RequiredSystemVersion = extendedHeader.RequiredSystemVersion;
                contentMetaModel2.SetUInt64PatchId(extendedHeader.PatchId);
                contentMetaModel1 = (ContentMetaModel)contentMetaModel2;
                this.m_ModelType  = typeof(ApplicationContentMetaModel);
            }
            return(contentMetaModel1);
        }
Esempio n. 2
0
        internal NintendoContentMetaBase(List <Tuple <ISource, NintendoContentInfo> > contentSourceList, ContentMetaDescriptor descriptor, bool isProdEncryption)
        {
            this.m_contentSourceList = contentSourceList;
            this.m_descriptor        = descriptor;
            string type                  = this.m_descriptor.Type;
            ulong  id                    = this.m_descriptor.Id;
            uint   version               = this.m_descriptor.Version;
            byte   attributes            = this.m_descriptor.Attributes;
            long   applicationId         = (long)this.m_descriptor.ApplicationId;
            uint   downloadSystemVersion = this.m_descriptor.RequiredDownloadSystemVersion;
            List <NintendoContentInfo>     contentInfoList     = this.m_descriptor.ContentInfoList;
            List <NintendoContentMetaInfo> contentMetaInfoList = this.m_descriptor.ContentMetaInfoList;

            byte[] digest = this.m_descriptor.Digest;
            if (!(type == "Application"))
            {
                if (!(type == "AddOnContent"))
                {
                    if (type == "Patch")
                    {
                        NintendoPatchExtendedHeader extendedHeader = (NintendoPatchExtendedHeader)descriptor.ExtendedHeader;
                        this.m_contentMeta = NintendoContentMeta.CreatePatchMeta(id, version, attributes, downloadSystemVersion, extendedHeader, contentInfoList, contentMetaInfoList, digest);
                    }
                    else
                    {
                        this.m_contentMeta = NintendoContentMeta.CreateDefault(id, version, type, attributes, downloadSystemVersion, contentInfoList, contentMetaInfoList, digest);
                    }
                }
                else
                {
                    NintendoAddOnContentExtendedHeader extendedHeader = (NintendoAddOnContentExtendedHeader)descriptor.ExtendedHeader;
                    this.m_contentMeta = NintendoContentMeta.CreateAddOnContentMeta(id, version, attributes, downloadSystemVersion, extendedHeader, contentInfoList, contentMetaInfoList, digest);
                }
            }
            else
            {
                NintendoApplicationExtendedHeader extendedHeader = (NintendoApplicationExtendedHeader)descriptor.ExtendedHeader;
                this.m_contentMeta = NintendoContentMeta.CreateApplicationMeta(id, version, attributes, downloadSystemVersion, extendedHeader, contentInfoList, contentMetaInfoList, digest);
            }
            this.m_source = new NintendoContentMetaBaseSource(this, !isProdEncryption);
        }