Пример #1
0
        public VLTTypeResolver()
        {
            this._typeTable = new Dictionary <uint, Type>();
            this._typeTable.Add(JenkinsHash.getHash32("EA::Reflection::Double"), typeof(EADouble));
            this._typeTable.Add(JenkinsHash.getHash32("EA::Reflection::Float"), typeof(EAFloat));
            this._typeTable.Add(JenkinsHash.getHash32("EA::Reflection::UInt8"), typeof(EAUInt8));
            this._typeTable.Add(JenkinsHash.getHash32("EA::Reflection::UInt16"), typeof(EAUInt16));
            this._typeTable.Add(JenkinsHash.getHash32("EA::Reflection::UInt32"), typeof(EAUInt32));
            this._typeTable.Add(JenkinsHash.getHash32("EA::Reflection::UInt64"), typeof(EAUInt64));
            this._typeTable.Add(JenkinsHash.getHash32("EA::Reflection::Int8"), typeof(EAInt8));
            this._typeTable.Add(JenkinsHash.getHash32("EA::Reflection::Int16"), typeof(EAInt16));
            this._typeTable.Add(JenkinsHash.getHash32("EA::Reflection::Int32"), typeof(EAInt32));
            this._typeTable.Add(JenkinsHash.getHash32("EA::Reflection::Int64"), typeof(EAInt64));
            this._typeTable.Add(JenkinsHash.getHash32("EA::Reflection::Bool"), typeof(EABool));
            this._typeTable.Add(JenkinsHash.getHash32("EA::Reflection::Text"), typeof(EAText));

            this._typeTable.Add(JenkinsHash.getHash32("Attrib::Types::Matrix"), typeof(AttribMatrix));
            this._typeTable.Add(JenkinsHash.getHash32("Attrib::Types::Vector2"), typeof(AttribVector2));
            this._typeTable.Add(JenkinsHash.getHash32("Attrib::Types::Vector3"), typeof(AttribVector3));
            this._typeTable.Add(JenkinsHash.getHash32("Attrib::Types::Vector4"), typeof(AttribVector4));
            this._typeTable.Add(JenkinsHash.getHash32("Attrib::RefSpec"), typeof(AttribRefSpec));
            this._typeTable.Add(JenkinsHash.getHash32("Attrib::Blob"), typeof(AttribBlob));

#if CARBON
            this._typeTable.Add(JenkinsHash.getHash32("Attrib::StringKey"), typeof(AttribStringKeyCarbon));
#else
            this._typeTable.Add(JenkinsHash.getHash32("Attrib::StringKey"), typeof(AttribStringKey));
#endif

            this._typeTable.Add(JenkinsHash.getHash32("AxlePair"), typeof(AxlePair));
            this._typeTable.Add(JenkinsHash.getHash32("CarBodyMotion"), typeof(CarBodyMotion));
            this._typeTable.Add(JenkinsHash.getHash32("GCollectionKey"), typeof(GCollectionKey));
            this._typeTable.Add(JenkinsHash.getHash32("JunkmanMod"), typeof(JunkmanMod));
            this._typeTable.Add(JenkinsHash.getHash32("UpgradeSpecs"), typeof(UpgradeSpecs));
        }
Пример #2
0
 public override void Write(BinaryWriter bw)
 {
     bw.Write(JenkinsHash.getHash32(this.Class));
     bw.Write(JenkinsHash.getHash32(this.RowName));
     bw.Write(0);
     bw.Write(this.Factor);
 }
