private static bool Login(Uri uri, bool masterOnly = false) { try { SDKEnvironment.Login(uri); return(true); } catch (Exception exception) { if (exception.Message.Length != 0) { Program.Logger.Log.Error(exception.Message); } SDKEnvironment.RemoveServer(uri); } try { SDKEnvironment.Login(uri, true); return(true); } catch (Exception exception) { if (exception.Message.Length != 0) { Program.Logger.Log.Error(exception.Message); } SDKEnvironment.RemoveServer(uri); } return(false); }
public void Connect(Uri uri) { _uri = uri; try { Environment.AddServer(uri, CredentialCache.DefaultNetworkCredentials); Environment.Login(uri); _configService = new XProtectConfigurationService(uri); } catch (ServerNotFoundMIPException) { LastError = $"Login to {_uri} failed. Server not found."; } catch (InvalidCredentialsMIPException ex) { LastError = $"Login to {_uri} failed. {ex.Message}"; } catch (LoginFailedInternalMIPException ex) { LastError = $"Login to {_uri} failed. {ex.Message}"; } catch (Exception e) { LastError = e.ToString(); } }
private static bool Login(Uri uri, bool masterOnly = false) { if (EnvironmentManager.Instance.MasterSite.ServerId.ServerType == VideoOS.Platform.ServerId.EnterpriseServerType) { Console.WriteLine("Bookmark is not supported on this product."); Console.ReadKey(); return(true); } try { SDKEnvironment.Login(uri); return(true); } catch (Exception exception) { if (exception.Message.Length != 0) { Program.Log.Info($"{Environment.NewLine}URI: {uri}{Environment.NewLine}Source: {exception.Source}{Environment.NewLine}Message: {exception.Message}{Environment.NewLine}Exception: {exception.ToString()}"); if (exception.InnerException != null) { Program.Log.Info($"{Environment.NewLine}Inner Exception:{Environment.NewLine}Message: {exception.InnerException.Message}{Environment.NewLine}Source: {exception.InnerException.Source}{Environment.NewLine}"); } } SDKEnvironment.RemoveServer(uri); } try { SDKEnvironment.Login(uri, true); return(true); } catch (Exception exception) { if (exception.Message.Length != 0) { Program.Log.Info($"{Environment.NewLine}URI (true): {uri}{Environment.NewLine}Source: {exception.Source}{Environment.NewLine}Message: {exception.Message}{Environment.NewLine}Exception: {exception.ToString()}"); if (exception.InnerException != null) { Program.Log.Info($"{Environment.NewLine}Inner Exception:{Environment.NewLine}Message: {exception.InnerException.Message}{Environment.NewLine}Source: {exception.InnerException.Source}{Environment.NewLine}"); } } SDKEnvironment.RemoveServer(uri); } return(false); }