Example #1
0
        public void SetupConfig()
        {
            try
            {
                bool   readConfig = false;
                string iniconfig  = Path.Combine(Util.ConfigFolder, "OpenViewer.ini");
                if (File.Exists(iniconfig))
                {
                    readConfig = true;
                }
                else
                {
                    readConfig = OpenViewer.Viewer.CreateDefaultConfig(iniconfig);
                }

                if (readConfig)
                {
                    config.Load(iniconfig);
                }
                else
                {
                    VUtil.LogConsole(this.ToString(), "SetupConfig: ERROR: can't load config file.");
                }
            }
            catch (Exception e)
            {
                VUtil.LogConsole(this.ToString(), "SetupConfig: FETAL:" + e.Message);
            }
        }
Example #2
0
        public bool CheckDriveSize()
        {
            bool flag = true;

            try
            {
                string    driveName    = Path.GetPathRoot(Application.ExecutablePath);
                DriveInfo currentDrive = new DriveInfo(driveName);

                // to MB.
                long size = currentDrive.TotalFreeSpace / (1024 * 1024);

                DialogResult res = DialogResult.OK;
                if (size < 500) // 500MB
                {
                    res = System.Windows.Forms.MessageBox.Show("HDDの空き容量が足りないために正常に起動できませんでした。", "起動エラー");
                    res = DialogResult.Cancel;
                }
                else if (size < 3 * 1024) // 3GB
                {
                    res = System.Windows.Forms.MessageBox.Show("正常に動作するために必要なHDD容量(3GB)が足りていません\nこのまま起動しますか?", "起動確認", MessageBoxButtons.OKCancel);
                }

                if (res != DialogResult.OK)
                {
                    flag = false;
                }
            }
            catch (Exception e)
            {
                VUtil.LogConsole(this.ToString(), "CheckDriveSize:" + e.Message);
            }

            return(flag);
        }