Пример #3
0
 private VltTypeMap()
 {
     _typeDictionary =
         new Dictionary <uint, Type>
     {
         { JenkinsHash.getHash32("EA::Reflection::Int8"), typeof(EaInt8) },
         { JenkinsHash.getHash32("EA::Reflection::Int16"), typeof(EaInt16) },
         { JenkinsHash.getHash32("EA::Reflection::Int32"), typeof(EaInt32) },
         { JenkinsHash.getHash32("EA::Reflection::Int64"), typeof(EaInt64) },
         { JenkinsHash.getHash32("EA::Reflection::UInt8"), typeof(EaUInt8) },
         { JenkinsHash.getHash32("EA::Reflection::UInt16"), typeof(EaUInt16) },
         { JenkinsHash.getHash32("EA::Reflection::UInt32"), typeof(EaUInt32) },
         { JenkinsHash.getHash32("EA::Reflection::UInt64"), typeof(EaUInt64) },
         { JenkinsHash.getHash32("EA::Reflection::Bool"), typeof(EaBoolean) },
         { JenkinsHash.getHash32("EA::Reflection::Float"), typeof(EaFloat) },
         { JenkinsHash.getHash32("EA::Reflection::Double"), typeof(EaDouble) },
         { JenkinsHash.getHash32("EA::Reflection::Text"), typeof(EaText) },
         { JenkinsHash.getHash32("Attrib::RefSpec"), typeof(RefSpec) },
         { JenkinsHash.getHash32("Attrib::StringKey"), typeof(StringKey) },
         { JenkinsHash.getHash32("Attrib::Types::Matrix"), typeof(Matrix) },
         { JenkinsHash.getHash32("Attrib::Types::Vector2"), typeof(Vector2) },
         { JenkinsHash.getHash32("Attrib::Types::Vector3"), typeof(Vector3) },
         { JenkinsHash.getHash32("Attrib::Types::Vector4"), typeof(Vector4) },
         { JenkinsHash.getHash32("Attrib::Blob"), typeof(Blob) },
         { JenkinsHash.getHash32("GCollectionKey"), typeof(CollectionKey) },
         { JenkinsHash.getHash32("AirSupport"), typeof(AirSupport) },
         { JenkinsHash.getHash32("AxlePair"), typeof(AxlePair) },
     };
 }
Пример #4
0
        public static void AddHash(string value)
        {
            var hash = JenkinsHash.getHash32(value);

            if (!Hashes.ContainsKey(hash))
            {
                Hashes[hash] = value;
            }
        }
Пример #5
0
        public static void addHashFromVLTDB(string A_0)
        {
            uint hash = JenkinsHash.getHash32(A_0);

            if (!HashTracker.hashesFromVLTFile.ContainsKey(hash))
            {
                HashTracker.hashesFromVLTFile[hash] = A_0;
                if (HashTracker.hashesFromTextFile.ContainsKey(hash))
                {
                    HashTracker.hashesFromTextFile.Remove(hash);
                }
            }
        }
Пример #6
0
        public static void AddAuto(string value)
        {
            uint key = JenkinsHash.getHash32(value);

            if (!_autoTable.ContainsKey(key))
            {
                _autoTable.Add(key, value);
                if (_loadTable.ContainsKey(key))
                {
                    _loadTable.Remove(key);
                }
            }
        }
Пример #7
0
        public static void Open(string filename)
        {
            StreamReader sr = new StreamReader(filename);
            string       line;

            do
            {
                line = sr.ReadLine();
                if (line != null)
                {
                    line = line.Trim();
                }

                if (line != null && line != "" && !line.StartsWith("#"))
                {
                    string[] split = line.Split('\t');
                    uint     key;
                    if (split.Length > 1)
                    {
                        if (split[1].StartsWith("0x"))
                        {
                            key = uint.Parse(split[1].Substring(2), NumberStyles.HexNumber);
                        }
                        else
                        {
                            key = uint.Parse(split[1], NumberStyles.HexNumber);
                        }

                        if (!_manualTable.ContainsKey(key))
                        {
                            _manualTable.Add(key, split[2]);
                        }
                    }
                    else
                    {
                        key = JenkinsHash.getHash32(line);
                        if (!_loadTable.ContainsKey(key))
                        {
                            _loadTable.Add(key, line);
                        }
                    }
                }
            } while(line != null);
            sr.Close();
        }
