fix bug 11071900

Signed-off-by: lilium-saber <WR364999428@hotmail.com>
GDN
lilium-saber 1 year ago
parent 99f5d11070
commit 80799ae956

@ -25,18 +25,23 @@ namespace WpfApp2
public TempResource() //用于创建
{
if(Directory.Exists(jsonpath))
if(!Directory.Exists(jsonpath))
{
List<MyData> js = JsonConvert.DeserializeObject<List<MyData>>(jsonpath);
js.Add(new MyData() { ID = "20230923001827495", KEY = "yjvMNY33Qc1TYSBjTQYQ", SECRET = "M2Q4YzkzZTIwZjNkMGE2ZjkwZWMxNzZk", SRCLAN = "jp", DSTLAN = "zh", NOW = "baidu", } );
string jjson = JsonConvert.SerializeObject(js);
File.WriteAllText(jsonpath, jjson);
StreamWriter streamWriter = new StreamWriter(jsonpath);
streamWriter.WriteLine("{\n\"ID\" : \"20230923001827495\"," +
"\n\"KEY\" : \"yjvMNY33Qc1TYSBjTQYQ\"," +
"\n\"SECRET\" : \"M2Q4YzkzZTIwZjNkMGE2ZjkwZWMxNzZk\"," +
"\n\"SRCLAN\" : \"jp\"," +
"\n\"DSTLAN\" : \"zh\"," +
"\n\"NOW\":\"baidu\"\n" +
"}");
streamWriter.Close();
}
}
private MyData GetJsonStream()
{
string jsonF = File.ReadAllText(jsonpath);
var jsonF = File.ReadAllText(jsonpath);
MyData da = JsonConvert.DeserializeObject<MyData>(jsonF);
return da;
}

@ -1,10 +1,5 @@

using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WpfApp2.translationKey
{
@ -24,19 +19,21 @@ namespace WpfApp2.translationKey
string temppathTemp = pathTemp + "\\" + name + ".txt";
StreamWriter sw = new StreamWriter(temppathTemp);
StreamWriter sw2 = new StreamWriter(txtPath,true);
foreach (string s in list)
{
sw.WriteLine(s);
}
name = "\n" + name;
System.IO.File.AppendAllText(txtPath, name);
sw2.WriteLine(name);
sw.Close();
sw2.Close();
}
public void InputBaiduPrivate(string name, string id, string key)//该函数仅百度支持
{
if(!Directory.Exists(pathTemp))
if (!Directory.Exists(pathTemp))
{
Directory.CreateDirectory(pathTemp);
}
@ -44,10 +41,10 @@ namespace WpfApp2.translationKey
string temppathTemp = pathTemp + "\\" + name + ".txt";
StreamWriter sw = new StreamWriter(temppathTemp);
StreamWriter sw2 = new StreamWriter(txtPath);
InputTranslationId(id,sw);
InputTranslationKey(key,sw);
InputTranslationId(id, sw);
InputTranslationKey(key, sw);
sw2.WriteLine(name);
sw.Close();
sw2.Close();

Loading…
Cancel
Save