/// <summary>
 /// Adds a new <see cref="WADEntry"/> to this <see cref="WADFile"/>
 /// </summary>
 /// <param name="path">The virtual path of the file being added</param>
 /// <param name="data">Data of file being added</param>
 /// <param name="compressedEntry">Whether the data needs to be GZip compressed inside WAD</param>
 public void AddEntry(string path, byte[] data, bool compressedEntry)
 {
     using (XXHash64 xxHash = XXHash64.Create())
     {
         AddEntry(BitConverter.ToUInt64(xxHash.ComputeHash(Encoding.ASCII.GetBytes(path.ToLower(new CultureInfo("en-US")))), 0), data, compressedEntry);
     }
 }
Example #2
0
        private void menuAddFolder_Click(object sender, RoutedEventArgs e)
        {
            using (CommonOpenFileDialog dialog = new CommonOpenFileDialog())
            {
                dialog.IsFolderPicker = true;

                if (dialog.ShowDialog() == CommonFileDialogResult.Ok)
                {
                    DirectoryInfo directory = new DirectoryInfo(dialog.FileName);

                    using (XXHash64 xxHash = XXHash64.Create())
                    {
                        foreach (FileInfo fileInfo in directory.EnumerateFiles("*", SearchOption.AllDirectories))
                        {
                            string path       = fileInfo.FullName.Substring(directory.FullName.Length + 1);
                            ulong  hashedPath = BitConverter.ToUInt64(xxHash.ComputeHash(Encoding.ASCII.GetBytes(path.ToLower())), 0);

                            if (!StringDictionary.ContainsKey(hashedPath))
                            {
                                StringDictionary.Add(hashedPath, path);
                            }

                            this.WAD.AddEntry(hashedPath, File.ReadAllBytes(fileInfo.FullName), true);
                        }
                    }

                    Logger.Info("Added files from directory: " + dialog.FileName);
                }
            }
        }
Example #3
0
        private void menuAddFolder_Click(object sender, RoutedEventArgs e)
        {
            System.Windows.Forms.FolderBrowserDialog dialog = new System.Windows.Forms.FolderBrowserDialog()
            {
                ShowNewFolderButton = false
            };

            if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                DirectoryInfo directory = new DirectoryInfo(dialog.SelectedPath);

                using (XXHash64 xxHash = XXHash64.Create())
                {
                    foreach (FileInfo fileInfo in directory.EnumerateFiles("*", SearchOption.AllDirectories))
                    {
                        string path       = fileInfo.FullName.Substring(directory.FullName.Length + 1);
                        ulong  hashedPath = BitConverter.ToUInt64(xxHash.ComputeHash(Encoding.ASCII.GetBytes(path.ToLower())), 0);

                        if (!StringDictionary.ContainsKey(hashedPath))
                        {
                            StringDictionary.Add(hashedPath, path);
                        }

                        this.Wad.AddEntry(hashedPath, File.ReadAllBytes(fileInfo.FullName), true);
                    }
                }

                Logger.Info("Added files from directory: " + dialog.SelectedPath);
            }
        }
Example #4
0
        public string addFile(string filepath, string path)
        {
            if (mapEntries.ContainsKey(path))
            {
                return("");
            }

            try
            {
                var result = this.activeWad.AddEntry(path, File.ReadAllBytes(filepath), true);

                using (XXHash64 xxHash = XXHash64.Create())
                {
                    StringDictionary.Add(BitConverter.ToUInt64(xxHash.ComputeHash(Encoding.ASCII.GetBytes(path.ToLower())), 0), path);
                }

                mapEntries.Add(path, result);

                return(path);
            }
            catch (Exception e) {
                Console.WriteLine(e.Message);
                return("");
            }
        }
 /// <summary>
 /// Adds a new <see cref="EntryType.FileRedirection"/> <see cref="WADEntry"/> to this <see cref="WADFile"/>
 /// </summary>
 /// <param name="path">The virtual path of the file being added</param>
 /// <param name="fileRedirection">The file the game should load instead of this one</param>
 public void AddEntry(string path, string fileRedirection)
 {
     using (XXHash64 xxHash = XXHash64.Create())
     {
         AddEntry(BitConverter.ToUInt64(xxHash.ComputeHash(Encoding.ASCII.GetBytes(path.ToLower(new CultureInfo("en-US")))), 0), fileRedirection);
     }
 }
 /// <summary>
 /// Removes a <see cref="WADEntry"/> Entry with the specified path
 /// </summary>
 /// <param name="path">The path of the <see cref="WADEntry"/> to remove</param>
 public void RemoveEntry(string path)
 {
     using (XXHash64 xxHash = XXHash64.Create())
     {
         RemoveEntry(BitConverter.ToUInt64(xxHash.ComputeHash(Encoding.ASCII.GetBytes(path)), 0));
     }
 }
