Exemplo n.º 1
0
        private static void ReadBlocks(IReader reader, ContainerReader containerFile, TagContainer tags)
        {
            while (containerFile.NextBlock())
            {
                switch (containerFile.BlockName)
                {
                case "data":
                    // Data block
                    tags.AddDataBlock(ReadDataBlock(reader, containerFile.BlockVersion));
                    break;

                case "tag!":
                    // Extracted tag
                    tags.AddTag(ReadTag(reader, containerFile.BlockVersion));
                    break;

                case "ersp":
                    // Extracted Raw Resource Page
                    tags.AddExtractedResourcePage(ReadExtractedResourcePage(reader, containerFile.BlockVersion));
                    break;

                case "rspg":
                    // Resource page
                    tags.AddResourcePage(ReadResourcePage(reader, containerFile.BlockVersion));
                    break;

                case "rsrc":
                    // Resource info
                    tags.AddResource(ReadResource(reader, containerFile.BlockVersion));
                    break;
                }
            }
        }
Exemplo n.º 2
0
        private static Patch ReadBlocks(IReader reader, ContainerReader container)
        {
            var result = new Patch();

            while (container.NextBlock())
            {
                switch (container.BlockName)
                {
                case "titl":
                    ReadPatchInfo(reader, container.BlockVersion, result);
                    break;

                case "segm":
                    ReadSegmentChanges(reader, result);
                    break;

                case "blfc":
                    ReadBlfInfo(reader, result);
                    break;

                    #region Deprecated

                case "meta":
                    ReadMetaChanges(reader, result);
                    break;

                case "locl":
                    ReadLocaleChanges(reader, result);
                    break;

                    #endregion Deprecated
                }
            }
            return(result);
        }
Exemplo n.º 3
0
        public static TagContainer ReadTagContainer(IReader reader)
        {
            var tags = new TagContainer();

            var containerFile = new ContainerReader(reader);

            if (!containerFile.NextBlock() || containerFile.BlockName != "tagc")
            {
                throw new ArgumentException("Not a valid tag container file");
            }

            containerFile.EnterBlock();
            ReadBlocks(reader, containerFile, tags);
            containerFile.LeaveBlock();

            return(tags);
        }
Exemplo n.º 4
0
        public static Patch LoadPatch(IReader reader)
        {
            var container = new ContainerReader(reader);

            if (!container.NextBlock() || container.BlockName != "asmp")
            {
                throw new InvalidOperationException("Invalid assembly patch");
            }
            if (container.BlockVersion > 0)
            {
                throw new InvalidOperationException("Unrecognized patch version");
            }

            container.EnterBlock();
            Patch patch = ReadBlocks(reader, container);

            container.LeaveBlock();

            return(patch);
        }
Exemplo n.º 5
0
        private static void ReadBlocks(IReader reader, ContainerReader containerFile, TagContainer tags)
        {
            while (containerFile.NextBlock())
            {
                switch (containerFile.BlockName)
                {
                case "data":
                    // Data block
                    tags.AddDataBlock(ReadDataBlock(reader, containerFile.BlockVersion));
                    break;

                case "tag!":
                    // Extracted tag
                    tags.AddTag(ReadTag(reader, containerFile.BlockVersion));
                    break;

                case "ersp":
                    // Extracted Raw Resource Page
                    tags.AddExtractedResourcePage(ReadExtractedResourcePage(reader, containerFile.BlockVersion));
                    break;

                case "rspg":
                    // Resource page
                    tags.AddResourcePage(ReadResourcePage(reader, containerFile.BlockVersion));
                    break;

                case "rsrc":
                    // Resource info
                    tags.AddResource(ReadResource(reader, containerFile.BlockVersion));
                    break;

                case "pdct":
                    // Prediction info
                    tags.AddPrediction(ReadPrediction(reader, containerFile.BlockVersion));
                    break;

                case "sndc":
                    // Sound platform codec
                    tags.AddSoundCodec(ReadSoundCodec(reader, containerFile.BlockVersion));
                    break;

                case "snpr":
                    // Sound pitch range
                    tags.AddSoundPitchRange(ReadSoundPitchRange(reader, containerFile.BlockVersion));
                    break;

                case "snld":
                    // Sound language pitch range
                    tags.AddSoundLanguageDuration(ReadSoundLanguageDuration(reader, containerFile.BlockVersion));
                    break;

                case "snpb":
                    // Sound playback parameter
                    tags.AddSoundPlayback(ReadSoundPlayback(reader, containerFile.BlockVersion));
                    break;

                case "snsc":
                    // Sound scale
                    tags.AddSoundScale(ReadSoundScale(reader, containerFile.BlockVersion));
                    break;

                case "spro":
                    // Sound promotion
                    tags.AddSoundPromotion(ReadSoundPromotion(reader, containerFile.BlockVersion));
                    break;

                case "scpb":
                    // Sound custom playback
                    tags.AddSoundCustomPlayback(ReadSoundCustomPlayback(reader, containerFile.BlockVersion));
                    break;

                case "snex":
                    // Sound extra info
                    tags.AddSoundExtraInfo(ReadSoundExtraInfo(reader, containerFile.BlockVersion));
                    break;
                }
            }
        }