static void Main(string[] args)
        {
            new Log(true);

            // Add the event handler for handling UI thread exceptions to the event.
            Application.ThreadException += new ThreadExceptionEventHandler(ThreadExceptionEventHandler);

            // Set the unhandled exception mode to force all Windows Forms errors
            // to go through our handler.
            Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);

            // Add the event handler for handling non-UI thread exceptions to the event.
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(UnhandledExceptionEventHandler);

            // initialize DPIManager BEFORE setting
            // the application to be DPI aware
            DPIManager.PreInitialize();
            User32Util.SetProcessDpiAwareness(ProcessDPIAwareness.ProcessPerMonitorDPIAware);

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            MainForm form = new MainForm(args);

            DPIManager.AddForm(form);
            DPIManager.ForceUpdate();

            Application.Run(form);
        }
Exemple #2
0
        public void RefreshGames()
        {
            lock (controls)
            {
                foreach (var con in controls)
                {
                    if (con.Value != null)
                    {
                        con.Value.Dispose();
                    }
                }
                this.list_Games.Controls.Clear();
                controls.Clear();

                List <UserGameInfo> games = gameManager.User.Games;
                for (int i = 0; i < games.Count; i++)
                {
                    UserGameInfo game = games[i];
                    NewUserGame(game);
                }

                if (games.Count == 0)
                {
                    noGamesPresent = true;
                    GameControl con = new GameControl(null, null);
                    con.Width = list_Games.Width;
                    con.Text  = "No games";
                    this.list_Games.Controls.Add(con);
                }
            }

            DPIManager.ForceUpdate();
            GameManager.Instance.SaveUserProfile();
        }
Exemple #3
0
        static void Main()
        {
            if (!StartChecks.StartCheck())
            {
                return;
            }

            // initialize DPIManager BEFORE setting
            // the application to be DPI aware
            DPIManager.PreInitialize();
            User32Util.SetProcessDpiAwareness(ProcessDPIAwareness.ProcessPerMonitorDPIAware);

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            MainForm form = new MainForm();

            DPIManager.AddForm(form);
            DPIManager.ForceUpdate();
            Settings sform = new Settings();

            DPIManager.AddForm(sform);
            DPIManager.ForceUpdate();
            SearchDisksForm sdf = new SearchDisksForm(form);

            DPIManager.AddForm(sdf);
            DPIManager.ForceUpdate();

            Application.Run(form);
        }
Exemple #4
0
        protected override void OnShown(EventArgs e)
        {
            base.OnShown(e);
            RefreshGames();

            DPIManager.ForceUpdate();
        }
        private void btn_Browse_Click(object sender, EventArgs e)
        {
            using (OpenFileDialog open = new OpenFileDialog())
            {
                open.Filter = "Game Executable Files|*.exe";
                if (open.ShowDialog() == DialogResult.OK)
                {
                    string path = open.FileName;

                    List <GameHandlerMetadata> allGames = gameManager.User.InstalledHandlers;

                    GameList list = new GameList(allGames);
                    DPIManager.ForceUpdate();

                    if (list.ShowDialog() == DialogResult.OK)
                    {
                        GameHandlerMetadata selected = list.Selected;
                        UserGameInfo        game     = gameManager.TryAddGame(path, list.Selected);

                        if (game == null)
                        {
                            MessageBox.Show("Game already in your library!");
                        }
                        else
                        {
                            MessageBox.Show("Game accepted as ID " + game.GameID);
                            RefreshGames();
                        }
                    }
                }
            }
        }
