コード例 #1
0
        public static void InitDictionary(string filename = "filenames.txt")
        {
            checksums.Clear();

            if (File.Exists(filename))
            {
                string[] lines = File.ReadAllLines(filename);

                foreach (string s in lines)
                {
                    string temp = s.Trim().ToLower();

                    if (temp != "")
                    {
                        if (!temp.Contains("#"))
                        {
                            uint crc = Checksum.CalcLegacy(temp, true);
                            if (!checksums.ContainsKey(crc))
                            {
                                checksums.Add(crc, temp);
                            }
                        }
                    }
                }
            }
        }
コード例 #2
0
 public ThpsWadEntry(string n, int off, int s)
 {
     name     = n;
     size     = s;
     offset   = off;
     checksum = Checksum.CalcLegacy(name, false);
 }
コード例 #3
0
 public ThpsWadEntry(string filename)
 {
     name     = Path.GetFileName(filename);
     checksum = Checksum.CalcLegacy(name, false);
     Data     = File.ReadAllBytes(filename);
     size     = Data.Length;
     offset   = 0;
 }
コード例 #4
0
        public bool ChecksumMatches()
        {
            if (checksumuint == Checksum.CalcLegacy(sb.ToString(), true)) //true because we already brute lowercase
            {
                return(true);
            }

            return(false);
        }
コード例 #5
0
        public void LoadFromLayout(string f)
        {
            string[] lol = File.ReadAllLines(f);

            string rootpath = Path.GetDirectoryName(f);
            string wadfold  = Path.GetFileNameWithoutExtension(f).Replace("__layout", "");

            WADname = wadfold;

            for (int i = 0; i < lol.Count(); i++)
            {
                string path = rootpath + "\\" + wadfold + "\\" + lol[i];

                if (File.Exists(path))
                {
                    byte[] data = File.ReadAllBytes(path);

                    ThpsWadEntry ff = new ThpsWadEntry(lol[i], 0, data.Length);

                    ff.Data = data;

                    if (lol[i][0] == '_' && lol[i][lol[i].Length - 1] == '_')
                    {
                        string nname = lol[i].Trim('_');
                        uint   hex   = 0;

                        Checksum.TryParseHex(nname, out hex);

                        ff.checksum = hex;
                    }
                    else
                    {
                        ff.checksum = Checksum.CalcLegacy(lol[i], false);
                    }

                    files.Add(ff);
                }
            }
        }
コード例 #6
0
 private void checkBox1_CheckedChanged(object sender, EventArgs e)
 {
     textBox3.Text = Checksum.CalcLegacy(textBox2.Text, checkBox1.Checked).ToString("X8");
 }