Signed-off-by: lilium-saber <WR364999428@hotmail.com>
GDN
lilium-saber 1 year ago
parent 5f0d8ff810
commit b00e0d0f24

@ -6,6 +6,7 @@ using System.Threading.Tasks;
using WpfApp1.WinOcr;
using WpfApp1.ScnToJson;
using WpfApp1.translationKey;
using WpfApp1.transToNet;
namespace testRjgc
{
@ -13,13 +14,19 @@ namespace testRjgc
{
AllClassAndInterfaceWellBeManipulatedInThisFileAndCallThroughFunction() { }
public void InputPrivate(string name, string id, string key)
public void InputPrivateBaidu(string name, string id, string key)
{
TranslationPrivateIn tr = new TranslationPrivateIn();
tr.InputTranslationPrivate(name, id, key);
tr.InputBaiduPrivate(name, id, key);
}
public List<string> OutputNameList(string id)
public void InPutPrivateA(string name, List<string> list)
{
TranslationPrivateIn tr = new TranslationPrivateIn();
tr.InPutPrivate(name, list);
}
public List<string> OutputNameList()
{
TranslationApiStr tr = new translationPrivateOut();
List<string> list = tr.OutputTranslationNameList();
@ -33,7 +40,7 @@ namespace testRjgc
return li;
}
public List<string> OutputPub(int id)
public List<string> OutputChoicPublic(int id)
{
TranslationApiInt sin = new translationPublic();
List<string> li = sin.OutputTranslationI(id);
@ -59,5 +66,42 @@ namespace testRjgc
return temp;
}
public string NetBaiDu(string input)
{
Messiah me = new jsonNet();
return me.RequestJsonBaiDu(input);
}
public string NetAllBaiDu(string input, string srcl, string dstl, string aid, string kkey)
{
Messiah me = new jsonNet();
return me.RequestJsonPrivateBaiDu(input, srcl, dstl, aid, kkey);
}
public string NetLanBaiDu(string input, string srcl, string dstl)
{
Messiah me = new jsonNet();
return me.RequestJsonLanguageChangeBaiDu(input, srcl, dstl);
}
public string NetXunFei(string input)
{
Messiah me = new jsonNet();
return me.RequestJsonXunFei(input);
}
public string NetLanXunFei(string input, string srcl, string dstl)
{
Messiah me = new jsonNet();
return me.RequestJsonLanguageChangeXunFei(input, srcl, dstl);
}
public string NetAllXunFei(string input, string srcl, string dstl, string xid, string xsecret, string xkey)
{
Messiah me = new jsonNet();
return me.RequestJsonPrivateXunFei(input, srcl, dstl, xid, xsecret, xkey);
}
}
}

@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace testRjgc.transToNet
namespace WpfApp1.transToNet
{
/*
internal class GrapeToJsonTrans : GrapeToJson

@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace testRjgc.transToNet
namespace WpfApp1.transToNet
{
interface Messiah
{
@ -14,10 +14,10 @@ namespace testRjgc.transToNet
public abstract string RequestJsonBaiDu(string input);
public abstract string RequestJsonXunFei(string input);
public abstract string RequestJsonPrivateXunFei(string input, string srcl, string dstl, string xid, string xkey);
//以下接口暂时废弃
public abstract string RequestJsonXunFei(string input);
public abstract string RequestJsonPrivateXunFei(string input, string srcl, string dstl, string xid, string xsecret, string xkey);
public abstract string RequestJsonLanguageChangeXunFei(string input, string srcl, string dstl);
}

@ -14,7 +14,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Web;
namespace testRjgc.transToNet
namespace WpfApp1.transToNet
{
internal class jsonNet : Messiah
{
@ -53,8 +53,16 @@ namespace testRjgc.transToNet
Console.WriteLine($"{jsonResponse}\n");
}
*/
private HttpClient HttpRequestC(string url)
{
HttpClient httpClient = new HttpClient()
{
BaseAddress = new Uri(url)
};
return httpClient;
}
public static string EncryptString(string str)//百度MD5加密计算方式
private static string EncryptString(string str)//百度MD5加密计算方式
{
MD5 md5 = MD5.Create();
// 将字符串转换成字节数组
@ -152,7 +160,7 @@ namespace testRjgc.transToNet
return "error";
}
public string RequestJsonPrivateXunFei(string input, string srcl, string dstl, string xid, string xkey)
public string RequestJsonPrivateXunFei(string input, string srcl, string dstl, string xid, string xse , string xkey)
{
return "error";
}
@ -162,12 +170,12 @@ namespace testRjgc.transToNet
return "error";
}
}
public class Trans_result
class Trans_result
{
public string src { get; set; }
public string dst { get; set; }
}
public class tempC2
class tempC2
{
public List<Trans_result> trans_result { get; set; }
}

@ -4,13 +4,17 @@ namespace WpfApp1.ScnToJson
{
internal class TranslationScnToJson
{
private string spath;//scn路径
private string dpath;//json
//private string spath;//scn路径
//private string dpath;//json
private string cmdHandle = "cd " + Directory.GetCurrentDirectory() + "\\VNT\\VNTextPatch";
private string voice = ".\\VNTextPatch extractlocal " + Directory.GetCurrentDirectory() + "\\VNT\\p1 " + Directory.GetCurrentDirectory() + "\\VNT\\p2";
public void StartTrans()
{
this.DirExsis("VNT\\p1");
this.DirExsis("VNT\\p2");
var p = new Process
{
StartInfo =
@ -27,9 +31,17 @@ namespace WpfApp1.ScnToJson
}
public void StopTrans(string spa, string dps)
public void DirExsis(string id)
{
if(Directory.Exists(Directory.GetCurrentDirectory() + "\\" + id))
{
Directory.CreateDirectory(Directory.GetCurrentDirectory() + "\\" + id);
}
}
public void StopTrans(string spa, string dps)//自选路径
{
string tempVoice = ".\\VNTextPatch extractlocal " + spa + dps;
string tempVoice = ".\\VNTextPatch extractlocal " + spa + " " + dps;
var p = new Process
{

@ -15,7 +15,28 @@ namespace WpfApp1.translationKey
public TranslationPrivateIn() { }
public void InputTranslationPrivate(string name, string id, string key)//目前仅百度支持
public void InPutPrivate(string name, List<string> list)
{
if (Directory.Exists(pathTemp))
{
Directory.CreateDirectory(pathTemp);
}
string temppathTemp = pathTemp + "\\" + name + ".txt";
StreamWriter sw = new StreamWriter(temppathTemp);
StreamWriter sw2 = new StreamWriter(txtPath);
foreach (string s in list)
{
sw.WriteLine(s);
}
sw2.WriteLine(name);
sw.Close();
sw2.Close();
}
public void InputBaiduPrivate(string name, string id, string key)//该函数仅百度支持
{
if(Directory.Exists(pathTemp))
{
@ -28,6 +49,7 @@ namespace WpfApp1.translationKey
InputTranslationId(id,sw);
InputTranslationKey(key,sw);
sw2.WriteLine(name);
sw.Close();
sw2.Close();

@ -58,7 +58,7 @@ namespace WpfApp1.translationKey
List<string> temp = new List<string> { };
if (Directory.Exists(temppath))//不存在
if (Directory.Exists(temppath))//不存在
{
temp.Add("尚未输入!!!");
return temp;

Loading…
Cancel
Save