GetWindowsVersion() публичный статический Метод

public static GetWindowsVersion ( ) : string
Результат string
Пример #1
0
        internal string CreateHtmlReport(string userMessage)
        {
            string report =
                string.Format(
                    @"<!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Transitional//EN"" ""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"">
                    <html xmlns=""http://www.w3.org/1999/xhtml"">
                    <head>
                    <meta http-equiv=""Content-Type"" content=""text/html; charset=utf-8"" />
                    <title>{0} {1} Crash Report</title>
                    <style type=""text/css"">
                    .message {{
                    padding-top:5px;
                    padding-bottom:5px;
                    padding-right:20px;
                    padding-left:20px;
                    font-family:Sans-serif;
                    }}
                    .content
                    {{
                    border-style:dashed;
                    border-width:1px;
                    }}
                    .title
                    {{
                    padding-top:1px;
                    padding-bottom:1px;
                    padding-right:10px;
                    padding-left:10px;
                    font-family:Arial;
                    }}
                    </style>
                    </head>
                    <body>
                    <div class=""title"" style=""background-color: #FFCC99"">
                    <h2>{0} {1} Crash Report</h2>
                    </div>
                    <br/>
                    <div class=""content"">
                    <div class=""title"" style=""background-color: #66CCFF;"">
                    <h3>Windows Version</h3>
                    </div>
                    <div class=""message"">
                    <p>{2}</p>
                    </div>
                    </div>
                    <br/>
                    <div class=""content"">
                    <div class=""title"" style=""background-color: #66CCFF;"">
                    <h3>CLR Version</h3>
                    </div>
                    <div class=""message"">
                    <p>{3}</p>
                    </div>
                    </div>
                    <br/>    
                    <div class=""content"">
                    <div class=""title"" style=""background-color: #66CCFF;"">
                    <h3>Exception</h3>
                    </div>
                    <div class=""message"">
                    {4}
                    </div>
                    </div>", HttpUtility.HtmlEncode(ApplicationTitle),
                    HttpUtility.HtmlEncode(ApplicationVersion),
                    HttpUtility.HtmlEncode(HelperMethods.GetWindowsVersion()),
                    HttpUtility.HtmlEncode(Environment.Version.ToString()),
                    CreateReport(Exception));

            if (!String.IsNullOrEmpty(userMessage))
            {
                report += $@"<br/>
                            <div class=""content"">
                            <div class=""title"" style=""background-color: #66FF99;"">
                            <h3>User Comment</h3>
                            </div>
                            <div class=""message"">
                            <p>{HttpUtility.HtmlEncode(userMessage)}</p>
                            </div>
                            </div>";
            }

            if (!String.IsNullOrEmpty(DeveloperMessage.Trim()))
            {
                report += $@"<br/>
                            <div class=""content"">
                            <div class=""title"" style=""background-color: #66FF99;"">
                            <h3>Developer Message</h3>
                            </div>
                            <div class=""message"">
                            <p>{HttpUtility.HtmlEncode(DeveloperMessage.Trim())}</p>
                            </div>
                            </div>";
            }

            report += "</body></html>";
            return(report);
        }
Пример #2
0
        public string HtmlReport()
        {
            string report =
                string.Format(@"<!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Transitional//EN"" ""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"">
                    <html xmlns=""http://www.w3.org/1999/xhtml"">
                    <head>
                    <meta http-equiv=""Content-Type"" content=""text/html; charset=utf-8"" />
                    <title>{0} {1} Crash Report</title>
                    <style type=""text/css"">
                    .message {{
                    padding-top:5px;
                    padding-bottom:5px;
                    padding-right:20px;
                    padding-left:20px;
                    font-family:Sans-serif;
                    }}
                    .content
                    {{
                    border-style:dashed;
                    border-width:1px;
                    }}
                    .title
                    {{
                    padding-top:1px;
                    padding-bottom:1px;
                    padding-right:10px;
                    padding-left:10px;
                    font-family:Arial;
                    }}
                    </style>
                    </head>
                    <body>
                    <div class=""title"" style=""background-color: #FFCC99"">
                    <h2>{0} {1} Crash Report</h2>
                    </div>
                    <br/>
                    <div class=""content"">
                    <div class=""title"" style=""background-color: #66CCFF;"">
                    <h3>Windows Version</h3>
                    </div>
                    <div class=""message"">
                    <p>{2}</p>
                    </div>
                    </div>
                    <br/>
                    <div class=""content"">
                    <div class=""title"" style=""background-color: #66CCFF;"">
                    <h3>CLR Version</h3>
                    </div>
                    <div class=""message"">
                    <p>{3}</p>
                    </div>
                    </div>
                    <br/>    
                    <div class=""content"">
                    <div class=""title"" style=""background-color: #66CCFF;"">
                    <h3>Machine Name</h3>
                    </div>
                    <div class=""message"">
                    <p>{4}</p>
                    </div>
                    </div>
                    <br/>    
                    <div class=""content"">
                    <div class=""title"" style=""background-color: #66CCFF;"">
                    <h3>Current Culture</h3>
                    </div>
                    <div class=""message"">
                    <p>{5}</p>
                    </div>
                    </div>
                    <br/>    
                    <div class=""content"">
                    <div class=""title"" style=""background-color: #66CCFF;"">
                    <h3>Current UI Culture</h3>
                    </div>
                    <div class=""message"">
                    <p>{6}</p>
                    </div>
                    </div>
                    <br/>    
                    <div class=""content"">
                    <div class=""title"" style=""background-color: #66CCFF;"">
                    <h3>System Installed Culture</h3>
                    </div>
                    <div class=""message"">
                    <p>{7}</p>
                    </div>
                    </div>
                    <br/>    
                    <div class=""content"">
                    <div class=""title"" style=""background-color: #66CCFF;"">
                    <h3>Loaded Assemblies</h3>
                    </div>
                    <div class=""message"">
                    <p>{8}</p>
                    </div>
                    </div>
                    <br/>    
                    <div class=""content"">
                    <div class=""title"" style=""background-color: #66CCFF;"">
                    <h3>Exception</h3>
                    </div>
                    <div class=""message"">
                    {9}
                    </div>
                    </div>", WebUtility.HtmlEncode(_reportCrash.ApplicationTitle),
                              WebUtility.HtmlEncode(_reportCrash.ApplicationVersion),
                              WebUtility.HtmlEncode(HelperMethods.GetWindowsVersion()),
                              WebUtility.HtmlEncode(Environment.Version.ToString()),
                              WebUtility.HtmlEncode(Environment.MachineName),
                              WebUtility.HtmlEncode(HelperMethods.GetCultureInfo(CultureInfo.CurrentCulture)),
                              WebUtility.HtmlEncode(HelperMethods.GetCultureInfo(CultureInfo.CurrentUICulture)),
                              WebUtility.HtmlEncode(HelperMethods.GetCultureInfo(CultureInfo.InstalledUICulture)),
                              WebUtility.HtmlEncode(HelperMethods.GetLoadedAssemblies()).Replace(Environment.NewLine, "<br/><br/>"),
                              CreateReport(_reportCrash.Exception));

            if (!String.IsNullOrEmpty(textBoxUserMessage.Text.Trim()))
            {
                report += string.Format(@"<br/>
                            <div class=""content"">
                            <div class=""title"" style=""background-color: #66FF99;"">
                            <h3>User Comment</h3>
                            </div>
                            <div class=""message"">
                            <p>{0}</p>
                            </div>
                            </div>", WebUtility.HtmlEncode(textBoxUserMessage.Text.Trim()));
            }
            report += "</body></html>";
            return(report);
        }