예제 #1
0
        private static string SysInfoToString()
        {
            StringBuilder sysinfo = new StringBuilder();

            sysinfo.AppendFormat("Date and Time:         {0}{1}", DateTime.Now, Environment.NewLine);
            sysinfo.AppendLine(FunctionToString("OS Version:            ", () => Environment.OSVersion.VersionString));
            sysinfo.AppendLine();

            sysinfo.AppendLine(FunctionToString("Application Domain:    ", () => AppDomain.CurrentDomain.FriendlyName));
            sysinfo.AppendLine(FunctionToString("Assembly Codebase:     ", () => ParentAssembly.CodeBase));
            sysinfo.AppendLine(FunctionToString("Assembly Full Name:    ", () => ParentAssembly.FullName));
            sysinfo.AppendLine(FunctionToString("Assembly Version:      ", () => ParentAssembly.GetName().Version.ToString()));
            sysinfo.AppendLine(FunctionToString("Assembly Build Date:   ", () => AssemblyBuildDate(ParentAssembly).ToString()));
            sysinfo.AppendLine();

            return(sysinfo.ToString());
        }
예제 #2
0
        //        '--
        //'-- gather some system information that is helpful to diagnosing
        //'-- exception
        //'--
        public static string SysInfoToString()
        {
            StringBuilder objStringBuilder = new StringBuilder();


            objStringBuilder.Append("Date and Time:         ");
            objStringBuilder.Append(DateTime.Now);
            objStringBuilder.Append(Environment.NewLine);

            objStringBuilder.Append("Machine Name:          ");
            try
            {
                objStringBuilder.Append(Environment.MachineName);
            }
            catch (Exception e)
            {
                objStringBuilder.Append(e.Message);
            }
            objStringBuilder.Append(Environment.NewLine);

            objStringBuilder.Append("IP Address:            ");
            objStringBuilder.Append(GetCurrentIP());
            objStringBuilder.Append(Environment.NewLine);

            objStringBuilder.Append("Current User:          "******"Application Domain:    ");
            try
            {
                objStringBuilder.Append(AppDomain.CurrentDomain.FriendlyName);
            }
            catch (Exception e)
            {
                objStringBuilder.Append(e.Message);
            }


            objStringBuilder.Append(Environment.NewLine);
            objStringBuilder.Append("Assembly Codebase:     ");
            try
            {
                objStringBuilder.Append(ParentAssembly.CodeBase);
            }
            catch (Exception e)
            {
                objStringBuilder.Append(e.Message);
            }
            objStringBuilder.Append(Environment.NewLine);

            objStringBuilder.Append("Assembly Full Name:    ");
            try
            {
                objStringBuilder.Append(ParentAssembly.FullName);
            }
            catch (Exception e)
            {
                objStringBuilder.Append(e.Message);
            }
            objStringBuilder.Append(Environment.NewLine);

            objStringBuilder.Append("Assembly Version:      ");
            try
            {
                objStringBuilder.Append(ParentAssembly.GetName().Version.ToString());
            }
            catch (Exception e)
            {
                objStringBuilder.Append(e.Message);
            }
            objStringBuilder.Append(Environment.NewLine);

            //objStringBuilder.Append("Assembly Build Date:   ");
            //try
            //{
            //    objStringBuilder.Append(AssemblyBuildDate(ParentAssembly).ToString());
            //  }
            //catch (Exception e)
            //{
            //    objStringBuilder.Append(e.Message);
            //}
            objStringBuilder.Append(Environment.NewLine);
            objStringBuilder.Append(Environment.NewLine);

            //If blnIncludeStackTrace Then
            //    objStringBuilder.Append(EnhancedStackTrace());
            //End If

            return(objStringBuilder.ToString());
        }