Пример #1
0
 public List<int> GetIndexes(CATFile cat)
 {
     List<int> result = new List<int>();
     for (int i = 0; i < cat.lines.Count; i++)
         if (cat.lines[i][7] == casnumber)
             result.Add(i);
     return result;
 }
Пример #2
0
 private void checkCATToolStripMenuItem_Click(object sender, EventArgs e)
 {
     OpenFileDialog d = new OpenFileDialog();
     d.Filter = "*.cat|*.cat";
     if (d.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         cat = new CATFile(d.FileName);
         Check();
     }
 }
Пример #3
0
        public List <int> GetIndexes(CATFile cat)
        {
            List <int> result = new List <int>();

            for (int i = 0; i < cat.lines.Count; i++)
            {
                if (cat.lines[i][7] == casnumber)
                {
                    result.Add(i);
                }
            }
            return(result);
        }
Пример #4
0
 public static byte[] GetDataBySha1(byte[] sha1, int maxsize = 0x7FFFFFFF)
 {
     CATFile cat = null;
     if (cat_base == null)
     {
         string path = GlobalStuff.FindSetting("gamepath") + "Data\\cas.cat";
         cat_base = new CATFile(path);
     }
     List<uint> casline = cat_base.FindBySHA1(sha1);
     if (casline.Count == 9)
         cat = cat_base;
     else
     {
         if (cat_patch == null)
         {
             string path = GlobalStuff.FindSetting("gamepath") + "Update\\Patch\\Data\\cas.cat";
             cat_patch = new CATFile(path);
         }
         cat = cat_patch;
         casline = cat_patch.FindBySHA1(sha1);
     }
     if (casline.Count == 9)
     {
         if (cas == null || cas.casnumber != casline[7])
         {
             string[] files = Directory.GetFiles(Path.GetDirectoryName(cat.MyPath));
             foreach (string file in files)
                 if (Path.GetFileName(file) == CASFile.GetCASFileName(casline[7]))
                 {
                     cas = new CASFile(file);
                     break;
                 }
         }
         if (cas != null && cas.casnumber == casline[7])
         {
             CASFile.CASEntry ce = cas.ReadEntry(casline.ToArray(), maxsize);
             return ce.data;
         }
     }
     return new byte[0];
 }
Пример #5
0
 public void SetCAT(CATFile Cat)
 {
     cat = Cat;
     Indexes = GetIndexes(cat);
 }
Пример #6
0
 private void toolStripButton3_Click(object sender, EventArgs e)
 {
     try
     {
         string input = Microsoft.VisualBasic.Interaction.InputBox("Please enter offset in decimal", "Find by offset and cas number", "");
         uint offset = Convert.ToUInt32(input);
         input = Microsoft.VisualBasic.Interaction.InputBox("Please enter cas number decimal", "Find by offset and cas number", "");
         uint casnr = Convert.ToUInt32(input);
         input = Microsoft.VisualBasic.Interaction.InputBox("Search base(b) or patch(p)?", "Find by offset and cas number", "b");
         CATFile cat = null;
         if (input != "p")
             cat = new CATFile(GlobalStuff.FindSetting("gamepath") + "Data\\cas.cat");
         else
             cat = new CATFile(GlobalStuff.FindSetting("gamepath") + "Update\\Patch\\Data\\cas.cat");
         byte[] sha1 = new byte[0];
         for (int i = 0; i < cat.lines.Count; i++)
             if (cat.lines[i][7] == casnr && cat.lines[i][5] <= offset && cat.lines[i][5] + cat.lines[i][6] > offset)
             {
                 MemoryStream m = new MemoryStream();
                 for (int j = 0; j < 5; j++)
                     Helpers.WriteLEUInt(m, cat.lines[i][j]);
                 sha1 = m.ToArray();
                 break;
             }
         cat = null;
         if(sha1.Length == 0)
         {
             MessageBox.Show("SHA1 not found!");
             return;
         }
         toolStripTextBox1.Text = Helpers.ByteArrayToHexString(sha1);
         Thread t = new Thread(ThreadedSearch);
         t.Start();
         MessageBox.Show("Done.");
         return;
     }
     catch (Exception)
     {
     }
 }
Пример #7
0
 public void SetCAT(CATFile Cat)
 {
     cat     = Cat;
     Indexes = GetIndexes(cat);
 }