public void proc_HasExited(object sender, EventArgs e) { string loginn = procnamecfg(handler.loginexepath); string charr = procnamecfg(handler.charexepath); string mapp = procnamecfg(handler.mapexepath); Process cproc = ((Process)sender); string switchval = cproc.ProcessName.ToLower(); if (switchval == loginn.ToLower()) { Invoke(new MethodInvoker(delegate { RTBLogin.AppendText(">>Login Server - stopped<<" + Environment.NewLine); })); } if (switchval == charr.ToLower()) { Invoke(new MethodInvoker(delegate { RTBChar.AppendText(">>Char Server - stopped<<" + Environment.NewLine); })); } if (switchval == mapp.ToLower()) { Invoke(new MethodInvoker(delegate { RTBMap.AppendText(">>Map Server - stopped<<" + Environment.NewLine); })); } }
public void proc_DataReceived(object sender, DataReceivedEventArgs e) { if (e.Data != null) { string loginn = procnamecfg(handler.loginexepath); string charr = procnamecfg(handler.charexepath); string mapp = procnamecfg(handler.mapexepath); Process cproc = ((Process)sender); string switchval = cproc.ProcessName.ToLower(); if (switchval == loginn.ToLower()) { Invoke(new MethodInvoker(delegate { #region information if (e.Data.Contains("[Error]")) { frm_errorlog.tb_errors.AppendText("[Login][" + Convert.ToString(DateTime.Now.TimeOfDay.Hours + ":" + DateTime.Now.TimeOfDay.Minutes) + "] " + e.Data + Environment.NewLine); errormsgs = errormsgs + 1; lb_error.Text = "Error: " + errormsgs; } else if (e.Data.Contains("[Debug]")) { debugmsgs = debugmsgs + 1; lb_debug.Text = "Debug: " + debugmsgs; } else if (e.Data.Contains("[SQL]")) { sqlmsgs = sqlmsgs + 1; lb_sql.Text = "SQL: " + sqlmsgs; } else if (e.Data.Contains("[Warning]")) { warnmsgs = warnmsgs + 1; lb_warnings.Text = "Warning: " + warnmsgs; } else if (e.Data.Contains("set users")) { try { if (handler.colorOLDREV) { string[] playercount = e.Data.Split(new Char[] { ':' }); lb_users.Text = playercount[3]; } else { string[] playercount = e.Data.Split(new Char[] { ':' }); lb_users.Text = playercount[2]; } } catch { lb_users.Text = "-GetFail-"; } } #endregion if (handler.colorMODE) { if (!handler.colorOLDREV) { #region Color Text REV 16400+ if (e.Data.Contains("[Status]")) { handler.AppendText(RTBLogin, "[Status]", handler.Status); String OriEData = e.Data; String NewEData = OriEData.Remove(0, 8); RTBLogin.AppendText(NewEData + Environment.NewLine); } else if (e.Data.Contains("[Info]")) { handler.AppendText(RTBLogin, "[Info]", handler.Info); String OriEData = e.Data; String NewEData = OriEData.Remove(0, 6); RTBLogin.AppendText(NewEData + Environment.NewLine); } else if (e.Data.Contains("[Notice]")) { handler.AppendText(RTBLogin, "[Notice]", handler.Notice); String OriEData = e.Data; String NewEData = OriEData.Remove(0, 8); RTBLogin.AppendText(NewEData + Environment.NewLine); } else if (e.Data.Contains("[Warning]")) { handler.AppendText(RTBLogin, "[Warning]", handler.Warning); String OriEData = e.Data; String NewEData = OriEData.Remove(0, 9); RTBLogin.AppendText(NewEData + Environment.NewLine); } else if (e.Data.Contains("[Error]")) { handler.AppendText(RTBLogin, "[Error]", handler.Error); String OriEData = e.Data; String NewEData = OriEData.Remove(0, 7); RTBLogin.AppendText(NewEData + Environment.NewLine); } else if (e.Data.Contains("[SQL]")) { handler.AppendText(RTBLogin, "[SQL]", handler.SQL); String OriEData = e.Data; String NewEData = OriEData.Remove(0, 5); RTBLogin.AppendText(NewEData + Environment.NewLine); } else if (e.Data.Contains("[Debug]")) { handler.AppendText(RTBLogin, "[Debug]", handler.Debug); String OriEData = e.Data; String NewEData = OriEData.Remove(0, 7); RTBLogin.AppendText(NewEData + Environment.NewLine); } else { RTBLogin.AppendText(e.Data + Environment.NewLine); } #endregion } else { #region Color Text REV 16400- string[] RTBLs = e.Data.Split(new Char[] { ']' }); if (e.Data.Contains("[Status]")) { try { handler.AppendText(RTBLogin, "[Status]", handler.Status); RTBLogin.AppendText(RTBLs[2] + Environment.NewLine); } catch { handler.AppendText(RTBLogin, "[Status]", handler.Status); RTBLogin.AppendText(RTBLs[1] + Environment.NewLine); } } else if (e.Data.Contains("[Info]")) { try { handler.AppendText(RTBLogin, "[Info]", handler.Info); RTBLogin.AppendText(RTBLs[2] + Environment.NewLine); } catch { handler.AppendText(RTBLogin, "[Info]", handler.Info); RTBLogin.AppendText(RTBLs[1] + Environment.NewLine); } } else if (e.Data.Contains("[Notice]")) { try { handler.AppendText(RTBLogin, "[Notice]", handler.Notice); RTBLogin.AppendText(RTBLs[2] + Environment.NewLine); } catch { handler.AppendText(RTBLogin, "[Notice]", handler.Notice); RTBLogin.AppendText(RTBLs[1] + Environment.NewLine); } } else if (e.Data.Contains("[Warning]")) { try { handler.AppendText(RTBLogin, "[Warning]", handler.Warning); RTBLogin.AppendText(RTBLs[2] + Environment.NewLine); } catch { handler.AppendText(RTBLogin, "[Warning]", handler.Warning); RTBLogin.AppendText(RTBLs[1] + Environment.NewLine); } } else if (e.Data.Contains("[Error]")) { try { handler.AppendText(RTBLogin, "[Error]", handler.Error); RTBLogin.AppendText(RTBLs[2] + Environment.NewLine); } catch { handler.AppendText(RTBLogin, "[Error]", handler.Error); RTBLogin.AppendText(RTBLs[1] + Environment.NewLine); } } else if (e.Data.Contains("[SQL]")) { try { handler.AppendText(RTBLogin, "[SQL]", handler.SQL); RTBLogin.AppendText(RTBLs[2] + Environment.NewLine); } catch { handler.AppendText(RTBLogin, "[SQL]", handler.SQL); RTBLogin.AppendText(RTBLs[1] + Environment.NewLine); } } else if (e.Data.Contains("[Debug]")) { try { handler.AppendText(RTBLogin, "[Debug]", handler.Debug); RTBLogin.AppendText(RTBLs[2] + Environment.NewLine); } catch { handler.AppendText(RTBLogin, "[Debug]", handler.Debug); RTBLogin.AppendText(RTBLs[1] + Environment.NewLine); } } else { RTBLogin.AppendText(e.Data + Environment.NewLine); } #endregion } } else { RTBLogin.AppendText(e.Data + Environment.NewLine); } })); } if (switchval == charr.ToLower()) { Invoke(new MethodInvoker(delegate { #region information if (e.Data.Contains("[Error]")) { errormsgs = errormsgs + 1; lb_error.Text = "Error: " + errormsgs; frm_errorlog.tb_errors.AppendText("[Char][" + Convert.ToString(DateTime.Now.TimeOfDay.Hours + ":" + DateTime.Now.TimeOfDay.Minutes) + "] " + e.Data + Environment.NewLine); } else if (e.Data.Contains("[Debug]")) { debugmsgs = debugmsgs + 1; lb_debug.Text = "Debug: " + debugmsgs; } else if (e.Data.Contains("[SQL]")) { sqlmsgs = sqlmsgs + 1; lb_sql.Text = "SQL: " + sqlmsgs; } else if (e.Data.Contains("[Warning]")) { warnmsgs = warnmsgs + 1; lb_warnings.Text = "Warning: " + warnmsgs; } #endregion if (handler.colorMODE) { if (!handler.colorOLDREV) { #region Color Text REV 16400+ if (e.Data.Contains("[Status]")) { handler.AppendText(RTBChar, "[Status]", handler.Status); String OriEData = e.Data; String NewEData = OriEData.Remove(0, 8); RTBChar.AppendText(NewEData + Environment.NewLine); } else if (e.Data.Contains("[Info]")) { handler.AppendText(RTBChar, "[Info]", handler.Info); String OriEData = e.Data; String NewEData = OriEData.Remove(0, 6); RTBChar.AppendText(NewEData + Environment.NewLine); } else if (e.Data.Contains("[Notice]")) { handler.AppendText(RTBChar, "[Notice]", handler.Notice); String OriEData = e.Data; String NewEData = OriEData.Remove(0, 8); RTBChar.AppendText(NewEData + Environment.NewLine); } else if (e.Data.Contains("[Warning]")) { handler.AppendText(RTBChar, "[Warning]", handler.Warning); String OriEData = e.Data; String NewEData = OriEData.Remove(0, 9); RTBChar.AppendText(NewEData + Environment.NewLine); } else if (e.Data.Contains("[Error]")) { handler.AppendText(RTBChar, "[Error]", handler.Error); String OriEData = e.Data; String NewEData = OriEData.Remove(0, 7); RTBChar.AppendText(NewEData + Environment.NewLine); } else if (e.Data.Contains("[SQL]")) { handler.AppendText(RTBChar, "[SQL]", handler.SQL); String OriEData = e.Data; String NewEData = OriEData.Remove(0, 5); RTBChar.AppendText(NewEData + Environment.NewLine); } else if (e.Data.Contains("[Debug]")) { handler.AppendText(RTBChar, "[Debug]", handler.Debug); String OriEData = e.Data; String NewEData = OriEData.Remove(0, 7); RTBChar.AppendText(NewEData + Environment.NewLine); } else { RTBChar.AppendText(e.Data + Environment.NewLine); } #endregion } else { #region Color Text REV 16400- string[] RTBCs = e.Data.Split(new Char[] { ']' }); if (e.Data.Contains("[Status]")) { try { handler.AppendText(RTBChar, "[Status]", handler.Status); RTBChar.AppendText(RTBCs[2] + Environment.NewLine); } catch { handler.AppendText(RTBChar, "[Status]", handler.Status); RTBChar.AppendText(RTBCs[1] + Environment.NewLine); } } else if (e.Data.Contains("[Info]")) { try { handler.AppendText(RTBChar, "[Info]", handler.Info); RTBChar.AppendText(RTBCs[2] + Environment.NewLine); } catch { handler.AppendText(RTBChar, "[Info]", handler.Info); RTBChar.AppendText(RTBCs[1] + Environment.NewLine); } } else if (e.Data.Contains("[Notice]")) { try { handler.AppendText(RTBChar, "[Notice]", handler.Notice); RTBChar.AppendText(RTBCs[2] + Environment.NewLine); } catch { handler.AppendText(RTBChar, "[Notice]", handler.Notice); RTBChar.AppendText(RTBCs[1] + Environment.NewLine); } } else if (e.Data.Contains("[Warning]")) { try { handler.AppendText(RTBChar, "[Warning]", handler.Warning); RTBChar.AppendText(RTBCs[2] + Environment.NewLine); } catch { handler.AppendText(RTBChar, "[Warning]", handler.Warning); RTBChar.AppendText(RTBCs[1] + Environment.NewLine); } } else if (e.Data.Contains("[Error]")) { try { handler.AppendText(RTBChar, "[Error]", handler.Error); RTBChar.AppendText(RTBCs[2] + Environment.NewLine); } catch { handler.AppendText(RTBChar, "[Error]", handler.Error); RTBChar.AppendText(RTBCs[1] + Environment.NewLine); } } else if (e.Data.Contains("[SQL]")) { try { handler.AppendText(RTBChar, "[SQL]", handler.SQL); RTBChar.AppendText(RTBCs[2] + Environment.NewLine); } catch { handler.AppendText(RTBChar, "[SQL]", handler.SQL); RTBChar.AppendText(RTBCs[1] + Environment.NewLine); } } else if (e.Data.Contains("[Debug]")) { try { handler.AppendText(RTBChar, "[Debug]", handler.Debug); RTBChar.AppendText(RTBCs[2] + Environment.NewLine); } catch { handler.AppendText(RTBChar, "[Debug]", handler.Debug); RTBChar.AppendText(RTBCs[1] + Environment.NewLine); } } else { RTBChar.AppendText(e.Data + Environment.NewLine); } #endregion } } else { RTBChar.AppendText(e.Data + Environment.NewLine); } })); } if (switchval == mapp.ToLower()) { Invoke(new MethodInvoker(delegate { #region information if (e.Data.Contains("[Error]")) { frm_errorlog.tb_errors.AppendText("[Map][" + Convert.ToString(DateTime.Now.TimeOfDay.Hours + ":" + DateTime.Now.TimeOfDay.Minutes) + "] " + e.Data + Environment.NewLine); errormsgs = errormsgs + 1; lb_error.Text = "Error: " + errormsgs; } else if (e.Data.Contains("[Debug]")) { debugmsgs = debugmsgs + 1; lb_debug.Text = "Debug: " + debugmsgs; } else if (e.Data.Contains("[SQL]")) { sqlmsgs = sqlmsgs + 1; lb_sql.Text = "SQL: " + sqlmsgs; } else if (e.Data.Contains("[Warning]")) { warnmsgs = warnmsgs + 1; lb_warnings.Text = "Warning: " + warnmsgs; } #endregion if (handler.colorMODE) { #region color text if (e.Data.Contains("[Status]")) { handler.AppendText(RTBMap, "[Status]", handler.Status); String OriEData = e.Data; String NewEData = OriEData.Remove(0, 8); RTBMap.AppendText(NewEData + Environment.NewLine); } else if (e.Data.Contains("[Info]")) { handler.AppendText(RTBMap, "[Info]", handler.Info); String OriEData = e.Data; String NewEData = OriEData.Remove(0, 6); RTBMap.AppendText(NewEData + Environment.NewLine); } else if (e.Data.Contains("[Notice]")) { handler.AppendText(RTBMap, "[Notice]", handler.Notice); String OriEData = e.Data; String NewEData = OriEData.Remove(0, 8); RTBMap.AppendText(NewEData + Environment.NewLine); } else if (e.Data.Contains("[Warning]")) { handler.AppendText(RTBMap, "[Warning]", handler.Warning); String OriEData = e.Data; String NewEData = OriEData.Remove(0, 9); RTBMap.AppendText(NewEData + Environment.NewLine); } else if (e.Data.Contains("[Error]")) { handler.AppendText(RTBMap, "[Error]", handler.Error); String OriEData = e.Data; String NewEData = OriEData.Remove(0, 7); RTBMap.AppendText(NewEData + Environment.NewLine); } else if (e.Data.Contains("[SQL]")) { handler.AppendText(RTBMap, "[SQL]", handler.SQL); String OriEData = e.Data; String NewEData = OriEData.Remove(0, 5); RTBMap.AppendText(NewEData + Environment.NewLine); } else if (e.Data.Contains("[Debug]")) { handler.AppendText(RTBMap, "[Debug]", handler.Debug); String OriEData = e.Data; String NewEData = OriEData.Remove(0, 7); RTBMap.AppendText(NewEData + Environment.NewLine); } else { RTBMap.AppendText(e.Data + Environment.NewLine); } #endregion } else { RTBMap.AppendText(e.Data + Environment.NewLine); } })); } } }