/// <summary> /// Add common setup action (will be always called during Setup phase) /// </summary> /// <param name="action">Action delegate</param> public void Configure(Action action) { if (action == null) { throw new ArgumentNullException(nameof(action)); } SetupActions.Add(new AppSetupAction(action, AppEnv.All)); }
/// <summary> /// Add an action for specific <para>environments</para> (will be called only /// for given envronements during setup phase) /// </summary> /// <param name="action">Action delegate</param> /// <param name="appEnv">AppEnv instance</param> public void ConfigureFor(AppEnv appEnv, Action action) { if (action == null) { throw new ArgumentNullException(nameof(action)); } if (appEnv == null) { throw new ArgumentNullException(nameof(appEnv)); } SetupActions.Add(new AppSetupAction(action, appEnv)); }
public void LoadActions() { if (Type == SlideType.Action) { try { List <string> parts = new List <string>(); using (StreamReader sr = new StreamReader(Source)) { string text = sr.ReadToEnd(); var commands = text.Split(";", StringSplitOptions.RemoveEmptyEntries).Select(s => (s + ";").Trim()); parts = commands.ToList(); } Title = "AUTO SEQ"; foreach (var part in parts) { // parse into commands if (part == ";") { } else if (part.StartsWith("!")) { if (part == ("!fullauto;")) { AutoOnly = true; } } else if (part.StartsWith("@")) { var a = AutomationAction.Parse(part.Remove(0, 1)); SetupActions.Add(a); } else if (part.StartsWith("#")) { var title = Regex.Match(part, @"#(?<title>.*);").Groups["title"].Value; Title = title; } else { var a = AutomationAction.Parse(part); Actions.Add(a); } } } catch (Exception) { } } }
/// <summary> /// Reigsters a new pre-deployment action for instances of the current service. /// </summary> /// <param name="action">An action to perform before deploying this service.</param> /// <returns>The current service manager.</returns> public IServiceManager RegisterSetupAction(IServiceAction action) { SetupActions.Add(action.Run); return(this); }