Ejemplo n.º 1
0
 public uiTagData(mTagData tagData)
 {
     InitializeComponent();
     foreach (Control control in base.Controls)
     {
         control.ContextMenuStrip = contextMenuStrip1;
     }
     ValueData         = tagData;
     lblValueName.Text = ValueData.Name;
 }
Ejemplo n.º 2
0
        private void ParseRecursively(List <mValue> ValueList, int chunkOffset, int chunkNumber)
        {
            for (int i = 0; i < ValueList.Count; i++)
            {
                object name;
                switch (ValueList[i].Attributes)
                {
                case mValue.ObjectAttributes.TagBlock:
                {
                    if ((chunkOffset + ValueList[i].Offset) <= ((int)Map.IO.In.BaseStream.Length))
                    {
                        break;
                    }
                    continue;
                }

                case mValue.ObjectAttributes.TagData:
                {
                    if ((chunkOffset + ValueList[i].Offset) <= ((int)Map.IO.In.BaseStream.Length))
                    {
                        goto Label_0224;
                    }
                    continue;
                }

                case mValue.ObjectAttributes.TagReference:
                {
                    if ((chunkOffset + ValueList[i].Offset) <= ((int)Map.IO.In.BaseStream.Length))
                    {
                        goto Label_03B7;
                    }
                    continue;
                }

                case mValue.ObjectAttributes.StringID:
                {
                    if ((chunkOffset + ValueList[i].Offset) <= ((int)Map.IO.In.BaseStream.Length))
                    {
                        goto Label_05E5;
                    }
                    continue;
                }

                default:
                {
                    continue;
                }
                }
                Map.IO.In.BaseStream.Position = chunkOffset + ValueList[i].Offset;
                mTagBlock block = (mTagBlock)ValueList[i];
                Structure item  = new Structure {
                    Name = block.Name
                };
                if (chunkNumber != -1)
                {
                    name      = item.Name;
                    item.Name = string.Concat(new object[] { name, " [", chunkNumber, "]" });
                }
                item.Size    = block.Size;
                item.Count   = Map.IO.In.ReadInt32();
                item.Pointer = Map.IO.In.ReadInt32() - Map.Map_Header.mapMagic;
                if (!(((item.Count <= 0) | (item.Pointer <= 0)) | (item.Count > 0x186a0)))
                {
                    item.Offset = chunkOffset + block.Offset;
                    Structures.Add(item);
                    for (int j = 0; j < item.Count; j++)
                    {
                        ParseRecursively(block.Values, item.Pointer + (j * item.Size), j);
                    }
                }
                continue;
Label_0224:
                Map.IO.In.BaseStream.Position = chunkOffset + ValueList[i].Offset;
                mTagData data  = (mTagData)ValueList[i];
                TagData  data2 = new TagData {
                    Name = data.Name
                };
                if (chunkNumber != -1)
                {
                    name       = data2.Name;
                    data2.Name = string.Concat(new object[] { name, " [", chunkNumber, "]" });
                }
                data2.Size = Map.IO.In.ReadInt32();
                Stream baseStream = Map.IO.In.BaseStream;
                baseStream.Position += 8L;
                data2.Pointer        = Map.IO.In.ReadInt32() - Map.Map_Header.mapMagic;
                if (!((data2.Size <= 0) | (data2.Pointer <= 0)))
                {
                    data2.Offset = chunkOffset + data.Offset;
                    Tag_Data_Blocks.Add(data2);
                }
                continue;
Label_03B7:
                Map.IO.In.BaseStream.Position = (chunkOffset + ValueList[i].Offset) + 12;
                mTagReference reference = (mTagReference)ValueList[i];
                Ident         ident     = new Ident {
                    Name = reference.Name
                };
                if (chunkNumber != -1)
                {
                    name       = ident.Name;
                    ident.Name = string.Concat(new object[] { name, " [", chunkNumber, "]" });
                }
                ident.Offset = chunkOffset + reference.Offset;
                ident.ID     = Map.IO.In.ReadInt32();
                int tagIndexByIdent = Map.GetTagIndexByIdent(ident.ID);
                if (tagIndexByIdent != -1)
                {
                    ident.TagClass = Map.Index_Items[tagIndexByIdent].Class;
                }
                else
                {
                    ident.TagClass = "Null";
                }
                if (tagIndexByIdent != -1)
                {
                    int    key = Map.Index_Items[tagIndexByIdent].Ident;
                    string str = Map.Index_Items[tagIndexByIdent].Name;
                    if (Map.tagNameList.TagPaths.ContainsKey(key))
                    {
                        try
                        {
                            str = Map.tagNameList.TagPaths[key];
                        }
                        catch
                        {
                        }
                    }
                    ident.TagName = str + "." + Map.Index_Items[tagIndexByIdent].Class;
                }
                else
                {
                    ident.TagName = "Null";
                }
                Idents.Add(ident);
                continue;
Label_05E5:
                Map.IO.In.BaseStream.Position = chunkOffset + ValueList[i].Offset;
                mStringID        gid        = (mStringID)ValueList[i];
                StringIdentifier identifier = new StringIdentifier {
                    Name = gid.Name
                };
                if (chunkNumber != -1)
                {
                    name            = identifier.Name;
                    identifier.Name = string.Concat(new object[] { name, " [", chunkNumber, "]" });
                }
                identifier.Offset      = chunkOffset + gid.Offset;
                identifier.Identifier  = Map.IO.In.ReadInt32();
                tagIndexByIdent        = Map.String_Table.GetStringItemIndexByID(Map, identifier.Identifier);
                identifier.StringIndex = tagIndexByIdent;
                try
                {
                    identifier.StringName = Map.String_Table.StringItems[tagIndexByIdent].Name;
                }
                catch
                {
                    identifier.StringName = "<<invalid sid>>";
                }
                Strings.Add(identifier);
            }
        }
 public void MapPluginWithPDBList(List <mValue> mValueList, List <PluginDataBlock> PDBList, int chunkSize, int unknownStructCount)
 {
     for (int i = 0; i < chunkSize; i += 4)
     {
         List <PluginDataBlock> pDBList = new List <PluginDataBlock>();
         foreach (PluginDataBlock block in PDBList)
         {
             foreach (Reflexive_DataBlock block2 in block.Reflexive_Data_Blocks)
             {
                 if (block2.Offset_In_Parent == i)
                 {
                     pDBList.Add(block2);
                 }
             }
         }
         if (pDBList.Count != 0)
         {
             mTagBlock item = new mTagBlock {
                 Name = "Unknown " + unknownStructCount
             };
             unknownStructCount++;
             item.Offset  = i;
             item.Size    = FindMostLikelySizeForChunk(pDBList);
             item.Visible = false;
             mValueList.Add(item);
             MapPluginWithPDBList(item.Values, pDBList, item.Size, unknownStructCount);
             i += 8;
             continue;
         }
         bool flag  = false;
         bool flag2 = false;
         foreach (PluginDataBlock block in PDBList)
         {
             foreach (Tag_Ident ident in block.Tag_Idents)
             {
                 if (ident.Offset_In_Parent == i)
                 {
                     mTagReference reference = new mTagReference {
                         Name    = "Unknown",
                         Offset  = i,
                         Visible = false
                     };
                     mValueList.Add(reference);
                     i   += 12;
                     flag = true;
                     break;
                 }
             }
             if (flag)
             {
                 break;
             }
             foreach (Tag_Void @void in block.Tag_Voids)
             {
                 if (@void.Offset_In_Parent == i)
                 {
                     mTagData data = new mTagData {
                         Name    = "Unknown",
                         Offset  = i,
                         Visible = false
                     };
                     mValueList.Add(data);
                     i    += 0x10;
                     flag2 = true;
                     break;
                 }
             }
             if (flag2)
             {
                 break;
             }
         }
         if (!flag && !flag2)
         {
             if ((chunkSize - i) >= 4)
             {
                 mUndefined undefined = new mUndefined {
                     Name    = "Unknown",
                     Offset  = i,
                     Visible = false
                 };
                 mValueList.Add(undefined);
             }
             else if ((chunkSize - i) >= 2)
             {
                 mInt16 num2 = new mInt16 {
                     Name    = "Unknown",
                     Offset  = i,
                     Visible = false
                 };
                 mValueList.Add(num2);
                 i -= 2;
             }
             else if ((chunkSize - i) == 1)
             {
                 mByte num3 = new mByte {
                     Name    = "Unknown",
                     Offset  = i,
                     Visible = false
                 };
                 mValueList.Add(num3);
             }
         }
     }
 }