|
|
@ -60,6 +60,8 @@ namespace STranslate.Utils
|
|
|
|
/// <param name="source">当前语言</param>
|
|
|
|
/// <param name="source">当前语言</param>
|
|
|
|
/// <returns></returns>
|
|
|
|
/// <returns></returns>
|
|
|
|
public static async Task<string> TranslateBaiduAsync(string appID, string secretKey, string text, LanguageEnum target, LanguageEnum source = LanguageEnum.AUTO)
|
|
|
|
public static async Task<string> TranslateBaiduAsync(string appID, string secretKey, string text, LanguageEnum target, LanguageEnum source = LanguageEnum.AUTO)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Random rd = new Random();
|
|
|
|
Random rd = new Random();
|
|
|
|
string salt = rd.Next(100000).ToString();
|
|
|
|
string salt = rd.Next(100000).ToString();
|
|
|
@ -93,6 +95,11 @@ namespace STranslate.Utils
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return string.Empty;
|
|
|
|
return string.Empty;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
throw ex;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
// 计算MD5值
|
|
|
|
// 计算MD5值
|
|
|
|
public static string EncryptString(string str)
|
|
|
|
public static string EncryptString(string str)
|
|
|
|
{
|
|
|
|
{
|
|
|
|