Example #7
0
        public static List <WadResult> GenerateWADStrings(WADFile wad, List <WadResult> wadResults)
        {
            List <string> strings = new List <string>();

            foreach (WADEntry entry in wad.Entries.Where(x => x.Type != EntryType.FileRedirection))
            {
                byte[]         entryContent = entry.GetContent(true);
                LeagueFileType fileType     = Utilities.GetLeagueFileExtensionType(entryContent);

                if (fileType == LeagueFileType.BIN)
                {
                    BINFile bin = null;
                    try
                    {
                        bin = new BINFile(new MemoryStream(entryContent));
                        strings.AddRange(ProcessBINLinkedFiles(bin.LinkedFiles));
                        strings.AddRange(ProcessBINFile(bin));
                    }
                    catch (Exception excp)
                    {
                        throw new Exception(TAG + "解析wad文件失败,创建BIN文件失败...|" + excp.Message);
                    }
                }
            }
            Dictionary <ulong, string> stringDictionary = new Dictionary <ulong, string>();

            strings = strings.Distinct().ToList();
            using (XXHash64 xxHash = XXHash64.Create())
            {
                foreach (string fetchedString in strings)
                {
                    if (!string.IsNullOrEmpty(fetchedString))
                    {
                        // 计算路径的哈希值
                        byte[] b       = Encoding.ASCII.GetBytes(fetchedString.ToLower());
                        byte[] hashVal = xxHash.ComputeHash(b);
                        ulong  hash    = BitConverter.ToUInt64(hashVal, 0);
                        string hex     = BitConverter.ToString(hashVal, 0);

                        if (!stringDictionary.ContainsKey(hash))
                        {
                            stringDictionary.Add(hash, fetchedString);
                            WadResult wadResult = new WadResult();
                            wadResult.hash = hash;
                            wadResult.hex  = hex;
                            wadResult.name = fetchedString;
                            //wadResult.type = Utilities.GetLeagueFileExtensionType(b);
                            wadResults.Add(wadResult);
                        }
                    }
                }
            }
            GC.Collect();
            return(wadResults);
        }
Example #8
0
        private void AddFile(string path, byte[] data, bool compressed, bool refresh)
        {
            using (XXHash64 xxHash = XXHash64.Create())
            {
                ulong hash = BitConverter.ToUInt64(xxHash.ComputeHash(Encoding.ASCII.GetBytes(path.ToLower())), 0);
                if (!StringDictionary.ContainsKey(hash))
                {
                    StringDictionary.Add(hash, path);
                }

                AddFile(hash, data, compressed, refresh);
            }
        }