Exemple #6
0
 private void PositionsControl_Paint(object sender, PaintEventArgs e)
 {
     if (positionsControl.isDisconnected)
     {
         DPIManager.ForceUpdate();
         positionsControl.isDisconnected = false;
     }
 }
        public void ChangeSelectedGame(UserGameInfo userGame)
        {
            this.userGame = userGame;

            panel_steps.Controls.Clear();

#if false
            string gameId = userGame.GameID;

            if (mainForm == null)
            {
                mainForm = MainForm.Instance;
                mainForm.BrowserBtns.OnBrowse += BrowserBtns_OnBrowse;
            }

            currentHandlers = GameManager.Instance.PackageManager.GetInstalledHandlers(gameId);
            if (currentHandlers.Length == 0)
            {
                // uninstalled package perhaps?
                return;
            }

            if (currentHandlers.Length > 1)
            {
                MainForm.Instance.ChangeTitle("Choose one handler to run game",
                                              FormGraphicsUtil.BuildCharToBitmap(new Size(40, 40), 30, Color.FromArgb(240, 240, 240), "⤷"));

                panel_steps.Controls.Add(list_handlers);

                list_handlers.Width  = panel_steps.Width;
                list_handlers.Height = panel_steps.Height;
                list_handlers.Left   = 1;
                list_handlers.Controls.Clear();

                //TODO fix
                //for (var i = 0; i < currentHandlers.Length; i++) {
                //    GameHandlerMetadata metadata = currentHandlers[i];

                //    GameControl handlerControl = new GameControl();
                //    handlerControl.Width = list_handlers.Width;
                //    handlerControl.Click += HandlerControl_Click;

                //    handlerControl.SetHandlerMetadata(metadata);
                //    list_handlers.Controls.Add(handlerControl);
                //}
            }
            else
            {
                // create first step
                SetupSteps(currentHandlers[0]);
                GoToStep(0);
            }
#endif

            DPIManager.ForceUpdate();
        }
        public void RefreshGames()
        {
            lock (controls)
            {
                foreach (var con in controls)
                {
                    if (con.Value != null)
                    {
                        con.Value.Dispose();
                    }
                }
                this.list_Games.Controls.Clear();
                this.list_Handlers.Controls.Clear();
                controls.Clear();

                List <GameHandlerMetadata> handlers = gameManager.User.InstalledHandlers;
                for (int i = 0; i < handlers.Count; i++)
                {
                    GameHandlerMetadata handler = handlers[i];
                    NewGameHandler(handler);
                }

                List <UserGameInfo> games = gameManager.User.Games;
                for (int i = 0; i < games.Count; i++)
                {
                    UserGameInfo game = games[i];
                    NewUserGame(game);
                }

                if (games.Count == 0)
                {
                    noGamesPresent = true;
                    GameControl con = new GameControl(null);
                    con.Width = list_Games.Width;
                    con.Text  = "No games";
                    this.list_Games.Controls.Add(con);
                }

                if (handlers.Count == 0)
                {
                    noGamesPresent = true;
                    HandlerControl con = new HandlerControl(null);
                    con.Width = list_Games.Width;
                    con.Text  = "No handlers";
                    this.list_Handlers.Controls.Add(con);
                }
            }

            DPIManager.ForceUpdate();
            gameManager.User.Save();
        }
Exemple #9
0
        private void btnAutoSearch_Click(object sender, EventArgs e)
        {
            if (form != null)
            {
                return;
            }

            form = new SearchDisksForm(this);
            //DPIManager.AddForm(form);

            form.FormClosed += Form_FormClosed;
            form.Show();
            SetUpForm(form);

            DPIManager.ForceUpdate();
        }
Exemple #10
0
        static void Main()
        {
            // initialize DPIManager BEFORE setting
            // the application to be DPI aware
            DPIManager.PreInitialize();
            User32Util.SetProcessDpiAwareness(ProcessDPIAwareness.ProcessPerMonitorDPIAware);

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            MainForm form = new MainForm();

            DPIManager.AddForm(form);
            DPIManager.ForceUpdate();

            Application.Run(form);
        }
Exemple #11
0
        private void ListInstalled_Click(object sender, EventArgs e)
        {
            MainForm.Instance.ChangeTitle("Remove Game From List", listInstalled.Image);

            panel_disks.Visible          = false;
            panel_installedGames.Visible = true;
            panel_gameData.Visible       = false;

            GameManager gm = GameManager.Instance;

            list_installedGames.Controls.Clear();
            // force a collect?
            GC.Collect();

            var installedGames = gm.GetInstalledGamesOrdered();

            foreach (var pair in installedGames)
            {
                List <UserGameInfo> games = pair.Value;

                string         gameTitle = gm.MetadataManager.GetGameName(pair.Key);
                TitleSeparator sep       = new TitleSeparator();
                sep.SetTitle(gameTitle);
                sep.Height = 20;
                this.list_installedGames.Controls.Add(sep);

                // get all Repository Game Infos
                for (int i = 0; i < games.Count; i++)
                {
                    GameControl  con  = new GameControl();
                    UserGameInfo game = games[i];
                    con.SetUserGameExe(game);
                    con.Width  = list_installedGames.Width;
                    con.Click += Installed_Game_Click;

                    gm.MetadataManager.GetIcon(game, (Bitmap bmp) => {
                        con.Image = bmp;
                    });
                    this.list_installedGames.Controls.Add(con);
                }
            }

            DPIManager.ForceUpdate();
            DPIManager.ForceUpdate();
        }
        public void UpdateUsers(List <UserGameInfo> users, Image newIcon)
        {
            Image = newIcon;

            list_gameFolders.Controls.Clear();
            for (int i = 0; i < users.Count; i++)
            {
                UserGameInfo game       = users[i];
                GameControl  gameFolder = new GameControl();
                gameFolder.Width = list_gameFolders.Width;
                gameFolder.SetUserGameExe(game);

                gameFolder.Click += GameFolder_Click;
                list_gameFolders.Controls.Add(gameFolder);
            }

            DPIManager.ForceUpdate();
        }