Пример #8
0
        public void am(RootRecord A_0, UnknownB0 A_1)
        {
            UnknownA8 a   = A_1.a(VLTOtherValue.TABLE_END) as UnknownA8;
            int       num = a.genht1[A_0.position].i2;

            A_1.ms1.Seek(num, SeekOrigin.Begin);
            BinaryReader a_ = new BinaryReader(A_1.ms1);

            this.genht1 = new Dictionary <uint, aclzz>(A_0.i3);
            for (int i = 0; i < A_0.i3; ++i)
            {
                UnknownDE.aclzz a2 = new UnknownDE.aclzz();
                a2.s1  = UnknownAP.a(a_);
                a2.i1  = A_0.ia1[i];
                a2.ui1 = JenkinsHash.getHash32(a2.s1);
                this.genht1.Add(a2.ui1, a2);
                HashTracker.addHashFromVLTDB(a2.s1);
            }
            this.genht2 = new Dictionary <uint, VLTClass>();
        }
Пример #9
0
        public void Init(VltRootRecord rootRecord, TableEndBlock teb, BinaryReader br)
        {
            var position = teb.InfoDictionary[rootRecord.Position].Address2;

            br.BaseStream.Seek(position, SeekOrigin.Begin);

            _managedClasses = new Dictionary <uint, ManagedClass>(rootRecord.NumEntries);

            for (var i = 0; i < rootRecord.NumEntries; ++i)
            {
                var mc = new ManagedClass
                {
                    Value   = BinaryUtil.ReadNullTerminatedString(br),
                    Unknown = rootRecord.Hashes[i]
                };

                mc.Hash = JenkinsHash.getHash32(mc.Value);

                _managedClasses.Add(mc.Hash, mc);
            }
        }
Пример #10
0
        public void LoadDatabase(VLTDataDatabaseLoad dbLoad, VLTFile vltFile)
        {
            VLTPointers vltPointers = vltFile.GetChunk(VLTChunkId.Pointers) as VLTPointers;
            int         offset      = vltPointers[dbLoad.Pointer].OffsetDest;

            vltFile.RawStream.Seek(offset, SeekOrigin.Begin);
            BinaryReader br = new BinaryReader(vltFile.RawStream);

            this._types = new Dictionary <uint, VLTType>(dbLoad.Count);

            for (int i = 0; i < dbLoad.Count; i++)
            {
                VLTType type = new VLTType();
                type.TypeName = NullTerminatedString.Read(br);
                type.Length   = dbLoad[i];
                type.Hash     = JenkinsHash.getHash32(type.TypeName);
                this._types.Add(type.Hash, type);
                HashResolver.AddAuto(type.TypeName);
            }

            this._classes = new Dictionary <uint, VLTClass>();
        }
