private void ClickDeTwist(object sender, RoutedEventArgs e) { OpenFileDialog openFileDialog = new OpenFileDialog() { DefaultExt = ".txt", Title = Localization.Get("Twist.FileSelector.Long") }; if (openFileDialog.ShowDialog() == true) { string file = openFileDialog.FileName; if (!File.Exists(file)) { MessageBox.Show(Localization.Get("Twist.FileSelector.Invalid")); } else { path = file; Task.Run(() => { string output = HandleProgress(x => sender == detwist ? Twister.DeTwist(File.ReadAllText(path), detwistingLanguage, x) : Twister.Twist(File.ReadAllText(path), x), sender == detwist ? 100 : int.MaxValue); Dispatcher.Invoke(() => { progressBar.Value = 0; SaveFileDialog saveFileDialog = new SaveFileDialog() { AddExtension = true, DefaultExt = ".txt", OverwritePrompt = true, Title = Localization.Get("Twist.Finished.SaveResults") }; if (saveFileDialog.ShowDialog() == true) { File.WriteAllText(saveFileDialog.FileName, output); } }); }); } } }
public static void Decode(byte[] bytes) { var twister = new Twister(); twister.Decrypt(bytes, 0x5D3E3); }