Exemple #1
0
        public bool WorkerInit()
        {
            netSettings = new NetSettings(CommonFunctions.SettingsPath +
                                          CommonFunctions.NetSettingsFile);

            if (netSettings.LoadConfig() != NetConfigStatus.OK)
            {
                StatusChange(WorkerStatus.FatalError, netSettings.ConfigError);
                return(false);
            }

            try
            {
                Directory.CreateDirectory(Workdir);
            }
            catch (Exception ex)
            {
                StatusChange(WorkerStatus.FatalError, ex.Message);
                return(false);
            }

            Downloader = new SendRequest("https://" + VPNProvider + "/" + JSONFile,
                                         Workdir + JSONFile);
            Downloader.ConnectionTimeout = netSettings.ConnectionTimeout;
            Downloader.ConnectionType    = netSettings.ConnectionType;
            Downloader.ProxyAddress      = netSettings.ProxyAddress;
            Downloader.ProxyPassword     = netSettings.ProxyPassword;
            Downloader.ProxyPort         = netSettings.ProxyPort;
            Downloader.ProxyUser         = netSettings.ProxyUser;

            return(true);
        }
Exemple #2
0
        private void frmNetworkSettings_Load(object sender, EventArgs e)
        {
            NetConfigStatus cstat = settings.LoadConfig();

            if (cstat == NetConfigStatus.Error)
            {
                MessageBox.Show("Файл конфигурации поврежден!\n" +
                                settings.ConfigError,
                                "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            formWorker = new FormWorker(settings, this);
            formWorker.FillForm();

            if (cstat == NetConfigStatus.ProxyPassNotDecrypted)
            {
                txtProxyPassword.Text = "";
                lblErrorMessage.Text  = "Сохраненный пароль не был расшифрован.";
            }
        }