CampahApp.Chatlog.UpdateFilters C# (CSharp) Method

UpdateFilters() public method

public UpdateFilters ( string rawstring ) : void
rawstring string
return void
        public void UpdateFilters(string rawstring)
        {
            rawstring = "," + rawstring + ",";
            rawstring = rawstring.ToLower().Replace(",yell,", ",RcvdYell,SentYell,").Replace(",party,", ",RcvdParty,SentParty,").Replace(",tell,", ",RcvdTell,SentTell,").Replace(",linkshell,", ",RcvdLinkShell,SentLinkShell,").Replace(",say,", ",RcvdSay,SentSay,").Replace(",shout,", ",RcvdShout,SentShout,").Replace(",emote,", ",RcvdEmote,SentEmote,");
            rawstring = rawstring.Substring(1, rawstring.Length - 2);
            string[] rawfilters = rawstring.Split(',');
            _filters.Clear();
            foreach (string raw in rawfilters)
            {
                //if (Enum.IsDefined(typeof(ChatMode), raw.Trim()))
                Int16 chatcode;
                if (Int16.TryParse(raw,System.Globalization.NumberStyles.HexNumber,System.Globalization.CultureInfo.InvariantCulture, out chatcode) && Enum.IsDefined(typeof(ChatMode),chatcode))
                {
                    _filters.Add((ChatMode)chatcode);
                }
                else if (Enum.GetNames(typeof(ChatMode)).Any(x => x.ToLower() == raw.Trim().ToLower()))
                {
                    _filters.Add((ChatMode)Enum.Parse(typeof(ChatMode), raw.Trim(), true));
                }
                else
                {
                    if (rawstring.Length > 0)
                    {
                        return;
                    }
                    _filters.Clear();
                }
            }
            Rewrite();
        }