コード例 #1
0
        private void Populate(StreamReader reader)
        {
            while (!reader.EndOfStream)
            {
                string line = reader.ReadLine();
                if (line.Contains(":"))
                {
                    string[] split = line.Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries);
                    if (split.Length != 2)
                    {
                        continue;
                    }

                    int hash = Convert.ToInt32(split[0]);
                    if (hash != 0 && !hashes.ContainsKey(hash))
                    {
                        hashes.Add(hash, split[1]); // Dont use ToLower(), use whatever is defined in Entities.
                    }
                }
                else if (line.Trim().Length > 0)
                {
                    int hash = (int)Utils.jenkins_one_at_a_time_hash(line.ToLower());
                    if (hash != 0 && !hashes.ContainsKey(hash))
                    {
                        hashes.Add(hash, line); // Dont use ToLower(), use whatever is defined in Entities.
                    }
                }
            }
        }
コード例 #2
0
 /// <summary>
 /// This does the actual searching of the hashes from the above function. Designed to run on multiple threads
 /// </summary>
 private void FindString()
 {
     while (CompileList.Count > 0)
     {
         Tuple <string, bool> scriptToSearch;
         lock (Program.ThreadLock)
         {
             scriptToSearch = CompileList.Dequeue();
         }
         using (Stream ScriptFile = File.OpenRead(scriptToSearch.Item1))
         {
             ScriptHeader header = ScriptHeader.Generate(ScriptFile, scriptToSearch.Item2);
             StringTable  table  = new StringTable(ScriptFile, header.StringTableOffsets, header.StringBlocks, header.StringsSize);
             foreach (string str in table.Values)
             {
                 if (HashToFind.Contains(Utils.jenkins_one_at_a_time_hash(str)))
                 {
                     if (IsLower(str))
                     {
                         continue;
                     }
                     lock (Program.ThreadLock)
                     {
                         if (!FoundStrings.Any(item => item.Item2 == str))
                         {
                             FoundStrings.Add(new Tuple <uint, string>(Utils.jenkins_one_at_a_time_hash(str), str));
                         }
                     }
                 }
             }
         }
     }
     Program.ThreadCount--;
 }
コード例 #3
0
        private void Populate(StreamReader reader)
        {
            while (!reader.EndOfStream)
            {
                string line = reader.ReadLine();
                if (line.Contains(" // "))
                {
                    string[] split = line.Split(new string[] { " // " }, StringSplitOptions.RemoveEmptyEntries);
                    if (split.Length != 2)
                    {
                        continue;
                    }

                    int hash = split[0].StartsWith("0x") ? Convert.ToInt32(split[0], 16) : (int)Utils.jenkins_one_at_a_time_hash(split[0]);
                    if (hash != 0 && !entries.ContainsKey(hash))
                    {
                        entries.Add(hash, ToLiteral(split[1]));
                    }
                }
            }
        }