예제 #1
0
        /// <summary>
        /// Determines whether [is server valid].
        /// </summary>
        /// <param name="server">The server.</param>
        /// <param name="html">The HTML.</param>
        /// <returns><c>true</c> if [is server valid]; otherwise, <c>false</c>.</returns>
        protected bool IsServerValid(ServerObject server, string html)
        {
            HtmlDocument doc = new HtmlDocument();

            doc.LoadHtml(html);
            if (string.IsNullOrWhiteSpace(server.Instructions) && string.IsNullOrWhiteSpace(server.ExpectedResult))
            {
                return(!string.IsNullOrWhiteSpace(doc.DocumentNode.InnerHtml));
            }
            return(doc.DocumentNode != null &&
                   doc.DocumentNode.SelectSingleNode(server.Instructions) != null &&
                   doc.DocumentNode.SelectSingleNode(server.Instructions).InnerText.ToLowerInvariant() == server.ExpectedResult.ToLowerInvariant());
        }
예제 #2
0
        /// <summary>
        /// Check_s the health check status changed.
        /// </summary>
        /// <param name="status">The status.</param>
        /// <param name="server">The server.</param>
        private static void check_HealthCheckStatusChanged(HealthCheckStatus status, ServerObject server)
        {
            switch (status)
            {
            case HealthCheckStatus.Starting:
                Console.WriteLine("Starting server check");
                break;

            case HealthCheckStatus.Downloading:
                Console.WriteLine("Downloading {0} server page", server.OriginalServerUrl);
                break;

            case HealthCheckStatus.ServerValid:
                Console.WriteLine("{0} server is valid stopping other checks", server.OriginalServerUrl);
                break;

            case HealthCheckStatus.ServerInvalid:
                Console.WriteLine("Determined that server {0} is not valid", server.OriginalServerUrl);
                break;

            default:
                break;
            }
        }
예제 #3
0
 /// <summary>
 /// Rewrites the master server.
 /// </summary>
 /// <param name="server">The server.</param>
 public static void RewriteMasterServer(ServerObject server)
 {
     File.WriteAllText(Path.Combine(ConfigLoader.GetAppPath(), _masterServerFileName), server.OriginalServerUrl);
 }