//呼叫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 + "\",\n");
}
var jsonString = jsonBuilder.ToString().Substring(0, jsonBuilder.Length - 2) + "}}";
var path = Directory.GetCurrentDirectory();
File.WriteAllText(path + "/th_th.json", Regex.Unescape(jsonString));
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/46975.html
標籤:C#
上一篇:用long型別讓我出了次生產事故,寫代碼還是要小心點
下一篇:C#執行緒處理 :一、執行緒基礎
