private void validateClientCredentials() { Pair cc = settings.getClientCredentials(); String clientId = (String)cc.First; String clientSecret = (string)cc.Second; Util.writeInfoLog("ClientID: " + maskString(clientId)); Util.writeInfoLog("clientSecret: " + maskString(clientSecret)); if ((((string)cc.First).Length == 0) || (((string)cc.First).Length == 0)) { throw new BINGClientCredentialException(); } }
public void persistModel() { String engine = "MYMEMORY"; if (model.getEngine().Equals(TranslateSettingsModel.Engine.BING)) { engine = "BING"; } Win32.WritePrivateProfileString("ENGINE", "engine", engine, dataSourcePath); Win32.WritePrivateProfileString("MYMEMORY", "email", model.email, dataSourcePath); Win32.WritePrivateProfileString("BING", "ClientIDAndSecret", model.getClientCredentials().First + ";" + model.getClientCredentials().Second, dataSourcePath); List <string> writableStringList = new List <string>(); foreach (Pair codeNamePair in model.getAllLanguages()) { writableStringList.Add(codeNamePair.First + ":" + codeNamePair.Second); } string writableString = string.Join(";", writableStringList.ToArray()); Win32.WritePrivateProfileString("TRANSLATE", "ALLLANGUAGES", writableString, dataSourcePath); string langPrefStr = model.getLanguagePreference().First + ":" + model.getLanguagePreference().Second; Win32.WritePrivateProfileString("TRANSLATE", "LANGUAGEPREF", langPrefStr, dataSourcePath); }