Пример #11
0
        public static void loadHashes(string fileName)
        {
            const string expressionPrefix = "EXPR\t";

            using (StreamReader streamReader = new StreamReader(fileName))
            {
                string text;
                while ((text = streamReader.ReadLine()) != null)
                {
                    text = text.Trim();
                    if (text != "" && text[0] != '#')
                    {
                        if (text.StartsWith(expressionPrefix))
                        {
                            // Basically, the idea with expressions is that there's plenty of hashes which have e.g. a common prefix or postfix.
                            // By using some simple syntax to indicate that we can drastically reduce space wasted in the hashes file.
                            text = text.Substring(expressionPrefix.Length);
                            bool isStringExpr = (text.IndexOf('{') != -1 && (text.LastIndexOf('}') > text.IndexOf('{')));
                            bool isNumberExpr = (text.IndexOf('[') != -1 && (text.LastIndexOf(']') > text.IndexOf('[')));

                            if (isStringExpr && isNumberExpr)
                            {
                                throw new NotImplementedException("String and Number in 1 expression not yet supported.");
                            }
                            else if (!isStringExpr && !isNumberExpr)
                            {
                                throw new FormatException("Why do you have an expression that's not an expression?!");
                            }
                            else if ((text.IndexOf('{') != text.LastIndexOf('{')) ||
                                     (text.IndexOf('}') != text.LastIndexOf('}')) ||
                                     (text.IndexOf('[') != text.LastIndexOf('[')) ||
                                     (text.IndexOf(']') != text.LastIndexOf(']')))
                            {
                                throw new NotImplementedException("Only one expression at a time please!");
                            }

                            if (isStringExpr)
                            {
                                string   prefix  = text.Split('{')[0];
                                string   postfix = text.Split('}')[1];
                                string   middle  = text.Substring(text.IndexOf('{') + 1, (text.IndexOf('}') - text.IndexOf('{') - 1));
                                string[] entries = middle.Split(',');

                                foreach (string entry in entries)
                                {
                                    uint hash = JenkinsHash.getHash32(prefix + entry + postfix);
                                    if (!HashTracker.hashesFromTextFile.ContainsKey(hash))
                                    {
                                        HashTracker.hashesFromTextFile[hash] = prefix + entry + postfix;
                                    }
                                }
                            }
                            else                            // if( isNumberExpr )
                            {
                                string prefix  = text.Split('[')[0];
                                string postfix = text.Split(']')[1];
                                string middle  = text.Substring(text.IndexOf('[') + 1, (text.IndexOf(']') - text.IndexOf('[') - 1));

                                // string.Split with a string is convoluted, so make it work with a character instead lol
                                middle = middle.Replace("..", ",");
                                string[] entries = middle.Split(',');

                                if (entries.Length != 2)
                                {
                                    throw new FormatException("Invalid number entry format!");
                                }

                                uint min, max;

                                if (!uint.TryParse(entries[0], out min) || !uint.TryParse(entries[1], out max))
                                {
                                    throw new FormatException("Failed to parse numbers!");
                                }

                                if (max < min)
                                {
                                    uint temp = max;
                                    max = min;
                                    min = temp;
                                }

                                for (uint i = min; i <= max; ++i)
                                {
                                    uint hash = JenkinsHash.getHash32(prefix + i + postfix);
                                    if (!HashTracker.hashesFromTextFile.ContainsKey(hash))
                                    {
                                        HashTracker.hashesFromTextFile[hash] = prefix + i + postfix;
                                    }
                                }
                            }
                        }
                        else
                        {
                            uint     hash;
                            string[] array = text.Split(new char[] { '\t' });
                            if (array.Length > 1)                              // basically, if this is a guess.
                            {
                                int sub = (array[1].StartsWith("0x") ? 2 : 0);
                                hash = uint.Parse(array[1].Substring(sub), NumberStyles.AllowHexSpecifier | NumberStyles.AllowTrailingWhite | NumberStyles.AllowLeadingWhite);
                                if (HashTracker.hashesFromTextFile.ContainsKey(hash))
                                {
                                    frmDesigner.instance.writeToConsole("NOTICE: Hash guess '" + array[2] + "' is already resolved as '" + HashTracker.hashesFromTextFile[hash] + "'");
                                }
                                else if (HashTracker.hashesFromVLTFile.ContainsKey(hash))
                                {
                                    frmDesigner.instance.writeToConsole("NOTICE: Hash guess '" + array[2] + "' is already resolved as '" + HashTracker.hashesFromVLTFile[hash] + "'");
                                }
                                if (!HashTracker.guessesFromTextFile.ContainsKey(hash))
                                {
                                    HashTracker.guessesFromTextFile[hash] = array[2];
                                }
                            }
                            else
                            {
                                hash = JenkinsHash.getHash32(text);
                                if (!HashTracker.hashesFromTextFile.ContainsKey(hash))
                                {
                                    HashTracker.hashesFromTextFile[hash] = text;
                                }
                                else
                                {
                                    frmDesigner.instance.writeToConsole("NOTICE: Found duplicate hash entry: '" + text + "'");
                                }
                            }
                        }
                    }
                }
            }
        }
Пример #12
0
 public override void Write(BinaryWriter bw)
 {
     bw.Write(JenkinsHash.getHash32(this.Value));
 }
