示例#1
0
        private void frmCommonSettings_Load(object sender, EventArgs e)
        {
            settings = new appSettings(CommonFunctions.SettingsPath +
                                       CommonFunctions.AppSettingsFile);

            if (!settings.LoadConfig())
            {
                CommonFunctions.ErrMessage(settings.ConfigError);
                return;
            }
            fWorker = new FormWorker(settings, this);
            fWorker.FillForm();
        }
示例#2
0
        public bool WorkerInit()
        {
            netSettings = new NetSettings(CommonFunctions.SettingsPath +
                                          CommonFunctions.NetSettingsFile);
            Settings = new appSettings(CommonFunctions.SettingsPath +
                                       CommonFunctions.AppSettingsFile);

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

            if (!Settings.LoadConfig())
            {
                StatusChange(WorkerStatus.FatalError, Settings.ConfigError);
                return(false);
            }

            ClearTemp();

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

            Downloader = new SendRequest(Settings.PageAddr, Workdir + HTMLPage);
            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);
        }