Example #1
0
        private void ProxySaveButton_Click(object sender, EventArgs e)
        {
            ClamConfig config = new ClamConfig();

            // Check if config file exists
            if (!File.Exists(config.ClamConfigFile))
            {
                ThrowError.Throw("ClamAV Config File does not exist\nHave you installed ClamAV?");
                return;
            }

            // Check Fields
            if (String.IsNullOrEmpty(ProxyServerTextBox.Text.Trim()) && !String.IsNullOrEmpty(ProxyUserTextBox.Text.Trim()))
            {
                ProxyServerTextBox.BackColor = Color.Red;
                return;
            }

            if (String.IsNullOrEmpty(ProxyUserTextBox.Text.Trim()) && !String.IsNullOrEmpty(ProxyPasswordTextBox.Text.Trim()))
            {
                ProxyUserTextBox.BackColor = Color.Red;
                return;
            }

            if (!String.IsNullOrEmpty(ProxyPortTextBox.Text))
            {
                try
                {
                    Int32 port = Int32.Parse(ProxyPortTextBox.Text);
                    if (port < 0 || port > 65535)
                    {
                        ProxyPortTextBox.BackColor = Color.Red;
                        return;
                    }
                }
                catch (Exception)
                {
                    ProxyPortTextBox.BackColor = Color.Red;
                    return;
                }
            }

            // All okay so clear all errors
            ProxyServerTextBox.BackColor   = Color.White;
            ProxyPortTextBox.BackColor     = Color.White;
            ProxyUserTextBox.BackColor     = Color.White;
            ProxyPasswordTextBox.BackColor = Color.White;

            // Save Fields
            config.WriteClamConfigKey("host", ProxyServerTextBox.Text.ToString().Trim());
            config.WriteClamConfigKey("port", ProxyPortTextBox.Text.ToString().Trim());
            config.WriteClamConfigKey("user", ProxyUserTextBox.Text.ToString().Trim());
            config.WriteClamConfigKey("password", ProxyPasswordTextBox.Text.ToString().Trim());

            //Disable Save Button
            ProxySaveButton.Enabled = false;
        }
Example #2
0
        private void DoInstall()
        {
            DownloadButton.Text    = "Installing";
            DownloadButton.Enabled = false;

            // NOTB - no ask toolbaar
            string command = ClamConfig.ClamAVInstallFile;
            string args    = "/sp- /silent /norestart /NOTB";

            System.Diagnostics.Process installer = new System.Diagnostics.Process();
            installer.StartInfo.FileName  = command;
            installer.StartInfo.Arguments = args;
            installer.Start();

            UpdateInstallLabel("Waiting to Kill Process FreshClam   ");

            // Thread.Sleep(3000);

            while (ClamConfig.WaitForProcess(installer.ProcessName))
            {
                ClamConfig.FindAndKillProcess("freshclam");
            }

            installer.WaitForExit();

            UpdateInstallLabel("Waiting to Kill Process ClamTray   ");

            while (ClamConfig.WaitForProcess("ClamTray"))
            {
                ClamConfig.FindAndKillProcess("ClamTray");
            }

            // Remove automatic start of ClamAV
            ClamConfig.RemoveRegistryKeys();

            // Set Quarantine option
            // Also remove warning for update
            try
            {
                ClamConfig clamConfig = new ClamConfig();
                clamConfig.WriteClamConfigKey("moveinfected", "1");
                clamConfig.WriteClamConfigKey("warnoutofdate", "0");
            }
            catch (Exception ex)
            {
                ThrowError.Throw(ex.Message);
            }

            CheckStatus();
        }