Ejemplo n.º 1
0
		private IList<Managed> ParseGroupBin(BinaryParser parser)
		{
			IList<Managed> items = this.context.Resolve<IList<Managed>>();

			parser.Expect(magic);
			parser.Expect(major);
			parser.Expect(minor);
			this.rev = parser.ConsumeByte();

			if (0 != parser.ConsumeUInt16())
			{
				throw new FormatException();
			}

			var resGroup = this.context.Resolve<ResGroup>(new Parameter[] { TypedParameter.From(parser.ResourceFile) });
			resGroup.BasePath = parser.BasePath;
			items.Add(resGroup);

			for (;;)
			{
				var blockHash = parser.ConsumeUInt32();
				if (blockHash == 0)
				{
					break;
				}
				var pos = parser.Position;
				var len = parser.ConsumeUInt32();
				switch (blockHash)
				{
					case 0x8081E087:
						this.ParseResGroupMembers(parser, resGroup);
						break;
					case 0xDC3C2177:
						this.ParseGroupResources(parser, resGroup);
						break;
					case 0x3b495dc0:
						this.ParseChildGroups(parser, resGroup);
						break;
					default:
						throw new FormatException();
				}
				if (parser.Position != pos + len)
				{
					throw new FormatException();
				}
			}
			return items;
		}
Ejemplo n.º 2
0
		private void ParseChildGroups(BinaryParser parser, ResGroup resGroup)
		{
			byte num = parser.ConsumeByte();
			while (num > 0)
			{
				string path = parser.ConsumeStringZ();
				if (!string.IsNullOrEmpty(path))
				{
					resGroup.AddFile(path);
				}
				{
					if (0 != parser.ConsumeUInt32())
					{
						throw new FormatException();
					}
				}
				{
					if (0x00001000 != parser.ConsumeInt32())
					{
						throw new FormatException();
					}
				}
				{
					if (0xd9794596 != parser.ConsumeUInt32())
					{
						throw new FormatException();
					}
				}

				--num;
			}
		}