Пример #13
0
        public TypeMap()
        {
            if (!BuildConfig.CARBON)
            {
                this.typeDictionary = new Dictionary <uint, Type>(28);

                this.typeDictionary.Add(JenkinsHash.getHash32("EA::Reflection::Int8"), typeof(EAInt8));
                this.typeDictionary.Add(JenkinsHash.getHash32("EA::Reflection::Int16"), typeof(EAInt16));
                this.typeDictionary.Add(JenkinsHash.getHash32("EA::Reflection::Int32"), typeof(EAInt32));
                this.typeDictionary.Add(JenkinsHash.getHash32("EA::Reflection::Int64"), typeof(EAInt64));
                this.typeDictionary.Add(JenkinsHash.getHash32("EA::Reflection::UInt8"), typeof(EAUInt8));
                this.typeDictionary.Add(JenkinsHash.getHash32("EA::Reflection::UInt16"), typeof(EAUInt16));
                this.typeDictionary.Add(JenkinsHash.getHash32("EA::Reflection::UInt32"), typeof(EAUInt32));
                this.typeDictionary.Add(JenkinsHash.getHash32("EA::Reflection::UInt64"), typeof(EAUInt64));
                this.typeDictionary.Add(JenkinsHash.getHash32("EA::Reflection::Bool"), typeof(EABool));
                this.typeDictionary.Add(JenkinsHash.getHash32("EA::Reflection::Float"), typeof(EAFloat));
                this.typeDictionary.Add(JenkinsHash.getHash32("EA::Reflection::Double"), typeof(EADouble));
                this.typeDictionary.Add(JenkinsHash.getHash32("EA::Reflection::Text"), typeof(EAText));
                this.typeDictionary.Add(JenkinsHash.getHash32("Attrib::RefSpec"), typeof(AttribRefSpec));
                this.typeDictionary.Add(JenkinsHash.getHash32("Attrib::StringKey"), typeof(AttribStringKey));
                this.typeDictionary.Add(JenkinsHash.getHash32("Attrib::Types::Matrix"), typeof(AttribMatrix));
                this.typeDictionary.Add(JenkinsHash.getHash32("Attrib::Types::Vector2"), typeof(AttribVector2));
                this.typeDictionary.Add(JenkinsHash.getHash32("Attrib::Types::Vector3"), typeof(AttribVector3));
                this.typeDictionary.Add(JenkinsHash.getHash32("Attrib::Types::Vector4"), typeof(AttribVector4));
                this.typeDictionary.Add(JenkinsHash.getHash32("Attrib::Blob"), typeof(AttribBlob));
                this.typeDictionary.Add(JenkinsHash.getHash32("AirSupport"), typeof(AirSupport));
                this.typeDictionary.Add(JenkinsHash.getHash32("AxlePair"), typeof(AxlePair));
                this.typeDictionary.Add(JenkinsHash.getHash32("CarBodyMotion"), typeof(CarBodyMotion));
                this.typeDictionary.Add(JenkinsHash.getHash32("CopCountRecord"), typeof(CopCountRecord));
                this.typeDictionary.Add(JenkinsHash.getHash32("GCollectionKey"), typeof(GCollectionKey));
                this.typeDictionary.Add(JenkinsHash.getHash32("HeavySupport"), typeof(HeavySupport));
                this.typeDictionary.Add(JenkinsHash.getHash32("JunkmanMod"), typeof(JunkmanMod));
                this.typeDictionary.Add(JenkinsHash.getHash32("TrafficPatternRecord"), typeof(TrafficPatternRecord));
                this.typeDictionary.Add(JenkinsHash.getHash32("UpgradeSpecs"), typeof(UpgradeSpecs));
            }
            else
            {
                this.typeDictionary = new Dictionary <uint, Type>();

                this.typeDictionary.Add(JenkinsHash.getHash32("EA::Reflection::Int8"), typeof(EAInt8));
                this.typeDictionary.Add(JenkinsHash.getHash32("EA::Reflection::Int16"), typeof(EAInt16));
                this.typeDictionary.Add(JenkinsHash.getHash32("EA::Reflection::Int32"), typeof(EAInt32));
                this.typeDictionary.Add(JenkinsHash.getHash32("EA::Reflection::Int64"), typeof(EAInt64));
                this.typeDictionary.Add(JenkinsHash.getHash32("EA::Reflection::UInt8"), typeof(EAUInt8));
                this.typeDictionary.Add(JenkinsHash.getHash32("EA::Reflection::UInt16"), typeof(EAUInt16));
                this.typeDictionary.Add(JenkinsHash.getHash32("EA::Reflection::UInt32"), typeof(EAUInt32));
                this.typeDictionary.Add(JenkinsHash.getHash32("EA::Reflection::UInt64"), typeof(EAUInt64));
                this.typeDictionary.Add(JenkinsHash.getHash32("EA::Reflection::Bool"), typeof(EABool));
                this.typeDictionary.Add(JenkinsHash.getHash32("EA::Reflection::Float"), typeof(EAFloat));
                this.typeDictionary.Add(JenkinsHash.getHash32("EA::Reflection::Double"), typeof(EADouble));
                this.typeDictionary.Add(JenkinsHash.getHash32("EA::Reflection::Text"), typeof(EAText));

                this.typeDictionary.Add(JenkinsHash.getHash32("Attrib::RefSpec"), typeof(AttribRefSpec));
                // Carbon axed the Hash64 for Attrib::StringKey.
                // TODO: Refactor Types to allow all classes to know their actual length, to adjust for this stuff dynamically.
                this.typeDictionary.Add(JenkinsHash.getHash32("Attrib::StringKey"), typeof(AttribStringKeyCarbon));
                this.typeDictionary.Add(JenkinsHash.getHash32("Attrib::Types::Matrix"), typeof(AttribMatrix));
                this.typeDictionary.Add(JenkinsHash.getHash32("Attrib::Types::Vector2"), typeof(AttribVector2));
                this.typeDictionary.Add(JenkinsHash.getHash32("Attrib::Types::Vector3"), typeof(AttribVector3));
                this.typeDictionary.Add(JenkinsHash.getHash32("Attrib::Types::Vector4"), typeof(AttribVector4));
                this.typeDictionary.Add(JenkinsHash.getHash32("Attrib::Blob"), typeof(AttribBlob));

                this.typeDictionary.Add(JenkinsHash.getHash32("AxlePair"), typeof(AxlePair));
                this.typeDictionary.Add(JenkinsHash.getHash32("CarBodyMotion"), typeof(CarBodyMotion));
                this.typeDictionary.Add(JenkinsHash.getHash32("JunkmanMod"), typeof(JunkmanMod));
                this.typeDictionary.Add(JenkinsHash.getHash32("TrafficPatternRecord"), typeof(TrafficPatternRecord));
                this.typeDictionary.Add(JenkinsHash.getHash32("UpgradeSpecs"), typeof(UpgradeSpecs));
            }
        }
