|
2 | 2 | using System.Collections.Generic; |
3 | 3 | using System.IO; |
4 | 4 | using System.Linq; |
| 5 | +using System.Reflection; |
5 | 6 | using System.Runtime.InteropServices; |
6 | 7 | using System.Text; |
| 8 | +using System.Text.RegularExpressions; |
7 | 9 | using System.Threading.Tasks; |
8 | 10 |
|
9 | 11 | namespace ConsoleApp1 |
10 | 12 | { |
11 | | - internal |
12 | | - class Program |
| 13 | + internal class Program |
13 | 14 | { |
14 | 15 |
|
15 | | - |
16 | 16 |
|
17 | | - static void Main(string[] args) |
18 | | - |
| 17 | + static void Main(string[] args) |
19 | 18 | { |
| 19 | + |
20 | 20 | Console.Title = "SaveFucker | a tool of decrypting MinecraftWorlds "; |
21 | 21 |
|
22 | 22 | string arg_path = ""; |
| 23 | + bool pass = true; |
23 | 24 |
|
24 | 25 | while (true) |
25 | 26 | { |
26 | | - Console.WriteLine("请输入您存档所在路径:"); |
| 27 | + |
| 28 | + pass = true; |
| 29 | + |
| 30 | + Console.ForegroundColor = ConsoleColor.White; |
| 31 | + Console.WriteLine("请输入您存档所在路径(请确保存档路径中不含有任何中文及其字符)"); |
| 32 | + Console.ForegroundColor = ConsoleColor.Gray; |
27 | 33 | arg_path = Console.ReadLine(); |
28 | | - if (Directory.Exists(arg_path)) |
29 | | - break; |
30 | | - Console.WriteLine("路径不存在,请重新输入"); |
| 34 | + |
| 35 | + |
| 36 | + if (!Directory.Exists(arg_path)) |
| 37 | + { |
| 38 | + Console.ForegroundColor = ConsoleColor.Red; |
| 39 | + Console.WriteLine("路径不存在,请重新输入"); |
| 40 | + Console.ForegroundColor = ConsoleColor.Gray; |
| 41 | + } |
| 42 | + else |
| 43 | + { |
| 44 | + for (int i = 0; i < arg_path.Length; i++) |
| 45 | + { |
| 46 | + if (Regex.IsMatch(arg_path[i].ToString(), @"[\u4e00-\u9fbb]+")) |
| 47 | + { |
| 48 | + Console.ForegroundColor = ConsoleColor.Red; |
| 49 | + Console.WriteLine("存档路径含有中文 请命名成英文 或 将存档保存到其他非中文的路径"); |
| 50 | + Console.ForegroundColor = ConsoleColor.Gray; |
| 51 | + pass = false; |
| 52 | + break; |
| 53 | + } |
| 54 | + |
| 55 | + } |
| 56 | + |
| 57 | + if (pass) |
| 58 | + break; |
| 59 | + |
| 60 | + |
| 61 | + |
| 62 | + } |
| 63 | + |
| 64 | + |
| 65 | + |
| 66 | + |
| 67 | + |
| 68 | + |
| 69 | + |
| 70 | + |
| 71 | + |
31 | 72 | } |
32 | | - |
| 73 | + |
| 74 | + |
| 75 | + |
33 | 76 | Console.WriteLine(MCStudio.Utils.LevelDbEncryptHelper.DecryptRecord(arg_path)); |
| 77 | + Console.ForegroundColor = ConsoleColor.Green; |
34 | 78 | Console.WriteLine("解密操作结束\r\n按下回车键退出程序..."); |
35 | 79 | Console.ReadLine(); |
36 | 80 |
|
37 | 81 | } |
| 82 | + |
| 83 | + |
| 84 | + |
| 85 | + |
| 86 | + |
| 87 | + |
| 88 | + |
| 89 | + |
38 | 90 | } |
39 | 91 | } |
0 commit comments