Example #9
0
        public static Dictionary <ulong, string> Generate(Wad wad)
        {
            Dictionary <ulong, string> hashtable = new Dictionary <ulong, string>();
            List <string> strings = new List <string>();

            foreach (WadEntry entry in wad.Entries.Values.Where(x => x.Type != WadEntryType.FileRedirection))
            {
                using Stream entryStream = entry.GetDataHandle().GetDecompressedStream();
                LeagueFileType fileType = LeagueUtilities.GetExtensionType(entryStream);

                if (fileType == LeagueFileType.BIN)
                {
                    BinTree bin = null;
                    try
                    {
                        bin = new BinTree(entryStream);
                    }
                    catch (Exception)
                    {
                    }

                    if (bin != null)
                    {
                        strings.AddRange(ProcessBinDependencies(bin.Dependencies));
                        strings.AddRange(ProcessBinTree(bin));
                    }
                }
                else if (IsLegacyDirList(entry.XXHash))
                {
                    strings.AddRange(ProcessLegacyDirList(entry));
                }
            }

            using (XXHash64 xxHash = XXHash64.Create())
            {
                foreach (string fetchedString in strings.Distinct())
                {
                    if (!string.IsNullOrEmpty(fetchedString))
                    {
                        ulong hash = BitConverter.ToUInt64(xxHash.ComputeHash(Encoding.ASCII.GetBytes(fetchedString.ToLower())), 0);

                        if (!hashtable.ContainsKey(hash))
                        {
                            hashtable.Add(hash, fetchedString);
                        }
                    }
                }
            }

            return(hashtable);
        }
        public static Dictionary <ulong, string> Generate(WADFile wad)
        {
            Dictionary <ulong, string> hashtable = new Dictionary <ulong, string>();
            List <string> strings = new List <string>();

            foreach (WADEntry entry in wad.Entries.Where(x => x.Type != EntryType.FileRedirection))
            {
                byte[]         entryContent = entry.GetContent(true);
                LeagueFileType fileType     = LeagueUtilities.GetExtension(entryContent);

                if (fileType == LeagueFileType.BIN)
                {
                    BINFile bin = null;
                    try
                    {
                        bin = new BINFile(new MemoryStream(entryContent));
                    }
                    catch (Exception)
                    {
                    }

                    if (bin != null)
                    {
                        strings.AddRange(ProcessBINLinkedFiles(bin.LinkedFiles));
                        strings.AddRange(ProcessBINFile(bin));
                    }
                }
                else if (IsLegacyDirList(entry.XXHash))
                {
                    strings.AddRange(ProcessLegacyDirList(entry));
                }
            }

            using (XXHash64 xxHash = XXHash64.Create())
            {
                foreach (string fetchedString in strings.Distinct())
                {
                    if (!string.IsNullOrEmpty(fetchedString))
                    {
                        ulong hash = BitConverter.ToUInt64(xxHash.ComputeHash(Encoding.ASCII.GetBytes(fetchedString.ToLower())), 0);

                        if (!hashtable.ContainsKey(hash))
                        {
                            hashtable.Add(hash, fetchedString);
                        }
                    }
                }
            }

            return(hashtable);
        }
Example #11
0
        public static void GenerateWADStrings(WADFile wad, Dictionary <ulong, string> stringDictionary)
        {
            List <string> strings = new List <string>();

            foreach (WADEntry entry in wad.Entries.Where(x => x.Type != EntryType.FileRedirection))
            {
                byte[]         entryContent = entry.GetContent(true);
                LeagueFileType fileType     = Utilities.GetLeagueFileExtensionType(entryContent);

                if (fileType == LeagueFileType.BIN)
                {
                    BINFile bin = null;
                    try
                    {
                        bin = new BINFile(new MemoryStream(entryContent));
                    }
                    catch (Exception excp)
                    {
                        Console.WriteLine(excp.Message);
                    }

                    if (bin != null)
                    {
                        strings.AddRange(ProcessBINLinkedFiles(bin.LinkedFiles));
                        strings = strings.Distinct().ToList();

                        strings.AddRange(ProcessBINFile(bin));
                    }
                }
            }

            using (XXHash64 xxHash = XXHash64.Create())
            {
                for (int i = 0; i < strings.Count; i++)
                {
                    string fetchedString = strings[i];
                    if (!string.IsNullOrEmpty(fetchedString))
                    {
                        ulong hash = BitConverter.ToUInt64(xxHash.ComputeHash(Encoding.ASCII.GetBytes(fetchedString.ToLower())), 0);

                        if (!stringDictionary.ContainsKey(hash))
                        {
                            stringDictionary.Add(hash, fetchedString);
                        }
                    }
                }
            }
        }
