private void btnTaskManager_Click(object sender, System.EventArgs e) { // Using the process class you can get access to additional information such the // modules loaded by a process. The form shown by this code illustrates this. frmTaskManager f = new frmTaskManager(); f.Show(); }
static public bool DoCommand(string _menuID, string _commandName, string _commandTitle, string _param, IApplication _application) { string _title; switch (_commandName) { case "IISRecycle": frmResetIISApp _frmIIS = MenuFunctions.AddPage <frmResetIISApp>("内存回收", _application); if (_frmIIS != null) { _frmIIS.Init("内存回收", "内存回收", _param); } break; case "WinServiceWatch": frmResetWindowsService _frmWinService = MenuFunctions.AddPage <frmResetWindowsService>("服务查看", _application); if (_frmWinService != null) { _frmWinService.Init("服务查看", "服务查看", _param); } break; case "OrganizeExtInfo": frmOrganizeExtInfo _frmOrgExt = MenuFunctions.AddPage <frmOrganizeExtInfo>("组织机构信息维护", _application); if (_frmOrgExt != null) { _frmOrgExt.Init("组织机构信息维护", "机构信息维护", _param); } break; case "UserLog": frmUserLog _rdf = new frmUserLog(); _application.AddForm("用户操作日志", _rdf); break; case "QueryLog": frmQueryLog _fql = new frmQueryLog(); _application.AddForm("数据查询日志", _fql); break; case "SystemLog": frmSystemLog _syslog = new frmSystemLog(); _application.AddForm("系统处理日志", _syslog); break; case "Notify": frmNotifyInfo _frm = MenuFunctions.AddPage <frmNotifyInfo>("通知通告", _application); if (_frm != null) { _frm.Init("通知通告", "通知通告", ""); } break; case "InterfaceManager_SJJH": frmIM_SJJH _frmIM_SJJH = MenuFunctions.AddPage <frmIM_SJJH>("数据交换接口管理", _application); if (_frmIM_SJJH != null) { _frmIM_SJJH.Init("数据交换接口管理", "数据交换接口管理", ""); } break; case "FSDataLoadAlertMailSet": //数据加载监控提示邮件设置 _title = StrUtils.GetMetaByName2("标题", _param); frmFsAlertMainSet _frmFsAlert = MenuFunctions.AddPage <frmFsAlertMainSet>(_title, _application); if (_frmFsAlert != null) { _frmFsAlert.Init(_title, "邮件设置", _param); } break; case "TaskManager": //后台任务管理器 _title = StrUtils.GetMetaByName2("标题", _param); frmTaskManager _frmTaskManager = MenuFunctions.AddPage <frmTaskManager>(_title, _application); if (_frmTaskManager != null) { _frmTaskManager.Init(_title, "任务管理", _param); } break; case "WorkCalendar": //工作日历 _title = "工作日历"; WorkCalenderForm _frmWorkCalenderForm = MenuFunctions.AddPage <WorkCalenderForm>(_title, _application); if (_frmWorkCalenderForm != null) { _frmWorkCalenderForm.Init(_title, "工作日历", _param); } break; case "GDSManager": _title = "通用接口管理"; frmGDSManager _frmGDSManager = MenuFunctions.AddPage <frmGDSManager>(_title, _application); if (_frmGDSManager != null) { _frmGDSManager.Init(_title, _title, _param); } break; } return(true); }
public void Play() { try { Dictionary <string, string> table = new Dictionary <string, string>(); string dataString = string.Empty; string[] split = null; dataString = _url; dataString = Uri.UnescapeDataString(dataString); bool encoded = Regex.IsMatch(dataString, "^[A-Za-z0-9+/=]+$", RegexOptions.IgnoreCase); if (encoded) { dataString = Encoding.UTF8.GetString(Convert.FromBase64String(dataString)); } _log.Debug("dataString = {0}", dataString); split = dataString.Split('&'); for (int i = 0; i < split.Length; i++) { string[] keyValue = split[i].Split('='); if (keyValue.Length == 2) { string key = keyValue[0]; string value = keyValue[1]; table.Add(key, value); } } for (int i = 0; i < _requiredFields.Length; i++) { if (!table.ContainsKey(_requiredFields[i])) { MessageBoxEx.Show(Program.MainForm, string.Format("One or more of the following fields was missing from the ConnectUO Url Protocol string: {0}", string.Join(" ", _requiredFields))); return; } } string idString = table[Id]; string name = table[NameTolken]; string portString = table[PortTolken]; string hostAddress = table[HostTolken]; string allowRazor; string removeEnc; string patches; bool razor = Program.Database.LaunchRazor; bool enc; if (!table.TryGetValue(AllowRazorTolken, out allowRazor)) { allowRazor = "false"; } if (!table.TryGetValue(RemoveEncTolken, out removeEnc)) { removeEnc = "true"; } if (!table.TryGetValue(PatchesTolken, out patches)) { patches = ""; } int port; int id; if (!int.TryParse(idString, out id)) { MessageBoxEx.Show(Program.MainForm, "Invalid server id."); return; } if (!int.TryParse(portString, out port) || (port > 65536 || port < 0)) { MessageBoxEx.Show(Program.MainForm, "Invalid port number, please use a valid port number between 0 and 65535"); return; } bool shardAllowsRazor; bool.TryParse(allowRazor, out shardAllowsRazor); bool.TryParse(removeEnc, out enc); //Make sure the user wants razor, and that shard allows it. razor = razor && shardAllowsRazor; if (string.IsNullOrEmpty(Program.Database.UltimaOnlineDirectory)) { MessageBoxEx.Show(Program.MainForm, "ConnectUO was unable to find the directory that Ultima Online is installed to. This must be set in order to launch the client."); return; } if (string.IsNullOrEmpty(Program.Database.UltimaOnlineExe)) { MessageBoxEx.Show(Program.MainForm, "ConnectUO was unable to find the client executable. This must be set in order to launch the client."); return; } string folderName = name; Utility.EnsureValidFolderName(ref folderName); string serverDirectory = Path.Combine(Program.Database.PatchDirectory, folderName); string[] patchFiles = null; Utility.EnsureDirectory(serverDirectory); List <ServerPatch> patchList = new List <ServerPatch>(); split = patches.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < split.Length; i++) { string[] patchVersion = split[i].Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries); if (patchVersion.Length == 2) { string patchUri = patchVersion[0]; string versionString = patchVersion[1]; int version; int.TryParse(versionString, out version); ServerPatch patch = new ServerPatch(); patch.ShardId = id; patch.PatchUrl = patchUri; patch.Version = version; if (!Program.Database.IsPatchApplied(patch)) { patchList.Add(patch); } } } if (patchList.Count > 0) { if (Program.Database.IsServerBeingPatched(id)) { MessageBoxEx.Show(Program.MainForm, String.Format("{0} is already being patched, you cannot play until the patching process has been completed", name), "ConnectUO 2.0"); return; } else { frmTaskManager taskManager = new frmTaskManager(patchList, serverDirectory); if (taskManager.ShowDialog() != System.Windows.Forms.DialogResult.OK) { return; } } } patchFiles = Directory.GetFiles(serverDirectory); ThreadPool.QueueUserWorkItem(delegate(object o) { new ConnectUOWebService().UpdatePlayStatistics(Program.Database.Guid, id); }); ClientLauncher.Launch(id, hostAddress, port, Path.Combine(Program.Database.UltimaOnlineDirectory, Program.Database.UltimaOnlineExe), Program.Database.RazorDirectory, razor, enc, Path.Combine(Program.Database.PatchDirectory, folderName), patchFiles); } catch (Exception e) { _log.Error(e); } }
public void Play() { try { Dictionary<string, string> table = new Dictionary<string, string>(); string dataString = string.Empty; string[] split = null; dataString = _url; dataString = Uri.UnescapeDataString(dataString); bool encoded = Regex.IsMatch(dataString, "^[A-Za-z0-9+/=]+$", RegexOptions.IgnoreCase); if (encoded) { dataString = Encoding.UTF8.GetString(Convert.FromBase64String(dataString)); } _log.Debug("dataString = {0}", dataString); split = dataString.Split('&'); for (int i = 0; i < split.Length; i++) { string[] keyValue = split[i].Split('='); if (keyValue.Length == 2) { string key = keyValue[0]; string value = keyValue[1]; table.Add(key, value); } } for (int i = 0; i < _requiredFields.Length; i++) { if (!table.ContainsKey(_requiredFields[i])) { MessageBoxEx.Show(Program.MainForm, string.Format("One or more of the following fields was missing from the ConnectUO Url Protocol string: {0}", string.Join(" ", _requiredFields))); return; } } string idString = table[Id]; string name = table[NameTolken]; string portString = table[PortTolken]; string hostAddress = table[HostTolken]; string allowRazor; string removeEnc; string patches; bool razor = Program.Database.LaunchRazor; bool enc; if (!table.TryGetValue(AllowRazorTolken, out allowRazor)) { allowRazor = "false"; } if (!table.TryGetValue(RemoveEncTolken, out removeEnc)) { removeEnc = "true"; } if (!table.TryGetValue(PatchesTolken, out patches)) { patches = ""; } int port; int id; if (!int.TryParse(idString, out id)) { MessageBoxEx.Show(Program.MainForm, "Invalid server id."); return; } if (!int.TryParse(portString, out port) || (port > 65536 || port < 0)) { MessageBoxEx.Show(Program.MainForm, "Invalid port number, please use a valid port number between 0 and 65535"); return; } bool shardAllowsRazor; bool.TryParse(allowRazor, out shardAllowsRazor); bool.TryParse(removeEnc, out enc); //Make sure the user wants razor, and that shard allows it. razor = razor && shardAllowsRazor; if (string.IsNullOrEmpty(Program.Database.UltimaOnlineDirectory)) { MessageBoxEx.Show(Program.MainForm, "ConnectUO was unable to find the directory that Ultima Online is installed to. This must be set in order to launch the client."); return; } if (string.IsNullOrEmpty(Program.Database.UltimaOnlineExe)) { MessageBoxEx.Show(Program.MainForm, "ConnectUO was unable to find the client executable. This must be set in order to launch the client."); return; } string folderName = name; Utility.EnsureValidFolderName(ref folderName); string serverDirectory = Path.Combine(Program.Database.PatchDirectory, folderName); string[] patchFiles = null; Utility.EnsureDirectory(serverDirectory); List<ServerPatch> patchList = new List<ServerPatch>(); split = patches.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < split.Length; i++) { string[] patchVersion = split[i].Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries); if (patchVersion.Length == 2) { string patchUri = patchVersion[0]; string versionString = patchVersion[1]; int version; int.TryParse(versionString, out version); ServerPatch patch = new ServerPatch(); patch.ShardId = id; patch.PatchUrl = patchUri; patch.Version = version; if (!Program.Database.IsPatchApplied(patch)) { patchList.Add(patch); } } } if (patchList.Count > 0) { if (Program.Database.IsServerBeingPatched(id)) { MessageBoxEx.Show(Program.MainForm, String.Format("{0} is already being patched, you cannot play until the patching process has been completed", name), "ConnectUO 2.0"); return; } else { frmTaskManager taskManager = new frmTaskManager(patchList, serverDirectory); if (taskManager.ShowDialog() != System.Windows.Forms.DialogResult.OK) { return; } } } patchFiles = Directory.GetFiles(serverDirectory); ThreadPool.QueueUserWorkItem(delegate(object o) { new ConnectUOWebService().UpdatePlayStatistics(Program.Database.Guid, id); }); ClientLauncher.Launch(id, hostAddress, port, Path.Combine(Program.Database.UltimaOnlineDirectory, Program.Database.UltimaOnlineExe), Program.Database.RazorDirectory, razor, enc, Path.Combine(Program.Database.PatchDirectory, folderName), patchFiles); } catch (Exception e) { _log.Error(e); } }