/// <summary> /// Validate the object. /// </summary> /// <exception cref="ValidationException"> /// Thrown if validation fails /// </exception> public override void Validate() { base.Validate(); if (MasterProfile == null) { throw new ValidationException(ValidationRules.CannotBeNull, "MasterProfile"); } if (AgentPoolProfiles == null) { throw new ValidationException(ValidationRules.CannotBeNull, "AgentPoolProfiles"); } if (LinuxProfile == null) { throw new ValidationException(ValidationRules.CannotBeNull, "LinuxProfile"); } if (OrchestratorProfile != null) { OrchestratorProfile.Validate(); } if (CustomProfile != null) { CustomProfile.Validate(); } if (ServicePrincipalProfile != null) { ServicePrincipalProfile.Validate(); } if (MasterProfile != null) { MasterProfile.Validate(); } if (AgentPoolProfiles != null) { foreach (var element in AgentPoolProfiles) { if (element != null) { element.Validate(); } } } if (WindowsProfile != null) { WindowsProfile.Validate(); } if (LinuxProfile != null) { LinuxProfile.Validate(); } if (DiagnosticsProfile != null) { DiagnosticsProfile.Validate(); } }
private void Initialize() { try { Util.WriteToChat("Loading profile"); //Find profiles MasterProfile = Profile.GetProfile(); CharProfile = MasterProfile.GetCharacterProfile(); //Set up command parser SetupCommandParser(); //Start experience policy CharProfile.Policy.Start(MasterProfile.Interval); //Start spell manager spellManager = new SpellTabManager(); spellManager.Start(MasterProfile.Interval); //Watch for changes to profiles masterProfileWatcher = new FileSystemWatcher() { Path = System.IO.Path.GetDirectoryName(Profile.ConfigurationPath), Filter = System.IO.Path.GetFileName(Profile.ConfigurationPath), EnableRaisingEvents = true, NotifyFilter = NotifyFilters.LastWrite, }; charProfileWatcher = new FileSystemWatcher() { Path = System.IO.Path.GetDirectoryName(CharProfile.Path), Filter = System.IO.Path.GetFileName(CharProfile.Path), EnableRaisingEvents = true, NotifyFilter = NotifyFilters.LastWrite, }; if (isFirstLogin) { //Run login commands CharProfile.ExecuteLoginCommands(); //Add events if they haven't already been added Globals.Core.CommandLineText += Core_CommandLineText; masterProfileWatcher.Changed += RequestReload; charProfileWatcher.Changed += RequestReload; isFirstLogin = false; } } catch (Exception ex) { Util.LogError(ex); } }