public static RootDirectoryEntity CreateRootEntityFromDirectory(string path, bool withHash = true, IProgress <int> progress = null) { DirectoryInfo wot = new DirectoryInfo(path); RootDirectoryEntity root = new RootDirectoryEntity(GetGameVersion(path)); HashProvider hp = withHash ? new SHA1HashProvider() : null; GameDirectoryParser.Parse(wot, root, wot.FullName.Length, hp, IgnoreList.FromEnumerable(File.ReadAllLines("ignored.txt")), progress); return(root); }
private async void btnCreateFile_Click(object sender, RoutedEventArgs e) { DirectoryInfo wot = new DirectoryInfo(txtGameFolder.Text); string output = txtOutputFile.Text; RootDirectoryEntity root = new RootDirectoryEntity(Helpers.GetGameVersion(txtGameFolder.Text)); HashProvider sha1 = new SHA1HashProvider(); btnCreateFile.IsEnabled = false; btnCreateFile.Content = "Creating..."; await Task.Run(() => GameDirectoryParser.Parse(wot, root, wot.FullName.Length, sha1, IgnoreList.FromEnumerable(File.ReadAllLines("ignored.txt")), null)); await Task.Run(() => new RootDirectoryEntityIO().Serialize(root, output)); btnCreateFile.Content = "Create"; btnCreateFile.IsEnabled = true; }