Exemple #13
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            using (OpenFileDialog open = new OpenFileDialog())
            {
                open.Filter = "Game Executable Files|*.exe";
                if (open.ShowDialog() == DialogResult.OK)
                {
                    string path = open.FileName;

                    List <GenericGameInfo> info = gameManager.GetGames(path);

                    if (info.Count > 1)
                    {
                        GameList list = new GameList(info);
                        DPIManager.ForceUpdate();

                        if (list.ShowDialog() == DialogResult.OK)
                        {
                            UserGameInfo game = gameManager.TryAddGame(path, list.Selected);

                            if (game == null)
                            {
                                MessageBox.Show("Game already in your library!");
                            }
                            else
                            {
                                MessageBox.Show("Game accepted as " + game.Game.GameName);
                                RefreshGames();
                            }
                        }
                    }
                    else if (info.Count == 1)
                    {
                        UserGameInfo game = gameManager.TryAddGame(path, info[0]);
                        MessageBox.Show("Game accepted as " + game.Game.GameName);
                        RefreshGames();
                    }
                    else
                    {
                        MessageBox.Show("Unknown game");
                    }
                }
            }
        }
Exemple #14
0
        public SearchDisksForm(MainForm main)
        {
            this.main = main;
            InitializeComponent();

            DPIManager.AddForm(this);
            DPIManager.ForceUpdate();

            for (int x = 1; x <= 100; x++)
            {
                if (ini.IniReadValue("SearchPaths", x.ToString()) == "")
                {
                    break;
                }
                else
                {
                    disksBox.Items.Add(ini.IniReadValue("SearchPaths", x.ToString()), true);
                }
            }
        }
        private void ScanGames_Click(object sender, EventArgs e)
        {
            ResetPanels();

            if (form != null)
            {
                return;
            }

            if (GameManager.Instance.User.InstalledHandlers.Count == 0)
            {
                MessageBox.Show("You have no game handlers installed. No games to search for.");
                return;
            }

            form = new SearchStorageForm();

            form.FormClosed += Form_FormClosed;
            form.Show();

            DPIManager.ForceUpdate();
        }
        private void LoadInstalled()
        {
            var gm       = GameManager.Instance;
            var handlers = gm.User.InstalledHandlers;

            interrobang = FormGraphicsUtil.BuildCharToBitmap(new Size(40, 40), 30, Color.FromArgb(240, 240, 240), "🗋");
            list_left.Controls.Clear();

            //HorizontalLineControl line = new HorizontalLineControl();
            //list_left.Controls.Add(line);
            //line.LineHorizontalPc = 100;
            //line.Width = list_left.Width;
            //line.LineHeight = 1;
            //line.LineColor = Color.FromArgb(255, 41, 45, 47);

            TitleSeparator gamesSep = new TitleSeparator();

            gamesSep.SetTitle("GAMES");
            gamesSep.Height = 20;
            this.list_left.Controls.Add(gamesSep);

            GameControl installGame = new GameControl();

            installGame.Width = list_left.Width;
            installGame.UpdateTitleText("Install game from exe");
            installGame.Image  = FormGraphicsUtil.BuildCharToBitmap(new Size(40, 40), 30, Color.FromArgb(240, 240, 240), "📁");
            installGame.Click += InstallGame_Click;
            list_left.Controls.Add(installGame);

            GameControl scanGames = new GameControl();

            scanGames.Width = list_left.Width;
            scanGames.UpdateTitleText("Scan for game exes");
            scanGames.Image  = FormGraphicsUtil.BuildCharToBitmap(new Size(40, 40), 30, Color.FromArgb(240, 240, 240), "🔍");
            scanGames.Click += ScanGames_Click;
            list_left.Controls.Add(scanGames);

            listInstalled       = new GameControl();
            listInstalled.Width = list_left.Width;
            listInstalled.UpdateTitleText("Remove games from list");
            listInstalled.Image  = FormGraphicsUtil.BuildCharToBitmap(new Size(40, 40), 30, Color.FromArgb(240, 240, 240), "⌫", 0, 8);
            listInstalled.Click += ListInstalled_Click;
            list_left.Controls.Add(listInstalled);

            TitleSeparator sep = new TitleSeparator();

            sep.SetTitle("HANDLERS");
            sep.Height = 20;
            this.list_left.Controls.Add(sep);

            GameControl installFile = new GameControl();

            installFile.Width = list_left.Width;
            installFile.UpdateTitleText("Install handler from file");
            //installFile.Image = Resources.nucleus;
            installFile.Image  = FormGraphicsUtil.BuildCharToBitmap(new Size(40, 40), 30, Color.FromArgb(240, 240, 240), "🔍");
            installFile.Click += InstallFile_Click;
            list_left.Controls.Add(installFile);

            if (handlers.Count == 0)
            {
                GameControl noAvailable = new GameControl();
                noAvailable.Width = list_left.Width;
                noAvailable.UpdateTitleText("No installed game handlers");
                noAvailable.Image = interrobang;
                list_left.Controls.Add(noAvailable);
            }
            else
            {
                handlers.Sort(GameHandlerMetadata.CompareHandlerTitle);
                foreach (var handler in handlers)
                {
                    GameControl gameHandler = new GameControl();
                    gameHandler.Width = list_left.Width;
                    gameHandler.SetHandlerMetadata(handler);
                    gameHandler.Click += GameHandler_Click;
                    gameHandler.Image  = interrobang;
                    list_left.Controls.Add(gameHandler);
                }
            }

            DPIManager.ForceUpdate();
        }
