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;
		}