public NintendoContentMetaXmlSource(NintendoContentMetaBase contentMetaBase, ISource metaHashSource, long metaSize)
        {
            this.m_contentMetaBase = contentMetaBase;
            this.m_MetaHashSource  = metaHashSource;
            NintendoContentMetaReader contentMetaReader = new NintendoContentMetaReader(contentMetaBase.GetBytes());
            ContentMetaModel          contentMetaModel1 = this.PrepareContentMetaModel(contentMetaBase.GetContentMetaDescryptor());

            contentMetaModel1.Type = contentMetaReader.GetType();
            contentMetaModel1.SetUInt64Id(contentMetaReader.GetId());
            contentMetaModel1.Version       = contentMetaReader.GetVersion();
            contentMetaModel1.AttributeList = ((ContentMetaAttribute)contentMetaReader.GetAttributes()).ToStringList();
            contentMetaModel1.RequiredDownloadSystemVersion = contentMetaReader.GetRequiredDownloadSystemVersion();
            byte[] bytes1 = new byte[NintendoContentMeta.GetDigestSize()];
            contentMetaModel1.SetDigestBytes(bytes1);
            List <NintendoContentInfo> contentInfoList = contentMetaReader.GetContentInfoList();

            if (contentInfoList.Count > 0)
            {
                contentMetaModel1.ContentList = new List <ContentModel>();
                foreach (NintendoContentInfo nintendoContentInfo in contentInfoList)
                {
                    ContentModel contentModel = new ContentModel();
                    contentModel.Type = nintendoContentInfo.Type;
                    contentModel.Size = nintendoContentInfo.Size;
                    byte[] bytes2 = new byte[NintendoContentMeta.GetContentInfoHashSize()];
                    contentModel.SetIdBytes(bytes2);
                    contentModel.SetHashBytes(bytes2);
                    contentMetaModel1.ContentList.Add(contentModel);
                }
            }
            contentMetaModel1.ContentList = contentMetaModel1.ContentList ?? new List <ContentModel>();
            this.m_MetaModel = new ContentModel();
            contentMetaModel1.ContentList.Add(this.m_MetaModel);
            this.m_MetaModel.Type = "Meta";
            this.m_MetaModel.Size = metaSize;
            byte[] bytes3 = new byte[NintendoContentMeta.GetContentInfoHashSize()];
            this.m_MetaModel.SetIdBytes(bytes3);
            this.m_MetaModel.SetHashBytes(bytes3);
            List <NintendoContentMetaInfo> contentMetaInfoList = contentMetaReader.GetContentMetaInfoList();

            if (contentMetaInfoList.Count > 0)
            {
                contentMetaModel1.ContentMetaList = new List <ContentMetaModel>();
                foreach (NintendoContentMetaInfo nintendoContentMetaInfo in contentMetaInfoList)
                {
                    ContentMetaModel contentMetaModel2 = new ContentMetaModel();
                    contentMetaModel2.Type = nintendoContentMetaInfo.Type;
                    contentMetaModel2.SetUInt64Id(nintendoContentMetaInfo.Id);
                    contentMetaModel2.Version       = nintendoContentMetaInfo.Version;
                    contentMetaModel2.AttributeList = ((ContentMetaAttribute)nintendoContentMetaInfo.Attributes).ToStringList();
                    contentMetaModel1.ContentMetaList.Add(contentMetaModel2);
                }
            }
            this.m_model = contentMetaModel1;
            this.Size    = (long)this.GetBytes().Length;
        }
Esempio n. 2
0
        private static ContentMetaDescriptor ExtractContentMetaDescriptor(byte[] buffer, ContentMetaModel model, List <NintendoContentInfo> contentInfoList)
        {
            NintendoContentMetaReader contentMetaReader = new NintendoContentMetaReader(buffer);
            NintendoExtendedHeader    extendedHeader    = contentMetaReader.GetExtendedHeader();

            if (contentMetaReader.GetType() == "AddOnContent")
            {
                (extendedHeader as NintendoAddOnContentExtendedHeader).Tag = (model as AddOnContentContentMetaModel).Tag;
            }
            return(new ContentMetaDescriptor(contentMetaReader.GetType(), contentMetaReader.GetId(), contentMetaReader.GetVersion(), contentMetaReader.GetAttributes(), contentMetaReader.GetApplicationId(), contentMetaReader.GetRequiredDownloadSystemVersion(), contentInfoList, contentMetaReader.GetContentMetaInfoList(), extendedHeader, contentMetaReader.GetDigest()));
        }