Exemple #17
0
        public void RefreshGames()
        {
            if (refreshingGames)
            {
                return;
            }
            refreshingGames = true;

            lock (controls) {
                foreach (var con in controls)
                {
                    if (con.Value != null)
                    {
                        con.Value.Dispose();
                    }
                }

                this.list_games.Controls.Clear();
                controls.Clear();

                // make menu before games
                pkgManagerBtn       = new GameControl();
                pkgManagerBtn.Width = list_games.Width;
                pkgManagerBtn.UpdateTitleText("Settings");
                pkgManagerBtn.Image = Properties.Resources.nucleus;
                //pkgManagerBtn.Image = FormGraphicsUtil.BuildCharToBitmap(new Size(40, 40), 30, Color.FromArgb(240, 240, 240), "⚙");
                pkgManagerBtn.Click += PkgManagerBtn_Click;
                this.list_games.Controls.Add(pkgManagerBtn);

                //HorizontalLineControl line = new HorizontalLineControl();
                //line.LineHorizontalPc = 100;
                //line.Width = list_games.Width;
                //line.LineHeight = 2;
                //line.LineColor = Color.FromArgb(255, 41, 45, 47);
                //this.list_games.Controls.Add(line);

                TitleSeparator sep = new TitleSeparator();
                sep.SetTitle("GAMES");
                this.list_games.Controls.Add(sep);

                var ordered = gameManager.GetInstalledGamesOrdered();
                foreach (var pair in ordered)
                {
                    NewUserGame(pair.Value);
                }

                if (ordered.Count() == 0)
                {
                    appPage = AppPage.NoGamesInstalled;
                    GameControl con = new GameControl();
                    con.Click += Con_Click;
                    con.Width  = list_games.Width;
                    con.UpdateTitleText("No games");
                    this.list_games.Controls.Add(con);
                }
            }

            // TODO: double-calling fixes some issues but is non-optimal
            DPIManager.ForceUpdate();
            DPIManager.ForceUpdate();

            UpdatePage();
            list_games.UpdateSizes();

            gameManager.User.Save();

            // auto-click pkg manager to not open with nothing selected
            PkgManagerBtn_Click(pkgManagerBtn, EventArgs.Empty);
            pkgManagerBtn.RadioSelected();

            refreshingGames = false;
        }
