| 17 | } |
| 18 | |
| 19 | public static void DumpDataStore(string path) |
| 20 | { |
| 21 | try |
| 22 | { |
| 23 | var output = Path.GetTempFileName(); |
| 24 | var bytes = File.ReadAllBytes(path); |
| 25 | |
| 26 | if (bytes.Length == 0) |
| 27 | { |
| 28 | MessageBox.Show("Your DataStore is empty!", |
| 29 | Program.Name, MessageBoxButton.OK, MessageBoxImage.Information); |
| 30 | return; |
| 31 | } |
| 32 | |
| 33 | Transform(bytes); |
| 34 | File.WriteAllBytes(output, bytes); |
| 35 | |
| 36 | Process.Start(new ProcessStartInfo |
| 37 | { |
| 38 | FileName = "notepad.exe", |
| 39 | Arguments = $"\"{output}\"", |
| 40 | UseShellExecute = false |
| 41 | }); |
| 42 | } |
| 43 | catch |
| 44 | { |
| 45 | MessageBox.Show($"Failed to dump DataStore from path: {path}", |
| 46 | Program.Name, MessageBoxButton.OK, MessageBoxImage.Information); |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | static void Transform(byte[] bytes) |
| 51 | { |