Example #12
0
        private void menuImportHashtable_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog
            {
                Title       = "Select the Hashtable files you want to load",
                Multiselect = true,
                Filter      = "Text Files (*.txt)|*.txt"
            };

            if (dialog.ShowDialog() == true)
            {
                try
                {
                    foreach (string fileName in dialog.FileNames)
                    {
                        foreach (string line in File.ReadAllLines(fileName))
                        {
                            string[] lineSplit = line.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

                            if (ulong.TryParse(lineSplit[0], out ulong hash) && !StringDictionary.ContainsKey(hash))
                            {
                                StringDictionary.Add(ulong.Parse(lineSplit[0]), lineSplit[1]);
                            }
                            else
                            {
                                using (XXHash64 xxHash = XXHash64.Create())
                                {
                                    ulong key = BitConverter.ToUInt64(xxHash.ComputeHash(Encoding.ASCII.GetBytes(lineSplit[0].ToLower())), 0);
                                    if (!StringDictionary.ContainsKey(key))
                                    {
                                        StringDictionary.Add(key, lineSplit[0].ToLower());
                                    }
                                }
                            }
                        }

                        Logger.Info("Imported Hashtable from: " + fileName);
                    }
                }
                catch (Exception excp)
                {
                    Logging.LogException(Logger, "Failed to Import Hashtable", excp);
                    return;
                }

                CollectionViewSource.GetDefaultView(this.datagridWadEntries.ItemsSource).Refresh();
            }
        }
Example #13
0
        private void menuImportHashtable_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog
            {
                Title            = "Select the Hashtable files you want to load",
                Multiselect      = true,
                Filter           = "Text Files (*.txt)|*.txt",
                InitialDirectory = (string)Config.Get("HashtableOpenDialogStartPath")
            };

            if (dialog.ShowDialog() == true)
            {
                try
                {
                    foreach (string fileName in dialog.FileNames)
                    {
                        foreach (string line in File.ReadAllLines(fileName))
                        {
                            using (XXHash64 xxHash = XXHash64.Create())
                            {
                                ulong hash = BitConverter.ToUInt64(xxHash.ComputeHash(Encoding.ASCII.GetBytes(line.ToLower())), 0);
                                if (!StringDictionary.ContainsKey(hash))
                                {
                                    StringDictionary.Add(hash, line);
                                }
                            }
                        }

                        Logger.Info("Imported Hashtable from: " + fileName);
                    }
                }
                catch (Exception excp)
                {
                    Logging.LogException(Logger, "Failed to Import Hashtable", excp);
                    return;
                }

                CollectionViewSource.GetDefaultView(this.datagridWadEntries.ItemsSource).Refresh();
            }
        }