Exemple #18
0
 public Settings()
 {
     InitializeComponent();
     DPIManager.AddForm(this);
     DPIManager.ForceUpdate();
 }
Exemple #19
0
        public Settings(MainForm mf, PositionsControl pc)
        {
            InitializeComponent();

            DPIManager.AddForm(this);
            DPIManager.ForceUpdate();

            Invalidate();

            controllerGuids = new TextBox[] { controllerOneGuid, controllerTwoGuid, controllerThreeGuid, controllerFourGuid, controllerFiveGuid, controllerSixGuid, controllerSevenGuid, controllerEightGuid, controllerNineGuid, controllerTenGuid, controllerElevenGuid, controllerTwelveGuid, controllerThirteenGuid, controllerFourteenGuid, controllerFifteenGuid, controllerSixteenGuid };
            controllerNicks = new TextBox[] { controllerOneNick, controllerTwoNick, controllerThreeNick, controllerFourNick, controllerFiveNick, controllerSixNick, controllerSevenNick, controllerEightNick, controllerNineNick, controllerTenNick, controllerElevenNick, controllerTwelveNick, controllerThirteenNick, controllerFourteenNick, controllerFifteenNick, controllerSixteenNick };

            mainForm         = mf as MainForm;
            positionsControl = pc;

            RefreshCmbNetwork();
            if (ini.IniReadValue("Misc", "Network") != "")
            {
                cmb_Network.Text = ini.IniReadValue("Misc", "Network");
            }
            else
            {
                cmb_Network.SelectedIndex = 0;
            }

            if (ini.IniReadValue("Misc", "SteamLang") != "")
            {
                cmb_Lang.Text = ini.IniReadValue("Misc", "SteamLang");
            }
            else
            {
                cmb_Lang.SelectedIndex = 0;
            }

            //Hotkeys
            if (ini.IniReadValue("Hotkeys", "Close").Contains('+'))
            {
                string[] closeHk = ini.IniReadValue("Hotkeys", "Close").Split('+');
                if ((closeHk[0] == "Ctrl" || closeHk[0] == "Alt" || closeHk[0] == "Shift") && closeHk[1].Length == 1 && Regex.IsMatch(closeHk[1], @"^[a-zA-Z0-9]+$"))
                {
                    settingsCloseCmb.SelectedItem = closeHk[0];
                    settingsCloseHKTxt.Text       = closeHk[1];
                }
            }
            else
            {
                ini.IniWriteValue("Hotkeys", "Close", "");
            }

            if (ini.IniReadValue("Hotkeys", "Stop").Contains('+'))
            {
                string[] stopHk = ini.IniReadValue("Hotkeys", "Stop").Split('+');
                if ((stopHk[0] == "Ctrl" || stopHk[0] == "Alt" || stopHk[0] == "Shift") && stopHk[1].Length == 1 && Regex.IsMatch(stopHk[1], @"^[a-zA-Z0-9]+$"))
                {
                    settingsStopCmb.SelectedItem = stopHk[0];
                    settingsStopTxt.Text         = stopHk[1];
                }
            }
            else
            {
                ini.IniWriteValue("Hotkeys", "Stop", "");
            }

            if (ini.IniReadValue("Hotkeys", "TopMost").Contains('+'))
            {
                string[] topHk = ini.IniReadValue("Hotkeys", "TopMost").Split('+');
                if ((topHk[0] == "Ctrl" || topHk[0] == "Alt" || topHk[0] == "Shift") && topHk[1].Length == 1 && Regex.IsMatch(topHk[1], @"^[a-zA-Z0-9]+$"))
                {
                    settingsTopCmb.SelectedItem = topHk[0];
                    settingsTopTxt.Text         = topHk[1];
                }
            }

            //Controll
            GetControllers();

            if (ini.IniReadValue("ControllerMapping", "Keyboard") != "")
            {
                keyboardNick.Text = ini.IniReadValue("ControllerMapping", "Keyboard");
            }

            //Custom Layout
            //if (ini.IniReadValue("CustomLayout", "Enabled") != "")
            //{
            //    mutexLogCheck.Checked = Boolean.Parse(ini.IniReadValue("CustomLayout", "Enabled"));
            //}
            if (ini.IniReadValue("CustomLayout", "HorizontalLines") != "")
            {
                numHorDiv.Value = int.Parse(ini.IniReadValue("CustomLayout", "HorizontalLines"));
            }
            if (ini.IniReadValue("CustomLayout", "VerticalLines") != "")
            {
                numVerDiv.Value = int.Parse(ini.IniReadValue("CustomLayout", "VerticalLines"));
            }
            if (ini.IniReadValue("CustomLayout", "MaxPlayers") != "")
            {
                numMaxPlyrs.Value = int.Parse(ini.IniReadValue("CustomLayout", "MaxPlayers"));
            }

            //Misc
            if (ini.IniReadValue("Misc", "UseNicksInGame") != "")
            {
                useNicksCheck.Checked = Boolean.Parse(ini.IniReadValue("Misc", "UseNicksInGame"));
            }

            if (ini.IniReadValue("Misc", "DebugLog") != "")
            {
                debugLogCheck.Checked = Boolean.Parse(ini.IniReadValue("Misc", "DebugLog"));
            }

            if (ini.IniReadValue("Misc", "ShowStatus") != "")
            {
                statusCheck.Checked = Boolean.Parse(ini.IniReadValue("Misc", "ShowStatus"));
            }

            if (ini.IniReadValue("Misc", "KeepAccounts") != "")
            {
                keepAccountsCheck.Checked = Boolean.Parse(ini.IniReadValue("Misc", "KeepAccounts"));
            }

            if (ini.IniReadValue("Misc", "NucleusAccountPassword") != "")
            {
                nucUserPassTxt.Text = ini.IniReadValue("Misc", "NucleusAccountPassword");
            }

            if (ini.IniReadValue("Audio", "Custom") == "0")
            {
                audioDefaultSettingsRadio.Checked = true;
                audioCustomSettingsBox.Enabled    = false;
            }
            else
            {
                audioCustomSettingsRadio.Checked = true;
            }

            //if (ini.IniReadValue("Misc", "VibrateOpen") != "")
            //{
            //    check_Vibrate.Checked = Boolean.Parse(ini.IniReadValue("Misc", "VibrateOpen"));
            //}

            RefreshAudioList();
        }
