using System.Text.Json; using System.Text.RegularExpressions; namespace HelloWorld; class Program { static string[] EXTS = { ".txt", ".json",}; static string PATTERN = "\'(.+)\':"; static string IDPATTERN = "ObjectId\\(\"(.+)\"\\)"; static void Main(string[] args) { int idx = 0; foreach (var item in args) { Console.WriteLine($"{idx} - {item}"); if (File.Exists(item)) { string ext = Path.GetExtension(item); if (EXTS.Contains(ext)) { string content = File.ReadAllText(item); content = Regex.Replace(content, PATTERN, "\"$1\":"); content = Regex.Replace(content, IDPATTERN, "\"$1\""); if (content != null) { WrapperInfo? wrapper = JsonSerializer.Deserialize(content); if (wrapper != null) { if (wrapper.Cn != null && wrapper.Cn.Length > 0) { wrapper.Cn = StringExtension.Decompress(wrapper.Cn); } if (wrapper.En != null && wrapper.En.Length > 0) { wrapper.En = StringExtension.Decompress(wrapper.En); } Console.WriteLine(wrapper.Cn); Console.WriteLine(wrapper.En); } } } } idx++; } Console.WriteLine("Press any key..."); Console.ReadLine(); } }