public override void Initialize(IInitializationContext context) { var defaultPath = GetDefaultInstallationPath(); var pathToLec = context.GetOrCreateSetting("LecPowerTranslator15", "InstallationPath", defaultPath); if (string.IsNullOrEmpty(pathToLec) && !string.IsNullOrEmpty(defaultPath)) { context.SetSetting("LecPowerTranslator15", "InstallationPath", defaultPath); pathToLec = defaultPath; } if (string.IsNullOrEmpty(pathToLec)) { throw new EndpointInitializationException("The LecPowerTranslator15 requires the path to the installation folder."); } context.DisableSpamChecks(); var exePath = Path.Combine(context.TranslatorDirectory, Path.Combine("FullNET", "Lec.ExtProtocol.exe")); var fileExists = File.Exists(exePath); if (!fileExists) { throw new EndpointInitializationException($"Could not find any executable at '{exePath}'"); } ExecutablePath = exePath; Arguments = Convert.ToBase64String(Encoding.UTF8.GetBytes(pathToLec)); if (context.SourceLanguage != "ja") { throw new EndpointInitializationException("Current implementation only supports japanese-to-english."); } if (context.DestinationLanguage != "en") { throw new EndpointInitializationException("Current implementation only supports japanese-to-english."); } }
public override void Initialize(IInitializationContext context) { var defaultPath = GetDefaultInstallationPath(); var path = context.GetOrCreateSetting("ezTrans", "InstallationPath", defaultPath); if (string.IsNullOrEmpty(path) && !string.IsNullOrEmpty(defaultPath)) { context.SetSetting("ezTrans", "InstallationPath", defaultPath); path = defaultPath; } context.DisableSpamChecks(); //subprocess path var exePath = Path.Combine(context.TranslatorDirectory, @"FullNET\ezTransXP.ExtProtocol.exe"); var fileExists = File.Exists(exePath); if (!fileExists) { throw new EndpointInitializationException($"Could not find any executable at '{exePath}'"); } ExecutablePath = exePath; //argument is ezTrans installation path Arguments = Convert.ToBase64String(Encoding.UTF8.GetBytes(path)); if (context.SourceLanguage != "ja") { throw new EndpointInitializationException("Current implementation only supports japanese-to-korean."); } if (context.DestinationLanguage != "ko") { throw new EndpointInitializationException("Current implementation only supports japanese-to-korean."); } }