Пример #14
0
        private void consoleCommandHandler(string cmd)
        {
            // TODO: impl
            string[] array  = cmd.Split(new char[] { ' ' }, 2);
            string   text   = array[0];
            bool     noArgs = true;
            string   text2  = null;

            if (array.Length > 1)
            {
                noArgs = false;
                text2  = array[1];
                text2.Split(new char[] { ' ' });
            }

            try
            {
                switch (text)
                {
                case "quit":
                case "exit":
                    this.exit();
                    break;

                case "open":
                case "load":
                    if (noArgs)
                    {
                        this.openFile();
                        break;
                    }
                    FileInfo fileInfo = new FileInfo(text2);
                    if (!fileInfo.Exists)
                    {
                        this.writeToConsole("Non existant file: " + fileInfo.FullName);
                        break;
                    }
                    if (!this.loadFile(fileInfo.FullName, true))
                    {
                        this.writeToConsole("Failed to load file: " + fileInfo.FullName);
                    }
                    break;

                case "unload":
                    if (noArgs)
                    {
                        this.writeToConsole("Error in command.");
                        break;
                    }
                    string[] filesToUnload = { text2 };
                    this.unloadFiles(new List <string>(filesToUnload));
                    break;

                case "unloadall":
                    if (!noArgs)
                    {
                        this.writeToConsole("Error in command.");
                        break;
                    }
                    this.unloadFiles();
                    break;

                case "reparse":
                    this.writeToConsole("Reparsing all VLTs...");
                    this.d();
                    this.tvRefresh();
                    break;

                case "cls":
                case "clear":
                    this.txtConsole.Text = "";
                    break;

                case "hex":
                    if (noArgs)
                    {
                        this.writeToConsole("Error in command.");
                        break;
                    }
                    this.writeToConsole(string.Format("hex({0})=0x{1:x}", ulong.Parse(text2), ulong.Parse(text2)));
                    break;

                case "hash":
                case "hash32":
                    if (noArgs)
                    {
                        this.writeToConsole("Error in command.");
                        break;
                    }
                    this.writeToConsole(string.Format("hash({0})=0x{1:x}", text2, JenkinsHash.getHash32(text2)));
                    break;

                case "hash64":
                    if (noArgs)
                    {
                        this.writeToConsole("Error in command.");
                        break;
                    }
                    this.writeToConsole(string.Format("hash64({0})=0x{1:x}", text2, JenkinsHash.getHash64(text2)));
                    break;

                case "hs":
                case "hsearch":
                    if (noArgs)
                    {
                        this.writeToConsole("Error in command.");
                    }
                    else if (this.au.Count <= 0)                              // No loaded files
                    {
                        this.writeToConsole("No files loaded to search!");
                        break;
                    }
                    else
                    {
                        this.search(text2);
                    }
                    if (text == "hs")
                    {
                        this.txtConsoleInput.Text           = "hs ";
                        this.txtConsoleInput.SelectionStart = this.txtConsoleInput.Text.Length;
                    }
                    break;

                case "savehash":
                    if (noArgs)
                    {
                        this.writeToConsole("Error in command.");
                        break;
                    }
                    FileInfo fileInfo2 = new FileInfo(text2);
                    HashTracker.dumpUsedHashes(fileInfo2.FullName);
                    this.writeToConsole("Saved used hashes list to: " + fileInfo2.FullName);
                    break;

                case "loadhash":
                    if (File.Exists(text2))
                    {
                        HashTracker.loadHashes(text2);
                        break;
                    }
                    this.writeToConsole("File does not exist.");
                    break;

                case "reloadhashes":
                    HashTracker.init();
                    this.writeToConsole("Hashes reloaded.");
                    break;

                case "help":
                    this.writeToConsole("Common commands:");
                    this.writeToConsole("\thash, hash64 <string>: returns the hash(64) of the given string.");
                    this.writeToConsole("\ths, hsearch <string/0xHASH>: searches for VLT entries of the given string or hash.");
                    this.writeToConsole("\thex <int>: returns the hexadecimal representation of the given decimal.");
                    this.writeToConsole("\tcls, clear: clear the console.");
                    break;

                case "debug":
                    frmMain maintest = new frmMain();
                    maintest.Show();
                    this.WindowState = FormWindowState.Minimized;
                    break;

                case "":
                    break;

                default:
                    this.writeToConsole("Unknown command.");
                    break;
                }
            }
            catch (Exception ex2)
            {
                this.writeToConsole("Exception: " + ex2.ToString());
                this.writeToConsole("Error while executing: " + cmd);
            }
        }
