public virtual void logEvent(String messageBody, Event.EVENT_FLAGS Flags) { if ((Flags & Event.EVENT_FLAGS.DEBUG) != 0) { //This is a debug message #if DEBUG if (!(messageBody[messageBody.IndexOf("/") + 1] == 's')) { logEvent(messageBody, Flags ^ Event.EVENT_FLAGS.DEBUG); } #endif } else { Event thisevent = new Event(messageBody, Flags); if (shouldWriteOut(messageBody, Flags)) { writeLogOut(thisevent.ToString()); } events.Add(thisevent); if (LoggedNewEvent != null) { LoggedNewEvent(thisevent); } } }
public virtual void logEvent(String[] messageBody, Event.EVENT_FLAGS Flags) { StringBuilder total = new StringBuilder(); for (int i = 0; i < messageBody.Length; i++) { total.AppendLine(messageBody[i]); } logEvent(total.ToString(), Flags); }
public override void logEvent(string messageBody, Event.EVENT_FLAGS Flags) { if (App.MainWin == null) { base.logEvent(messageBody, Flags); return; } if ((Flags & Event.EVENT_FLAGS.IMPORTANT) != 0) { App.MainWin.Dispatcher.Invoke(() => { App.MainWin.notifyIcon.BalloonTipClicked += baloonClick; App.MainWin.notifyIcon.ShowBalloonTip(2000, "Important!", messageBody, System.Windows.Forms.ToolTipIcon.Info); }); } App.MainWin.Dispatcher.Invoke(new Action(() => base.logEvent(messageBody, Flags))); }
public void StopServer(bool showMessage) { try { server.kill(); } catch (NullReferenceException) { } cmdStartServer.Visibility = Visibility.Visible; cmdStopServer.Visibility = Visibility.Hidden; lblServerStatus.Text = "The server is.. Stopped."; Event.EVENT_FLAGS flags = Event.EVENT_FLAGS.NORMAL; if (showMessage) { flags |= Event.EVENT_FLAGS.IMPORTANT; } App.Log.logEvent("The server has been killed.", flags); }
//protected override void OnActivated(EventArgs e) //{ // notifyIcon.Visible = false; // base.OnActivated(e); //} public void StartServer(bool showMessage) { server = new myTcpServer(App.Config.SERVER_PORT); try { server.start(); string currentIP; if (!App.Config.ipAddress.Equals((currentIP = TCPserver.getLocalIP().ToString().Trim()))) { App.Log.logEvent("The IP address of this computer has changed!! Take note of the new IP (erase your bookmark and add): " + currentIP, Event.EVENT_FLAGS.IMPORTANT); App.Config.ipAddress = currentIP; App.serialize(App.Config); } this.lblAddress.Text = currentIP; if (App.Config.SERVER_PORT != 80) { lblAddress.Text += ":" + App.Config.SERVER_PORT; } cmdStartServer.Visibility = Visibility.Hidden; cmdStopServer.Visibility = Visibility.Visible; lblServerStatus.Text = "The server is.. Started."; Event.EVENT_FLAGS flags = Event.EVENT_FLAGS.NORMAL; if (showMessage) { flags |= Event.EVENT_FLAGS.IMPORTANT; } App.Log.logEvent("The server has been started.", flags); } catch (NetworkException ex) { App.Log.logEvent(ex.Message, Event.EVENT_FLAGS.IMPORTANT); } catch (SocketException exception) { App.Log.logEvent("critical error: " + exception.Message + "\r\n" + exception.StackTrace.ToString(), Event.EVENT_FLAGS.IMPORTANT); } }
public virtual bool shouldWriteOut(string message, Event.EVENT_FLAGS Flags) { return((Flags & Event.EVENT_FLAGS.NOLOG) != Event.EVENT_FLAGS.NOLOG); }
public override bool shouldWriteOut(string message, Event.EVENT_FLAGS Flags) { return((Flags & Event.EVENT_FLAGS.IMPORTANT) != 0); }