예제 #1
0
        public Notificator(bool searching)
        {
            InitializeComponent();

            this.searching = searching;
            if (searching)
            {
                StartButton.Content = "Stop searching";
                TheList.IsEnabled   = false;
            }

            string[] ncs = Properties.Settings.Default.Notificator.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
            for (int i = 0; i < ncs.Length; i++)
            {
                string[] data = ncs[i].Split(new char[] { ',' });
                if (data.Length == 8)
                {
                    NotificatorClass nc = new NotificatorClass();
                    nc.WordsAsText      = data[0].Replace(":", Environment.NewLine);
                    nc.InGameNames      = data[1] == "True";
                    nc.InHosterNames    = data[2] == "True";
                    nc.InJoinMessages   = data[3] == "True";
                    nc.InMessages       = data[4] == "True";
                    nc.InMessageSenders = data[5] == "True";
                    nc.IsEnabled        = data[6] == "True";
                    nc.MatchType        = (NotificatorClass.MatchTypes)Convert.ToInt32(data[7]);
                    this.TheList.Items.Add(nc);
                }
            }
        }
예제 #2
0
        public bool Equals(NotificatorClass n)
        {
            // If parameter is null return false:
            if ((object)n == null)
            {
                return(false);
            }

            // Return true if the fields match:
            return(id == n.id);
        }
예제 #3
0
        private void StartSearching(object sender, RoutedEventArgs e)
        {
            if (searching) // Stop!
            {
                StartButton.Content = "Start searching";
                NotificatorEvent(this, null);
                searching         = false;
                TheList.IsEnabled = true;
            }
            else // Start!
            {
                List <NotificatorClass> list = new List <NotificatorClass>();
                StringBuilder           sb   = new StringBuilder();

                foreach (var item in TheList.Items)
                {
                    NotificatorClass nc = (NotificatorClass)item;

                    sb.Append(nc.WordsAsText.Trim().Replace(Environment.NewLine, ":"));
                    sb.Append(',');
                    sb.Append(nc.InGameNames.ToString());
                    sb.Append(',');
                    sb.Append(nc.InHosterNames.ToString());
                    sb.Append(',');
                    sb.Append(nc.InJoinMessages.ToString());
                    sb.Append(',');
                    sb.Append(nc.InMessages.ToString());
                    sb.Append(',');
                    sb.Append(nc.InMessageSenders.ToString());
                    sb.Append(',');
                    sb.Append(nc.IsEnabled.ToString());
                    sb.Append(',');
                    sb.Append(((int)nc.MatchType).ToString());
                    sb.Append('|');

                    if (nc.IsEnabled && nc.Words.Count > 0 && (nc.InGameNames || nc.InHosterNames || nc.InJoinMessages || nc.InMessages || nc.InMessageSenders))
                    {
                        list.Add(nc);
                    }
                }

                if (list.Count > 0)
                {
                    Properties.Settings.Default.Notificator = sb.ToString();
                    Properties.Settings.Default.Save();
                    NotificatorEvent(this, new NotificatorEventArgs(list));
                    this.Close();
                }
            }
            e.Handled = true;
        }
예제 #4
0
        public override bool Equals(System.Object obj)
        {
            // If parameter is null return false.
            if (obj == null)
            {
                return(false);
            }

            // If parameter cannot be cast to Point return false.
            NotificatorClass n = obj as NotificatorClass;

            if ((System.Object)n == null)
            {
                return(false);
            }

            // Return true if the fields match:
            return(id == n.id);
        }