Пример #15
0
        /**
         * Searches open files for the specified entry name/hash; stores results in the given List
         */
        private void search(string A_0, ref List <string> A_1)
        {
            uint num;

            if (A_0.StartsWith("0x"))
            {
                num = uint.Parse(A_0.Substring(2), NumberStyles.AllowHexSpecifier | NumberStyles.AllowLeadingWhite | NumberStyles.AllowTrailingWhite);
            }
            else
            {
                num = JenkinsHash.getHash32(A_0);
            }

            foreach (VLTClass dq in this.av)
            {
                if (dq.classHash == num)
                {
                    string text = A_0 + ": Found match for class: " + HashTracker.getValueForHash(dq.classHash);
                    if (!A_1.Contains(text))
                    {
                        A_1.Add(text);
                    }
                }

                foreach (VLTClass.aclz1 a in dq)
                {
                    if (a.hash == num)
                    {
                        string text = string.Concat(new string[]
                        {
                            A_0,
                            ": Found match for field: ",
                            HashTracker.getValueForHash(dq.classHash),
                            "/",
                            HashTracker.getValueForHash(a.hash)
                        });
                        if (!A_1.Contains(text))
                        {
                            A_1.Add(text);
                        }
                    }
                }

                foreach (UnknownDR dr in dq.dqb1)
                {
                    if (dr.c1.hash == num)
                    {
                        string text = string.Concat(new string[]
                        {
                            A_0,
                            ": Found match for row: ",
                            HashTracker.getValueForHash(dq.classHash),
                            "/",
                            this.a(dr)
                        });
                        if (!A_1.Contains(text))
                        {
                            A_1.Add(text);
                        }
                    }
                }
            }
        }