Exemplo n.º 1
0
        public void ProcessEvent(EventType etType, CapturableEvents ceEvent, params string[] a_strMessageParams)
        {
            if (this.CapturedEvents.Contains(ceEvent) == true)
            {
                DateTime dtLoggedTime = DateTime.Now; // UtcNow.AddHours(m_prcClient.Game.UTCoffset).ToLocalTime();
                string   strEventText = String.Empty;

                if (this.m_prcClient.Language.LocalizedExists("uscEvents.lsvEvents." + ceEvent.ToString()) == true)
                {
                    strEventText = this.m_prcClient.Language.GetLocalized("uscEvents.lsvEvents." + ceEvent.ToString(), a_strMessageParams);
                }

                CapturedEvent newCapture = new CapturedEvent(etType, ceEvent, strEventText, dtLoggedTime, this.m_prcClient.InstigatingAccountName);

                this.ProcessEvent(newCapture);
            }
        }
Exemplo n.º 2
0
        public void ProcessEvent(CapturedEvent capture)
        {
            if (this.CapturedEvents.Contains(capture.Event) == true)
            {
                capture.LoggedTime = capture.LoggedTime.ToUniversalTime().AddHours(m_prcClient.Game.UtcOffset).ToLocalTime();
                if (this.Logging == true)
                {
                    this.WriteLogLine(String.Format("{0}\t{1}\t{2}\t{3}\t{4}", capture.EventType.ToString(), capture.LoggedTime.ToString("MM/dd/yyyy HH:mm:ss"), capture.InstigatingAdmin, capture.Event.ToString(), capture.EventText.Replace("{", "{{").Replace("}", "}}")));
                }

                this.LogEntries.Enqueue(capture);

                while (this.LogEntries.Count > 100)
                {
                    this.LogEntries.Dequeue();
                }

                if (this.LoggedEvent != null)
                {
                    FrostbiteConnection.RaiseEvent(this.LoggedEvent.GetInvocationList(), capture);
                }
            }
        }
Exemplo n.º 3
0
        private void LoggedEvents_LoggedEvent(CapturedEvent ceEvent) {
            this.InvokeIfRequired(() => {
                this.lsvEvents.BeginUpdate();

                this.CleanUpLoggedEvents(this.AddLoggedEvent(ceEvent));

                this.lsvEvents.EndUpdate();
            });
        }
Exemplo n.º 4
0
        private ListViewItem AddLoggedEvent(CapturedEvent ceEvent) {

            ListViewItem lviNewEvent = this.CreateLoggedEvent(ceEvent);

            this.m_queListItems.Enqueue(lviNewEvent);
            this.lsvEvents.Items.Add(lviNewEvent);

            return lviNewEvent;
        }
Exemplo n.º 5
0
        private ListViewItem CreateLoggedEvent(CapturedEvent ceEvent) {

            ListViewItem lviNewEvent = new ListViewItem();

            if (ceEvent.EventType == EventType.Game) {
                lviNewEvent.ImageKey = "bfbc2server.png";
                lviNewEvent.Text = "Game";
            }
            else if (ceEvent.EventType == EventType.Plugins) {
                lviNewEvent.ImageKey = "plugin.png";
                lviNewEvent.Text = "Plugins";
            }
            else if (ceEvent.EventType == EventType.Connection) {
                lviNewEvent.ImageKey = "connect.png";
                lviNewEvent.Text = "Connection";
            }
            else if (ceEvent.EventType == EventType.Playerlist) {
                lviNewEvent.ImageKey = "mouse.png";
                lviNewEvent.Text = "Playerlist";
            }
            else if (ceEvent.EventType == EventType.Layer) {
                lviNewEvent.ImageKey = "layer.png";
                lviNewEvent.Text = "Layer";
            }

            ListViewItem.ListViewSubItem lvsiNewSubItem = new ListViewItem.ListViewSubItem(lviNewEvent, ceEvent.LoggedTime.ToString("MM/dd/yyyy HH:mm:ss"));
            lvsiNewSubItem.Name = "datetime";
            lviNewEvent.SubItems.Add(lvsiNewSubItem);

            lvsiNewSubItem = new ListViewItem.ListViewSubItem(lviNewEvent, ceEvent.InstigatingAdmin);
            lvsiNewSubItem.Name = "admin";
            lviNewEvent.SubItems.Add(lvsiNewSubItem);

            lvsiNewSubItem = new ListViewItem.ListViewSubItem(lviNewEvent, ceEvent.Event.ToString());
            lvsiNewSubItem.Name = "event";
            lviNewEvent.SubItems.Add(lvsiNewSubItem);

            //lviNewEvent.SubItems.Add(DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString());
            //lviNewEvent.SubItems.Add(Event.ToString("G"));

            lvsiNewSubItem = new ListViewItem.ListViewSubItem(lviNewEvent, ceEvent.EventText);

            lvsiNewSubItem.Name = "message";
            lviNewEvent.SubItems.Add(lvsiNewSubItem);

            return lviNewEvent;
        }
Exemplo n.º 6
0
        public void ProcessEvent(EventType etType, CapturableEvents ceEvent, params string[] a_strMessageParams) {
            if (this.CapturedEvents.Contains(ceEvent) == true) {

                DateTime dtLoggedTime = DateTime.Now; // UtcNow.AddHours(m_prcClient.Game.UTCoffset).ToLocalTime();
                string strEventText = String.Empty;

                if (this.m_prcClient.Language.LocalizedExists("uscEvents.lsvEvents." + ceEvent.ToString()) == true) {
                    strEventText = this.m_prcClient.Language.GetLocalized("uscEvents.lsvEvents." + ceEvent.ToString(), a_strMessageParams);
                }

                CapturedEvent newCapture = new CapturedEvent(etType, ceEvent, strEventText, dtLoggedTime, this.m_prcClient.InstigatingAccountName);

                this.ProcessEvent(newCapture);
            }
        }
Exemplo n.º 7
0
        public void ProcessEvent(CapturedEvent capture)
        {

            if (this.CapturedEvents.Contains(capture.Event) == true) {
                capture.LoggedTime = capture.LoggedTime.ToUniversalTime().AddHours(m_prcClient.Game.UtcOffset).ToLocalTime();
                if (this.Logging == true) {
                    this.WriteLogLine(String.Format("{0}\t{1}\t{2}\t{3}\t{4}", capture.EventType.ToString(), capture.LoggedTime.ToString("MM/dd/yyyy HH:mm:ss"), capture.InstigatingAdmin, capture.Event.ToString(), capture.EventText.Replace("{", "{{").Replace("}", "}}")));
                }

                this.LogEntries.Enqueue(capture);

                while (this.LogEntries.Count > 100) {
                    this.LogEntries.Dequeue();
                }

                if (this.LoggedEvent != null) {
                    FrostbiteConnection.RaiseEvent(this.LoggedEvent.GetInvocationList(), capture);
                }
            }
        }