protected override void Process([NotNull] ProcessorArgs args) { Install9Args arguments = (Install9Args)args; if (!arguments.Tasker.UnInstall || arguments.ScriptsOnly) { this.Skip(); return; } InstallParam sqlDbPrefixParam = arguments.Tasker.GlobalParams.FirstOrDefault(p => p.Name == "SqlDbPrefix"); if (sqlDbPrefixParam != null && !string.IsNullOrEmpty(sqlDbPrefixParam.Value)) { foreach (SitecoreEnvironment sitecoreEnvironment in SitecoreEnvironmentHelper.SitecoreEnvironments) { if (sitecoreEnvironment.Name == sqlDbPrefixParam.Value) { SitecoreEnvironmentHelper.SitecoreEnvironments.Remove(sitecoreEnvironment); SitecoreEnvironmentHelper.SaveSitecoreEnvironmentData(SitecoreEnvironmentHelper.SitecoreEnvironments); return; } } } }
private void AddEnvironment(SitecoreEnvironment environment) { foreach (SitecoreEnvironment se in SitecoreEnvironmentHelper.SitecoreEnvironments) { if (se.Name == environment.Name) { return; } } SitecoreEnvironmentHelper.SitecoreEnvironments.Add(environment); SitecoreEnvironmentHelper.SaveSitecoreEnvironmentData(SitecoreEnvironmentHelper.SitecoreEnvironments); }
private void AddSitecoreEnvironment(SitecoreEnvironment sitecoreEnvironment) { // Do not add new Sitecore environment if its name already exists in the Environments.json file foreach (SitecoreEnvironment se in SitecoreEnvironmentHelper.SitecoreEnvironments) { if (se.Name == sitecoreEnvironment.Name) { return; } } SitecoreEnvironmentHelper.SitecoreEnvironments.Add(sitecoreEnvironment); SitecoreEnvironmentHelper.SaveSitecoreEnvironmentData(SitecoreEnvironmentHelper.SitecoreEnvironments); }
protected override void Process([NotNull] ProcessorArgs arguments) { Assert.ArgumentNotNull(arguments, "arguments"); DeleteContainersArgs args = (DeleteContainersArgs)arguments; Assert.ArgumentNotNull(args, "args"); Guid environmentId = args.EnvironmentId; SitecoreEnvironment environment; if (!SitecoreEnvironmentHelper.TryGetEnvironmentById(environmentId, out environment)) { // TODO: log warn message if the env cannot be resolved from the environments.json return; } SitecoreEnvironmentHelper.SitecoreEnvironments.Remove(environment); SitecoreEnvironmentHelper.SaveSitecoreEnvironmentData(SitecoreEnvironmentHelper.SitecoreEnvironments); return; }