private async void btnSystemStop_Click(object sender, EventArgs e) { try { var confirmResult = MessageBox.Show( string.Format("Are you sure to stop all instances in: '{0}'? If you click the system will be unavailable!", GlobalVariables.Enviroment.ToString()), "Confirm Shut Down System", MessageBoxButtons.YesNo); if (confirmResult == DialogResult.Yes) { imgAppStatus.Image = Properties.Resources.Button_Blank_Red_icon; imgRdsStatus.Image = Properties.Resources.Button_Blank_Red_icon; imgScheduleStatus.Image = Properties.Resources.Button_Blank_Red_icon; var manager = new SystemManagement(); await manager.ShutDownSystem(cboxStopJumpbox.Checked); WriteNotification(String.Format("{0} system is stopped!", GlobalVariables.Enviroment.ToString())); } } catch (Exception ex) { HandleException(ex); } finally { await PopulateSystemStatus(); } }
public void SendTestBad3(string agregatorCode) { Dictionary <DateTime, Dictionary <string, Dictionary <DateTime, Dictionary <Enums.MeasureType, double> > > > agregatorData = null; ISystemManagement system = new SystemManagement(); system.Send(agregatorCode, agregatorData); }
private void LoadAutoScalingGroupSettings() { SystemManagement service = new SystemManagement(); lstAutoScalingGroupSettings = service.GetAutoScalingGroupSettingsByEnv(GlobalVariables.Enviroment); gvAsgSettings.DataSource = lstAutoScalingGroupSettings; }
//-----------------------------------------------Envroment Status-------------------------------------------------------------- private async void btnSystemStart_Click(object sender, EventArgs e) { try { tabCtrlMain.SelectedIndex = 1; var confirmResult = MessageBox.Show( string.Format("Are you sure to start all instances in: '{0}'? Pleae check the settings first and then click YES button!", GlobalVariables.Enviroment.ToString()), "Confirm Start System", MessageBoxButtons.YesNo); if (confirmResult == DialogResult.Yes) { imgAppStatus.Image = Properties.Resources.Button_Blank_Red_icon; imgRdsStatus.Image = Properties.Resources.Button_Blank_Red_icon; imgScheduleStatus.Image = Properties.Resources.Button_Blank_Red_icon; var manager = new SystemManagement(); await manager.StartSystem(lstAutoScalingGroupSettings, cboxRdsMutlAZ.Checked); WriteNotification($"{GlobalVariables.Enviroment.ToString()} system is started!"); } } catch (Exception ex) { HandleException(ex); } finally { await PopulateSystemStatus(); } }
public void turnOffGoodParameter() { ISystemManagement system = new SystemManagement(Enums.State.on); bool ret = system.turnOff(); Assert.AreEqual(true, ret); }
private void 系统管理ToolStripMenuItem_Click(object sender, EventArgs e) { SystemManagement sm = new SystemManagement(); sm.MdiParent = this; sm.WindowState = FormWindowState.Maximized;//以最大化形式打开 sm.Show(); }
public void turnOffBadParameter() { ISystemManagement system = new SystemManagement(Enums.State.off); Assert.Throws <ArgumentException>(() => { bool ret = system.turnOff(); }); }
static void Main() { //UserLookAndFeel.Default.SkinName = "Visual Studio 2013 Light"; DevExpress.UserSkins.BonusSkins.Register(); //if (Security.DataStandardTime().ToString("MM-dd").Equals("02-14") || Security.DataStandardTime().ToString("MM-dd").Equals("02-22")) // UserLookAndFeel.Default.SkinName = "Valentine"; ////else //UserLookAndFeel.Default.SkinName = "Xmas 2008 Blue"; UserLookAndFeel.Default.SkinName = "Office 2016 Colorfull"; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //Application.Run(new MainForm()); license = ConfigurationManager.AppSettings["License"]; //Hashtable macAddress = new Hashtable(); //macAddress.Add("wqb", "F32AE69569ECD888683C258486A5F50045912FFBDA0D16AF"); //if (macAddress.Values.OfType<String>().Contains(Security.Encrypt(SystemManagement.GetMacAddressByNetworkInformation()))) if (license.Equals(Security.Encrypt(SystemManagement.GetMacAddressByNetworkInformation()))) { LoginForm loginForm = new LoginForm(); if (loginForm.ShowDialog() == DialogResult.OK) { int trialDay = (Convert.ToDateTime(Security.Decrypt("57D58C8A2BC084018F9968BEFD6705F2")) - sysDateTime).Days;// Security.DataStandardTime()).Days;//2017-12-30 //int trialDay = (Convert.ToDateTime(Security.Decrypt("D0EB083A96761F6A1B3E6BB21FD1B850")) - Security.DataStandardTime()).Days;//2017-03-01 if (trialDay < 1) { XtraMessageBox.Show("系统已过试用期,购买咨询:15989744575 李先生。", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } //else if (Security.Encrypt(Security.DataStandardTime().ToString("yyyy-MM-dd")).Equals("7877984B2FAE09F6A4B7C75AC9DD29BC"))//2015-01-01 即不能上网,获取不了系统时间 else if (Security.Encrypt(sysDateTime.ToString("yyyy-MM-dd")).Equals("7877984B2FAE09F6A4B7C75AC9DD29BC"))//2015-01-01 { XtraMessageBox.Show("系统未授权使用,请联系系统开发人员。", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (trialDay <= 5) { XtraMessageBox.Show(string.Format("试用期剩余{0}天,购买咨询:15989744575 李先生。", trialDay), "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } CABApplication application = new CABApplication(); application.Run(); } } } else { XtraMessageBox.Show("系统未授权使用,请联系系统开发人员。", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
void Collider() { Debug.DrawLine(boxColliderBoundMin, BoxCollider2D.bounds.max, Color.blue, 0.5f); var hit = Physics2D.Linecast(boxColliderBoundMin, BoxCollider2D.bounds.max, target); if (hit.transform != null) { if (showSliderEnemy) { PlayerController.GetSliderEnemy(hit.transform); } var script = hit.transform.gameObject.GetComponent <MonoBehaviour>(); SystemManagement.CallMethod(script, "GetDamage", 1, startPosition, 0.3f, false); Stop(); } }
private async void btnRdsStart_Click(object sender, EventArgs e) { var service = new SystemManagement(); var lstInstanceSelected = new List <SA_RdsInstance>(); var strInstanceSelected = string.Empty; foreach (DataGridViewRow item in gvRDS.Rows) { if (item.Cells["ActionSelected"].Value == null) { continue; } bool selected; if (bool.TryParse(item.Cells["ActionSelected"].Value.ToString(), out selected) && selected && item.Cells["Status"].Value.ToString() == "stopped") { lstInstanceSelected.Add(lstRdsInstances.Find( o => o.DBInstanceIdentifier == (string)item.Cells["DBInstanceIdentifier"].Value)); strInstanceSelected += (string)item.Cells["DBInstanceIdentifier"].Value + ","; } } if (lstInstanceSelected.Count > 0) { strInstanceSelected = strInstanceSelected.Substring(0, strInstanceSelected.Length - 1); var confirmResult = MessageBox.Show( string.Format("RDS instances: {0} are selected. Pleae click YES button to start them!", strInstanceSelected), "Confirm Start RDS Instances", MessageBoxButtons.YesNo); if (confirmResult == DialogResult.Yes) { try { NotifyToMainStatus($"RDS instances {strInstanceSelected} begin to start.", System.Drawing.Color.Green); await service.StartRdsInstances(lstInstanceSelected); await PopulateRDSList(); } catch (Exception ex) { HandleException(ex); return; } WriteNotification($"RDS instances {strInstanceSelected} are started."); } } }
public static void UpdateSystemSettings(SystemSettings updatedSystemSettings) { var tokenCryptography = new TokenCryptography(); var systemManagement = new SystemManagement(); var serializer = new SystemSettingsSerializer(); var systemSettings = serializer.Deserialize(GlobalAppSettings.GetConfigFilepath()); systemManagement.UpdateSystemSetting(updatedSystemSettings.MailSettingsHost, SystemSettingKeys.MailSettingsHost.ToString()); systemManagement.UpdateSystemSetting(updatedSystemSettings.MailSettingsPort.ToString(), SystemSettingKeys.MailSettingsPort.ToString()); systemManagement.UpdateSystemSetting(updatedSystemSettings.MailSettingsSenderName, SystemSettingKeys.MailSettingsSenderName.ToString()); if (!String.IsNullOrEmpty(updatedSystemSettings.MailSettingsPassword)) { systemManagement.UpdateSystemSetting( tokenCryptography.DoEncryption(updatedSystemSettings.MailSettingsPassword), SystemSettingKeys.MailSettingsPassword.ToString()); } systemManagement.UpdateSystemSetting(updatedSystemSettings.MailSettingsIsSecureAuthentication.ToString(), SystemSettingKeys.MailSettingsIsSecureAuthentication.ToString()); systemManagement.UpdateSystemSetting(updatedSystemSettings.MailSettingsAddress, SystemSettingKeys.MailSettingsAddress.ToString()); systemManagement.UpdateSystemSetting(updatedSystemSettings.OrganizationName, SystemSettingKeys.OrganizationName.ToString()); systemManagement.UpdateSystemSetting(updatedSystemSettings.LoginLogo, SystemSettingKeys.LoginLogo.ToString()); systemManagement.UpdateSystemSetting(updatedSystemSettings.MainScreenLogo, SystemSettingKeys.MainScreenLogo.ToString()); systemManagement.UpdateSystemSetting(updatedSystemSettings.FavIcon, SystemSettingKeys.FavIcon.ToString()); systemManagement.UpdateSystemSetting(updatedSystemSettings.WelcomeNoteText, SystemSettingKeys.WelcomeNoteText.ToString()); systemManagement.UpdateSystemSetting(updatedSystemSettings.DateFormat, SystemSettingKeys.DateFormat.ToString()); systemManagement.UpdateSystemSetting(updatedSystemSettings.BaseUrl, SystemSettingKeys.BaseUrl.ToString()); systemManagement.UpdateSystemSetting(updatedSystemSettings.TimeZone, SystemSettingKeys.TimeZone.ToString()); }
private async Task PopulateScheduleActions() { listView2.Items.Clear(); SystemManagement service = new SystemManagement(); var lstAction = await service.GetApiScheduledActions(); var counterSuspended = 0; foreach (var action in lstAction) { ListViewItem item = new ListViewItem(); item.Text = action.Name; item.SubItems.Add(action.DesiredCapacity); item.SubItems.Add(action.MaxSize); item.SubItems.Add(action.MinSize); item.SubItems.Add(action.Recurrence); item.SubItems.Add(action.StartTime); item.SubItems.Add(action.EndTime); item.SubItems.Add(action.Suspend); listView2.Items.Add(item); if (action.Suspend == "True") { counterSuspended++; } } if (0 == counterSuspended) { imgScheduleStatus.Image = Properties.Resources.Button_Blank_Green_icon; } else if (lstAction.Count == counterSuspended) { imgScheduleStatus.Image = Properties.Resources.Button_Blank_Gray_icon; } else { imgScheduleStatus.Image = Properties.Resources.Button_Blank_Red_icon; } }
static void Main(string[] args) { var app = new CommandLineApplication(); app.Description = "Password storage utility."; app.HelpOption("-?|-h|--help"); app.Command("a2c", command => { command.Description = "Perform an Argon2 calibration to determine the best combination of iterations, memory usage, and parallel threads for password storage using Argon2."; command.HelpOption("-?|-h|--help"); var timeOption = command.Option( "-t|--time", "The maximum time in milliseconds it should take to calculate the password hash. Defaults to 1000.", CommandOptionType.SingleValue ); var parallelismOption = command.Option( "-p|--parallelism", "The degree of parallelism. Defaults to twice the number of CPU cores.", CommandOptionType.SingleValue ); var iterationsOption = command.Option( "-i|--iterations", "The minimum number of iterations. Defaults to 2.", CommandOptionType.SingleValue ); var modeOption = command.Option( "-m|--mode", "The mode of operation. The default is Argon2id. Advanced usage only.", CommandOptionType.SingleValue, c => c.ShowInHelpText = false ); var saltLengthOption = command.Option( "--saltlength", "The length of the salt and password, in bytes. Defaults to 16. Advanced usage only.", CommandOptionType.SingleValue, c => c.ShowInHelpText = false ); var hashLengthOption = command.Option( "--hashlength", "The length of the hash, in bytes. Defaults to 16. Advanced usage only.", CommandOptionType.SingleValue, c => c.ShowInHelpText = false ); command.OnExecute(() => { var factory = new Argon2Factory(); var logger = new Argon2Logger(); var input = new Argon2CalibrationInput() { MaximumTime = ReadOption(timeOption, () => 1000), DegreeOfParallelism = ReadOption(parallelismOption, () => SystemManagement.GetTotalCpuCores() * 2), MinimumIterations = ReadOption(iterationsOption, () => 2), Mode = ReadOption(modeOption, () => Argon2Mode.Argon2id), SaltAndPasswordLength = ReadOption(saltLengthOption, () => 16), HashLength = ReadOption(hashLengthOption, () => 16) }; var calibrator = new Argon2Calibrator(factory, logger, input); var results = calibrator.Run(); logger.WriteLine(); logger.WriteLine("Best results:"); results.ToList().ForEach(result => logger.WriteCalibrationResult(result)); return(0); }); }); app.OnExecute(() => 0); app.Execute(args); }
private void btnAsgSettingsSave_Click(object sender, EventArgs e) { SystemManagement service = new SystemManagement(); service.SaveAllAutoScalingGroupSettings(lstAutoScalingGroupSettings); }
//-----------------------------------------------Auto-Scaling Settings-------------------------------------------------------------- private void btnAsgSettingsInit_Click(object sender, EventArgs e) { SystemManagement service = new SystemManagement(); service.InitAutoScalingGroupSettings(GlobalVariables.Enviroment); }