//调用ResXResourceReader类,需要引用System.Windows.Forms.dll,下同
ResXResourceReader resxReader = new ResXResourceReader(@"资源文件路径");
IDictionaryEnumerator dict = resxReader.GetEnumerator();
StringBuilder jsonBuilder = new StringBuilder("{"th_th": {");
while (dict.MoveNext())
{
Console.WriteLine("{0},{1}", dict.Key, dict.Value);
jsonBuilder.Append(""" + dict.Key + "":"" + dict.Value + "",
");
}
var jsonString = jsonBuilder.ToString().Substring(0, jsonBuilder.Length - 2) + "}}";
var path = Directory.GetCurrentDirectory();
File.WriteAllText(path + "/th_th.json", Regex.Unescape(jsonString));