Example #14
0
        private void buttonAddFileAdd_Click(object sender, RoutedEventArgs e)
        {
            if (this.buttonAddFileOpen.Visibility == Visibility.Visible)
            {
                try
                {
                    this.Wad.AddEntry(this.textboxAddFilePath.Text, File.ReadAllBytes(this.textboxAddFileFilePath.Text), this.checkboxAddFileCompressed.IsChecked.Value);

                    using (XXHash64 xxHash = XXHash64.Create())
                    {
                        StringDictionary.Add(BitConverter.ToUInt64(xxHash.ComputeHash(Encoding.ASCII.GetBytes(this.textboxAddFilePath.Text.ToLower())), 0), this.textboxAddFilePath.Text);
                    }

                    CollectionViewSource.GetDefaultView(this.datagridWadEntries.ItemsSource).Refresh();
                }
                catch (Exception exception)
                {
                    MessageBox.Show(exception.Message, "Please choose a different Path", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
            }
            else
            {
                try
                {
                    this.Wad.AddEntry(this.textboxAddFileFilePath.Text, this.textboxAddFilePath.Text);

                    using (XXHash64 xxHash = XXHash64.Create())
                    {
                        StringDictionary.Add(BitConverter.ToUInt64(xxHash.ComputeHash(Encoding.ASCII.GetBytes(this.textboxAddFileFilePath.Text.ToLower())), 0), this.textboxAddFileFilePath.Text);
                    }

                    CollectionViewSource.GetDefaultView(this.datagridWadEntries.ItemsSource).Refresh();
                }
                catch (Exception exception)
                {
                    MessageBox.Show(exception.Message, "Please choose a different Path", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
            }
        }
Example #15
0
        public void importHashTable(string fileName)
        {
            foreach (string line in File.ReadAllLines(fileName))
            {
                string[] lineSplit = line.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

                if (ulong.TryParse(lineSplit[0], out ulong hash) && !StringDictionary.ContainsKey(hash))
                {
                    StringDictionary.Add(ulong.Parse(lineSplit[0]), lineSplit[1]);
                }
                else
                {
                    using (XXHash64 xxHash = XXHash64.Create())
                    {
                        ulong key = BitConverter.ToUInt64(xxHash.ComputeHash(Encoding.ASCII.GetBytes(lineSplit[0].ToLower())), 0);
                        if (!StringDictionary.ContainsKey(key))
                        {
                            StringDictionary.Add(key, lineSplit[0].ToLower());
                        }
                    }
                }
            }
        }
Example #16
0
        public List <String> importFolder(string folderPath)
        {
            var           list      = new List <string>();
            DirectoryInfo directory = new DirectoryInfo(folderPath);

            using (XXHash64 xxHash = XXHash64.Create())
            {
                foreach (FileInfo fileInfo in directory.EnumerateFiles("*", SearchOption.AllDirectories))
                {
                    string path       = fileInfo.FullName.Substring(directory.FullName.Length + 1);
                    ulong  hashedPath = BitConverter.ToUInt64(xxHash.ComputeHash(Encoding.ASCII.GetBytes(path.ToLower())), 0);

                    if (!StringDictionary.ContainsKey(hashedPath))
                    {
                        StringDictionary.Add(hashedPath, path);
                    }

                    var entry = this.activeWad.AddEntry(hashedPath, File.ReadAllBytes(fileInfo.FullName), true);
                    mapEntries.Add(path, entry);
                    list.Add(path);
                }
            }
            return(list);
        }
Example #17
0
 private string checksum_xxhash(byte[] data)
 {
     xxhash.Initialize();
     return(hex(xxhash.ComputeHash(data)));
 }
Example #18
0
        private void menuCreateFromDirectory_Click(object sender, RoutedEventArgs e)
        {
            System.Windows.Forms.FolderBrowserDialog dialog = new System.Windows.Forms.FolderBrowserDialog()
            {
                ShowNewFolderButton = false
            };

            if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                this.Wad?.Dispose();
                this.Wad         = new WADFile();
                StringDictionary = new Dictionary <ulong, string>();

                DirectoryInfo directory = new DirectoryInfo(dialog.SelectedPath);

                using (XXHash64 xxHash = XXHash64.Create())
                {
                    foreach (FileInfo fileInfo in directory.EnumerateFiles("*", SearchOption.AllDirectories))
                    {
                        string path = fileInfo.FullName.Substring(directory.FullName.Length + 1);
                        string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(path);
                        bool   hasUnknownPath           = fileNameWithoutExtension.All(c => "ABCDEF0123456789".Contains(c)) && fileNameWithoutExtension.Length <= 16;

                        if (hasUnknownPath)
                        {
                            ulong hashedPath = HexStringToUInt64(fileNameWithoutExtension);
                            this.Wad.AddEntry(hashedPath, File.ReadAllBytes(fileInfo.FullName), true);
                        }
                        else
                        {
                            ulong hashedPath = BitConverter.ToUInt64(xxHash.ComputeHash(Encoding.ASCII.GetBytes(path.ToLower())), 0);
                            if (!StringDictionary.ContainsKey(hashedPath))
                            {
                                StringDictionary.Add(hashedPath, path);
                            }

                            this.Wad.AddEntry(hashedPath, File.ReadAllBytes(fileInfo.FullName), true);
                        }
                    }
                }

                if ((bool)this.Config["GenerateWadDictionary"])
                {
                    try
                    {
                        WADHashGenerator.GenerateWADStrings(Logger, this.Wad, StringDictionary);
                    }
                    catch (Exception excp)
                    {
                        Logging.LogException(Logger, "Failed to Generate WAD String Dictionary", excp);
                    }
                }
                this.previewExpander.IsEnabled = true;

                this.menuSave.IsEnabled               = true;
                this.menuImportHashtable.IsEnabled    = true;
                this.menuExportHashtable.IsEnabled    = true;
                this.menuExportAll.IsEnabled          = true;
                this.menuAddFile.IsEnabled            = true;
                this.menuAddFileRedirection.IsEnabled = true;
                this.menuAddFolder.IsEnabled          = true;
                this.CurrentlySelectedEntry           = null;
                this.datagridWadEntries.ItemsSource   = this.Wad.Entries;

                Logger.Info("Created WAD file from directory: " + dialog.SelectedPath);
                CollectionViewSource.GetDefaultView(this.datagridWadEntries.ItemsSource).Refresh();
            }
        }
Example #19
0
        private static void TestFile(int index, int fileSize)
        {
            TotalSize += (ulong)fileSize;
            Console.WriteLine("=============================================================");
            var path = CreateFile(fileSize);

            Console.WriteLine($"No.{index}, File size = {fileSize.ToString("X")}");
            Console.WriteLine();
            Console.WriteLine($"Official tool xxHash32: {GetXXHashCPortOutput(path, 0)}");
            Console.WriteLine($"Official tool xxHash64: {GetXXHashCPortOutput(path, 1)}");
            Console.WriteLine();
            using (var fs = new FileStream(path, FileMode.Open))
            {
                watch.Start();
                var bigEndianHashBytes32 = xxH32.ComputeHash(fs);
                watch.Stop();
                var xxHash32Cost = watch.Elapsed.TotalMilliseconds;
                fs.Seek(0, SeekOrigin.Begin);
                watch.Reset();
                watch.Start();
                var bigEndianHashBytes64 = xxH64.ComputeHash(fs);
                watch.Stop();
                var xxHash64Cost = watch.Elapsed.TotalMilliseconds;
                fs.Seek(0, SeekOrigin.Begin);
                watch.Reset();
                watch.Start();
                var md5HashBytes = md5.ComputeHash(fs);
                watch.Stop();
                var md5Cost = watch.Elapsed.TotalMilliseconds;

                fs.Seek(0, SeekOrigin.Begin);
                watch.Reset();
                watch.Start();
                var crc32NormalHashBytes = Crc32Normal.ComputeHash(fs);
                watch.Stop();
                var crc32NormalCost = watch.Elapsed.TotalMilliseconds;
#if SSE42
                fs.Seek(0, SeekOrigin.Begin);
                watch.Reset();
                watch.Start();
                var crc32SSEHashBytes = Crc32SSE.ComputeHash(fs);
                watch.Stop();
                var crc32SSECost = watch.Elapsed.TotalMilliseconds;
#endif
                Console.WriteLine($"My xxHash32 uint value: {xxH32.HashUInt32.ToString("x")}");
                Console.WriteLine($"My xxHash64 uint value: {xxH64.HashUInt64.ToString("x")}");
                Console.WriteLine();
                Console.WriteLine($"My xxHash32 bytes value(big endian): {BitConverter.ToString(bigEndianHashBytes32, 0, bigEndianHashBytes32.Length).Replace("-", "")}");
                Console.WriteLine($"My xxHash64 bytes value(big endian): {BitConverter.ToString(bigEndianHashBytes64, 0, bigEndianHashBytes64.Length).Replace("-", "")}");
                Console.WriteLine();
                Console.WriteLine($"MD5 bytes value: {BitConverter.ToString(md5HashBytes, 0, md5HashBytes.Length).Replace("-", "")}");
                Console.WriteLine($"CRC32C normal version bytes value: {BitConverter.ToString(crc32NormalHashBytes, 0, crc32NormalHashBytes.Length).Replace("-", "")}");
#if SSE42
                Console.WriteLine($"CRC32C SSE42 version bytes value: {BitConverter.ToString(crc32SSEHashBytes, 0, crc32SSEHashBytes.Length).Replace("-", "")}");
#endif
                Console.WriteLine();
                Console.WriteLine($"My xxHash32 cost: {xxHash32Cost.ToString()}");
                Console.WriteLine($"My xxHash64 cost: {xxHash64Cost.ToString()}");
                Console.WriteLine($"MD5 cost: {md5Cost.ToString()}");
                Console.WriteLine($"CRC32C normal version cost: {crc32NormalCost.ToString()}");
                XH32Cost      += (decimal)xxHash32Cost;
                XH64Cost      += (decimal)xxHash64Cost;
                MD5Cost       += (decimal)md5Cost;
                CRCNormalCost += (decimal)crc32NormalCost;
#if SSE42
                Console.WriteLine($"CRC32C SSE42 version cost: {crc32SSECost.ToString()}");
                CRCSSECost += (decimal)crc32SSECost;
#endif
            }
            File.Delete(path);
        }