public void CheckConnection(VersionOneSettings settings) { if (settings.OAuth2) { return; } else { var connectionValidator = new V1ConnectionValidator(settings.Path, settings.Username, settings.Password, settings.Integrated, GetProxy(settings.ProxySettings)); connectionValidator.Test(ApiVersion); } }
public static bool CheckConnectionValid() { string proxyServerUri = ConfigurationManager.AppSettings["proxyServerUri"]; bool success = true; string connectionAddress = ConfigurationManager.AppSettings["V1Instance"]; string userName = ConfigurationManager.AppSettings["V1InstanceUsername"]; string userPassword = ConfigurationManager.AppSettings["V1InstancePassword"]; bool useIntegrated = ConfigurationManager.AppSettings["IntegratedAuth"].Equals("true"); V1ConnectionValidator connectionValidator; if(!string.IsNullOrEmpty(proxyServerUri)) { var proxyProvider = GetProxyProvider(); connectionValidator = new V1ConnectionValidator(connectionAddress, userName, userPassword, useIntegrated, proxyProvider); } else { connectionValidator = new V1ConnectionValidator(connectionAddress, userName, userPassword, useIntegrated); } try { connectionValidator.Test(); } catch (Exception ex) { success = false; logger.Error(ex.Message); } return success; }