public void Load(BinaryReader _reader) { try { int num1 = _reader.ReadInt32(); for (int index1 = 0; index1 < num1; ++index1) { string _controllerName = _reader.ReadString(); ControllerType _controllerType = (ControllerType)_reader.ReadInt32(); int num2 = _reader.ReadInt32(); this.DeleteControllerSetting(_controllerType, _controllerName); ControllerSetting controllerSetting = new ControllerSetting(_controllerName, _controllerType); for (int index2 = 0; index2 < num2; ++index2) { InputSetting _inputSetting = new InputSetting(_reader.ReadInt32(), _reader.ReadInt32(), (ControllerType)_reader.ReadInt32(), (ControllerElementType)_reader.ReadInt32(), _reader.ReadInt32(), (AxisRange)_reader.ReadInt32(), (KeyCode)_reader.ReadInt32(), (ModifierKeyFlags)_reader.ReadInt32(), _reader.ReadInt32(), (Pole)_reader.ReadInt32(), _reader.ReadBoolean(), _reader.ReadInt32()); controllerSetting.AddElement(_inputSetting); } this.controllerList.Add(controllerSetting); } Debug.Log((object)"ロードに成功しました:Load(BinaryReader _reader)"); } catch (Exception ex) { Debug.LogException(ex); } }
private HealthCheckRuleResult evaluate_Controller_Setting_Performance_Profile( HealthCheckRuleDescription hcrd, JobTarget jobTarget, Dictionary <string, HealthCheckSettingMapping> healthCheckSettingsDictionary, List <ControllerSetting> controllerSettingsList) { logger.Trace("Evaluating {0}", hcrd); HealthCheckRuleResult healthCheckRuleResult = createHealthCheckRuleResult(jobTarget, "Controller", jobTarget.Controller, 0, hcrd); healthCheckRuleResult.Application = "[ALL APPS]"; if (controllerSettingsList != null) { ControllerSetting controllerSettingProfile = controllerSettingsList.Where(s => s.Name == "performance.profile").FirstOrDefault(); if (controllerSettingProfile == null) { healthCheckRuleResult.Grade = 1; healthCheckRuleResult.Description = "Controller performance profile is unknown"; } else { healthCheckRuleResult.Description = String.Format("Controller performance profile is '{0}'", controllerSettingProfile.Value); // Defined in Enterprise Console via various // C:\AppDynamics\Platform\platform-admin\archives\controller\4.5.4.15417\playbooks\controller-<size>.groovy switch (controllerSettingProfile.Value.ToLower()) { case "internal": case "dev": case "demo": healthCheckRuleResult.Grade = 1; break; case "small": healthCheckRuleResult.Grade = 2; break; case "medium": healthCheckRuleResult.Grade = 3; break; case "large": healthCheckRuleResult.Grade = 4; break; case "extra-large": healthCheckRuleResult.Grade = 5; break; default: healthCheckRuleResult.Grade = 1; break; } } } return(healthCheckRuleResult); }
private void LoadData() { if (m_Controller == null) { m_Controller = InputManager.Instance.InputSettingMap[1]; } PlayerManager.Instance.LoadPlayer(1, m_Controller, m_data); }
private void ControllerSettingToMapping(ControllerType _controllerType) { if (_controllerType == 2 && this.joystickCount <= 0) { return; } int num1 = _controllerType != 2 ? 1 : this.joystickCount; for (int index = 0; index < num1; ++index) { ControllerSetting controllerSetting = (ControllerSetting)null; foreach (ControllerSetting controller in this.controllerList) { if (_controllerType == null || _controllerType == 1) { if (controller.controllerType == _controllerType) { controllerSetting = controller; break; } } else if (this.joysticks != null) { if (((Controller)this.joysticks[index]).get_hardwareName() == controller.controllerName) { controllerSetting = controller; break; } } else { break; } } if (controllerSetting != null) { int num2 = _controllerType != 2 ? 0 : (int)((Controller)this.joysticks[index]).id; using (IEnumerator <ControllerMap> enumerator = ((IEnumerable <ControllerMap>)((Player.ControllerHelper.MapHelper)((Player.ControllerHelper) this.player.controllers).maps).GetMaps(controllerSetting.controllerType, num2)).GetEnumerator()) { while (((IEnumerator)enumerator).MoveNext()) { enumerator.Current.ClearElementMaps(); } } foreach (InputSetting element in controllerSetting.elements) { int categoryId = element.categoryId; int layoutId = element.layoutId; ((Player.ControllerHelper.MapHelper)((Player.ControllerHelper) this.player.controllers).maps).GetMap(controllerSetting.controllerType, num2, categoryId, layoutId).ReplaceOrCreateElementMap(element.ToElementAssignmentCreateSetting()); } } } }
public override bool GetSaveDataFromStream(FileStream fileStream, BinaryFormatter bf) { var retVal = false; ProfileSettings settings = (ProfileSettings)bf.Deserialize(fileStream); retVal = settings != null; if (retVal) { this.controllerSettings = settings.controllerSettings; this.MusicEnable = settings.MusicEnable; } return(retVal); }
private void ControllerMappingToSetting(ControllerType _controllerType) { List <ControllerSetting> controllerSettingList = new List <ControllerSetting>(); switch ((int)_controllerType) { case 0: case 1: this.DeleteControllerSetting(_controllerType, (string)null); ControllerSetting controllerSetting1 = new ControllerSetting(_controllerType, 0); if (_controllerType == null) { controllerSettingList.Add(controllerSetting1); break; } break; case 2: for (int index = 0; index < this.joystickCount; ++index) { ControllerSetting controllerSetting2 = new ControllerSetting(_controllerType, (int)((Controller)this.joysticks[index]).id); this.DeleteControllerSetting(_controllerType, controllerSetting2.controllerName); controllerSettingList.Add(controllerSetting2); } break; } foreach (ControllerSetting controllerSetting2 in controllerSettingList) { if (controllerSetting2.maps != null) { this.controllerList.Add(controllerSetting2); using (IEnumerator <ControllerMap> enumerator1 = ((IEnumerable <ControllerMap>)controllerSetting2.maps).GetEnumerator()) { while (((IEnumerator)enumerator1).MoveNext()) { using (IEnumerator <ActionElementMap> enumerator2 = ((IEnumerable <ActionElementMap>)enumerator1.Current.get_AllMaps()).GetEnumerator()) { while (((IEnumerator)enumerator2).MoveNext()) { ActionElementMap current = enumerator2.Current; controllerSetting2.AddElement(new InputSetting(current)); } } } } } } controllerSettingList.Clear(); }
private bool InputSetting(ControllerSetting controller) { currentAxis = new AxisEventData(EventSystem.current); currentButton = EventSystem.current.currentSelectedGameObject; if (Input.GetAxis(controller.Vertical) > 0) { currentAxis.moveDir = MoveDirection.Up; ExecuteEvents.Execute(currentButton, currentAxis, ExecuteEvents.moveHandler); timer = timeBetweenInputs; return(true); } else if (Input.GetAxis(controller.Vertical) < 0) { currentAxis.moveDir = MoveDirection.Down; ExecuteEvents.Execute(currentButton, currentAxis, ExecuteEvents.moveHandler); timer = timeBetweenInputs; return(true); } else if (Input.GetAxis(controller.Horizontal) > 0) { currentAxis.moveDir = MoveDirection.Right; ExecuteEvents.Execute(currentButton, currentAxis, ExecuteEvents.moveHandler); timer = timeBetweenInputs; return(true); } else if (Input.GetAxis(controller.Horizontal) < 0) { currentAxis.moveDir = MoveDirection.Left; ExecuteEvents.Execute(currentButton, currentAxis, ExecuteEvents.moveHandler); timer = timeBetweenInputs; return(true); } else if (Input.GetKeyDown(controller.Submit)) { if (m_Audio == null) { return(true); } if (m_Audio.isPlaying) { m_Audio.Stop(); } m_Audio.Play(); return(true); } return(false); }
public void LoadPlayer(int i, ControllerSetting controller, DataSaver data) { PlayerData playerData = new PlayerData(); PlayerInfo playerInfo = LoadPlayerInfo(data); playerData.info = playerInfo; playerData.controllerSetting = controller; playerData.data = data; if (m_PlayerMap.ContainsKey(i)) { m_PlayerMap[i] = playerData; } else { m_PlayerMap.Add(i, playerData); } }
/// <summary> /// Initialize by player info to setup player's weapons and stratagems. /// </summary> /// <param name="data"></param> public void Initialize(PlayerInfo data, int serialNum = 1) { data.CopyTo(m_Data); m_SerialNumber = serialNum; m_Record = new PlayerRecord(); this.OnDeathBegin += () => { m_Record.TimesOfDeath++; }; m_ControllerSetting = PlayerManager.Instance.Players[serialNum].controllerSetting; m_Controller.SetJoyNumber(m_ControllerSetting); // Setup stratagems m_StratagemController.CheckCodesMechine.InputVertical = m_ControllerSetting.StratagemVertical; m_StratagemController.CheckCodesMechine.InputHorizontal = m_ControllerSetting.StratagemHorizontal; if (m_StratagemController.Stratagems.Count > 0) { m_StratagemController.Clear(); } if (m_Data.Stratagems.Count > 0) { m_StratagemController.AddStratagems(m_Data.Stratagems, m_Parts.RightHand, m_Parts.LaunchPoint); } // Setup weapons m_WeapoonController.ClearWeapon(); m_WeapoonController.OnFire += () => { m_Record.Shots++; }; if (m_Data.Weapons.Count > 0) { m_WeapoonController.AddMultiWeapons(m_Data.Weapons, m_Parts.LaunchPoint, this); } // Setup grenades if (m_Data.Grenades.Count > 0) { m_GrenadesController.AddGrenades(data.Grenades, m_Parts.RightHand, m_Parts.LaunchPoint, this); } // Setup sounds SoundDataSetting soundData = ResourceManager.m_Instance.LoadData(typeof(SoundDataSetting), "Sounds/Player", "SoundDataSetting") as SoundDataSetting; m_SoundManager.SetAudioClips(soundData.SoundDatas); OnSpawnFinish += () => m_SoundManager.PlayInWorld(UnityEngine.Random.Range(1010, 1013), this.transform.position); OnDeathBegin += () => m_SoundManager.PlayInWorld(UnityEngine.Random.Range(1020, 1023), this.transform.position); OnDamaged += () => m_SoundManager.PlayInWorld(UnityEngine.Random.Range(1030, 1033), this.transform.position); }
public void CreateBackupPolicyTest() { StatefulServiceContext statefulServiceContext = new StatefulServiceContext(); var mockStatefulService = new Mock <StatefulService>(); mockStatefulService.SetupGet <IReliableStateManager>((mockStatefulService1) => mockStatefulService1.StateManager ).Returns(new MockIReliableStateManager()); BackupPolicy backupPolicy = new BackupPolicy { BackupPolicyName = "SampleBackupPolicy1" }; ControllerSetting controllerSetting = new ControllerSetting(mockStatefulService.Object, new CancellationToken()); BackupPolicyController backupPolicyController = new BackupPolicyController(controllerSetting); backupPolicyController.AddBackupPolicy(backupPolicy).Wait(); BackupPolicy queryBackupPolicy = backupPolicyController.GetBackupPolicyByName(backupPolicy.BackupPolicyName).Result; if (queryBackupPolicy.Equals(backupPolicy)) { Assert.Equals(queryBackupPolicy, backupPolicy); } }
private bool InputSetting(ControllerSetting m_controller) { if (Input.GetAxis(m_controller.Vertical) > 0 || Input.GetAxis("Vertical") > 0) { if (AxisUp != null) { AxisUp(); } timer = timeBetweenInputs; return(true); } else if (Input.GetAxis(m_controller.Vertical) < 0 || Input.GetAxis("Vertical") < 0) { if (AxisDown != null) { AxisDown(); } timer = timeBetweenInputs; return(true); } else if (Input.GetAxis(m_controller.Horizontal) > 0 || Input.GetAxis("Horizontal") > 0) { if (AxisRight != null) { AxisRight(); } timer = timeBetweenInputs; return(true); } else if (Input.GetAxis(m_controller.Horizontal) < 0 || Input.GetAxis("Horizontal") < 0) { if (AxisLeft != null) { AxisLeft(); } timer = timeBetweenInputs; return(true); } else if (Input.GetKeyDown(m_controller.Submit) || Input.GetKeyDown(KeyCode.Space)) { if (AxisSubmit != null) { AxisSubmit(); } timer = timeBetweenInputs; return(true); } else if (Input.GetKeyDown(m_controller.Cancel) || Input.GetKeyDown(KeyCode.Escape)) { if (AxisCancel != null) { AxisCancel(); } timer = timeBetweenInputs; return(true); } else if (Input.GetButtonDown("Return") || Input.GetKeyDown(KeyCode.Backspace)) { PlayerManager.Instance.UnloadPlayerMap(); SceneController.Instance.ToLauncher(); timer = timeBetweenInputs; return(true); } else if (Input.GetKeyDown(KeyCode.M)) { if (AxisSecret != null) { AxisSecret(); } timer = timeBetweenInputs; return(true); } return(false); }
public PartitionEventsController(ControllerSetting controllerSetting) : base(controllerSetting) { }
// RestorePoints are referred as BackupList in Swagger-spec. public BackupRestorePointsController(ControllerSetting controllerSetting) { this.statefulService = controllerSetting.StatefulService; }
public ClusterEventsController(ControllerSetting controllerSetting) : base(controllerSetting) { }
public RestoreController(ControllerSetting controllerSetting) { this.statefulService = controllerSetting.StatefulService; }
/// <summary> /// https://community.appdynamics.com/t5/Knowledge-Base/Controller-and-Agent-ADD-Limit-Notifications-Explanations/ta-p/23273#CONTROLLER_ASYNC_ADD_REG_LIMIT_REACHED /// </summary> /// <param name="hcrd"></param> /// <param name="jobTarget"></param> /// <param name="healthCheckSettingsDictionary"></param> /// <param name="controllerSettingsList"></param> /// <returns></returns> private List <HealthCheckRuleResult> evaluate_Controller_Setting_ADD_Limits( HealthCheckRuleDescription hcrd, JobTarget jobTarget, Dictionary <string, HealthCheckSettingMapping> healthCheckSettingsDictionary, List <ControllerSetting> controllerSettingsList) { logger.Trace("Evaluating {0}", hcrd); HealthCheckRuleResult healthCheckRuleResult = createHealthCheckRuleResult(jobTarget, "Controller", jobTarget.Controller, 0, hcrd); healthCheckRuleResult.Application = "[ALL APPS]"; List <HealthCheckRuleResult> healthCheckRuleResults = new List <HealthCheckRuleResult>(); if (controllerSettingsList != null) { // Defined in Enterprise Console via various // C:\AppDynamics\Platform\platform-admin\archives\controller\4.5.4.15417\playbooks\controller-<size>.groovy ControllerSetting controllerSettingProfile = controllerSettingsList.Where(s => s.Name == "performance.profile").FirstOrDefault(); if (controllerSettingProfile != null) { List <ControllerSetting> controllerSettingsLimits = controllerSettingsList.Where(s => s.Name.Contains(".registration.limit")).ToList(); if (controllerSettingsLimits != null) { foreach (ControllerSetting controllerSetting in controllerSettingsLimits) { string lookupSettingName = String.Format("ControllerSetting.{0}.{1}", controllerSettingProfile.Value, controllerSetting.Name); int settingCurrentValue = -1; int settingDefaultValue = -1; int settingRecommendedValue = -1; if (Int32.TryParse(controllerSetting.Value, out settingCurrentValue) == true) { HealthCheckRuleResult healthCheckRuleResult1 = healthCheckRuleResult.Clone(); healthCheckRuleResult1.Name = String.Format("{0} ({1})", healthCheckRuleResult.Name, controllerSetting.Name); healthCheckRuleResult1.Grade = -1; // All settings are taken // from C:\AppDynamics\Platform\platform-admin\archives\controller\4.5.4.15417\playbooks\controller-<size>.groovy in EC // And from careful review of significant number of controllers switch (controllerSetting.Name) { case "application.custom.metric.registration.limit": case "application.metric.registration.limit": case "async.thread.tracking.registration.limit": case "metric.registration.limit": case "sep.ADD.registration.limit": case "stacktrace.ADD.registration.limit": case "error.registration.limit": // maxStacktracePerAccountLimit = 4000 // maxSepPerAccountLimit = 4000 // maxErrorsPerAccountLimit = 4000 settingRecommendedValue = getIntegerSetting(healthCheckSettingsDictionary, lookupSettingName, -1); if (settingRecommendedValue != -1) { if (settingCurrentValue == settingRecommendedValue) { healthCheckRuleResult1.Grade = 5; healthCheckRuleResult1.Description = String.Format("Controller setting '{0}'='{1}', at recommended value", controllerSetting.Name, settingCurrentValue); } else if (settingCurrentValue < settingRecommendedValue) { healthCheckRuleResult1.Grade = 3; healthCheckRuleResult1.Description = String.Format("Controller setting '{0}'='{1}', (<) less than recommended value '{2}'", controllerSetting.Name, settingCurrentValue, settingRecommendedValue); } else if (settingCurrentValue > settingRecommendedValue) { healthCheckRuleResult1.Grade = 5; healthCheckRuleResult1.Description = String.Format("Controller setting '{0}'='{1}', (>) greater than recommended value '{2}'", controllerSetting.Name, settingCurrentValue, settingRecommendedValue); } } break; case "collections.ADD.registration.limit": // maxCollectionsPerAccountLimit = 4000 settingDefaultValue = getIntegerSetting(healthCheckSettingsDictionary, lookupSettingName, 4000); if (settingCurrentValue == settingDefaultValue) { healthCheckRuleResult1.Grade = 3; healthCheckRuleResult1.Description = String.Format("Controller setting '{0}'='{1}', at default value", controllerSetting.Name, settingCurrentValue); } else if (settingCurrentValue < settingDefaultValue) { healthCheckRuleResult1.Grade = 2; healthCheckRuleResult1.Description = String.Format("Controller setting '{0}'='{1}', (<) less than default value '{2}'", controllerSetting.Name, settingCurrentValue, settingDefaultValue); } else if (settingCurrentValue > settingDefaultValue) { healthCheckRuleResult1.Grade = 5; healthCheckRuleResult1.Description = String.Format("Controller setting '{0}'='{1}', (>) greater than default value '{2}'", controllerSetting.Name, settingCurrentValue, settingDefaultValue); } break; case "tracked.object.ADD.registration.limit": // maxTrackedObjectAccountLimit = 4000 settingDefaultValue = getIntegerSetting(healthCheckSettingsDictionary, lookupSettingName, 4000); if (settingCurrentValue == settingDefaultValue) { healthCheckRuleResult1.Grade = 3; healthCheckRuleResult1.Description = String.Format("Controller setting '{0}'='{1}', at default value", controllerSetting.Name, settingCurrentValue); } else if (settingCurrentValue < settingDefaultValue) { healthCheckRuleResult1.Grade = 2; healthCheckRuleResult1.Description = String.Format("Controller setting '{0}'='{1}', (<) less than default value '{2}'", controllerSetting.Name, settingCurrentValue, settingDefaultValue); } else if (settingCurrentValue > settingDefaultValue) { healthCheckRuleResult1.Grade = 5; healthCheckRuleResult1.Description = String.Format("Controller setting '{0}'='{1}', (>) greater than default value '{2}'", controllerSetting.Name, settingCurrentValue, settingDefaultValue); } break; case "memory.ADD.registration.limit": // maxMemoryPointsPerAccountLimit = 4000 settingDefaultValue = getIntegerSetting(healthCheckSettingsDictionary, lookupSettingName, 4000); if (settingCurrentValue == settingDefaultValue) { healthCheckRuleResult1.Grade = 3; healthCheckRuleResult1.Description = String.Format("Controller setting '{0}'='{1}', at default value", controllerSetting.Name, settingCurrentValue); } else if (settingCurrentValue < settingDefaultValue) { healthCheckRuleResult1.Grade = 2; healthCheckRuleResult1.Description = String.Format("Controller setting '{0}'='{1}', (<) less than default value '{2}'", controllerSetting.Name, settingCurrentValue, settingDefaultValue); } else if (settingCurrentValue > settingDefaultValue) { healthCheckRuleResult1.Grade = 5; healthCheckRuleResult1.Description = String.Format("Controller setting '{0}'='{1}', (>) greater than default value '{2}'", controllerSetting.Name, settingCurrentValue, settingDefaultValue); } break; case "backend.registration.limit": // maxBackendsPerAccountLimit = 100000 settingDefaultValue = getIntegerSetting(healthCheckSettingsDictionary, lookupSettingName, 10000); if (settingCurrentValue == settingDefaultValue) { healthCheckRuleResult1.Grade = 3; healthCheckRuleResult1.Description = String.Format("Controller setting '{0}'='{1}', at default value", controllerSetting.Name, settingCurrentValue); } else if (settingCurrentValue < settingDefaultValue) { healthCheckRuleResult1.Grade = 2; healthCheckRuleResult1.Description = String.Format("Controller setting '{0}'='{1}', (<) less than default value '{2}'", controllerSetting.Name, settingCurrentValue, settingDefaultValue); } else if (settingCurrentValue > settingDefaultValue) { healthCheckRuleResult1.Grade = 5; healthCheckRuleResult1.Description = String.Format("Controller setting '{0}'='{1}', (>) greater than default value '{2}'", controllerSetting.Name, settingCurrentValue, settingDefaultValue); } break; case "controller.metric.registration.limit": // Don't know what this one means default: break; } if (healthCheckRuleResult1.Grade != -1) { healthCheckRuleResults.Add(healthCheckRuleResult1); } } } } } } return(healthCheckRuleResults); }
// Use this for initialization void Start() { Controller = PlayerManager.Instance.Players[PlayerID].controllerSetting; }
//Set controller public void SetController(ControllerSetting controller) { m_Controller = controller; }
public void SetJoyNumber(ControllerSetting controller) { m_InputSetting = controller; }
private void SetController() { m_controller = (PlayerManager.Instance.Players[1].controllerSetting == InputManager.Instance.InputSettingMap[1]) ? InputManager.Instance.InputSettingMap[2] : InputManager.Instance.InputSettingMap[1]; }
public ServiceEventsController(ControllerSetting controllerSetting) : base(controllerSetting) { }
// Use this for initialization void Start() { m_ControllerSetting1 = InputManager.Instance.InputSettingMap[1]; m_ControllerSetting2 = InputManager.Instance.InputSettingMap[2]; }
public CorrelatedEventsController(ControllerSetting controllerSetting) : base(controllerSetting) { }
public BackupPartitionController(ControllerSetting controllerSetting) { this.statefulService = controllerSetting.StatefulService; }
public NodeEventsController(ControllerSetting controllerSetting) : base(controllerSetting) { }
public BackupMappingController(ControllerSetting controllerSetting) { this.statefulService = controllerSetting.StatefulService; }
/// <summary> /// https://community.appdynamics.com/t5/Knowledge-Base/Why-am-I-receiving-the-error-quot-Controller-Metric-Data-Buffer/ta-p/14653 /// https://community.appdynamics.com/t5/Knowledge-Base/Why-are-snapshots-missing-in-the-Controller/ta-p/19047 /// </summary> /// <param name="hcrd"></param> /// <param name="jobTarget"></param> /// <param name="healthCheckSettingsDictionary"></param> /// <param name="controllerSettingsList"></param> /// <returns></returns> private List <HealthCheckRuleResult> evaluate_Controller_Setting_Buffer_Sizes( HealthCheckRuleDescription hcrd, JobTarget jobTarget, Dictionary <string, HealthCheckSettingMapping> healthCheckSettingsDictionary, List <ControllerSetting> controllerSettingsList) { logger.Trace("Evaluating {0}", hcrd); HealthCheckRuleResult healthCheckRuleResult = createHealthCheckRuleResult(jobTarget, "Controller", jobTarget.Controller, 0, hcrd); healthCheckRuleResult.Application = "[ALL APPS]"; List <HealthCheckRuleResult> healthCheckRuleResults = new List <HealthCheckRuleResult>(); if (controllerSettingsList != null) { // Defined in Enterprise Console via various // C:\AppDynamics\Platform\platform-admin\archives\controller\4.5.4.15417\playbooks\controller-<size>.groovy ControllerSetting controllerSettingProfile = controllerSettingsList.Where(s => s.Name == "performance.profile").FirstOrDefault(); if (controllerSettingProfile != null) { List <ControllerSetting> controllerSettingsBuffers = controllerSettingsList.Where(s => s.Name.Contains(".buffer.size")).ToList(); if (controllerSettingsBuffers != null) { foreach (ControllerSetting controllerSetting in controllerSettingsBuffers) { // Dealing with only these: // events.buffer.size // metrics.buffer.size // process.snapshots.buffer.size // snapshots.buffer.size string lookupSettingName = String.Format("ControllerSetting.{0}.{1}", controllerSettingProfile.Value, controllerSetting.Name); int settingCurrentValue = -1; Int32.TryParse(controllerSetting.Value, out settingCurrentValue); int settingDefaultValue = getIntegerSetting(healthCheckSettingsDictionary, lookupSettingName, -1); if (settingDefaultValue != -1 && settingCurrentValue != -1) { HealthCheckRuleResult healthCheckRuleResult1 = healthCheckRuleResult.Clone(); healthCheckRuleResult1.Name = String.Format("{0} ({1})", healthCheckRuleResult.Name, controllerSetting.Name); if (settingCurrentValue == settingDefaultValue) { healthCheckRuleResult1.Grade = 5; healthCheckRuleResult1.Description = String.Format("Controller performance profile is '{0}', setting '{1}'='{2}', at default value", controllerSettingProfile.Value, controllerSetting.Name, settingCurrentValue); } else if (settingCurrentValue < settingDefaultValue) { healthCheckRuleResult1.Grade = 3; healthCheckRuleResult1.Description = String.Format("Controller performance profile is '{0}', setting '{1}'='{2}', (<) less than default value '{3}'", controllerSettingProfile.Value, controllerSetting.Name, settingCurrentValue, settingDefaultValue); } else if (settingCurrentValue > settingDefaultValue) { healthCheckRuleResult1.Grade = 4; healthCheckRuleResult1.Description = String.Format("Controller performance profile is '{0}', setting '{1}'='{2}', (>) greater than default value '{3}'", controllerSettingProfile.Value, controllerSetting.Name, settingCurrentValue, settingDefaultValue); } healthCheckRuleResults.Add(healthCheckRuleResult1); } } } } } return(healthCheckRuleResults); }
public SuspendBackupController(ControllerSetting controllerSetting) { this.statefulService = controllerSetting.StatefulService; }
public override bool Execute(ProgramOptions programOptions, JobConfiguration jobConfiguration) { Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); StepTiming stepTimingFunction = new StepTiming(); stepTimingFunction.JobFileName = programOptions.OutputJobFilePath; stepTimingFunction.StepName = jobConfiguration.Status.ToString(); stepTimingFunction.StepID = (int)jobConfiguration.Status; stepTimingFunction.StartTime = DateTime.Now; stepTimingFunction.NumEntities = jobConfiguration.Target.Count; this.DisplayJobStepStartingStatus(jobConfiguration); FilePathMap = new FilePathMap(programOptions, jobConfiguration); try { if (this.ShouldExecute(jobConfiguration) == false) { return(true); } bool reportFolderCleaned = false; // Process each Controller once int i = 0; var controllers = jobConfiguration.Target.GroupBy(t => t.Controller); foreach (var controllerGroup in controllers) { Stopwatch stopWatchTarget = new Stopwatch(); stopWatchTarget.Start(); JobTarget jobTarget = controllerGroup.ToList()[0]; StepTiming stepTimingTarget = new StepTiming(); stepTimingTarget.Controller = jobTarget.Controller; stepTimingTarget.ApplicationName = jobTarget.Application; stepTimingTarget.ApplicationID = jobTarget.ApplicationID; stepTimingTarget.JobFileName = programOptions.OutputJobFilePath; stepTimingTarget.StepName = jobConfiguration.Status.ToString(); stepTimingTarget.StepID = (int)jobConfiguration.Status; stepTimingTarget.StartTime = DateTime.Now; stepTimingTarget.NumEntities = 0; try { this.DisplayJobTargetStartingStatus(jobConfiguration, jobTarget, i + 1); #region Controller Settings loggerConsole.Info("Controller Settings"); List <ControllerSetting> controllerSettingsList = new List <ControllerSetting>(); JArray controllerSettingsArray = FileIOHelper.LoadJArrayFromFile(FilePathMap.ControllerSettingsDataFilePath(jobTarget)); if (controllerSettingsArray != null) { foreach (JObject controllerSettingObject in controllerSettingsArray) { ControllerSetting controllerSetting = new ControllerSetting(); controllerSetting.Controller = jobTarget.Controller; controllerSetting.ControllerLink = String.Format(DEEPLINK_CONTROLLER, controllerSetting.Controller, DEEPLINK_TIMERANGE_LAST_15_MINUTES); controllerSetting.Name = getStringValueFromJToken(controllerSettingObject, "name"); controllerSetting.Description = getStringValueFromJToken(controllerSettingObject, "description"); controllerSetting.Value = getStringValueFromJToken(controllerSettingObject, "value"); controllerSetting.Updateable = getBoolValueFromJToken(controllerSettingObject, "updateable"); controllerSetting.Scope = getStringValueFromJToken(controllerSettingObject, "scope"); controllerSettingsList.Add(controllerSetting); } } controllerSettingsList = controllerSettingsList.OrderBy(c => c.Name).ToList(); FileIOHelper.WriteListToCSVFile(controllerSettingsList, new ControllerSettingReportMap(), FilePathMap.ControllerSettingsIndexFilePath(jobTarget)); stepTimingTarget.NumEntities = stepTimingTarget.NumEntities + controllerSettingsList.Count; #endregion #region HTTP Templates loggerConsole.Info("HTTP Templates"); List <HTTPAlertTemplate> httpTemplatesList = new List <HTTPAlertTemplate>(); JArray httpTemplatesArray = FileIOHelper.LoadJArrayFromFile(FilePathMap.HTTPTemplatesDataFilePath(jobTarget)); JArray httpTemplatesDetailArray = FileIOHelper.LoadJArrayFromFile(FilePathMap.HTTPTemplatesDetailDataFilePath(jobTarget)); if (httpTemplatesArray != null) { foreach (JObject httpTemplateObject in httpTemplatesArray) { HTTPAlertTemplate httpAlertTemplate = new HTTPAlertTemplate(); httpAlertTemplate.Controller = jobTarget.Controller; httpAlertTemplate.Name = getStringValueFromJToken(httpTemplateObject, "name"); httpAlertTemplate.Method = getStringValueFromJToken(httpTemplateObject, "method"); httpAlertTemplate.Scheme = getStringValueFromJToken(httpTemplateObject, "scheme"); httpAlertTemplate.Host = getStringValueFromJToken(httpTemplateObject, "host"); httpAlertTemplate.Port = getIntValueFromJToken(httpTemplateObject, "port"); httpAlertTemplate.Path = getStringValueFromJToken(httpTemplateObject, "path"); httpAlertTemplate.Query = getStringValueFromJToken(httpTemplateObject, "query"); httpAlertTemplate.AuthType = getStringValueFromJToken(httpTemplateObject, "authType"); httpAlertTemplate.AuthUsername = getStringValueFromJToken(httpTemplateObject, "authUsername"); httpAlertTemplate.AuthPassword = getStringValueFromJToken(httpTemplateObject, "authPassword"); httpAlertTemplate.Headers = getStringValueOfObjectFromJToken(httpTemplateObject, "headers", true); if (isTokenPropertyNull(httpTemplateObject, "payloadTemplate") == false) { httpAlertTemplate.ContentType = getStringValueFromJToken(httpTemplateObject["payloadTemplate"], "httpRequestActionMediaType"); httpAlertTemplate.FormData = getStringValueOfObjectFromJToken(httpTemplateObject["payloadTemplate"], "formDataPairs", true); httpAlertTemplate.Payload = getStringValueFromJToken(httpTemplateObject["payloadTemplate"], "payload"); } httpAlertTemplate.ConnectTimeout = getLongValueFromJToken(httpTemplateObject, "connectTimeoutInMillis"); httpAlertTemplate.SocketTimeout = getLongValueFromJToken(httpTemplateObject, "socketTimeoutInMillis"); httpAlertTemplate.ResponseAny = getStringValueOfObjectFromJToken(httpTemplateObject, "responseMatchCriteriaAnyTemplate"); httpAlertTemplate.ResponseNone = getStringValueOfObjectFromJToken(httpTemplateObject, "responseMatchCriteriaNoneTemplate"); if (httpTemplatesDetailArray != null) { JToken httpAlertTemplateToken = httpTemplatesDetailArray.Where(t => t["name"].ToString() == httpAlertTemplate.Name).FirstOrDefault(); if (httpAlertTemplateToken != null) { httpAlertTemplate.TemplateID = getLongValueFromJToken(httpAlertTemplateToken, "id"); } } httpTemplatesList.Add(httpAlertTemplate); } } httpTemplatesList = httpTemplatesList.OrderBy(c => c.Name).ToList(); FileIOHelper.WriteListToCSVFile(httpTemplatesList, new HTTPAlertTemplateReportMap(), FilePathMap.HTTPTemplatesIndexFilePath(jobTarget)); stepTimingTarget.NumEntities = stepTimingTarget.NumEntities + httpTemplatesList.Count; #endregion #region Email Templates loggerConsole.Info("Email Templates"); List <EmailAlertTemplate> emailTemplatesList = new List <EmailAlertTemplate>(); JArray emailTemplatesArray = FileIOHelper.LoadJArrayFromFile(FilePathMap.EmailTemplatesDataFilePath(jobTarget)); JArray emailTemplatesDetailArray = FileIOHelper.LoadJArrayFromFile(FilePathMap.EmailTemplatesDetailDataFilePath(jobTarget)); if (emailTemplatesArray != null) { foreach (JObject emailTemplateObject in emailTemplatesArray) { EmailAlertTemplate emailAlertTemplate = new EmailAlertTemplate(); emailAlertTemplate.Controller = jobTarget.Controller; emailAlertTemplate.Name = getStringValueFromJToken(emailTemplateObject, "name"); emailAlertTemplate.OneEmailPerEvent = getBoolValueFromJToken(emailTemplateObject, "oneEmailPerEvent"); emailAlertTemplate.EventLimit = getLongValueFromJToken(emailTemplateObject, "eventClampLimit"); try { string[] emails = emailTemplateObject["toRecipients"].Select(s => getStringValueFromJToken(s, "value")).ToArray(); emailAlertTemplate.To = String.Join(";", emails); } catch { } try { string[] emails = emailTemplateObject["ccRecipients"].Select(s => getStringValueFromJToken(s, "value")).ToArray(); emailAlertTemplate.CC = String.Join(";", emails); } catch { } try { string[] emails = emailTemplateObject["bccRecipients"].Select(s => getStringValueFromJToken(s, "value")).ToArray(); emailAlertTemplate.BCC = String.Join(";", emails); } catch { } try { string[] emails = emailTemplateObject["testToRecipients"].Select(s => getStringValueFromJToken(s, "value")).ToArray(); emailAlertTemplate.TestTo = String.Join(";", emails); } catch { } try { string[] emails = emailTemplateObject["testCcRecipients"].Select(s => getStringValueFromJToken(s, "value")).ToArray(); emailAlertTemplate.TestCC = String.Join(";", emails); } catch { } try { string[] emails = emailTemplateObject["testBccRecipients"].Select(s => getStringValueFromJToken(s, "value")).ToArray(); emailAlertTemplate.TestBCC = String.Join(";", emails); } catch { } emailAlertTemplate.TestLogLevel = getStringValueFromJToken(emailTemplateObject, "testLogLevel"); emailAlertTemplate.Headers = getStringValueOfObjectFromJToken(emailTemplateObject, "headers", true); emailAlertTemplate.Subject = getStringValueFromJToken(emailTemplateObject, "subject"); emailAlertTemplate.TextBody = getStringValueFromJToken(emailTemplateObject, "textBody"); emailAlertTemplate.HTMLBody = getStringValueFromJToken(emailTemplateObject, "htmlBody"); emailAlertTemplate.IncludeHTMLBody = getBoolValueFromJToken(emailTemplateObject, "includeHtmlBody"); emailAlertTemplate.Properties = getStringValueOfObjectFromJToken(emailTemplateObject, "defaultCustomProperties"); emailAlertTemplate.TestProperties = getStringValueOfObjectFromJToken(emailTemplateObject, "testPropertiesPairs"); emailAlertTemplate.EventTypes = getStringValueOfObjectFromJToken(emailTemplateObject, "eventTypeCountPairs"); if (emailTemplatesDetailArray != null) { JToken emailTemplateDetailToken = emailTemplatesDetailArray.Where(t => t["name"].ToString() == emailAlertTemplate.Name).FirstOrDefault(); if (emailTemplateDetailToken != null) { emailAlertTemplate.TemplateID = getLongValueFromJToken(emailTemplateDetailToken, "id"); } } emailTemplatesList.Add(emailAlertTemplate); } } emailTemplatesList = emailTemplatesList.OrderBy(c => c.Name).ToList(); FileIOHelper.WriteListToCSVFile(emailTemplatesList, new EmailAlertTemplateReportMap(), FilePathMap.EmailTemplatesIndexFilePath(jobTarget)); stepTimingTarget.NumEntities = stepTimingTarget.NumEntities + emailTemplatesList.Count; #endregion #region Combine All for Report CSV // If it is the first one, clear out the combined folder if (reportFolderCleaned == false) { FileIOHelper.DeleteFolder(FilePathMap.ControllerSettingsReportFolderPath()); Thread.Sleep(1000); FileIOHelper.CreateFolder(FilePathMap.ControllerSettingsReportFolderPath()); reportFolderCleaned = true; } // Append all the individual report files into one if (File.Exists(FilePathMap.ControllerSettingsIndexFilePath(jobTarget)) == true && new FileInfo(FilePathMap.ControllerSettingsIndexFilePath(jobTarget)).Length > 0) { FileIOHelper.AppendTwoCSVFiles(FilePathMap.ControllerSettingsReportFilePath(), FilePathMap.ControllerSettingsIndexFilePath(jobTarget)); } if (File.Exists(FilePathMap.HTTPTemplatesIndexFilePath(jobTarget)) == true && new FileInfo(FilePathMap.HTTPTemplatesIndexFilePath(jobTarget)).Length > 0) { FileIOHelper.AppendTwoCSVFiles(FilePathMap.HTTPTemplatesReportFilePath(), FilePathMap.HTTPTemplatesIndexFilePath(jobTarget)); } if (File.Exists(FilePathMap.EmailTemplatesIndexFilePath(jobTarget)) == true && new FileInfo(FilePathMap.EmailTemplatesIndexFilePath(jobTarget)).Length > 0) { FileIOHelper.AppendTwoCSVFiles(FilePathMap.EmailTemplatesReportFilePath(), FilePathMap.EmailTemplatesIndexFilePath(jobTarget)); } #endregion } catch (Exception ex) { logger.Warn(ex); loggerConsole.Warn(ex); return(false); } finally { stopWatchTarget.Stop(); this.DisplayJobTargetEndedStatus(jobConfiguration, jobTarget, i + 1, stopWatchTarget); stepTimingTarget.EndTime = DateTime.Now; stepTimingTarget.Duration = stopWatchTarget.Elapsed; stepTimingTarget.DurationMS = stopWatchTarget.ElapsedMilliseconds; List <StepTiming> stepTimings = new List <StepTiming>(1); stepTimings.Add(stepTimingTarget); FileIOHelper.WriteListToCSVFile(stepTimings, new StepTimingReportMap(), FilePathMap.StepTimingReportFilePath(), true); } i++; } return(true); } catch (Exception ex) { logger.Error(ex); loggerConsole.Error(ex); return(false); } finally { stopWatch.Stop(); this.DisplayJobStepEndedStatus(jobConfiguration, stopWatch); stepTimingFunction.EndTime = DateTime.Now; stepTimingFunction.Duration = stopWatch.Elapsed; stepTimingFunction.DurationMS = stopWatch.ElapsedMilliseconds; List <StepTiming> stepTimings = new List <StepTiming>(1); stepTimings.Add(stepTimingFunction); FileIOHelper.WriteListToCSVFile(stepTimings, new StepTimingReportMap(), FilePathMap.StepTimingReportFilePath(), true); } }
public BaseController(ControllerSetting controllerSetting) { Assert.IsNotNull(controllerSetting, "controllerSetting != null"); Assert.IsNotNull(controllerSetting.CurrentRuntime, "controllerSetting.CurrentRuntime != null"); this.CurrentRuntime = controllerSetting.CurrentRuntime; }