Exemple #20
0
        private void ScanGames_Click(object sender, EventArgs e)
        {
            MainForm.Instance.ChangeTitle("Scan Storage for Games", scanGames.Image);

            panel_disks.Visible          = true;
            panel_installedGames.Visible = false;
            panel_gameData.Visible       = false;

            list_storage.Controls.Clear();
            diskControls = new List <CheckedTextControl>();
            GC.Collect();

            DriveInfo[] drives = DriveInfo.GetDrives();
            for (int i = 0; i < drives.Length; i++)
            {
                DriveInfo drive = drives[i];

                if (drive.DriveType == DriveType.CDRom ||
                    drive.DriveType == DriveType.Network)
                {
                    // CDs cannot use NTFS
                    // and network I'm not even trying
                    continue;
                }

                SearchStorageInfo  d   = new SearchStorageInfo(drive);
                CheckedTextControl con = null;
                if (drive.IsReady)
                {
                    if (drive.DriveFormat != "NTFS")
                    {
                        // ignore non-NTFS drives
                        continue;
                    }

                    con            = new CheckedTextControl();
                    con.Width      = list_installedGames.Width;
                    con.Checked    = true;
                    con.SharedData = d;
                    list_storage.Controls.Add(con);
                    diskControls.Add(con);

                    Control sep = new Control();
                    sep.Height = 2;
                    list_storage.Controls.Add(sep);

                    try {
                        long free  = drive.AvailableFreeSpace / 1024 / 1024 / 1024;
                        long total = drive.TotalSize / 1024 / 1024 / 1024;
                        long used  = total - free;

                        d.SetInfo(drive.Name + " " + used + " GB used");
                        //checkedBox.Items.Add(d, true);
                    } catch {
                        // notify user of crash
                        d.SetInfo(drive.Name + " (Not authorized)");
                        //checkedBox.Items.Add(d, CheckState.Indeterminate);
                    }
                }
                else
                {
                    // user might want to get that drive ready
                    d.SetInfo(drive.Name + " (Drive not ready)");
                    //checkedBox.Items.Add(d, CheckState.Indeterminate);
                }

                if (con != null)
                {
                    con.UpdateTitleText(d.Info);
                }
            }

            DPIManager.ForceUpdate();
            DPIManager.ForceUpdate();
        }