mCleaner.Logics.Clam.CommandLogic_Clam.CheckClamWinInstallation C# (CSharp) Method

CheckClamWinInstallation() public method

public CheckClamWinInstallation ( ) : void
return void
        public void CheckClamWinInstallation()
        {
            if (string.IsNullOrEmpty(Settings.Default.ClamWin_DB))
            {
                // override setting first
                Settings.Default.ClamWin_DB = Path.Combine(this._exec_clam, "db");

                //string default_db_path = "db";
                //default_db_path = Path.Combine(Environment.GetEnvironmentVariable("ProgramData"), default_db_path);
                //if (Directory.Exists(default_db_path))
                //{
                //    MessageBoxResult mbr = MessageBox.Show("mCleaner detected you currently have ClamWin installed in your system. Do you want to use its current database?\r\n\r\nmCleaner strongly suggests that you use mClearner's database for ClamAV to have more control over over the virus definition database.", "mCleaner", MessageBoxButton.YesNo, MessageBoxImage.Information);
                //    if (mbr == MessageBoxResult.Yes)
                //    {
                //        Settings.Default.ClamWin_DB = default_db_path;
                //        this._exec_clam_db_path = Settings.Default.ClamWin_DB;
                //    }
                //}

                Settings.Default.ClamWin_SupressMessageAtStartup = true;
                Settings.Default.Save();
                this._exec_clam_db_path = Settings.Default.ClamWin_DB;
            }

            // check for .cvd files
            string maincvd = Path.Combine(this._exec_clam_db_path, "main.cvd");
            string dailycvd = Path.Combine(this._exec_clam_db_path, "daily.cvd");

                                       // not sure if daily.cvd is necessary
            if (!File.Exists(maincvd)) // && !File.Exists(dailycvd))
            {
                MessageBox.Show("mCleaner has to update the virus definitions.", "mCleaner", MessageBoxButton.OK, MessageBoxImage.Information);
                Settings.Default.ClamWin_Update = true;
            }
            else
            {
                // if they exists then let's check how many days since the last update

                if (Settings.Default.ClamWin_LastDBUpdate.Ticks > 0)
                {
                    TimeSpan timespan = DateTime.Now - Settings.Default.ClamWin_LastDBUpdate;
                    if (timespan.TotalDays >= Settings.Default.ClamWin_DaysBeforeNotifyToUpdate)
                    {
                        MessageBox.Show(string.Format("It's been {0} days since the last time you updated the virus definitions.", (int)timespan.TotalDays), "mCleaner", MessageBoxButton.OK, MessageBoxImage.Information);
                        Settings.Default.ClamWin_Update = true;
                    }
                }
                else
                {
                    //MessageBox.Show(string.Format("mCleaner was not able to get the date ", ""), "mCleaner", MessageBoxButton.OK, MessageBoxImage.Information);
                }
            }
        }