本文整理汇总了C#中ITranslation.GetTranslation方法的典型用法代码示例。如果您正苦于以下问题:C# ITranslation.GetTranslation方法的具体用法?C# ITranslation.GetTranslation怎么用?C# ITranslation.GetTranslation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITranslation
的用法示例。
在下文中一共展示了ITranslation.GetTranslation方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WebSocketInterface
public WebSocketInterface(int port, ITranslation translations)
{
_server = new WebSocketServer();
var setupComplete = _server.Setup(new ServerConfig
{
Name = "NecroWebSocket",
Ip = "Any",
Port = port,
Mode = SocketMode.Tcp,
Security = "tls",
Certificate = new CertificateConfig
{
FilePath = @"cert.pfx",
Password = "necro"
}
});
if (setupComplete == false)
{
Logger.Write(translations.GetTranslation(TranslationString.WebSocketFailStart, port), LogLevel.Error);
return;
}
_server.NewMessageReceived += HandleMessage;
_server.NewSessionConnected += HandleSession;
_server.Start();
}
示例2: checkProxy
public void checkProxy(ITranslation translator)
{
using (var tempWebClient = new NecroWebClient())
{
string unproxiedIP = WebClientExtensions.DownloadString(tempWebClient, new Uri("https://api.ipify.org/?format=text"));
if (UseProxy)
{
tempWebClient.Proxy = this.InitProxy();
string proxiedIPres = WebClientExtensions.DownloadString(tempWebClient, new Uri("https://api.ipify.org/?format=text"));
string proxiedIP = proxiedIPres == null?"INVALID PROXY": proxiedIPres;
Logger.Write(translator.GetTranslation(TranslationString.Proxied, unproxiedIP, proxiedIP), LogLevel.Info, (unproxiedIP == proxiedIP) ? ConsoleColor.Red : ConsoleColor.Green);
if (unproxiedIP == proxiedIP || proxiedIPres == null)
{
Logger.Write(translator.GetTranslation(TranslationString.FixProxySettings), LogLevel.Info, ConsoleColor.Red);
Console.ReadKey();
Environment.Exit(0);
}
}
else
{
Logger.Write(translator.GetTranslation(TranslationString.Unproxied, unproxiedIP), LogLevel.Info, ConsoleColor.Red);
}
}
}
示例3: SetupUserAccount
private static void SetupUserAccount(ITranslation translator, GlobalSettings settings)
{
Console.WriteLine("");
Logger.Write(translator.GetTranslation(TranslationString.FirstStartSetupUsernamePrompt), LogLevel.None);
string strInput = Console.ReadLine();
if (settings.Auth.AuthType == AuthType.Google)
settings.Auth.GoogleUsername = strInput;
else
settings.Auth.PtcUsername = strInput;
Logger.Write(translator.GetTranslation(TranslationString.FirstStartSetupUsernameConfirm, strInput));
Console.WriteLine("");
Logger.Write(translator.GetTranslation(TranslationString.FirstStartSetupPasswordPrompt), LogLevel.None);
strInput = Console.ReadLine();
if (settings.Auth.AuthType == AuthType.Google)
settings.Auth.GooglePassword = strInput;
else
settings.Auth.PtcPassword = strInput;
Logger.Write(translator.GetTranslation(TranslationString.FirstStartSetupPasswordConfirm, strInput));
Logger.Write(translator.GetTranslation(TranslationString.FirstStartAccountCompleted), LogLevel.None);
}
示例4: SetupTranslationCode
private static Session SetupTranslationCode(Session session, ITranslation translator, GlobalSettings settings)
{
Logger.Write(translator.GetTranslation(TranslationString.FirstStartLanguagePrompt, "Y", "N"), LogLevel.None);
string strInput;
bool boolBreak = false;
while (!boolBreak)
{
strInput = Console.ReadLine().ToLower();
switch (strInput)
{
case "y":
boolBreak = true;
break;
case "n":
return session;
default:
Logger.Write(translator.GetTranslation(TranslationString.PromptError, "y", "n"), LogLevel.Error);
continue;
}
}
Logger.Write(translator.GetTranslation(TranslationString.FirstStartLanguageCodePrompt));
strInput = Console.ReadLine();
settings.TranslationLanguageCode = strInput;
session = new Session(new ClientSettings(settings), new LogicSettings(settings));
translator = session.Translation;
Logger.Write(translator.GetTranslation(TranslationString.FirstStartLanguageConfirm, strInput));
return session;
}
示例5: SetupConfig
private static void SetupConfig(ITranslation translator, GlobalSettings settings)
{
Logger.Write(translator.GetTranslation(TranslationString.FirstStartDefaultLocationPrompt, "Y", "N"), LogLevel.None);
bool boolBreak = false;
while (!boolBreak)
{
string strInput = Console.ReadLine().ToLower();
switch (strInput)
{
case "y":
boolBreak = true;
break;
case "n":
Logger.Write(translator.GetTranslation(TranslationString.FirstStartDefaultLocationSet));
return;
default:
// PROMPT ERROR \\
Logger.Write(translator.GetTranslation(TranslationString.PromptError, "y", "n"), LogLevel.Error);
continue;
}
}
Logger.Write(translator.GetTranslation(TranslationString.FirstStartDefaultLocation), LogLevel.None);
Logger.Write(translator.GetTranslation(TranslationString.FirstStartSetupDefaultLatLongPrompt));
while (true)
{
try
{
string strInput = Console.ReadLine();
string[] strSplit = strInput.Split( ',' );
if( strSplit.Length > 1 )
{
double dblLat = double.Parse( strSplit[ 0 ].Trim( ' ' ) );
double dblLong = double.Parse( strSplit[ 1 ].Trim( ' ' ) );
settings.DefaultLatitude = dblLat;
settings.DefaultLongitude = dblLong;
Logger.Write( translator.GetTranslation( TranslationString.FirstStartSetupDefaultLatLongConfirm, $"{dblLat}, {dblLong}" ) );
}
else
{
Logger.Write( translator.GetTranslation( TranslationString.FirstStartSetupDefaultLocationError, $"{settings.DefaultLatitude}, {settings.DefaultLongitude}", LogLevel.Error ) );
continue;
}
break;
}
catch (FormatException)
{
Logger.Write(translator.GetTranslation(TranslationString.FirstStartSetupDefaultLocationError, $"{settings.DefaultLatitude}, {settings.DefaultLongitude}", LogLevel.Error));
continue;
}
}
}
示例6: SetupAccountType
private static void SetupAccountType(ITranslation translator, GlobalSettings settings)
{
string strInput;
Logger.Write(translator.GetTranslation(TranslationString.FirstStartSetupAccount), LogLevel.None);
Logger.Write(translator.GetTranslation(TranslationString.FirstStartSetupTypePrompt, "google", "ptc"));
while (true)
{
strInput = Console.ReadLine().ToLower();
switch (strInput)
{
case "google":
settings.Auth.AuthType = AuthType.Google;
Logger.Write(translator.GetTranslation(TranslationString.FirstStartSetupTypeConfirm, "GOOGLE"));
return;
case "ptc":
settings.Auth.AuthType = AuthType.Ptc;
Logger.Write(translator.GetTranslation(TranslationString.FirstStartSetupTypeConfirm, "PTC"));
return;
default:
Logger.Write(translator.GetTranslation(TranslationString.FirstStartSetupTypePromptError, "google", "ptc"), LogLevel.Error);
break;
}
}
}
示例7: PromptForSetup
public static bool PromptForSetup(ITranslation translator)
{
Logger.Write(translator.GetTranslation(TranslationString.FirstStartPrompt, "Y", "N"), LogLevel.Warning);
while (true)
{
string strInput = Console.ReadLine().ToLower();
switch (strInput)
{
case "y":
return true;
case "n":
Logger.Write(translator.GetTranslation(TranslationString.FirstStartAutoGenSettings));
return false;
default:
Logger.Write(translator.GetTranslation(TranslationString.PromptError, "Y", "N"), LogLevel.Error);
continue;
}
}
}
示例8: SetupConfig
private static void SetupConfig(ITranslation translator, GlobalSettings settings)
{
Logger.Write(translator.GetTranslation(TranslationString.FirstStartDefaultLocationPrompt, "Y", "N"), LogLevel.None);
bool boolBreak = false;
while (!boolBreak)
{
string strInput = Console.ReadLine().ToLower();
switch (strInput)
{
case "y":
boolBreak = true;
break;
case "n":
Logger.Write(translator.GetTranslation(TranslationString.FirstStartDefaultLocationSet));
return;
default:
// PROMPT ERROR \\
Logger.Write(translator.GetTranslation(TranslationString.PromptError, "y", "n"), LogLevel.Error);
continue;
}
}
Logger.Write(translator.GetTranslation(TranslationString.FirstStartDefaultLocation), LogLevel.None);
Logger.Write(translator.GetTranslation(TranslationString.FirstStartSetupDefaultLatPrompt));
while (true)
{
try
{
double dblInput = double.Parse(Console.ReadLine());
settings.DefaultLatitude = dblInput;
Logger.Write(translator.GetTranslation(TranslationString.FirstStartSetupDefaultLatConfirm, dblInput));
break;
}
catch (FormatException)
{
Logger.Write(translator.GetTranslation(TranslationString.FirstStartSetupDefaultLocationError, settings.DefaultLatitude, LogLevel.Error));
continue;
}
}
Logger.Write(translator.GetTranslation(TranslationString.FirstStartSetupDefaultLongPrompt));
while (true)
{
try
{
double dblInput = double.Parse(Console.ReadLine());
settings.DefaultLongitude = dblInput;
Logger.Write(translator.GetTranslation(TranslationString.FirstStartSetupDefaultLongConfirm, dblInput));
break;
}
catch (FormatException)
{
Logger.Write(translator.GetTranslation(TranslationString.FirstStartSetupDefaultLocationError, settings.DefaultLongitude, LogLevel.Error));
continue;
}
}
}