public static void VerifyServerInformation(IPanoramaClient panoramaClient, Uri uriServer, string username, string password) { switch (panoramaClient.GetServerState()) { case ServerState.missing: throw new PanoramaServerException(string.Format("The server {0} does not exist", uriServer.Host)); case ServerState.unknown: throw new PanoramaServerException(string.Format("Unknown error connecting to the server {0}", uriServer.Host)); } switch (panoramaClient.IsPanorama()) { case PanoramaState.other: throw new PanoramaServerException(string.Format("The server {0} is not a Panorama server", uriServer.Host)); case PanoramaState.unknown: throw new PanoramaServerException(string.Format("Unknown error connecting to the server {0}", uriServer.Host)); } switch (panoramaClient.IsValidUser(username, password)) { case UserState.nonvalid: throw new PanoramaServerException("The username and password could not be authenticated with the panorama server"); case UserState.unknown: throw new PanoramaServerException(string.Format("Unknown error connecting to the server {0}", uriServer.Host)); } }
public static void VerifyServerInformation(IPanoramaClient panoramaClient, string username, string password) { var uriServer = panoramaClient.ServerUri; switch (panoramaClient.GetServerState()) { case ServerState.missing: throw new PanoramaServerException(string.Format(Resources.EditServerDlg_VerifyServerInformation_The_server__0__does_not_exist, uriServer.Host)); case ServerState.unknown: throw new PanoramaServerException(string.Format(Resources.EditServerDlg_OkDialog_Unknown_error_connecting_to_the_server__0__, uriServer.Host)); } switch (panoramaClient.IsPanorama()) { case PanoramaState.other: throw new PanoramaServerException(string.Format(Resources.EditServerDlg_OkDialog_The_server__0__is_not_a_Panorama_server, uriServer.Host)); case PanoramaState.unknown: throw new PanoramaServerException(string.Format(Resources.EditServerDlg_OkDialog_Unknown_error_connecting_to_the_server__0__, uriServer.Host)); } switch (panoramaClient.IsValidUser(username, password)) { case UserState.nonvalid: throw new PanoramaServerException(Resources.EditServerDlg_OkDialog_The_username_and_password_could_not_be_authenticated_with_the_panorama_server); case UserState.unknown: throw new PanoramaServerException(string.Format(Resources.EditServerDlg_OkDialog_Unknown_error_connecting_to_the_server__0__, uriServer.Host)); } }