Beispiel #1
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()));
        }
Beispiel #2
0
 public ContentMetaDescriptor(string type, ulong id, uint version, byte attributes, ulong applicationId, uint requiredDownloadSystemVersion, List <NintendoContentInfo> contentInfoList, List <NintendoContentMetaInfo> contentMetaInfoList, NintendoExtendedHeader extendedHeader, byte[] digest)
 {
     this.Type                          = type;
     this.Id                            = id;
     this.Version                       = version;
     this.Attributes                    = attributes;
     this.ContentInfoList               = contentInfoList;
     this.ContentMetaInfoList           = contentMetaInfoList;
     this.ExtendedHeader                = extendedHeader;
     this.RequiredDownloadSystemVersion = requiredDownloadSystemVersion;
     this.Digest                        = digest;
 }
Beispiel #3
0
        private static ContentMetaDescriptor ExtractContentMetaDescriptor(string type, string metaPath, List <NintendoContentInfo> contentInfoList)
        {
            ulong applicationId = 0;
            byte  attributes    = 0;
            NintendoExtendedHeader         extendedHeader      = (NintendoExtendedHeader)null;
            List <NintendoContentMetaInfo> contentMetaInfoList = new List <NintendoContentMetaInfo>();
            uint  num1 = NintendoContentMetaBase.GetDefaultDownloadSystemVersion();
            ulong id;
            uint  version;

            if (type.Equals("SystemUpdate"))
            {
                ContentMetaModel contentMeta1 = NintendoContentMetaBase.GetDeserializedModel <SystemUpdateModel>(metaPath, false).ContentMeta;
                if (contentMeta1.Type != "SystemUpdate")
                {
                    throw new ArgumentException("The content meta type is not SystemUpdate.");
                }
                id      = contentMeta1.GetUInt64Id();
                version = contentMeta1.Version;
                foreach (ContentMetaModel contentMeta2 in contentMeta1.ContentMetaList)
                {
                    contentMetaInfoList.Add(new NintendoContentMetaInfo(contentMeta2.Type, contentMeta2.GetUInt64Id(), contentMeta2.Version, (byte)ContentMetaAttributeExtension.FromStringList((IEnumerable <string>)contentMeta2.AttributeList)));
                }
            }
            else
            {
                DotMetaReader dotMetaReader = new DotMetaReader(metaPath);
                id         = dotMetaReader.GetContentMetaId();
                version    = dotMetaReader.GetVersion();
                attributes = dotMetaReader.GetContentMetaAttributes();
                num1       = dotMetaReader.GetRequiredDownloadSystemVersion().GetValueOrDefault(num1);
                if (!(type == "Application"))
                {
                    if (!(type == "AddOnContent"))
                    {
                        if (type == "Patch")
                        {
                            applicationId = dotMetaReader.GetApplicationId();
                            uint?requiredSystemVersion1 = dotMetaReader.GetRequiredSystemVersion();
                            uint requiredSystemVersion2 = requiredSystemVersion1.HasValue ? requiredSystemVersion1.Value : NintendoContentMeta.GetRequiredSystemVersion();
                            extendedHeader = (NintendoExtendedHeader) new NintendoPatchExtendedHeader(dotMetaReader.GetApplicationId(), requiredSystemVersion2);
                            version        = NintendoContentMetaBase.ShiftVersion(version, "Patch");
                        }
                    }
                    else
                    {
                        applicationId  = dotMetaReader.GetApplicationId();
                        extendedHeader = (NintendoExtendedHeader) new NintendoAddOnContentExtendedHeader(dotMetaReader.GetApplicationId(), dotMetaReader.GetRequiredApplicationVersion(), dotMetaReader.GetAddOnContentTag());
                        version        = NintendoContentMetaBase.ShiftVersion(version, "AddOnContent");
                    }
                }
                else
                {
                    long num2 = (long)id + 2048L;
                    uint?requiredSystemVersion = dotMetaReader.GetRequiredSystemVersion();
                    int  num3 = requiredSystemVersion.HasValue ? (int)requiredSystemVersion.Value : (int)NintendoContentMeta.GetRequiredSystemVersion();
                    extendedHeader = (NintendoExtendedHeader) new NintendoApplicationExtendedHeader((ulong)num2, (uint)num3);
                    version        = NintendoContentMetaBase.ShiftVersion(version, "Application");
                }
            }
            return(new ContentMetaDescriptor(type, id, version, attributes, applicationId, num1, contentInfoList, contentMetaInfoList, extendedHeader, new byte[NintendoContentMeta.GetDigestSize()]));
        }