Beispiel #1
0
        private void AwayClick(object sender, RoutedEventArgs e)
        {
            if (e != null)
            {
                e.Handled = true;
            }

            if (Away)
            {
                Away = false;
                AwayChanged(this, new BoolEventArgs(Away));
                this.Close();
            }
            else
            {
                string text = WormNetCharTable.RemoveNonWormNetChars(AwayText.Text.Trim());
                if (text.Length > 0)
                {
                    Away = true;
                    Properties.Settings.Default.AwayMessage = text;
                    Properties.Settings.Default.Save();
                    AwayChanged(this, new BoolEventArgs(Away));
                    this.Close();
                }
            }
        }
Beispiel #2
0
        public override string Validate(ref string text)
        {
            text = WormNetCharTable.RemoveNonWormNetChars(text.Trim());
            string[] words = text.ToLower().Split(new char[] { ' ' });

            if (words.Length == 3 && words[0] == "great" && words[1] == "snooper" && gsVersionRegex.IsMatch(words[2]) && words[2] != "v" + App.GetVersion())
            {
                return("No trolling please!");
            }
            return(string.Empty);
        }
Beispiel #3
0
        // Send a message by the user (action)
        public void MessageSend(object sender, KeyEventArgs e)
        {
            TextBox tb = (TextBox)sender;

            if (e.Key == Key.Return && tb.Text.Length > 0)
            {
                // Remove non-wormnet characters
                Channel ch      = (Channel)tb.DataContext;
                string  message = (ch.Server.IsWormNet) ? message = WormNetCharTable.RemoveNonWormNetChars(tb.Text.TrimEnd()) : tb.Text.TrimEnd();

                if (message.Length > 0)
                {
                    ch.UserMessagesAdd(message);
                    ch.UserMessageLoadedIdx = -1;
                    SendMessageToChannel(message, ch, true);
                }

                tb.Clear();
                e.Handled = true;
            }
        }
Beispiel #4
0
 public override string Validate(ref string text)
 {
     text = WormNetCharTable.RemoveNonWormNetChars(text.Trim());
     return(string.Empty);
 }
Beispiel #5
0
        public Login()
        {
            if (firstStart)
            {
                WormNetCharTable.Initialize();

                if (!Properties.Settings.Default.SettingsUpgraded)
                {
                    try
                    {
                        Properties.Settings.Default.Upgrade();
                        if (Properties.Settings.Default.Group0List.Length == 0)
                        {
                            Properties.Settings.Default.Group0List = Properties.Settings.Default.BuddyList;
                        }

                        // new colors
                        if (Properties.Settings.Default.ChannelMessageStyle == "F0FFFF|13|0|0|0|0|Tahoma")
                        {
                            Properties.Settings.Default.ChannelMessageStyle = (string)Properties.Settings.Default.Properties["ChannelMessageStyle"].DefaultValue;
                        }
                        if (Properties.Settings.Default.JoinMessageStyle == "808000|12|0|0|0|0|Tahoma")
                        {
                            Properties.Settings.Default.JoinMessageStyle = (string)Properties.Settings.Default.Properties["JoinMessageStyle"].DefaultValue;
                        }
                        if (Properties.Settings.Default.PartMessageStyle == "808000|12|0|0|0|0|Tahoma")
                        {
                            Properties.Settings.Default.PartMessageStyle = (string)Properties.Settings.Default.Properties["PartMessageStyle"].DefaultValue;
                        }
                        if (Properties.Settings.Default.QuitMessageStyle == "808000|12|0|0|0|0|Tahoma")
                        {
                            Properties.Settings.Default.QuitMessageStyle = (string)Properties.Settings.Default.Properties["QuitMessageStyle"].DefaultValue;
                        }
                        if (Properties.Settings.Default.OfflineMessageStyle == "FF0000|13|0|0|0|0|Tahoma")
                        {
                            Properties.Settings.Default.OfflineMessageStyle = (string)Properties.Settings.Default.Properties["OfflineMessageStyle"].DefaultValue;
                        }
                        if (Properties.Settings.Default.ActionMessageStyle == "FFFF00|13|0|0|0|0|Tahoma")
                        {
                            Properties.Settings.Default.ActionMessageStyle = (string)Properties.Settings.Default.Properties["ActionMessageStyle"].DefaultValue;
                        }
                        if (Properties.Settings.Default.UserMessageStyle == "E9967A|13|0|0|0|0|Tahoma")
                        {
                            Properties.Settings.Default.UserMessageStyle = (string)Properties.Settings.Default.Properties["UserMessageStyle"].DefaultValue;
                        }
                        if (Properties.Settings.Default.NoticeMessageStyle == "E9967A|13|0|0|0|0|Tahoma")
                        {
                            Properties.Settings.Default.NoticeMessageStyle = (string)Properties.Settings.Default.Properties["NoticeMessageStyle"].DefaultValue;
                        }
                    }
                    catch (Exception) { }

                    var    validator   = new GSVersionValidator();
                    string quitMessage = Properties.Settings.Default.QuitMessagee;
                    if (Properties.Settings.Default.QuitMessagee == string.Empty || validator.Validate(ref quitMessage) != string.Empty)
                    {
                        Properties.Settings.Default.QuitMessagee = "Great Snooper v" + App.GetVersion();
                    }
                    Properties.Settings.Default.SettingsUpgraded = true;
                    Properties.Settings.Default.Save();
                }

                MessageSettings.Initialize();
                CountriesClass.Initialize();
                GlobalManager.Initialize();
                UserGroups.Initialize();
                Sounds.Initialize();

                // Reducing Timeline frame rate
                Timeline.DesiredFrameRateProperty.OverrideMetadata(
                    typeof(Timeline),
                    new FrameworkPropertyMetadata {
                    DefaultValue = 25
                }
                    );
            }
            InitializeComponent();
            DataContext = this;

            nickRegex  = new Regex(@"^[a-z`]", RegexOptions.IgnoreCase);
            nickRegex2 = new Regex(@"^[a-z`][a-z0-9`\-]*$", RegexOptions.IgnoreCase);

            ServerList = new SortedObservableCollection <string>();
            ServerList.DeSerialize(Properties.Settings.Default.ServerAddresses);

            Server.SelectedItem = Properties.Settings.Default.ServerAddress;

            switch (Properties.Settings.Default.LoginType)
            {
            case "simple":
                LoginTypeChooser.SelectedIndex = 0;
                break;

            default:
                LoginTypeChooser.SelectedIndex = 1;
                break;
            }

            AutoLogIn.IsChecked = Properties.Settings.Default.AutoLogIn;
            Nick.Text           = Properties.Settings.Default.UserName;

            Country.ItemsSource = CountriesClass.Countries;
            if (Properties.Settings.Default.UserCountry != -1)
            {
                CountryClass country = CountriesClass.GetCountryByID(Properties.Settings.Default.UserCountry);
                Country.SelectedItem = country;
            }
            else
            {
                CultureInfo ci = CultureInfo.InstalledUICulture;

                CountryClass country;
                if (ci != null)
                {
                    country = CountriesClass.GetCountryByCC(ci.TwoLetterISOLanguageName.ToUpper());
                }
                else
                {
                    country = CountriesClass.DefaultCountry;
                }

                Country.SelectedItem = country;
            }

            Rank.ItemsSource   = RanksClass.Ranks;
            Rank.SelectedIndex = Properties.Settings.Default.UserRank;
            Clan.Text          = Properties.Settings.Default.UserClan;

            TUSNick.Text     = Properties.Settings.Default.TusNick;
            TUSPass.Password = Properties.Settings.Default.TusPass;
        }