Exemplo n.º 1
0
		public static List<Entry> ProcessBlamFile(string path)
		{
			List<Entry> entries = null;

			using(IO.EndianReader s = new BlamLib.IO.EndianReader(path, BlamLib.IO.EndianState.Big))
			{
				BLF head = new BLF();
				try { head.Read(s); }
				catch (Debug.ExceptionLog) { return null; }
				entries.Add(head);

				uint group_tag;
				TagInterface.TagGroup tag_group;
				Entry e;

				while((group_tag = unchecked((uint)s.Peek())) != MiscGroups._eof.ID)
				{
					tag_group = Groups.FindTagGroup(group_tag);
					Debug.Assert.If(tag_group, "Unhandled group @0x{0:X} ('{1}')", s.Position, new string(TagInterface.TagGroup.FromUInt(group_tag)));

					Type t = (Type)tag_group.EngineData;

					System.Reflection.ConstructorInfo ci = t.GetConstructor(new Type[0]);
					e = (Entry)ci.Invoke(null);

					e.Read(s);
					entries.Add(e);
				}
			}

			return entries;
		}