示例#1
0
        private void CollectSystemInfo(Exception exception)
        {
            //Use a stringbuilder for more efficient string concatenation.
            StringBuilder sb = new StringBuilder();

            //Print basic infomation
            sb.AppendLine("---Automatically generated crashlog, please attach to post when reporting---");
            sb.AppendLine("Date: " + DateTime.Now.ToString("F"));
            sb.AppendLine("Version: " + AssemblyVersionName.GetVersion());
            sb.AppendLine("");

            //Print system info, catching any random exceptions that might happen
            try
            {
                sb.AppendLine("OS: " + GetOS());
                sb.AppendLine("Graphics: " + GetGraphics());
                sb.AppendLine("Processor: " + GetProcessor());
                sb.AppendLine("Installed RAM: " + Math.Round(new Microsoft.VisualBasic.Devices.ComputerInfo().TotalPhysicalMemory / 1024f / 1024f / 1024f, 2) + "GB");
            }
            catch
            {
                sb.AppendLine("Error while fetching system information");
            }

            //Append the entire exception (Info, Message, Stacktrace)
            sb.AppendLine("");
            sb.AppendLine(exception.ToString());

            if (errorBox != null)
            {
                errorBox.Invoke(new Action(() => errorBox.Text = sb.ToString()));
            }
        }
示例#2
0
    public static string GetVersion()
    {
        Version             version = Assembly.GetEntryAssembly().GetName().Version;
        AssemblyVersionName name    = Assembly.GetEntryAssembly().GetCustomAttributes(typeof(AssemblyVersionName), false).Cast <AssemblyVersionName>().ToList <AssemblyVersionName>()[0];

        return(AssemblyVersionName.Prefix + version + name.ShortName);
    }
示例#3
0
        public override void Add(ScreenManager screenManager)
        {
            Game.CurrentGameState = GameState.Login;
            base.Add(screenManager);
            (Manager.Game as Application).BackgroundImage = ContentPack.Textures["gui\\background"];

            //Add the logo image
            LogoImage = new ImageBox(Manager)
            {
                Image = ContentPack.Textures["gui\\logosmall"], SizeMode = SizeMode.Centered
            };
            LogoImage.SetSize(LogoImage.Image.Width, LogoImage.Image.Height);
            LogoImage.SetPosition((Window.Width / 2) - (LogoImage.Width / 2), 0);
            LogoImage.Init();
            Window.Add(LogoImage);

            //Add github contribute link
            GithubIcon = new ImageBox(Manager)
            {
                Image = ContentPack.Textures["gui\\github"], SizeMode = SizeMode.Auto,
            };
            GithubIcon.ToolTip.Text = "We love open source! Contribute to Bricklayer at our GitHub repo.";
            GithubIcon.SetSize(GithubIcon.Width, GithubIcon.Height);
            GithubIcon.SetPosition(Window.Width - GithubIcon.Width - 8, Window.Height - GithubIcon.Height - 8);
            GithubIcon.Init();
            GithubIcon.Color = Color.White * .6f;
            //Click/Hover events
            GithubIcon.MouseOut += new MouseEventHandler(delegate(object o, MouseEventArgs e)
            {
                GithubIcon.Color = Color.White * .6f;
            });
            GithubIcon.MouseOver += new MouseEventHandler(delegate(object o, MouseEventArgs e)
            {
                GithubIcon.Color = Color.White;
            });
            GithubIcon.Click += new TomShane.Neoforce.Controls.EventHandler(delegate(object o, TomShane.Neoforce.Controls.EventArgs e)
            {
                if (Manager.Game.IsActive)
                {
                    Process.Start(githubLink);                        //Open the link in a browser
                }
            });
            Window.Add(GithubIcon);

            //Add version tag
            Version = new Label(Manager)
            {
                Font = FontSize.Default14
            };
            Version.SetSize(200, 16);
            Version.SetPosition(8, Window.Height - Version.Height - 8);
            Version.Init();
            Version.Text = AssemblyVersionName.GetVersion();
            Window.Add(Version);

            //Add the login window
            Login = new ServerWindow(Manager);
            Login.Init();
            if (Login.Top - 24 < LogoImage.Height + LogoImage.Top) //If it is too close to logo, move it down a bit
            {
                Login.Top = LogoImage.Height + LogoImage.Top - 24;
            }
            Window.Add(Login);
            Login.Show();
        }