public void OnClick(Window mainWindow, Instance instance) { Assert.ArgumentNotNull(mainWindow, "mainWindow"); var instances = InstanceManager.PartiallyCachedInstances ?? InstanceManager.Instances; Assert.IsNotNull(instances, "instances"); var otherInstances = instances.Where(x => x.ID != instance.ID); foreach (var otherInstance in otherInstances) { if (otherInstance == null) { continue; } try { var processIds = otherInstance.ProcessIds; foreach (var processId in processIds) { var process = Process.GetProcessById(processId); Log.Info("Killing process " + processId, this); process.Kill(); } } catch (Exception ex) { Log.Warn("An error occurred", this, ex); } } }
public void OnClick(Window mainWindow, Instance instance) { Assert.ArgumentNotNull(mainWindow, "mainWindow"); var instances = InstanceManager.Instances; Assert.IsNotNull(instances, "instances"); var otherInstances = instances.Where(x => x.ID != instance.ID); foreach (var otherInstance in otherInstances) { try { if (otherInstance == null) { continue; } Log.Info("Recycling instance " + otherInstance, this); otherInstance.Recycle(); } catch (Exception ex) { Log.Warn("An error occurred", this, ex); } } }
public void OnClick(Window mainWindow, Instance instance) { if (EnvironmentHelper.CheckSqlServer()) { WindowHelper.ShowDialog(new DatabasesDialog(), mainWindow); } }
public static void CopyAgentFiles(Instance instance) { Assert.ArgumentNotNull(instance, "instance"); string agent = Path.Combine(instance.WebRootPath, AgentHelper.AgentPath); FileSystem.FileSystem.Local.Directory.Ensure(agent); var files = new[] { new { FileName = PublishAgentFiles.PublishFileName, Contents = PublishAgentFiles.PublishContents }, new { FileName = PublishAgentFiles.StatusFileName, Contents = PublishAgentFiles.StatusContents } }; foreach (var file in files) { string targetFilePath = Path.Combine(agent, file.FileName); FileSystem.FileSystem.Local.Directory.DeleteIfExists(targetFilePath); FileSystem.FileSystem.Local.File.WriteAllText(targetFilePath, file.Contents); } }
public void OnClick(Window mainWindow, Instance instance) { Analytics.TrackEvent("Refresh"); using (new ProfileSection("Refresh main window instances", this)) { ProfileSection.Argument("mainWindow", mainWindow); ProfileSection.Argument("instance", instance); var refreshMode = this.GetMode(mainWindow); switch (refreshMode) { case RefreshMode.Instances: MainWindowHelper.RefreshInstances(); return; case RefreshMode.Installer: MainWindowHelper.RefreshInstaller(); return; case RefreshMode.Caches: MainWindowHelper.RefreshCaches(); return; case RefreshMode.Everything: MainWindowHelper.RefreshEverything(); return; } } }
private static void DoUpdateLicense(string licenseFilePath, Instance instance) { if (instance != null) { try { FileSystem.FileSystem.Local.File.Copy(licenseFilePath, instance.LicencePath, true); } catch (Exception ex) { Log.Error(ex.Message, typeof(LicenseUpdater), ex); } } else { foreach (Instance inst in InstanceManager.Instances) { try { FileSystem.FileSystem.Local.File.Copy(licenseFilePath, inst.LicencePath, true); } catch (Exception ex) { Log.Error(ex.Message, typeof(LicenseUpdater), ex); } } } }
public void OnClick(Window mainWindow, Instance instance) { if (FileSystem.FileSystem.Local.Directory.Exists(ProfileManager.Profile.LocalRepository)) { WizardPipelineManager.Start("download8", mainWindow, null, null, MainWindowHelper.RefreshInstaller, WindowsSettings.AppDownloaderSdnUserName.Value, WindowsSettings.AppDownloaderSdnPassword.Value); } }
public void OnClick(Window mainWindow, Instance instance) { Assert.ArgumentNotNull(mainWindow, "mainWindow"); if (instance == null) { Run(mainWindow, string.Empty); return; } var ids = (instance.ProcessIds ?? new int[0]).ToArray(); if (ids.Length == 0) { WindowHelper.HandleError("No running w3wp processes for this Sitecore instance", false); return; } foreach (var id in ids) { var defaultValue = id.ToString(CultureInfo.InvariantCulture); if (Run(mainWindow, defaultValue)) { return; } } }
public ClickDetailsWrapper(MouseClickInformation clickDetails, Instance instance, EventArgs rawArgs) { this.ClickDetails = clickDetails; this.Instance = instance; this.RawArgs = rawArgs; this.IsInstanceClick = instance != null; }
protected virtual Image GetIconForInstance(Instance instance) { string version = instance.Product.ShortVersion; string instanceName = instance.Name; if (this.InternalCache.ContainsKey(instanceName)) { return this.InternalCache[instanceName]; } Image resolvedImage = null; if (!version.IsNullOrEmpty() && version.Length > 1) { var shortVersion = version.Substring(0, 2); var resolvedIcon = MultisourceResourcesManager.GetIconResource("sc" + shortVersion, null); if (resolvedIcon != null) { resolvedImage = resolvedIcon.ToBitmap(); } } if (resolvedImage == null && this.DefaultIcon != null) { resolvedImage = this.DefaultIcon.ToBitmap(); } this.InternalCache.Add(instanceName, resolvedImage); return resolvedImage; }
public ReinstallArgs(Instance instance, SqlConnectionStringBuilder connectionString, string license, string webServerIdentity, bool serverSideRedirect) { this.ConnectionString = connectionString; this.Name = instance.Name; this.Bindings = instance.Bindings; this.Product = instance.Product; this.WebRootPath = instance.WebRootPath; this.RootPath = instance.RootPath; this.DataFolderPath = instance.DataFolderPath; this.DatabasesFolderPath = Path.Combine(this.RootPath, "Databases"); this.WebServerIdentity = webServerIdentity; this.LicenseFilePath = license; this.Modules = new Product[0]; this.IsClassic = instance.IsClassic; this.Is32Bit = instance.Is32Bit; this.ForceNetFramework4 = instance.IsNetFramework4; this.ServerSideRedirect = serverSideRedirect; this.TempFolder = Path.Combine(this.RootPath, "Temp"); this.InstanceDatabases = instance.AttachedDatabases; this.instanceName = instance.Name; this.StopInstance = instance.Stop; this.WebsiteID = instance.ID; var executionTimeout = UpdateWebConfigHelper.GetHttpRuntime(instance.GetWebResultConfig()).GetAttribute("executionTimeout"); this.IncreaseExecutionTimeout = string.IsNullOrEmpty(executionTimeout) || executionTimeout != "600"; }
protected override bool ProcessInstanceClickInternal(Instance instance) { if (OSShellHelper.ConfirmFileRun("Visual Studio project")) { return base.ProcessInstanceClickInternal(instance); } return true; }
public InstallModulesWizardArgs(Instance instance = null) { this.Instance = instance; if (instance != null) { this.WebRootPath = instance.WebRootPath; } }
public void OnClick(Window mainWindow, Instance instance) { if (instance != null) { var id = MainWindowHelper.GetListItemID(instance.ID); WizardPipelineManager.Start("installmodules", mainWindow, null, null, () => MainWindowHelper.MakeInstanceSelected(id), instance); } }
public void OnClick(Window mainWindow, Instance instance) { Assert.ArgumentNotNull(mainWindow, "mainWindow"); Assert.IsNotNull(instance, "instance"); InstanceHelperEx.OpenInBrowserAsAdmin(instance, mainWindow, this.VirtualPath, this.Browser, this.Params); }
public void OnClick(Window mainWindow, Instance instance) { if (instance != null) { var id = MainWindowHelper.GetListItemID(instance.ID); WizardPipelineManager.Start("export", mainWindow, new ExportArgs(instance, false, true, true, true, false, false, false, false, false), null, () => MainWindowHelper.MakeInstanceSelected(id), instance, string.Empty); } }
public static string CreateAuthFile(Instance instance, string url = null) { url = url ?? GenerateAuthUrl(); var destFileName = Path.Combine(instance.WebRootPath, url.TrimStart('/')); CreateFile(destFileName); return destFileName; }
public void OnClick(Window mainWindow, Instance instance) { var result = WindowHelper.ShowDialog<SettingsDialog>(null, mainWindow); if (result != null) { MainWindowHelper.Initialize(); } }
public void OnClick(Window mainWindow, Instance instance) { WindowHelper.ShowDialog<SettingsDialog>(null, mainWindow); if (!LifeManager.IsRestarting) { MainWindowHelper.Initialize(); } }
public static void Browse(Instance instance, string virtualPath, bool isFrontEnd, string browser, string[] parameters) { string url = instance.GetUrl(); if (!string.IsNullOrEmpty(url)) { url += '/' + virtualPath.TrimStart('/'); CoreApp.OpenInBrowser(url, isFrontEnd, browser, parameters); } }
public void OnClick(Window mainWindow, Instance instance) { Assert.ArgumentNotNull(mainWindow, "mainWindow"); if (instance != null) { InstanceHelperEx.OpenCurrentLogFile(instance, mainWindow, this.logFileType); } }
public void OnClick(Window mainWindow, Instance instance) { if (instance != null) { var args = new RestoreArgs(instance); var id = MainWindowHelper.GetListItemID(instance.ID); WizardPipelineManager.Start("restore", mainWindow, args, null, () => MainWindowHelper.MakeInstanceSelected(id), instance); } }
public static void Update(Window mainWindow, Instance instance) { if (instance != null) { const string current = "Selected instance"; const string all = "All instances"; var options = new[] { current, all }; var result = WindowHelper.AskForSelection(Title, null, "You have selected \"{0}\" Sitecore instance. \nWould you like to update the license file only there?".FormatWith(instance.Name), options, mainWindow); if (result == null) { return; } if (result == all) { instance = null; } } string filePath = ProfileManager.Profile.License; const string settings = "Definied in settings"; const string custom = "Another license file"; var options2 = new[] { settings, custom }; var result2 = WindowHelper.AskForSelection(Title, null, "Which license file would you like to use?", options2, mainWindow); if (result2 == null) { return; } if (result2 == custom) { var openDialog = new OpenFileDialog { Filter = @"License files|*.xml" }; if (openDialog.ShowDialog() != System.Windows.Forms.DialogResult.OK) { return; } filePath = openDialog.FileName; } WindowHelper.LongRunningTask(() => DoUpdateLicense(filePath, instance), "Updating license...", mainWindow); }
public static string GetInstanceRoot(Instance instance) { if (TPPKAdvancedSettings.TPPKFastRootEvaluation.Value) { return Path.GetDirectoryName(instance.WebRootPath); } return instance.RootPath; }
public InstallModulesArgs([NotNull] Instance instance, [NotNull] IEnumerable<Product> modules, [CanBeNull] SqlConnectionStringBuilder connectionString = null) { Assert.ArgumentNotNull(instance, "instance"); Assert.ArgumentNotNull(modules, "modules"); this.Modules = modules; this.ConnectionString = connectionString; this.Instance = instance; this.instanceName = instance.Name; }
public void OnClick(Window mainWindow, Instance instance) { Analytics.TrackEvent("Backup"); if (instance != null) { var id = MainWindowHelper.GetListItemID(instance.ID); WizardPipelineManager.Start("backup", mainWindow, new BackupArgs(instance), null, () => MainWindowHelper.MakeInstanceSelected(id), instance); } }
public static void Publish(Instance instance) { Assert.ArgumentNotNull(instance, "instance"); string publishUrl = AgentHelper.GetUrl(instance, PublishAgentFiles.PublishFileName); string statusUrl = AgentHelper.GetUrl(instance, PublishAgentFiles.StatusFileName); ExecuteAgent(AgentFiles.StatusFileName, statusUrl, PublishAgentFiles.PublishFileName, publishUrl); }
public static void OpenCurrentInstanceLog(Instance instance) { try { new OpenCurrentLogButton().OnClick(MainWindow, instance); } catch { } }
public void OnClick(Window mainWindow, Instance instance) { using (new ProfileSection("Refresh main window instances", this)) { ProfileSection.Argument("mainWindow", mainWindow); ProfileSection.Argument("instance", instance); MainWindowHelper.RefreshEverything(); } }
public void OnClick(Window mainWindow, Instance instance) { if (instance != null) { var connectionString = ProfileManager.GetConnectionString(); var args = new DeleteArgs(instance, connectionString); args.OnCompleted += () => mainWindow.Dispatcher.Invoke(new Action(() => this.OnPipelineCompleted(args.RootPath))); var index = MainWindowHelper.GetListItemID(instance.ID); WizardPipelineManager.Start("delete", mainWindow, args, null, () => OnWizardCompleted(index)); } }