コード例 #1
0
        } // FromFile

        /// <summary>
        /// Loads the header block of a release manifest file
        /// </summary>
        private void DeserializeHeader(
            BinaryReader reader,
            ReleaseManifest manifest,
            DeserializationContext context)
        {
            manifest.Header.magic         = reader.ReadUInt32();
            manifest.Header.formatVersion = reader.ReadUInt32();
            manifest.Header.unknownCount  = reader.ReadUInt32();
            manifest.Header.entityVersion = reader.ReadUInt32();
        }
コード例 #2
0
        /// <summary>
        /// Skips over the filesystem body portion of a release manifest file.
        ///
        /// Offsets to the directory and file tables' contents are stored in the deserialization
        /// context object.
        /// </summary>
        private void DeserializeSkipFileSystemBody(
            BinaryReader reader,
            ReleaseManifest manifest,
            DeserializationContext context)
        {
            context.DirectoryTableCount      = reader.ReadUInt32();
            context.DirectoryTableDataOffset = reader.BaseStream.Position;
            reader.BaseStream.Position      += kDirectoryEntrySize * context.DirectoryTableCount;

            context.FileTableCount      = reader.ReadUInt32();
            context.FileTableDataOffset = reader.BaseStream.Position;
            reader.BaseStream.Position += kFileEntrySize * context.FileTableCount;
        }
コード例 #3
0
        internal ReleaseManifestFileEntry(
            uint fileId,
            ReleaseManifest releaseManifest,
            ReleaseManifestFileEntryDescriptor fileDescriptor,
            ReleaseManifestDirectoryEntry parent)
            : base(releaseManifest.StringTable[fileDescriptor.NameIndex])
        {
            m_id = fileId;
            m_releaseManifest = releaseManifest;
            m_descriptor      = fileDescriptor;
            m_parent          = parent;
            m_parent.m_files.Add(this);
            m_parent.AddChild(this); // TODO: Override to remove duplication

            Name = m_releaseManifest.StringTable[NameStringTableIndex];
        }
コード例 #4
0
        /// <summary>
        /// Deserializes the string table of a release manifest file
        /// </summary>
        private void DeserializeStringTable(
            BinaryReader reader,
            ReleaseManifest manifest,
            DeserializationContext context)
        {
            var stringTable = new ReleaseManifestStringTable();

            stringTable.Count     = reader.ReadUInt32();
            stringTable.BlockSize = reader.ReadUInt32();
            stringTable.Strings   = new string[stringTable.Count];
            for (var i = 0; i < stringTable.Count; i++)
            {
                stringTable.Strings[i] = reader.ReadNullTerminatedString();
            }
            manifest.StringTable = stringTable;
        }
コード例 #5
0
        // - deserialization ------------------------------------------------------------------------
        /// <summary>
        /// Loads a Riot Application Distribution System Release Manifest file from the given path.
        /// </summary>
        public ReleaseManifest Load(string path)
        {
            using (var ms = new MemoryStream(File.ReadAllBytes(path)))
                using (var reader = new BinaryReader(ms)) {
                    var rmFile  = new ReleaseManifest();
                    var context = new DeserializationContext()
                    {
                        ReleaseManifest = rmFile
                    };

                    DeserializeHeader(reader, rmFile, context);
                    DeserializeSkipFileSystemBody(reader, rmFile, context);
                    DeserializeStringTable(reader, rmFile, context);
                    DeserializeFileSystemBody(reader, rmFile, context);

                    return(rmFile);
                }// using
        } // FromFile
コード例 #6
0
        internal ReleaseManifestDirectoryEntry(
            uint directoryId,
            ReleaseManifest releaseManifest,
            ReleaseManifestDirectoryDescriptor descriptor,
            ReleaseManifestDirectoryEntry parent)
            : base(releaseManifest.StringTable[descriptor.NameIndex])
        {
            m_id = directoryId;
            m_releaseManifest = releaseManifest;
            m_descriptor      = descriptor;

            m_parent = parent;
            if (m_parent != null)
            {
                m_parent.m_directories.Add(this);
                m_parent.AddChild(this); // TODO: Override to remove duplication
            }

            m_directories = new List <ReleaseManifestDirectoryEntry>((int)descriptor.SubdirectoryCount);
            m_files       = new List <ReleaseManifestFileEntry>((int)descriptor.FileCount);

            this.Name = releaseManifest.StringTable[descriptor.NameIndex];
        }
コード例 #7
0
        /// <summary>
        /// Deserializes the filesystem portion (directory and files) of a release manifest file.
        /// </summary>
        private void DeserializeFileSystemBody(
            BinaryReader reader,
            ReleaseManifest manifest,
            DeserializationContext context)
        {
            // - First load the directory block and treeify it ---------------------------------------
            reader.BaseStream.Position   = context.DirectoryTableDataOffset;
            context.DirectoryDescriptors = new ReleaseManifestDirectoryDescriptor[context.DirectoryTableCount];
            context.FileParentTable      = new ReleaseManifestDirectoryEntry[context.FileTableCount];
            context.DirectoryTable       = new ReleaseManifestDirectoryEntry[context.DirectoryTableCount];

            for (var i = 0; i < context.DirectoryTableCount; i++)
            {
                context.DirectoryDescriptors[i] = reader.ReadRMDirectoryDescriptor();
            }

            DeserializeTreeifyDirectoryDescriptor(0, context);
            manifest.Directories = new ReadOnlyCollection <ReleaseManifestDirectoryEntry>(context.DirectoryTable);
            manifest.Root        = context.DirectoryTable[0];

            // - Place the File Descriptors into our tree---------------------------------------------
            reader.BaseStream.Position = context.FileTableDataOffset;
            var files = new ReleaseManifestFileEntry[context.FileTableCount];

            for (var fileId = 0U; fileId < context.FileTableCount; fileId++)
            {
                var fileDescriptor = reader.ReadRMFileEntryDescriptor();
                files[fileId] = new ReleaseManifestFileEntry(
                    fileId,
                    manifest,
                    fileDescriptor,
                    context.FileParentTable[fileId]
                    );
            }

            manifest.Files = new ReadOnlyCollection <ReleaseManifestFileEntry>(files);
        }
コード例 #8
0
ファイル: RiotProject.cs プロジェクト: briankchan/librads
 public RiotProject(RiotProjectType projectType, ReleaseManifest releaseManifest, uint version)
 {
    this.projectType = projectType;
    this.releaseManifest = releaseManifest;
    this.version = version;
 }
コード例 #9
0
 public ReleaseManifestWriter(ReleaseManifest manifest)
 {
     this.manifest = manifest;
 }