private void next_Click(object sender, EventArgs e) { #region validation if (serverName.Text == "") { Dialogs.Error.Show("ErrorNoServerName"); return; } if (engineSelect.SelectedItem == null) { Dialogs.Error.Show("ErrorNoEngine"); return; } if (this.versionSelect.SelectedItem == null) { Dialogs.Error.Show("ErrorNoVersion"); return; } if (selectDirectory.SelectedPath == "") { Dialogs.Error.Show("ErrorNoDirectory"); return; } if (selectJar.FileName == "") { Dialogs.Error.Show("ErrorNoJar"); return; } #endregion Data.Server data = new Data.Server(); data.engine = engineSelect.SelectedItem.ToString(); data.name = serverName.Text; data.version = versionSelect.SelectedItem.ToString(); data.path = selectDirectory.SelectedPath; data.jarPath = selectJar.FileName; data.isImported = true; if (File.Exists(data.GetFile())) { Dialogs.Error.Show("ErrorServerExists"); return; } data.Save(); this.Enabled = false; tabs.mainWindow.serversTree.FullRefresh(); }
private void DownloadProgressCompleted(object sender, AsyncCompletedEventArgs e) { if (e.Cancelled && File.Exists(ServerDirectory + "server.jar")) { Directory.Delete(ServerDirectory, true); return; } if (e.Error != null) { Error.Show("DownloadErrorServer"); Directory.Delete(ServerDirectory, true); File.Delete(EngineFile); return; } ServerData.Save(); StreamWriter file = File.CreateText(ServerDirectory + "eula.txt"); file.Write("eula=true"); file.Close(); this.readyButton.Text = Language.GetString("DownloadFinished"); new Computer().FileSystem.CopyFile(EngineFile, ServerData.GetDirectory() + "server.jar", UIOption.AllDialogs); this.tabs.mainWindow.serversTree.FullRefresh(); }
public bool Save() { dServer = new Data.Server(); if (_serverID == "") { _serverID = dServer.Save(Host, DBName, UserName, Password, Port, ServerName); if (_serverID != "") { Tz.Deployment.Setup s = new Tz.Deployment.Setup(); s.ExecuteClientSetup(Connection()); return(true); } else { return(false); } } else { if (dServer.Update(ServerID, Host, DBName, UserName, Password, Port, ServerName)) { return(true); } else { return(false); } } }