private void LoadJexus() { if (!File.Exists(DialogHelper.ListJexus)) { return; } var lines = File.ReadAllLines(DialogHelper.ListJexus); foreach (var item in lines) { var parts = item.Split(','); var data = ServerTreeNode.CreateJexusNode( _serviceContainer, name: parts[0], hostName: parts[1], credentials: parts[4], hash: parts[2], server: null, isLocalhost: bool.Parse(parts[3])); RegisterServer(data); } }
internal void ConnectToServer() { var names = new List <string>(); GetAllServers(names, treeView1.Nodes); var dialog = new ConnectionWizard(_serviceContainer, names.ToArray()); if (dialog.ShowDialog(this) != DialogResult.OK) { return; } var data = (ConnectionWizardData)dialog.WizardData; ServerTreeNode node; if (data.Mode == WorkingMode.Jexus) { node = ServerTreeNode.CreateJexusNode( _serviceContainer, data.Name, data.HostName, data.UserName + "|" + data.Password, data.CertificateHash, data.Server, isLocalhost: true); var path = Path.GetTempFileName(); var random = Guid.NewGuid().ToString(); File.WriteAllText(path, random); node.IsLocalhost = AsyncHelper.RunSync(() => ((JexusServerManager)node.ServerManager).LocalhostTestAsync(path, random)); data.Server.IsLocalhost = node.IsLocalhost; } else { node = ServerTreeNode.CreateIisExpressNode( _serviceContainer, data.Name, data.FileName, data.Server, ignoreInCache: false); } try { RegisterServer(node); // TODO: trigger the load in connection wizard to throw exception earlier. node.LoadServer(cmsApplicationPools, cmsSites, cmsSite); actSave.Enabled = true; } catch (Exception ex) { RollbarLocator.RollbarInstance.Error(ex); File.WriteAllText(DialogHelper.DebugLog, ex.ToString()); var last = ex; while (last is AggregateException) { last = last.InnerException; } var message = new StringBuilder(); message.AppendLine("Could not connect to the specified computer.") .AppendLine() .AppendFormat("Details: {0}", last?.Message); MessageBox.Show(message.ToString(), Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } }