private void SaveConfiguration() { if (!m_IsModified) { return; } Configuration m_c = new Configuration(); m_c.ServerAddress = this.textBoxServerAddress.Text; m_c.ServerPort = (int)this.numericUpDownPort.Value; m_c.ADSLEntryName = this.textBoxADSLEntryName.Text; m_c.ADSLUserName = this.textBoxADSLUserName.Text; m_c.ADSLPassword = this.textBoxADSLPassword.Text; m_c.CurrentMode = ClientControlManager.Mode; m_c.Configurations = new Dictionary <ClientMode, ConfigurationDetailInMode>(); ConfigurationDetailInMode low = new ConfigurationDetailInMode(); low.QueryInterval = (int)this.numericUpDownQueryIntervalLow.Value; low.SingleTransportation = (int)this.numericUpDownSingleTranspotationLow.Value; low.MaxRunningTask = (int)this.numericUpDownMaxRunningTaskLow.Value; low.MaxRetryTime = (int)this.numericUpDownMaxRetryTimeLow.Value; low.MaxCPUUsage = (int)this.numericUpDownCPUUsageLow.Value; m_c.Configurations.Add(ClientMode.LowspeedMode, low); ConfigurationDetailInMode standard = new ConfigurationDetailInMode(); standard.QueryInterval = (int)this.numericUpDownQueryIntervalStandard.Value; standard.SingleTransportation = (int)this.numericUpDownSingleTranspotationStandard.Value; standard.MaxRunningTask = (int)this.numericUpDownMaxRunningTaskStandard.Value; standard.MaxRetryTime = (int)this.numericUpDownMaxRetryTimeStandard.Value; standard.MaxCPUUsage = (int)this.numericUpDownCPUUsageStandard.Value; m_c.Configurations.Add(ClientMode.StandardspeedMode, standard); ConfigurationDetailInMode high = new ConfigurationDetailInMode(); high.QueryInterval = (int)this.numericUpDownQueryIntervalHigh.Value; high.SingleTransportation = (int)this.numericUpDownSingleTranspotationHigh.Value; high.MaxRunningTask = (int)this.numericUpDownMaxRunningTaskHigh.Value; high.MaxRetryTime = (int)this.numericUpDownMaxRetryTimeHigh.Value; high.MaxCPUUsage = (int)this.numericUpDownCPUUsageHigh.Value; m_c.Configurations.Add(ClientMode.HighspeedMode, high); ClientControlManager.Configuration = m_c; m_IsModified = false; }
private void SaveConfiguration() { if (!m_IsModified) return; Configuration m_c = new Configuration(); m_c.ServerAddress = this.textBoxServerAddress.Text; m_c.ServerPort = (int)this.numericUpDownPort.Value; m_c.ADSLEntryName = this.textBoxADSLEntryName.Text; m_c.ADSLUserName = this.textBoxADSLUserName.Text; m_c.ADSLPassword = this.textBoxADSLPassword.Text; m_c.CurrentMode = ClientControlManager.Mode; m_c.Configurations = new Dictionary<ClientMode, ConfigurationDetailInMode>(); ConfigurationDetailInMode low = new ConfigurationDetailInMode(); low.QueryInterval = (int)this.numericUpDownQueryIntervalLow.Value; low.SingleTransportation = (int)this.numericUpDownSingleTranspotationLow.Value; low.MaxRunningTask = (int)this.numericUpDownMaxRunningTaskLow.Value; low.MaxRetryTime = (int)this.numericUpDownMaxRetryTimeLow.Value; low.MaxCPUUsage = (int)this.numericUpDownCPUUsageLow.Value; m_c.Configurations.Add(ClientMode.LowspeedMode, low); ConfigurationDetailInMode standard = new ConfigurationDetailInMode(); standard.QueryInterval = (int)this.numericUpDownQueryIntervalStandard.Value; standard.SingleTransportation = (int)this.numericUpDownSingleTranspotationStandard.Value; standard.MaxRunningTask = (int)this.numericUpDownMaxRunningTaskStandard.Value; standard.MaxRetryTime = (int)this.numericUpDownMaxRetryTimeStandard.Value; standard.MaxCPUUsage = (int)this.numericUpDownCPUUsageStandard.Value; m_c.Configurations.Add(ClientMode.StandardspeedMode, standard); ConfigurationDetailInMode high = new ConfigurationDetailInMode(); high.QueryInterval = (int)this.numericUpDownQueryIntervalHigh.Value; high.SingleTransportation = (int)this.numericUpDownSingleTranspotationHigh.Value; high.MaxRunningTask = (int)this.numericUpDownMaxRunningTaskHigh.Value; high.MaxRetryTime = (int)this.numericUpDownMaxRetryTimeHigh.Value; high.MaxCPUUsage = (int)this.numericUpDownCPUUsageHigh.Value; m_c.Configurations.Add(ClientMode.HighspeedMode, high); ClientControlManager.Configuration = m_c; m_IsModified = false; }
private void LoadConfiguration() { Configuration m_c = ClientControlManager.Configuration; this.textBoxServerAddress.Text = m_c.ServerAddress; this.numericUpDownPort.Value = m_c.ServerPort; this.textBoxADSLEntryName.Text = m_c.ADSLEntryName; this.textBoxADSLUserName.Text = m_c.ADSLUserName; this.textBoxADSLPassword.Text = m_c.ADSLPassword; if (m_c.Configurations != null) { ConfigurationDetailInMode low = m_c.Configurations[ClientMode.LowspeedMode]; this.numericUpDownQueryIntervalLow.Value = low.QueryInterval; this.numericUpDownSingleTranspotationLow.Value = low.SingleTransportation; this.numericUpDownMaxRunningTaskLow.Value = low.MaxRunningTask; this.numericUpDownMaxRetryTimeLow.Value = low.MaxRetryTime; this.numericUpDownCPUUsageLow.Value = low.MaxCPUUsage; ConfigurationDetailInMode standard = m_c.Configurations[ClientMode.StandardspeedMode]; this.numericUpDownQueryIntervalStandard.Value = standard.QueryInterval; this.numericUpDownSingleTranspotationStandard.Value = standard.SingleTransportation; this.numericUpDownMaxRunningTaskStandard.Value = standard.MaxRunningTask; this.numericUpDownMaxRetryTimeStandard.Value = standard.MaxRetryTime; this.numericUpDownCPUUsageStandard.Value = standard.MaxCPUUsage; ConfigurationDetailInMode high = m_c.Configurations[ClientMode.HighspeedMode]; this.numericUpDownQueryIntervalHigh.Value = high.QueryInterval; this.numericUpDownSingleTranspotationHigh.Value = high.SingleTransportation; this.numericUpDownMaxRunningTaskHigh.Value = high.MaxRunningTask; this.numericUpDownMaxRetryTimeHigh.Value = high.MaxRetryTime; this.numericUpDownCPUUsageHigh.Value = high.MaxCPUUsage; } m_IsModified = false; }
private static void RecheckConfiguration() { if (ms_c.ServerPort < 1 || ms_c.ServerPort > 32768) { ms_c.ServerPort = 1371; } if (ms_c.Configurations == null) { ms_c.Configurations = new Dictionary <ClientMode, ConfigurationDetailInMode>(); } if (ms_c.CurrentMode == 0) { ms_c.CurrentMode = ClientMode.StandardspeedMode; } //Low ConfigurationDetailInMode Low; if (ms_c.Configurations.ContainsKey(ClientMode.LowspeedMode)) { Low = ms_c.Configurations[ClientMode.LowspeedMode]; } else { Low = new ConfigurationDetailInMode(); } if (Low.SingleTransportation < 1 || Low.SingleTransportation > 20) { Low.SingleTransportation = 3; } if (Low.QueryInterval < 10 || Low.QueryInterval > 3600) { Low.QueryInterval = 30; } if (Low.MaxRunningTask < 1 || Low.MaxRunningTask > 20) { Low.MaxRunningTask = 2; } if (Low.MaxRetryTime < 0 || Low.MaxRetryTime > 5) { Low.MaxRetryTime = 0; } if (Low.MaxCPUUsage < 1 || Low.MaxCPUUsage > 100) { Low.MaxCPUUsage = 50; } ms_c.Configurations[ClientMode.LowspeedMode] = Low; //Standard ConfigurationDetailInMode Standard; if (ms_c.Configurations.ContainsKey(ClientMode.StandardspeedMode)) { Standard = ms_c.Configurations[ClientMode.StandardspeedMode]; } else { Standard = new ConfigurationDetailInMode(); } if (Standard.SingleTransportation < 1 || Standard.SingleTransportation > 20) { Standard.SingleTransportation = 5; } if (Standard.QueryInterval < 10 || Standard.QueryInterval > 3600) { Standard.QueryInterval = 30; } if (Standard.MaxRunningTask < 1 || Standard.MaxRunningTask > 20) { Standard.MaxRunningTask = 4; } if (Standard.MaxRetryTime < 0 || Standard.MaxRetryTime > 5) { Standard.MaxRetryTime = 1; } if (Standard.MaxCPUUsage < 1 || Standard.MaxCPUUsage > 100) { Standard.MaxCPUUsage = 75; } ms_c.Configurations[ClientMode.StandardspeedMode] = Standard; //High ConfigurationDetailInMode High; if (ms_c.Configurations.ContainsKey(ClientMode.HighspeedMode)) { High = ms_c.Configurations[ClientMode.HighspeedMode]; } else { High = new ConfigurationDetailInMode(); } if (High.SingleTransportation < 1 || High.SingleTransportation > 20) { High.SingleTransportation = 7; } if (High.QueryInterval < 10 || High.QueryInterval > 3600) { High.QueryInterval = 30; } if (High.MaxRunningTask < 1 || High.MaxRunningTask > 20) { High.MaxRunningTask = 5; } if (High.MaxRetryTime < 0 || High.MaxRetryTime > 5) { High.MaxRetryTime = 1; } if (High.MaxCPUUsage < 1 || High.MaxCPUUsage > 100) { High.MaxCPUUsage = 100; } ms_c.Configurations[ClientMode.HighspeedMode] = High; }
private static void RecheckConfiguration() { if (ms_c.ServerPort < 1 || ms_c.ServerPort > 32768) ms_c.ServerPort = 1371; if (ms_c.Configurations == null) { ms_c.Configurations = new Dictionary<ClientMode, ConfigurationDetailInMode>(); } if (ms_c.CurrentMode == 0) ms_c.CurrentMode = ClientMode.StandardspeedMode; //Low ConfigurationDetailInMode Low; if (ms_c.Configurations.ContainsKey(ClientMode.LowspeedMode)) Low = ms_c.Configurations[ClientMode.LowspeedMode]; else Low = new ConfigurationDetailInMode(); if (Low.SingleTransportation < 1 || Low.SingleTransportation > 20) Low.SingleTransportation = 3; if (Low.QueryInterval < 10 || Low.QueryInterval > 3600) Low.QueryInterval = 30; if (Low.MaxRunningTask < 1 || Low.MaxRunningTask > 20) Low.MaxRunningTask = 2; if (Low.MaxRetryTime < 0 || Low.MaxRetryTime > 5) Low.MaxRetryTime = 0; if (Low.MaxCPUUsage < 1 || Low.MaxCPUUsage > 100) Low.MaxCPUUsage = 50; ms_c.Configurations[ClientMode.LowspeedMode] = Low; //Standard ConfigurationDetailInMode Standard; if (ms_c.Configurations.ContainsKey(ClientMode.StandardspeedMode)) Standard = ms_c.Configurations[ClientMode.StandardspeedMode]; else Standard = new ConfigurationDetailInMode(); if (Standard.SingleTransportation < 1 || Standard.SingleTransportation > 20) Standard.SingleTransportation = 5; if (Standard.QueryInterval < 10 || Standard.QueryInterval > 3600) Standard.QueryInterval = 30; if (Standard.MaxRunningTask < 1 || Standard.MaxRunningTask > 20) Standard.MaxRunningTask = 4; if (Standard.MaxRetryTime < 0 || Standard.MaxRetryTime > 5) Standard.MaxRetryTime = 1; if (Standard.MaxCPUUsage < 1 || Standard.MaxCPUUsage > 100) Standard.MaxCPUUsage = 75; ms_c.Configurations[ClientMode.StandardspeedMode] = Standard; //High ConfigurationDetailInMode High; if (ms_c.Configurations.ContainsKey(ClientMode.HighspeedMode)) High = ms_c.Configurations[ClientMode.HighspeedMode]; else High = new ConfigurationDetailInMode(); if (High.SingleTransportation < 1 || High.SingleTransportation > 20) High.SingleTransportation = 7; if (High.QueryInterval < 10 || High.QueryInterval > 3600) High.QueryInterval = 30; if (High.MaxRunningTask < 1 || High.MaxRunningTask > 20) High.MaxRunningTask = 5; if (High.MaxRetryTime < 0 || High.MaxRetryTime > 5) High.MaxRetryTime = 1; if (High.MaxCPUUsage < 1 || High.MaxCPUUsage > 100) High.MaxCPUUsage = 100; ms_c.Configurations[ClientMode.HighspeedMode] = High; }