diff --git a/src/translationKey/translationApi.cs b/src/translationKey/translationApi.cs new file mode 100644 index 0000000..a543272 --- /dev/null +++ b/src/translationKey/translationApi.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace WpfApp1.translationKey +{ + + abstract class TranslateApiStr + { + + public abstract List OutputTranslationS(String id); + public abstract List OutputTranslationName(); + + } + + abstract class TranslationApiInt + { + public abstract List OutputTranslationI(int id); + } +} diff --git a/src/translationKey/translationPrivateIn.cs b/src/translationKey/translationPrivateIn.cs new file mode 100644 index 0000000..8d6120e --- /dev/null +++ b/src/translationKey/translationPrivateIn.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace WpfApp1.translationKey +{ + class TranslationPrivateIn + { + private String pathTemp = "../translationResource/"; + private String txtPath = "../translationResource/ListPrivate.txt"; + + public void InputTranslationPrivate(String name, String id, String key) + { + pathTemp = pathTemp + name + ".txt"; + StreamWriter sw = new StreamWriter(pathTemp); + StreamWriter sw2 = new StreamWriter(txtPath); + + InputTranslationId(id,sw); + InputTranslationKey(key,sw); + sw2.WriteLine(name); + sw.Close(); + sw2.Close(); + } + + public void InputTranslationId(String id, StreamWriter sw) + { + + sw.WriteLine(id); + } + + public void InputTranslationKey(String key, StreamWriter sw) + { + sw.WriteLine(key); + } + } +} diff --git a/src/translationKey/translationPrivateOut.cs b/src/translationKey/translationPrivateOut.cs new file mode 100644 index 0000000..af0b39e --- /dev/null +++ b/src/translationKey/translationPrivateOut.cs @@ -0,0 +1,87 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace WpfApp1.translationKey +{ + class translationPrivateOut : TranslateApiStr + { + private String name; + private String path = "../translationResource/"; + private String txtPath = "../translationResource/ListPrivate.txt"; + + translationPrivateOut() + { } + + private String getTranslationPrivateApi(StreamReader sr) + { + String temp = sr.ReadLine(); + + if(temp != null) + { + return temp; + } + else + { + return "ERROR"; + } + + } + + private String getTranslationPrivateKey(StreamReader sr) + { + String temp = sr.ReadLine(); + + if (temp != null) + { + return temp; + } + else + { + return "ERROR"; + } + + } + + public override List OutputTranslationS(String id) + { + this.name = id; + this.path = this.path + this.name + ".txt"; + + StreamReader sr = new StreamReader(this.path); + + var temp = new List { }; + temp.Add(this.getTranslationPrivateApi(sr)); + temp.Add(this.getTranslationPrivateKey(sr)); + + sr.Close(); + return temp; + } + + public override List OutputTranslationName() + { + List temp = new List { }; + + StreamReader sr = new StreamReader(this.txtPath); + String temp2 = sr.ReadLine(); + if (temp2 == null) + { + temp.Add("ERROR"); + } + else + { + while (temp2 != null) + { + temp.Add(temp2); + temp2 = sr.ReadLine(); + } + } + + sr.Close(); + return temp; + } + } +} diff --git a/src/translationKey/translationPublic.cs b/src/translationKey/translationPublic.cs new file mode 100644 index 0000000..9fe786c --- /dev/null +++ b/src/translationKey/translationPublic.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace WpfApp1.translationKey +{ + class translationPublic : TranslationApiInt + { + + public override List OutputTranslationI(int id) + { + var temp = new List { }; + switch (id) + { + case 0://讯飞 + { + temp.Add("");//APISecret + temp.Add("");//APIKey + break; + } + case 1://百度 + { + temp.Add("");//APIAppid + temp.Add("");//APIKey + break; + } + case 2://google + { + temp.Add("");//NULL,空 + temp.Add("");//APIKey + break; + } + } + return temp; + } + } +} diff --git a/src/translationKey/translationResource/ListPrivate.txt b/src/translationKey/translationResource/ListPrivate.txt new file mode 100644 index 0000000..e69de29