public void Filter(string searchText)
 {
     if (!string.IsNullOrEmpty(searchText))
     {
         if (_children != null)
         {
             foreach (var recordSetFieldItemModel in _children)
             {
                 recordSetFieldItemModel.Filter(searchText);
             }
         }
         if (_children != null && _children.Any(model => model.IsVisible))
         {
             IsVisible = true;
         }
         else
         {
             IsVisible = !string.IsNullOrEmpty(DisplayName) && DisplayName.ToLower().Contains(searchText.ToLower());
         }
     }
     else
     {
         IsVisible = true;
         if (_children != null)
         {
             foreach (var recordSetFieldItemModel in _children)
             {
                 recordSetFieldItemModel.IsVisible = true;
             }
         }
     }
     _searchText = searchText;
     NotifyOfPropertyChange(() => Children);
 }
Beispiel #2
0
 public User(commentResult result)
 {
     FacebookId     = result.data.from.id;
     DisplayName    = result.data.from.name;
     NormalizedName = DisplayName.ToLower().Normalize();
     Comments       = new List <Comment>();
 }
 public void Filter(string searchText)
 {
     if (!string.IsNullOrEmpty(searchText))
     {
         IsVisible = !string.IsNullOrEmpty(DisplayName) && DisplayName.ToLower().Contains(searchText.ToLower());
     }
     else
     {
         IsVisible = true;
     }
 }
Beispiel #4
0
 /// <summary>
 /// Performs file search
 /// </summary>
 /// <param name="pattern"></param>
 public void PerformFileSearch(string pattern)
 {
     if (DisplayName.ToLower().Contains(pattern.ToLower()))
     {
         SetVisibility(true);
     }
     else
     {
         IsVisible = false;
     }
 }
Beispiel #5
0
        public virtual IEnumerable <ValidationResult> Validate(ValidationContext validationContext)
        {
            var validationResults = new List <ValidationResult>();

            if (HttpRequestStorage.DatabaseEntities.ProjectDocuments.Where(x => x.ProjectID == ParentID && x.ProjectDocumentID != DocumentID)
                .Any(x => x.DisplayName.ToLower() == DisplayName.ToLower()))
            {
                validationResults.Add(new SitkaValidationResult <EditProjectDocumentsViewModel, string>("The Display Name must be unique for each Document attached to a Project", m => m.DisplayName));
            }

            return(validationResults);
        }
        public override IEnumerable <ValidationResult> Validate(ValidationContext validationContext)
        {
            var validationResults = new List <ValidationResult>();

            if (HttpRequestStorage.DatabaseEntities.ProjectAttachmentUpdates.Where(x => x.ProjectUpdateBatchID == ParentID && x.ProjectAttachmentUpdateID != AttachmentID)
                .Any(x => x.DisplayName.ToLower() == DisplayName.ToLower()))
            {
                validationResults.Add(new SitkaValidationResult <NewProjectAttachmentViewModel, string>($"The Display Name must be unique for each Attachment attached to a {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} Update", m => m.DisplayName));
            }

            return(validationResults);
        }
 public void ValidatePriceAndAvailability(int amountDeposited)
 {
     if (SupportedProductNames.All(n => n != Name))
     {
         throw new VendingMachineDomainException($"Product {DisplayName.ToLower()} not found");
     }
     if (amountDeposited < Price)
     {
         throw new VendingMachineDomainException($"Insufficient amount. Add {(Price - amountDeposited).ToAmounDenominationString()} ");
     }
     if (AvailableCount == 0)
     {
         throw new VendingMachineDomainException($"We run out of {DisplayName.ToLower()}");
     }
 }
Beispiel #8
0
        /// <summary>
        /// Returns the string representation of this constraint
        /// </summary>
        protected virtual string GetStringRepresentation()
        {
            System.Text.StringBuilder sb = new System.Text.StringBuilder();

            sb.Append("<");
            sb.Append(DisplayName.ToLower());

            foreach (object arg in Arguments)
            {
                sb.Append(" ");
                sb.Append(Displayable(arg));
            }

            sb.Append(">");

            return(sb.ToString());
Beispiel #9
0
        public virtual IEnumerable <ValidationResult> Validate(ValidationContext validationContext)
        {
            var validationResults = new List <ValidationResult>();

            ProjectAttachmentPrimaryKey projectAttachmentPrimaryKey = AttachmentID;
            var projectAttachment = projectAttachmentPrimaryKey.EntityObject;

            // We want to validate that the DisplayName is unique per project & attachment type. A project can have duplicate display names as long as they are different attachment types
            if (HttpRequestStorage.DatabaseEntities.ProjectAttachments.Where(x => x.ProjectID == ParentID && x.ProjectAttachmentID != AttachmentID && x.AttachmentTypeID == projectAttachment.AttachmentTypeID)
                .Any(x => x.DisplayName.ToLower() == DisplayName.ToLower()))
            {
                AttachmentTypePrimaryKey attachmentTypePrimaryKey = projectAttachment.AttachmentTypeID;
                var attachmentType = attachmentTypePrimaryKey.EntityObject;

                validationResults.Add(new SitkaValidationResult <NewProjectAttachmentViewModel, string>($"There is already an attachment with the display name \"{DisplayName}\" under the {attachmentType.AttachmentTypeName} attachment type for this {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()}.", m => m.DisplayName));
            }

            return(validationResults);
        }
 protected void Construct(MemberInfo memberInfo, ConsoleInvokableAttribute attribute, List<Parameter> parameters)
 {
     string displayName;
     if (string.IsNullOrEmpty(attribute.Name))
     {
         displayName = memberInfo.Name;
     }
     else
     {
         displayName = attribute.Name;
     }
     
     EnabledSelf = attribute.EnabledByDefault;
     EnableGroup = attribute.EnableGroup?.ToLower();
     BufferWhileInactive = attribute.BufferWhileInactive;
     DisplayName = displayName;
     Name = DisplayName.ToLower();
     Description = attribute.Description;
     InvokeParameters = parameters;
     MandatoryParameterCount = InvokeParameters.Count((p) => !p.Optional);
 }
        public void Query()
        {
            var query = this.AccountLevelPolicyService.Query();

            if (!string.IsNullOrWhiteSpace(DisplayName))
            {
                query = query.Where(x => x.DisplayName.ToLower().Contains(DisplayName.ToLower()));
            }
            if (State != AccountLevelPolicyStates.All)
            {
                query = query.Where(x => x.State == State);
            }
            List = query.ToList(this, x => new ListAccountLevelPolicy(x));

            var accountTypes = AccountTypeService.Query(new AccountTypeRequest()).ToList();

            List.Merge(accountTypes,
                       (a, b) => a.InnerObject.AccountTypeId == b.AccountTypeId,
                       (a, b) => a.AccountTypeName = b.Any() ? b.FirstOrDefault().DisplayName : ""
                       );
        }
Beispiel #12
0
        public void Query()
        {
            var query = this.PointPolicyService.Query();

            if (State != States.All)
            {
                query = query.Where(x => x.State == State);
            }
            if (!string.IsNullOrWhiteSpace(DisplayName))
            {
                query = query.Where(x => x.DisplayName.ToLower().Contains(DisplayName.ToLower()));
            }

            List = query.ToList(this, x => new ListPointPolicy(x));
            var levels = AccountLevelPolicyService.Query().ToList();

            foreach (var pointPolicy in List)
            {
                var      ids   = (pointPolicy.InnerObject.AccountLevels ?? "").Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                string[] names = levels.Where(x => ids.Contains(x.AccountLevelPolicyId.ToString())).Select(x => x.DisplayName).ToArray();
                pointPolicy.AccountLevelName = string.Join(",", names);
            }
        }
Beispiel #13
0
 /// <summary>
 /// Returns the string representation of this constraint
 /// </summary>
 protected override string GetStringRepresentation()
 {
     return(string.Format("<{0} \"{1}\" {2}>", DisplayName.ToLower(), expected, caseInsensitive ? "ignorecase" : "respectcase"));
 }
Beispiel #14
0
        public CoreSum CreateMenu(Menu root)
        {
            Menu = new Menu(DisplayName, "m" + Name);

            if (!Name.Contains("smite"))
            {
                Menu.AddItem(new MenuItem("use" + Name, "Use " + DisplayName)).SetValue(true).Permashow();
            }

            if (Name == "summonersnowball")
            {
                Activator.UseEnemyMenu = true;
            }

            if (Name == "summonerheal")
            {
                Activator.UseAllyMenu = true;
                Menu.AddItem(new MenuItem("selflowhp" + Name + "pct", "Use on Hero HP % <="))
                .SetValue(new Slider(20));
                Menu.AddItem(new MenuItem("selfmuchhp" + Name + "pct", "Use on Hero Dmg Dealt % >="))
                .SetValue(new Slider(45));
                Menu.AddItem(new MenuItem("mode" + Name, "Mode: ")).SetValue(new StringList(new[] { "Always", "Combo" }, 1));
            }

            if (Name == "summonerboost")
            {
                Activator.UseAllyMenu = true;
                var ccmenu = new Menu(DisplayName + " Buff Types", DisplayName.ToLower() + "cdeb");
                ccmenu.AddItem(new MenuItem(Name + "cignote", "Ignite")).SetValue(true);
                ccmenu.AddItem(new MenuItem(Name + "cexhaust", "Exhaust")).SetValue(true);
                ccmenu.AddItem(new MenuItem(Name + "cstun", "Stuns")).SetValue(true);
                ccmenu.AddItem(new MenuItem(Name + "ccharm", "Charms")).SetValue(true);
                ccmenu.AddItem(new MenuItem(Name + "ctaunt", "Taunts")).SetValue(true);
                ccmenu.AddItem(new MenuItem(Name + "cfear", "Fears")).SetValue(true);
                ccmenu.AddItem(new MenuItem(Name + "cflee", "Flee")).SetValue(true);
                ccmenu.AddItem(new MenuItem(Name + "csnare", "Snares")).SetValue(true);
                ccmenu.AddItem(new MenuItem(Name + "csilence", "Silences")).SetValue(true);
                ccmenu.AddItem(new MenuItem(Name + "csupp", "Supression")).SetValue(true);
                ccmenu.AddItem(new MenuItem(Name + "cpolymorph", "Polymorphs")).SetValue(true);
                ccmenu.AddItem(new MenuItem(Name + "cblind", "Blinds")).SetValue(true);
                ccmenu.AddItem(new MenuItem(Name + "cslow", "Slows")).SetValue(false);
                ccmenu.AddItem(new MenuItem(Name + "cpoison", "Poisons")).SetValue(true);
                Menu.AddSubMenu(ccmenu);

                Menu.AddItem(new MenuItem("use" + Name + "number", "Min Buffs to Use")).SetValue(new Slider(1, 1, 5));
                Menu.AddItem(new MenuItem("use" + Name + "time", "Min Durration to Use (sec)")).SetValue(new Slider(2, 1, 5));
                Menu.AddItem(new MenuItem("use" + Name + "delay", "Activation Delay")).SetValue(new Slider(150, 0, 500));
                Menu.AddItem(new MenuItem("use" + Name + "od", "Use for Dangerous Only")).SetValue(false);
                Menu.AddItem(new MenuItem("mode" + Name, "Mode: ")).SetValue(new StringList(new[] { "Always", "Combo" }));
            }

            if (Name == "summonerdot")
            {
                Activator.UseEnemyMenu = true;
                Menu.AddItem(new MenuItem("ignotet", "Ignite Under Turret")).SetValue(true);

                switch (Player.ChampionName)
                {
                case "Ahri":
                    Menu.AddItem(new MenuItem("ii" + Player.ChampionName, "Ignite after Charm?")).SetValue(false);
                    break;

                case "Cassiopeia":
                    Menu.AddItem(new MenuItem("ii" + Player.ChampionName, "Ignite after Poison?")).SetValue(false);
                    break;

                case "Diana":
                    Menu.AddItem(new MenuItem("ii" + Player.ChampionName, "Ignite after Moonlight?")).SetValue(false);
                    break;
                }

                Menu.AddItem(new MenuItem("mode" + Name, "Mode: "))
                .SetValue(new StringList(new[] { "Killsteal", "Combo" }, 1));
            }

            if (Name == "summonermana")
            {
                Activator.UseAllyMenu = true;
                Menu.AddItem(new MenuItem("selflowmp" + Name + "pct", "Minimum Mana % <=")).SetValue(new Slider(40));
            }

            if (Name == "summonerbarrier")
            {
                Activator.UseAllyMenu = true;
                Menu.AddItem(new MenuItem("selflowhp" + Name + "pct", "Use on Hero HP % <=")).SetValue(new Slider(20));
                Menu.AddItem(new MenuItem("selfmuchhp" + Name + "pct", "Use on Hero Dmg Dealt % >=")).SetValue(new Slider(45));
                Menu.AddItem(new MenuItem("use" + Name + "ulti", "Use on Dangerous (Ultimates Only)")).SetValue(true);
                Menu.AddItem(new MenuItem("mode" + Name, "Mode: ")).SetValue(new StringList(new[] { "Always", "Combo" }, 1));
            }

            if (Name == "summonerexhaust")
            {
                Activator.UseEnemyMenu = true;
                Menu.AddItem(new MenuItem("a" + Name + "pct", "Exhaust on ally HP %")).SetValue(new Slider(35));
                Menu.AddItem(new MenuItem("e" + Name + "pct", "Exhaust on enemy HP %")).SetValue(new Slider(35));
                Menu.AddItem(new MenuItem("use" + Name + "ulti", "Use on Dangerous")).SetValue(true);
                Menu.AddItem(new MenuItem("mode" + Name, "Mode: ")).SetValue(new StringList(new[] { "Always", "Combo" }));
            }

            if (Name == "summonersmite")
            {
                Activator.UseEnemyMenu = true;
                Menu.AddItem(new MenuItem("usesmite", "Use Smite")).SetValue(new KeyBind('M', KeyBindType.Toggle, true)).Permashow();
                Menu.AddItem(new MenuItem("smiteskill", "Smite + Ability")).SetValue(true);
                Menu.AddItem(new MenuItem("smitesmall", "Smite Small Camps")).SetValue(true);
                Menu.AddItem(new MenuItem("smitelarge", "Smite Large Camps")).SetValue(true);
                Menu.AddItem(new MenuItem("smitesuper", "Smite Epic Camps")).SetValue(true);
                Menu.AddItem(new MenuItem("smitemode", "Smite Enemies: "))
                .SetValue(new StringList(new[] { "Killsteal", "Combo", "Nope" }, 1));
                Menu.AddItem(new MenuItem("savesmite", "Save a Smite Charge").SetValue(true));
            }

            root.AddSubMenu(Menu);
            return(this);
        }
Beispiel #15
0
        /// <summary>
        /// Returns the constraint DisplayName followed by arguments within angle brackets.
        /// </summary>
        public override string ToString()
        {
            var expectedStrings = _expected.Cast <object>().Select(MsgUtils.FormatValue).ToArray();

            return($"<{DisplayName.ToLower()} {string.Join(" ", expectedStrings)}>");
        }
Beispiel #16
0
        public Message(IrcMessage data, TwitchChannel channel, bool enableTimestamp = true, bool enablePingSound = true,
                       bool isReceivedWhisper = false, bool isSentWhisper = false, bool includeChannel = false)
        {
            //var w = Stopwatch.StartNew();

            ParseTime = DateTime.Now;

            Channel = channel;

            var words = new List <Word>();

            var text = data.Params ?? "";

            Username = data.PrefixNickname ?? "";

            if (string.IsNullOrWhiteSpace(Username))
            {
                string login;

                if (data.Tags.TryGetValue("login", out login))
                {
                    Username = login;
                }
            }

            var slashMe = false;

            // Handle /me messages
            if (text.Length > 8 && text.StartsWith("\u0001ACTION "))
            {
                text    = text.Substring("\u0001ACTION ".Length, text.Length - "\u0001ACTION ".Length - 1);
                slashMe = true;
            }

            // Highlights
            if (!IrcManager.Account.IsAnon)
            {
                if ((AppSettings.ChatEnableHighlight || AppSettings.ChatEnableHighlightSound ||
                     AppSettings.ChatEnableHighlightTaskbar) && Username != IrcManager.Account.Username.ToLower())
                {
                    if (!AppSettings.HighlightIgnoredUsers.ContainsKey(Username))
                    {
                        if (!IrcManager.IgnoredUsers.Contains(Username))
                        {
                            if (AppSettings.CustomHighlightRegex != null &&
                                AppSettings.CustomHighlightRegex.IsMatch(text))
                            {
                                if (AppSettings.ChatEnableHighlight)
                                {
                                    HighlightType = HighlightType.Highlighted;
                                }

                                if (EnablePings && enablePingSound)
                                {
                                    if (AppSettings.ChatEnableHighlightSound)
                                    {
                                        GuiEngine.Current.PlaySound(NotificationSound.Ping);
                                    }
                                    if (AppSettings.ChatEnableHighlightTaskbar)
                                    {
                                        GuiEngine.Current.FlashTaskbar();
                                    }
                                }
                            }
                        }
                    }
                }
            }

            // Tags
            string value;

            if (data.Tags.TryGetValue("color", out value))
            {
                try
                {
                    if (value.Length == 7 && value[0] == '#')
                    {
                        UsernameColor = HSLColor.FromRGB(Convert.ToInt32(value.Substring(1), 16));
                    }
                }
                catch { }
            }
            if (data.Tags.TryGetValue("display-name", out value))
            {
                DisplayName = value;
            }

            // Bits
            string bits = null;

            data.Tags.TryGetValue("bits", out bits);

            // Add timestamp
            string timestampTag;
            string timestamp = null;

            string tmiTimestamp;
            long   tmiTimestampInt;

            DateTime timestampTime = DateTime.Now;

            if (data.Tags.TryGetValue("tmi-sent-ts", out tmiTimestamp))
            {
                if (long.TryParse(tmiTimestamp, out tmiTimestampInt))
                {
                    var dtDateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);

                    var time = dtDateTime.AddSeconds(tmiTimestampInt / 1000).ToLocalTime();

                    timestampTime = time;

                    //timestamp = time.ToString(AppSettings.ChatShowTimestampSeconds ? "HH:mm:ss" : "HH:mm");
                    //enableTimestamp = true;
                }
            }
            else if (data.Tags.TryGetValue("timestamp-utc", out timestampTag))
            {
                DateTime time;
                if (DateTime.TryParseExact(timestampTag, "yyyyMMdd-HHmmss", CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal, out time))
                {
                    timestampTime = time;
                    //timestamp = time.ToString(AppSettings.ChatShowTimestampSeconds ? "HH:mm:ss" : "HH:mm");
                    //enableTimestamp = true;
                }
            }

            if (enableTimestamp && AppSettings.ChatShowTimestamps)
            {
                string timestampFormat;

                if (AppSettings.ChatShowTimestampSeconds)
                {
                    timestampFormat = AppSettings.TimestampsAmPm ? "hh:mm:ss tt" : "HH:mm:ss";
                }
                else
                {
                    timestampFormat = AppSettings.TimestampsAmPm ? "hh:mm tt" : "HH:mm";
                }

                timestamp = timestampTime.ToString(timestampFormat, enUS);

                words.Add(new Word
                {
                    Type     = SpanType.Text,
                    Value    = timestamp,
                    Color    = HSLColor.FromRGB(-8355712),
                    Font     = FontType.Small,
                    CopyText = timestamp
                });
            }

            // add channel name
            if (includeChannel)
            {
                words.Add(new Word
                {
                    Type     = SpanType.Text,
                    Link     = new Link(LinkType.ShowChannel, channel.Name),
                    Value    = "#" + channel.Name,
                    Color    = HSLColor.FromRGB(-8355712),
                    Font     = FontType.Medium,
                    CopyText = "#" + channel.Name
                });
            }

            // get badges from tags
            if (data.Tags.TryGetValue("badges", out value))
            {
                var badges = value.Split(',');

                foreach (var badge in badges)
                {
                    if (badge.StartsWith("bits/"))
                    {
                        int cheer;
                        if (int.TryParse(badge.Substring("bits/".Length), out cheer))
                        {
                            object image;

                            if (cheer >= 1000000)
                            {
                                image = GuiEngine.Current.GetImage(ImageType.Cheer1000000);
                            }
                            else if (cheer >= 900000)
                            {
                                image = GuiEngine.Current.GetImage(ImageType.Cheer900000);
                            }
                            else if (cheer >= 800000)
                            {
                                image = GuiEngine.Current.GetImage(ImageType.Cheer800000);
                            }
                            else if (cheer >= 700000)
                            {
                                image = GuiEngine.Current.GetImage(ImageType.Cheer700000);
                            }
                            else if (cheer >= 600000)
                            {
                                image = GuiEngine.Current.GetImage(ImageType.Cheer600000);
                            }
                            else if (cheer >= 500000)
                            {
                                image = GuiEngine.Current.GetImage(ImageType.Cheer500000);
                            }
                            else if (cheer >= 400000)
                            {
                                image = GuiEngine.Current.GetImage(ImageType.Cheer400000);
                            }
                            else if (cheer >= 300000)
                            {
                                image = GuiEngine.Current.GetImage(ImageType.Cheer300000);
                            }
                            else if (cheer >= 200000)
                            {
                                image = GuiEngine.Current.GetImage(ImageType.Cheer200000);
                            }
                            else if (cheer >= 100000)
                            {
                                image = GuiEngine.Current.GetImage(ImageType.Cheer100000);
                            }
                            else if (cheer >= 10000)
                            {
                                image = GuiEngine.Current.GetImage(ImageType.Cheer10000);
                            }
                            else if (cheer >= 5000)
                            {
                                image = GuiEngine.Current.GetImage(ImageType.Cheer5000);
                            }
                            else if (cheer >= 1000)
                            {
                                image = GuiEngine.Current.GetImage(ImageType.Cheer1000);
                            }
                            else if (cheer >= 100)
                            {
                                image = GuiEngine.Current.GetImage(ImageType.Cheer100);
                            }
                            else
                            {
                                image = GuiEngine.Current.GetImage(ImageType.Cheer1);
                            }

                            words.Add(new Word {
                                Type = SpanType.LazyLoadedImage, Value = new LazyLoadedImage(image)
                                {
                                    Scale = cheer > 100000 ? 0.25 : 1
                                }, Tooltip = "Twitch Cheer " + cheer
                            });
                        }
                    }
                    else if (badge.StartsWith("subscriber/"))
                    {
                        try
                        {
                            var n = int.Parse(badge.Substring("subscriber/".Length));

                            Badges |= MessageBadges.Sub;
                            var e = channel.GetSubscriberBadge(n);
                            words.Add(new Word {
                                Type = SpanType.LazyLoadedImage, Value = e, Link = new Link(LinkType.Url, Channel.SubLink), Tooltip = e.Tooltip
                            });
                        }
                        catch { }
                    }
                    else
                    {
                        switch (badge)
                        {
                        case "staff/1":
                            Badges |= MessageBadges.Staff;
                            words.Add(new Word {
                                Type = SpanType.LazyLoadedImage, Value = new LazyLoadedImage(GuiEngine.Current.GetImage(ImageType.BadgeStaff)), Tooltip = "Twitch Staff"
                            });
                            break;

                        case "admin/1":
                            Badges |= MessageBadges.Admin;
                            words.Add(new Word {
                                Type = SpanType.LazyLoadedImage, Value = new LazyLoadedImage(GuiEngine.Current.GetImage(ImageType.BadgeAdmin)), Tooltip = "Twitch Admin"
                            });
                            break;

                        case "global_mod/1":
                            Badges |= MessageBadges.GlobalMod;
                            words.Add(new Word {
                                Type = SpanType.LazyLoadedImage, Value = GuiEngine.Current.GetImage(ImageType.BadgeGlobalmod), Tooltip = "Global Moderator"
                            });
                            break;

                        case "moderator/1":
                            Badges |= MessageBadges.Mod;
                            if (channel.ModeratorBadge == null)
                            {
                                words.Add(new Word {
                                    Type = SpanType.LazyLoadedImage, Value = new LazyLoadedImage(GuiEngine.Current.GetImage(ImageType.BadgeModerator)), Tooltip = "Channel Moderator"
                                });
                            }
                            else
                            {
                                words.Add(new Word {
                                    Type = SpanType.LazyLoadedImage, Value = channel.ModeratorBadge, Tooltip = channel.ModeratorBadge.Tooltip
                                });
                            }
                            break;

                        case "turbo/1":
                            Badges |= MessageBadges.Turbo;
                            words.Add(new Word {
                                Type = SpanType.LazyLoadedImage, Value = new LazyLoadedImage(GuiEngine.Current.GetImage(ImageType.BadgeTurbo)), Tooltip = "Turbo Subscriber"
                            });
                            break;

                        case "broadcaster/1":
                            Badges |= MessageBadges.Broadcaster;
                            words.Add(new Word {
                                Type = SpanType.LazyLoadedImage, Value = new LazyLoadedImage(GuiEngine.Current.GetImage(ImageType.BadgeBroadcaster)), Tooltip = "Channel Broadcaster"
                            });
                            break;

                        case "premium/1":
                            Badges |= MessageBadges.Broadcaster;
                            words.Add(new Word {
                                Type = SpanType.LazyLoadedImage, Value = new LazyLoadedImage(GuiEngine.Current.GetImage(ImageType.BadgeTwitchPrime)), Tooltip = "Twitch Prime"
                            });
                            break;
                        }
                    }
                }
            }

            LazyLoadedImage fourtfBadge;

            if (Common.Badges.FourtfGlobalBadges.TryGetValue(Username, out fourtfBadge))
            {
                words.Add(new Word {
                    Type = SpanType.LazyLoadedImage, Value = fourtfBadge, Tooltip = fourtfBadge.Tooltip
                });
            }

            // Username
            if (string.IsNullOrWhiteSpace(DisplayName))
            {
                DisplayName = Username;
            }

            var messageUser = (isSentWhisper ? IrcManager.Account.Username + " -> " : "");

            messageUser += DisplayName;

            if (!isReceivedWhisper && !isSentWhisper)
            {
                messageUser += (DisplayName.ToLower() != Username ? $" ({Username})" : "");
            }

            if (isReceivedWhisper)
            {
                messageUser += " -> " + IrcManager.Account.Username;
            }

            if (!slashMe)
            {
                messageUser += ":";
            }

            words.Add(new Word
            {
                Type  = SpanType.Text,
                Value = messageUser,
                Color = UsernameColor,
                Font  = FontType.MediumBold,
                Link  = new Link(LinkType.UserInfo, new UserInfoData {
                    UserName = Username, Channel = channel
                }),
                CopyText = messageUser
            });

            var twitchEmotes = new List <Tuple <int, LazyLoadedImage> >();

            // Twitch Emotes
            if (AppSettings.ChatEnableTwitchEmotes && data.Tags.TryGetValue("emotes", out value))
            {
                //  93064:0-6,8-14/80481:16-20,22-26
                value.Split('/').Do(emote =>
                {
                    if (emote != "")
                    {
                        var x  = emote.Split(':');
                        var id = int.Parse(x[0]);
                        foreach (var y in x[1].Split(','))
                        {
                            var coords = y.Split('-');
                            var index  = int.Parse(coords[0]);
                            var name   = text.Substring(index, int.Parse(coords[1]) - index + 1);

                            // ignore ignored emotes
                            if (!AppSettings.ChatIgnoredEmotes.ContainsKey(name))
                            {
                                var e = Emotes.GetTwitchEmoteById(id, name);

                                twitchEmotes.Add(Tuple.Create(index, e));
                            }
                        }
                        ;
                    }
                });
                twitchEmotes.Sort((e1, e2) => e1.Item1.CompareTo(e2.Item1));
            }

            //if (data.Tags.TryGetValue("id", out value))
            //{

            //}
            //if (data.Tags.TryGetValue("mod", out value))
            //{

            //}
            //if (data.Tags.TryGetValue("subscriber", out value))
            //{
            //    if (value == "1")
            //        Badges |= MessageBadges.Sub;
            //}
            //if (data.Tags.TryGetValue("turbo", out value))
            //{
            //    if (value == "1")
            //        Badges |= MessageBadges.Turbo;
            //}

            var i = 0;
            var currentTwitchEmoteIndex = 0;
            var currentTwitchEmote      = twitchEmotes.FirstOrDefault();

            foreach (var split in text.Split(' '))
            {
                if (currentTwitchEmote != null)
                {
                    if (currentTwitchEmote.Item1 == i)
                    {
                        words.Add(new Word
                        {
                            Type     = SpanType.LazyLoadedImage,
                            Value    = currentTwitchEmote.Item2,
                            Link     = new Link(LinkType.Url, currentTwitchEmote.Item2.Url),
                            Tooltip  = currentTwitchEmote.Item2.Tooltip,
                            CopyText = currentTwitchEmote.Item2.Name
                        });
                        i += split.Length + 1;
                        currentTwitchEmoteIndex++;
                        currentTwitchEmote = currentTwitchEmoteIndex == twitchEmotes.Count ? null : twitchEmotes[currentTwitchEmoteIndex];
                        continue;
                    }
                }

                foreach (var o in Emojis.ParseEmojis(split))
                {
                    var s = o as string;

                    if (s != null)
                    {
                        //foreach (var match in Regex.Matches(@"\b\w+\b", s))
                        //{
                        //    LazyLoadedImage bttvEmote;
                        //    if (AppSettings.ChatEnableBttvEmotes && (Emotes.BttvGlobalEmotes.TryGetValue(s, out bttvEmote) || channel.BttvChannelEmotes.TryGetValue(s, out bttvEmote))
                        //        || (AppSettings.ChatEnableFfzEmotes && Emotes.FfzGlobalEmotes.TryGetValue(s, out bttvEmote)))
                        //    {
                        //        words.Add(new Word
                        //        {
                        //            Type = SpanType.LazyLoadedImage,
                        //            Value = bttvEmote,
                        //            Color = slashMe ? UsernameColor : new int?(),
                        //            Tooltip = bttvEmote.Tooltip,
                        //            Link = bttvEmote.Url,
                        //            CopyText = bttvEmote.Name
                        //        });
                        //    }
                        //}

                        if (bits != null && Regex.IsMatch(s, "cheer[1-9][0-9]*"))
                        {
                            int cheer;

                            if (int.TryParse(s.Substring("cheer".Length), out cheer))
                            {
                                string color = null;

                                HSLColor bitsColor;

                                if (cheer >= 10000)
                                {
                                    color     = "red";
                                    bitsColor = new HSLColor(0, 1f, 0.5f);
                                }
                                else if (cheer >= 5000)
                                {
                                    color     = "blue";
                                    bitsColor = new HSLColor(0.61f, 1f, 0.4f);
                                }
                                else if (cheer >= 1000)
                                {
                                    color     = "green";
                                    bitsColor = new HSLColor(0.5f, 1f, 0.5f);
                                }
                                else if (cheer >= 100)
                                {
                                    color     = "purple";
                                    bitsColor = new HSLColor(0.8f, 1f, 0.5f);
                                }
                                else
                                {
                                    color     = "gray";
                                    bitsColor = HSLColor.FromRGB(0.5f, 0.5f, 0.5f);
                                }

                                var bitsLink = $"http://static-cdn.jtvnw.net/bits/{(GuiEngine.Current.IsDarkTheme ? "dark" : "light")}/animated/{color}/1";

                                words.Add(new Word {
                                    Type = SpanType.LazyLoadedImage, Value = Emotes.MiscEmotesByUrl.GetOrAdd(bitsLink, url => new LazyLoadedImage {
                                        Name = "cheer", Url = url, Tooltip = "Twitch Bits Badge"
                                    }), Tooltip = "Twitch Bits Donation", CopyText = s, Link = new Link(LinkType.Url, "https://blog.twitch.tv/introducing-cheering-celebrate-together-da62af41fac6")
                                });
                                words.Add(new Word {
                                    Type = SpanType.Text, Value = "x" + s.Substring(5), Font = FontType.Small, Color = bitsColor
                                });

                                continue;
                            }
                        }

                        LazyLoadedImage bttvEmote;
                        if (!AppSettings.ChatIgnoredEmotes.ContainsKey(s) && (AppSettings.ChatEnableBttvEmotes && (Emotes.BttvGlobalEmotes.TryGetValue(s, out bttvEmote) || channel.BttvChannelEmotes.TryGetValue(s, out bttvEmote)) ||
                                                                              (AppSettings.ChatEnableFfzEmotes && (Emotes.FfzGlobalEmotes.TryGetValue(s, out bttvEmote) || channel.FfzChannelEmotes.TryGetValue(s, out bttvEmote))) ||
                                                                              Emotes.ChatterinoEmotes.TryGetValue(s, out bttvEmote)))
                        {
                            words.Add(new Word
                            {
                                Type     = SpanType.LazyLoadedImage,
                                Value    = bttvEmote,
                                Color    = slashMe ? UsernameColor : new HSLColor?(),
                                Tooltip  = bttvEmote.Tooltip,
                                Link     = new Link(LinkType.Url, bttvEmote.Url),
                                CopyText = bttvEmote.Name
                            });
                        }
                        else
                        {
                            var link = _matchLink(split);

                            words.Add(new Word
                            {
                                Type     = SpanType.Text,
                                Value    = s,
                                Color    = slashMe ? UsernameColor : (link == null ? new HSLColor?() : HSLColor.FromRGB(-8355712)),
                                Link     = link == null ? null : new Link(LinkType.Url, link),
                                CopyText = s
                            });
                        }
                    }
                    else
                    {
                        var e = o as LazyLoadedImage;

                        if (e != null)
                        {
                            words.Add(new Word
                            {
                                Type             = SpanType.LazyLoadedImage,
                                Value            = e,
                                Link             = new Link(LinkType.Url, e.Url),
                                Tooltip          = e.Tooltip,
                                CopyText         = e.Name,
                                HasTrailingSpace = e.HasTrailingSpace
                            });
                        }
                    }
                }

                var splitLength = 0;
                for (var j = 0; j < split.Length; j++)
                {
                    splitLength++;

                    if (char.IsHighSurrogate(split[j]))
                    {
                        j += 1;
                    }
                }

                i += splitLength + 1;
            }

            Words = words;

            RawMessage = text;

            if (!isReceivedWhisper && AppSettings.HighlightIgnoredUsers.ContainsKey(Username))
            {
                HighlightTab = false;
            }

            //w.Stop();
            //Console.WriteLine("Message parsed in " + w.Elapsed.TotalSeconds.ToString("0.000000") + " seconds");
        }
Beispiel #17
0
        public BehaviourMeta(System.Type target)
        {
            //TargetType = target;
            Name        = target.Name;
            DisplayName = Name;
            Namespace   = target.Namespace;
            string iconPath = "";

            if (target.IsSubclassOf(typeof(BTNodeBase)))
            {
                NodeType = EBTNodeType.controller;
                Category = "Composite";
                iconPath = Installizer.InstallRoot + "/DevilFramework/Editor/Icons/composite.png";
            }
            else if (target.IsSubclassOf(typeof(BTTaskBase)))
            {
                NodeType = EBTNodeType.task;
                Category = "Task";
                iconPath = Installizer.InstallRoot + "/DevilFramework/Editor/Icons/task.png";
            }
            else if (target.IsSubclassOf(typeof(BTConditionBase)))
            {
                NodeType = EBTNodeType.condition;
                Category = "Condition";
                iconPath = Installizer.InstallRoot + "/DevilFramework/Editor/Icons/condition.png";
            }
            else if (target.IsSubclassOf(typeof(BTServiceBase)))
            {
                NodeType = EBTNodeType.service;
                Category = "Service";
                iconPath = Installizer.InstallRoot + "/DevilFramework/Editor/Icons/service.png";
            }
            else
            {
                NodeType = EBTNodeType.invalid;
                Category = "Invalid";
            }

            BTCompositeAttribute attr = Ref.GetCustomAttribute <BTCompositeAttribute>(target);

            if (attr != null)
            {
                if (!string.IsNullOrEmpty(attr.Title))
                {
                    DisplayName = attr.Title;
                }
                if (!string.IsNullOrEmpty(attr.Detail))
                {
                    SubTitle = attr.Detail;
                }
                if (!string.IsNullOrEmpty(attr.IconPath))
                {
                    iconPath = attr.IconPath;
                }
                if (!string.IsNullOrEmpty(attr.Category))
                {
                    Category = attr.Category;
                }
                HideProperty = attr.HideProperty;
            }
            FieldInfo[]            fields      = target.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
            List <BTInputProperty> propperties = new List <BTInputProperty>();

            for (int i = 0; i < fields.Length; i++)
            {
                BTVariableAttribute vatt = Ref.GetCustomAttribute <BTVariableAttribute>(fields[i]);
                if (vatt != null)
                {
                    BTInputProperty pro = new BTInputProperty(fields[i], vatt);
                    propperties.Add(pro);
                }
            }
            Icon           = DevilEditorUtility.GetTexture(iconPath);
            Properties     = propperties.ToArray();
            NotDisplayName = string.Format("<b><color=yellow>NOT</color></b> {0}", DisplayName);
            SearchName     = Name.ToLower() + " " + DisplayName.ToLower();
            color          = BehaviourModuleManager.GetOrNewInstance().GetCategoryColor(Category);
        }
Beispiel #18
0
        public summoner CreateMenu(Menu root)
        {
            Menu = new Menu(DisplayName, "m" + Name);

            if (!Name.Contains("smite"))
            {
                Menu.AddItem(new MenuItem("use" + Name, "Use " + DisplayName)).SetValue(true);
            }

            if (Name == "summonerheal")
            {
                Menu.AddItem(new MenuItem("selflowhp" + Name + "pct", "Use on Hero HP % <="))
                .SetValue(new Slider(20));
                Menu.AddItem(new MenuItem("selfmuchhp" + Name + "pct", "Use on Hero Dmg Dealt % >="))
                .SetValue(new Slider(45));
            }

            if (Name == "summonerboost(disabled)")
            {
                var ccmenu = new Menu(DisplayName + " Debuffs", DisplayName.ToLower() + "cdeb");
                ccmenu.AddItem(new MenuItem(Name + "cignote", "Ignite")).SetValue(true);
                ccmenu.AddItem(new MenuItem(Name + "cexhaust", "Exhaust")).SetValue(true);
                ccmenu.AddItem(new MenuItem(Name + "cstun", "Stuns")).SetValue(true);
                ccmenu.AddItem(new MenuItem(Name + "ccharm", "Charms")).SetValue(true);
                ccmenu.AddItem(new MenuItem(Name + "ctaunt", "Taunts")).SetValue(true);
                ccmenu.AddItem(new MenuItem(Name + "cfear", "Fears")).SetValue(true);
                ccmenu.AddItem(new MenuItem(Name + "cflee", "Flee")).SetValue(true);
                ccmenu.AddItem(new MenuItem(Name + "csnare", "Snares")).SetValue(true);
                ccmenu.AddItem(new MenuItem(Name + "csilence", "Silences")).SetValue(true);
                ccmenu.AddItem(new MenuItem(Name + "csupp", "Supression")).SetValue(true);
                ccmenu.AddItem(new MenuItem(Name + "cpolymorph", "Polymorphs")).SetValue(true);
                ccmenu.AddItem(new MenuItem(Name + "cblind", "Blinds")).SetValue(true);
                ccmenu.AddItem(new MenuItem(Name + "cslow", "Slows")).SetValue(true);
                ccmenu.AddItem(new MenuItem(Name + "cpoison", "Poisons")).SetValue(true);
                Menu.AddSubMenu(ccmenu);

                Menu.AddItem(new MenuItem("use" + Name + "Number", "Minimum Spells to Use")).SetValue(new Slider(1, 1, 5));
                Menu.AddItem(new MenuItem("use" + Name + "Time", "Minumum Durration to Use")).SetValue(new Slider(2, 1, 5));
                Menu.AddItem(new MenuItem("use" + Name + "Od", "Use only on Dangerous")).SetValue(false);
                Menu.AddItem(new MenuItem("mode" + Name, "Mode: ")).SetValue(new StringList(new[] { "Always", "Combo" }));
            }

            if (Name == "summonerdot")
            {
                Menu.AddItem(new MenuItem("mode" + Name, "Mode: "))
                .SetValue(new StringList(new[] { "Killsteal", "Combo" }, 1));
            }

            if (Name == "summonermana")
            {
                Menu.AddItem(new MenuItem("selflowmp" + Name + "pct", "Minimum Mana % <=")).SetValue(new Slider(40));
            }

            if (Name == "summonerbarrier")
            {
                Menu.AddItem(new MenuItem("selflowhp" + Name + "pct", "Use on Hero HP % <=")).SetValue(new Slider(20));
                Menu.AddItem(new MenuItem("selfmuchhp" + Name + "pct", "Use on Hero Dmg Dealt % >=")).SetValue(new Slider(45));
                Menu.AddItem(new MenuItem("use" + Name + "Ulti", "Use on Dangerous (Ultimates Only)")).SetValue(true);
            }

            if (Name == "summonerexhaust")
            {
                Menu.AddItem(new MenuItem("a" + Name + "pct", "Exhaust on ally HP %")).SetValue(new Slider(35));
                Menu.AddItem(new MenuItem("e" + Name + "pct", "Exhaust on enemy HP %")).SetValue(new Slider(35));
                Menu.AddItem(new MenuItem("use" + Name + "Ulti", "Use on Dangerous")).SetValue(true);
                Menu.AddItem(new MenuItem("mode" + Name, "Mode: ")).SetValue(new StringList(new[] { "Always", "Combo" }));
            }

            if (Activator.SmiteInGame && Name == "summonersmite")
            {
                Menu.AddItem(new MenuItem("usesmite", "Use Smite")).SetValue(new KeyBind('M', KeyBindType.Toggle, true));
                Menu.AddItem(new MenuItem("smitesmall", "Smite Small Camps")).SetValue(true);
                Menu.AddItem(new MenuItem("smitelarge", "Smite Large Camps")).SetValue(true);
                Menu.AddItem(new MenuItem("smitesuper", "Smite Epic Camps")).SetValue(true);
                Menu.AddItem(new MenuItem("smitemode", "Smite Enemies: "))
                .SetValue(new StringList(new[] { "Killsteal", "Combo", "Nope" }, 1));
                Menu.AddItem(new MenuItem("savesmite", "Save a Smite Charge").SetValue(true));
            }

            root.AddSubMenu(Menu);
            return(this);
        }
 private void SetKeywordStrings(params string[] keywords)
 {
     KeywordStrings = keywords == null && !string.IsNullOrEmpty(DisplayName)
         ? new[] { DisplayName.ToUpper(), DisplayName.ToLower() }
         : keywords;
 }
Beispiel #20
0
 public void Filter(string searchText)
 {
     if (!string.IsNullOrEmpty(searchText))
     {
         if (_children != null)
         {
             foreach (var itemModel in _children)
             {
                 itemModel.Filter(searchText);
             }
         }
         var anyChildrenVisible = _children != null && _children.Any(model => model.IsVisible);
         var displayNameContainsSearchString = !string.IsNullOrEmpty(DisplayName) && DisplayName.ToLower().Contains(searchText.ToLower());
         IsVisible = anyChildrenVisible || displayNameContainsSearchString;
     }
     else
     {
         IsVisible = true;
         if (_children != null)
         {
             foreach (var itemModel in _children)
             {
                 itemModel.IsVisible = true;
             }
         }
     }
     _searchText = searchText;
     NotifyOfPropertyChange(() => Children);
 }
        public CoreSum CreateMenu(Menu root)
        {
            try
            {
                Menu = new Menu(DisplayName, "m" + Name);

                if (!Name.Contains("smite") && !Name.Contains("teleport"))
                {
                    Menu.AddItem(new MenuItem("use" + Name, "Use " + DisplayName)).SetValue(true).Permashow();
                }

                if (Name == "summonersnowball")
                {
                    Activator.UseEnemyMenu = true;
                }

                if (Name == "summonerheal")
                {
                    Activator.UseAllyMenu = true;
                    Menu.AddItem(new MenuItem("selflowhp" + Name + "pct", "Use on Hero HP % <=")).SetValue(new Slider(20));
                    Menu.AddItem(new MenuItem("selfmuchhp" + Name + "pct", "Use on Hero Dmg Dealt % >=")).SetValue(new Slider(45));
                    Menu.AddItem(new MenuItem("use" + Name + "tower", "Include Tower Damage")).SetValue(false);
                    Menu.AddItem(new MenuItem("mode" + Name, "Mode: ")).SetValue(new StringList(new[] { "Always", "Combo" }, 1));
                }

                if (Name == "summonerboost")
                {
                    Activator.UseAllyMenu = true;
                    var ccmenu = new Menu(DisplayName + " Buff Types", DisplayName.ToLower() + "cdeb");
                    ccmenu.AddItem(new MenuItem(Name + "cstun", "Stuns")).SetValue(true);
                    ccmenu.AddItem(new MenuItem(Name + "ccharm", "Charms")).SetValue(true);
                    ccmenu.AddItem(new MenuItem(Name + "ctaunt", "Taunts")).SetValue(true);
                    ccmenu.AddItem(new MenuItem(Name + "cflee", "Flee/Fear")).SetValue(true);
                    ccmenu.AddItem(new MenuItem(Name + "csnare", "Snares")).SetValue(true);
                    ccmenu.AddItem(new MenuItem(Name + "cexh", "Exhaust")).SetValue(false);
                    ccmenu.AddItem(new MenuItem(Name + "csupp", "Supression")).SetValue(false);
                    ccmenu.AddItem(new MenuItem(Name + "csilence", "Silences")).SetValue(false);
                    ccmenu.AddItem(new MenuItem(Name + "cpolymorph", "Polymorphs")).SetValue(false);
                    ccmenu.AddItem(new MenuItem(Name + "cblind", "Blinds")).SetValue(false);
                    ccmenu.AddItem(new MenuItem(Name + "cslow", "Slows")).SetValue(false);
                    ccmenu.AddItem(new MenuItem(Name + "cpoison", "Poisons")).SetValue(false);
                    Menu.AddSubMenu(ccmenu);

                    Menu.AddItem(new MenuItem("use" + Name + "number", "Min Buffs to Use")).SetValue(new Slider(1, 1, 5))
                    .SetTooltip("Will Only " + DisplayName + " if Your Buff Count is >= Value");
                    Menu.AddItem(new MenuItem("use" + Name + "time", "Min Durration to Use"))
                    .SetValue(new Slider(500, 250, 2000))
                    .SetTooltip("Will not use unless the buff durration (stun, snare, etc) last at least this long (ms, 500 = 0.5 seconds)");
                    Menu.AddItem(new MenuItem("use" + Name + "od", "Use for Dangerous Only")).SetValue(false);
                    Menu.AddItem(new MenuItem("use" + Name + "delay", "Activation Delay (in ms)")).SetValue(new Slider(150, 0, 500));
                    Menu.AddItem(new MenuItem("mode" + Name, "Mode: ")).SetValue(new StringList(new[] { "Always", "Combo" }));
                }

                if (Name == "summonerdot")
                {
                    Activator.UseEnemyMenu = true;
                    Menu.AddItem(new MenuItem("idmgcheck", "Combo Damage Check %", true)).SetValue(95)
                    .SetValue(new Slider(100, 1, 200)).SetTooltip("Lower if Igniting to early. Increase if opposite.");

                    switch (Player.ChampionName)
                    {
                    case "Ahri":
                        Menu.AddItem(new MenuItem("ii" + Player.ChampionName, Player.ChampionName + ": Check Charm"))
                        .SetValue(false).SetTooltip("Only ignite if target is charmed?");
                        break;

                    case "Cassiopeia":
                        Menu.AddItem(new MenuItem("ii" + Player.ChampionName, Player.ChampionName + ": Check Poison"))
                        .SetValue(false).SetTooltip("Only ignite if target is poisoned?");
                        break;

                    case "Diana":
                        Menu.AddItem(new MenuItem("ii" + Player.ChampionName, Player.ChampionName + ": Check Moonlight?"))
                        .SetValue(false).SetTooltip("Only ignite if target has moonlight debuff?");
                        break;
                    }

                    Menu.AddItem(new MenuItem("itu", "Dont Ignite Near Turret")).SetValue(true);
                    Menu.AddItem(new MenuItem("igtu", "-> Ignore after Level")).SetValue(new Slider(11, 1, 18));
                    Menu.AddItem(new MenuItem("idraw", "Draw Combo Damage %")).SetValue(true);
                    Menu.AddItem(new MenuItem("mode" + Name, "Mode: "))
                    .SetValue(new StringList(new[] { "Killsteal", "Combo" }, 0));
                }

                if (Name == "summonermana")
                {
                    Activator.UseAllyMenu = true;
                    Menu.AddItem(new MenuItem("selflowmp" + Name + "pct", "Minimum Mana % <=")).SetValue(new Slider(40));
                }

                if (Name == "summonerbarrier")
                {
                    Activator.UseAllyMenu = true;
                    Menu.AddItem(new MenuItem("selflowhp" + Name + "pct", "Use on Hero HP % <=")).SetValue(new Slider(20));
                    Menu.AddItem(new MenuItem("selfmuchhp" + Name + "pct", "Use on Hero Dmg Dealt % >=")).SetValue(new Slider(45));
                    Menu.AddItem(new MenuItem("use" + Name + "ulti", "Use on Dangerous (Ultimates Only)")).SetValue(true);
                    Menu.AddItem(new MenuItem("f" + Name, "-> Force Barrier"))
                    .SetValue(false).SetTooltip("Will force barrier ultimates ignoring HP% & income damage");
                    Menu.AddItem(new MenuItem("use" + Name + "tower", "Include Tower Damage")).SetValue(true);
                    Menu.AddItem(new MenuItem("mode" + Name, "Mode: ")).SetValue(new StringList(new[] { "Always", "Combo" }, 1));
                }

                if (Name == "summonerexhaust")
                {
                    Activator.UseEnemyMenu = true;
                    Menu.AddItem(new MenuItem("a" + Name + "pct", "Exhaust on ally HP %")).SetValue(new Slider(35));
                    Menu.AddItem(new MenuItem("e" + Name + "pct", "Exhaust on enemy HP %")).SetValue(new Slider(45));
                    Menu.AddItem(new MenuItem("use" + Name + "ulti", "Use on Dangerous (Utimates Only)"))
                    .SetValue(true).SetTooltip("Or spells with \"Force Exhaust\"");
                    Menu.AddItem(new MenuItem("f" + Name, "-> Force Exhaust"))
                    .SetValue(true).SetTooltip("Will force exhaust ultimates ignoring HP% & income damage");
                    Menu.AddItem(new MenuItem("mode" + Name, "Mode: ")).SetValue(new StringList(new[] { "Always", "Combo" }));
                }

                if (Name == "summonersmite")
                {
                    Activator.UseEnemyMenu = true;
                    Menu.AddItem(new MenuItem("usesmite", "Use Smite")).SetValue(new KeyBind('M', KeyBindType.Toggle, true)).Permashow();
                    Menu.AddItem(new MenuItem("smiteskill", "-> Smite + Ability")).SetValue(true);
                    Menu.AddItem(new MenuItem("smitesmall", "Smite Small Camps")).SetValue(true);
                    // Menu.AddItem(new MenuItem("smitekrug", "-> Krug")).SetValue(true);
                    // Menu.AddItem(new MenuItem("smitewolve", "-> Wolves")).SetValue(true);
                    // Menu.AddItem(new MenuItem("smiterazor", "-> Razorbeak")).SetValue(true);
                    Menu.AddItem(new MenuItem("smitelarge", "Smite Large Camps")).SetValue(true);
                    // Menu.AddItem(new MenuItem("smiteblu", "-> Blu")).SetValue(true);
                    // Menu.AddItem(new MenuItem("smitered", "-> Red")).SetValue(true);
                    Menu.AddItem(new MenuItem("smitesuper", "Smite Epic Camps")).SetValue(true);
                    // Menu.AddItem(new MenuItem("smitebaron", "-> Baron")).SetValue(true);
                    // Menu.AddItem(new MenuItem("smitedragon", "-> Dragon")).SetValue(true);
                    // Menu.AddItem(new MenuItem("smiterift", "-> Rift Herald")).SetValue(true);
                    Menu.AddItem(new MenuItem("smitemode", "Smite Enemies: "))
                    .SetValue(new StringList(new[] { "Killsteal", "Combo", "Nope" }, 1));
                    Menu.AddItem(new MenuItem("savesmite", "-> Save a Smite Charge")
                                 .SetValue(true).SetTooltip("Will only combo smite if Ammo > 1"));
                    // Menu.AddItem(new MenuItem("savesmite2", "-> Dont Smite Near Camps")
                    // .SetValue(true).SetTooltip("Wont smite enemies near camps"));
                }

                if (Name == "summonerteleport")
                {
                    Activator.UseAllyMenu = true;
                    Menu.AddItem(new MenuItem("telesound", "Enable Sound")).SetValue(false).SetTooltip("Only you can hear this.");
                    Menu.AddItem(new MenuItem("telelowhp2", "Ping Low Health Allies")).SetValue(false);
                    Menu.AddItem(new MenuItem("teleulthp2", "Ping Dangerous Activity")).SetValue(false);
                }

                root.AddSubMenu(Menu);
            }

            catch (Exception e)
            {
                Console.WriteLine(e);
                Game.PrintChat("<font color=\"#FFF280\">Exception thrown at CoreSum.CreateMenu: </font>: " + e.Message);
            }

            return(this);
        }
Beispiel #22
0
 /// <summary>
 /// Determines whether this entry contains the specified filter word.
 /// </summary>
 /// <param name="filterWord">The filter word.</param>
 /// <returns>
 ///     <c>true</c> if contains the specified filter word; otherwise, <c>false</c>.
 /// </returns>
 /// <remarks>Documented by Dev05, 2008-12-10</remarks>
 public bool Contains(string filterWord)
 {
     return(DisplayName.ToLower().Contains(filterWord) || IsVerified && IsAccessible && (Author.ToLower().Contains(filterWord) ||
                                                                                         Category.ToString().ToLower().Contains(filterWord) || Description.ToLower().Contains(filterWord) ||
                                                                                         Group.Header.ToLower().Contains(filterWord) || LastTimeLearned.ToLongTimeString().ToLower().Contains(filterWord)));
 }
Beispiel #23
0
 public string BuildItemCss()
 {
     return(string.Format("{0}-{1}", DisplayName.ToLower(), Year));
 }
Beispiel #24
0
        public Message(IrcMessage data, TwitchChannel channel, bool enableTimestamp = true, bool enablePingSound = true,
                       bool isReceivedWhisper = false, bool isSentWhisper = false, bool includeChannel = false, bool isPastMessage = false)
        {
            //var w = Stopwatch.StartNew();

            ParseTime = DateTime.Now;
            Channel   = channel;

            List <Word> words = new List <Word>();
            string      value;

            string text = data.Params ?? "";

            Params   = text;
            Username = data.PrefixNickname ?? "";

            if (string.IsNullOrWhiteSpace(Username))
            {
                string login;

                if (data.Tags.TryGetValue("login", out login))
                {
                    Username = login;
                }
            }

            if (data.Tags.TryGetValue("user-id", out value))
            {
                UserId = value;
            }

            var slashMe = false;

            // Handle /me messages
            if (text.Length > 8 && text.StartsWith("\u0001ACTION "))
            {
                text    = text.Substring("\u0001ACTION ".Length, text.Length - "\u0001ACTION ".Length - 1);
                slashMe = true;
            }

            if (data.Tags.TryGetValue("display-name", out value))
            {
                DisplayName = value;
            }

            // Username
            if (string.IsNullOrWhiteSpace(DisplayName))
            {
                DisplayName = Username;
            }
            // Highlights
            if (!IrcManager.Account.IsAnon)
            {
                if ((AppSettings.ChatEnableHighlight || AppSettings.ChatEnableHighlightSound ||
                     AppSettings.ChatEnableHighlightTaskbar) && Username != IrcManager.Account.Username.ToLower())
                {
                    if (!AppSettings.HighlightIgnoredUsers.ContainsKey(Username))
                    {
                        if (!IrcManager.IgnoredUsers.Contains(Username))
                        {
                            if (AppSettings.CustomHighlightRegex != null &&
                                AppSettings.CustomHighlightRegex.IsMatch(text))
                            {
                                if (AppSettings.ChatEnableHighlight)
                                {
                                    HighlightType = HighlightType.Highlighted;
                                }

                                if (EnablePings && enablePingSound)
                                {
                                    if (AppSettings.ChatEnableHighlightSound)
                                    {
                                        GuiEngine.Current.PlaySound(NotificationSound.Ping);
                                    }
                                    if (AppSettings.ChatEnableHighlightTaskbar)
                                    {
                                        GuiEngine.Current.FlashTaskbar();
                                    }
                                }
                            }
                            else if (AppSettings.HighlightUserNames != null &&
                                     (AppSettings.HighlightUserNames.ContainsKey(Username) ||
                                      AppSettings.HighlightUserNames.ContainsKey(DisplayName)))
                            {
                                if (AppSettings.ChatEnableHighlight)
                                {
                                    HighlightType = HighlightType.UsernameHighlighted;
                                }
                            }
                        }
                    }
                }
            }

            // Tags
            if (data.Tags.TryGetValue("color", out value))
            {
                try
                {
                    if (value.Length == 7 && value[0] == '#')
                    {
                        UsernameColor = HSLColor.FromRGB(Convert.ToInt32(value.Substring(1), 16));
                    }
                }
                catch { }
            }

            // Bits
            string bits = null;

            data.Tags.TryGetValue("bits", out bits);

            // Add timestamp
            string timestampTag;
            string timestamp = null;

            string tmiTimestamp;
            long   tmiTimestampInt;

            DateTime timestampTime = DateTime.Now;

            if (data.Tags.TryGetValue("tmi-sent-ts", out tmiTimestamp))
            {
                if (long.TryParse(tmiTimestamp, out tmiTimestampInt))
                {
                    var dtDateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);

                    var time = dtDateTime.AddSeconds(tmiTimestampInt / 1000).ToLocalTime();

                    timestampTime = time;

                    //timestamp = time.ToString(AppSettings.ChatShowTimestampSeconds ? "HH:mm:ss" : "HH:mm");
                    //enableTimestamp = true;
                }
            }
            else if (data.Tags.TryGetValue("timestamp-utc", out timestampTag))
            {
                DateTime time;
                if (DateTime.TryParseExact(timestampTag, "yyyyMMdd-HHmmss", CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal, out time))
                {
                    timestampTime = time;
                    //timestamp = time.ToString(AppSettings.ChatShowTimestampSeconds ? "HH:mm:ss" : "HH:mm");
                    //enableTimestamp = true;
                }
            }

            if (enableTimestamp && AppSettings.ChatShowTimestamps)
            {
                string timestampFormat;

                if (AppSettings.ChatShowTimestampSeconds)
                {
                    timestampFormat = AppSettings.TimestampsAmPm ? "hh:mm:ss tt" : "HH:mm:ss";
                }
                else
                {
                    timestampFormat = AppSettings.TimestampsAmPm ? "hh:mm tt" : "HH:mm";
                }

                timestamp = timestampTime.ToString(timestampFormat, enUS);

                words.Add(new Word
                {
                    Type     = SpanType.Text,
                    Value    = timestamp,
                    Color    = HSLColor.FromRGB(-8355712),
                    Font     = FontType.Small,
                    CopyText = timestamp
                });
            }

            // add channel name
            if (includeChannel)
            {
                words.Add(new Word
                {
                    Type     = SpanType.Text,
                    Link     = new Link(LinkType.ShowChannel, channel.Name),
                    Value    = "#" + channel.Name,
                    Color    = HSLColor.FromRGB(-8355712),
                    Font     = FontType.Medium,
                    CopyText = "#" + channel.Name
                });
            }

            // add moderation buttons
            if (channel.IsModOrBroadcaster && !string.Equals(IrcManager.Account.Username, Username))
            {
                string badges;
                if (data.Tags.TryGetValue("badges", out badges))
                {
                    if (badges.Contains("broadcaster"))
                    {
                        goto aftermod;
                    }

                    if (badges.Contains("moderator") && !channel.IsBroadcaster)
                    {
                        goto aftermod;
                    }
                }

                if (AppSettings.EnableBanButton)
                {
                    words.Add(new Word
                    {
                        Type    = SpanType.LazyLoadedImage,
                        Value   = new LazyLoadedImage(GuiEngine.Current.GetImage(ImageType.Ban)),
                        Link    = new Link(LinkType.BanUser, Tuple.Create(Username, channel.Name)),
                        Tooltip = "Ban User"
                    });
                }

                if (AppSettings.EnableTimeoutButton)
                {
                    foreach (var amount in AppSettings.TimeoutButtons)
                    {
                        int    tmpAmount = amount;
                        string tooltip   = "";

                        if (tmpAmount > 60 * 60 * 24)
                        {
                            tooltip   += tmpAmount / (60 * 60 * 24) + " days ";
                            tmpAmount %= 60 * 60 * 24;
                        }
                        if (tmpAmount > 60 * 60)
                        {
                            tooltip   += tmpAmount / (60 * 60) + " hours ";
                            tmpAmount %= 60 * 60;
                        }
                        if (tmpAmount > 60)
                        {
                            tooltip   += tmpAmount / (60) + " mins ";
                            tmpAmount %= 60;
                        }
                        if (tmpAmount > 0)
                        {
                            tooltip += tmpAmount + " secs ";
                        }

                        Image image;
                        if (AppSettings.TimeoutButtons.Count > 1)
                        {
                            image = ((dynamic)GuiEngine.Current).GetImageForTimeout(amount);
                        }
                        else
                        {
                            image = GuiEngine.Current.GetImage(ImageType.Timeout);
                        }

                        words.Add(new Word
                        {
                            Type    = SpanType.LazyLoadedImage,
                            Value   = new LazyLoadedImage(image),
                            Link    = new Link(LinkType.TimeoutUser, Tuple.Create(Username, channel.Name, amount)),
                            Tooltip = $"Timeout User ({tooltip.Trim()})"
                        });
                    }
                }
            }
aftermod:

            // get badges from tags
            if (data.Tags.TryGetValue("badges", out value))
            {
                var             badges = value.Split(',');
                LazyLoadedImage image;
                foreach (var badge in badges)
                {
                    if (badge.StartsWith("subscriber/"))
                    {
                        try
                        {
                            int n = int.Parse(badge.Substring("subscriber/".Length));

                            Badges |= MessageBadges.Sub;
                            image   = channel.GetSubscriberBadge(n);
                            if (image != null)
                            {
                                words.Add(new Word {
                                    Type = SpanType.LazyLoadedImage, Value = image, Link = new Link(LinkType.Url, Channel.SubLink), Tooltip = image.Tooltip
                                });
                            }
                            else
                            {
                                image = GuiEngine.Current.GetBadge(badge);
                                if (image != null)
                                {
                                    words.Add(new Word {
                                        Type = SpanType.LazyLoadedImage, Value = image, Link = new Link(LinkType.Url, image.click_url), Tooltip = image.Tooltip
                                    });
                                }
                            }
                        }
                        catch { }
                    }
                    else if (badge.Equals("moderator/1") && channel.ModeratorBadge != null)
                    {
                        words.Add(new Word {
                            Type = SpanType.LazyLoadedImage, Value = channel.ModeratorBadge, Tooltip = channel.ModeratorBadge.Tooltip
                        });
                    }
                    else if (badge.StartsWith("bits/"))
                    {
                        try {
                            int n = int.Parse(badge.Substring("bits/".Length));

                            image = channel.GetCheerBadge(n);
                            if (image != null)
                            {
                                words.Add(new Word {
                                    Type = SpanType.LazyLoadedImage, Value = image, Link = new Link(LinkType.Url, image.click_url), Tooltip = image.Tooltip
                                });
                            }
                            else
                            {
                                image = GuiEngine.Current.GetBadge(badge);
                                if (image != null)
                                {
                                    words.Add(new Word {
                                        Type = SpanType.LazyLoadedImage, Value = image, Link = new Link(LinkType.Url, image.click_url), Tooltip = image.Tooltip
                                    });
                                }
                            }
                        } catch {}
                    }
                    else
                    {
                        image = GuiEngine.Current.GetBadge(badge);
                        if (image != null)
                        {
                            words.Add(new Word {
                                Type = SpanType.LazyLoadedImage, Value = image, Link = new Link(LinkType.Url, image.click_url), Tooltip = image.Tooltip
                            });
                        }
                    }
                }
            }

            var messageUser = (isSentWhisper ? IrcManager.Account.Username + " -> " : "");

            messageUser += DisplayName;

            if (!isReceivedWhisper && !isSentWhisper)
            {
                messageUser += (DisplayName.ToLower() != Username ? $" ({Username})" : "");
            }

            if (isReceivedWhisper)
            {
                messageUser += " -> " + IrcManager.Account.Username;
            }

            if (!slashMe)
            {
                messageUser += ":";
            }

            words.Add(new Word
            {
                Type  = SpanType.Text,
                Value = messageUser,
                Color = UsernameColor,
                Font  = FontType.MediumBold,
                Link  = new Link(LinkType.UserInfo, new UserInfoData {
                    UserName = Username, UserId = UserId, Channel = channel
                }),
                CopyText = messageUser
            });

            var twitchEmotes = new List <Tuple <int, LazyLoadedImage> >();

            if (data.Tags.TryGetValue("msg-id", out value))
            {
                if (value.Contains("highlighted-message"))
                {
                    if (!isPastMessage)
                    {
                        Message message;
                        message = new Message("Highlighted Message", HSLColor.Gray, true)
                        {
                            HighlightType = HighlightType.HighlightedMessage
                        };
                        channel.AddMessage(message);
                    }
                    HighlightType = HighlightType.HighlightedMessage;
                }
            }
            // Twitch Emotes
            if (AppSettings.ChatEnableTwitchEmotes && data.Tags.TryGetValue("emotes", out value))
            {
                //  93064:0-6,8-14/80481:16-20,22-26
                value.Split('/').Do(emote =>
                {
                    if (emote != "")
                    {
                        var x = emote.Split(':');
                        try {
                            var id = x[0];
                            foreach (var y in x[1].Split(','))
                            {
                                var coords = y.Split('-');
                                var index  = int.Parse(coords[0]);
                                var name   = text.Substring(index, int.Parse(coords[1]) - index + 1);

                                // ignore ignored emotes
                                if (!AppSettings.ChatIgnoredEmotes.ContainsKey(name))
                                {
                                    var e = Emotes.GetTwitchEmoteById(id, name);

                                    twitchEmotes.Add(Tuple.Create(index, e));
                                }
                            }
                            ;
                        } catch (Exception e) {
                            GuiEngine.Current.log("Generic Exception Handler: " + " " + emote + " " + x[0] + " " + e.ToString());
                        }
                    }
                });
                twitchEmotes.Sort((e1, e2) => e1.Item1.CompareTo(e2.Item1));
            }

            var i = 0;
            var currentTwitchEmoteIndex = 0;
            var currentTwitchEmote      = twitchEmotes.FirstOrDefault();

            foreach (var split in text.Split(' '))
            {
                if (currentTwitchEmote != null)
                {
                    if (currentTwitchEmote.Item1 == i)
                    {
                        words.Add(new Word
                        {
                            Type     = SpanType.LazyLoadedImage,
                            Value    = currentTwitchEmote.Item2,
                            Link     = new Link(LinkType.Url, currentTwitchEmote.Item2.Url),
                            Tooltip  = currentTwitchEmote.Item2.Tooltip,
                            CopyText = currentTwitchEmote.Item2.Name
                        });
                        i += split.Length + 1;
                        currentTwitchEmoteIndex++;
                        currentTwitchEmote = currentTwitchEmoteIndex == twitchEmotes.Count ? null : twitchEmotes[currentTwitchEmoteIndex];
                        continue;
                    }
                }

                foreach (var o in Emojis.ParseEmojis(split))
                {
                    var s = o as string;

                    if (s != null)
                    {
                        Match m = Regex.Match(s, "([A-Za-z]+)([1-9][0-9]*)");
                        if (bits != null && m.Success)
                        {
                            try{
                                int    cheer;
                                string prefix   = m.Groups[1].Value;
                                string getcheer = m.Groups[2].Value;
                                if (int.TryParse(getcheer, out cheer))
                                {
                                    string          color;
                                    string          bitsLink;
                                    bool            found = false;
                                    HSLColor        bitsColor;
                                    LazyLoadedImage emote;
                                    if (!(found = channel.GetCheerEmote(prefix, cheer, !GuiEngine.Current.IsDarkTheme, out emote, out color)))
                                    {
                                        found = GuiEngine.Current.GetCheerEmote(prefix, cheer, !GuiEngine.Current.IsDarkTheme, out emote, out color);
                                    }
                                    if (found)
                                    {
                                        bitsColor = HSLColor.FromRGBHex(color);
                                        bitsLink  = emote.Url;

                                        words.Add(new Word {
                                            Type = SpanType.LazyLoadedImage, Value = Emotes.MiscEmotesByUrl.GetOrAdd(bitsLink, url => new LazyLoadedImage {
                                                Name = "cheer", Url = url, Tooltip = "Twitch Bits Badge"
                                            }), Tooltip = "Twitch Bits Donation", CopyText = s, Link = new Link(LinkType.Url, "https://blog.twitch.tv/introducing-cheering-celebrate-together-da62af41fac6")
                                        });
                                        words.Add(new Word {
                                            Type = SpanType.Text, Value = getcheer, Font = FontType.Small, Color = bitsColor
                                        });
                                    }
                                    continue;
                                }
                            } catch (Exception e) {
                                GuiEngine.Current.log("Generic Exception Handler: " + e.ToString());
                            }
                        }

                        LazyLoadedImage bttvEmote;
                        if (!AppSettings.ChatIgnoredEmotes.ContainsKey(s) && (AppSettings.ChatEnableBttvEmotes && (Emotes.BttvGlobalEmotes.TryGetValue(s, out bttvEmote) || channel.BttvChannelEmotes.TryGetValue(s, out bttvEmote)) ||
                                                                              (AppSettings.ChatEnableFfzEmotes && (Emotes.FfzGlobalEmotes.TryGetValue(s, out bttvEmote) || channel.FfzChannelEmotes.TryGetValue(s, out bttvEmote)))))
                        {
                            words.Add(new Word
                            {
                                Type     = SpanType.LazyLoadedImage,
                                Value    = bttvEmote,
                                Color    = slashMe ? UsernameColor : new HSLColor?(),
                                Tooltip  = bttvEmote.Tooltip,
                                Link     = new Link(LinkType.Url, bttvEmote.Url),
                                CopyText = bttvEmote.Name
                            });
                        }
                        else
                        {
                            var link = _matchLink(split);

                            words.Add(new Word
                            {
                                Type     = SpanType.Text,
                                Value    = s.Replace('﷽', '?'),
                                Color    = slashMe ? UsernameColor : (link == null ? new HSLColor?() : HSLColor.FromRGB(-8355712)),
                                Link     = link == null ? null : new Link(LinkType.Url, link),
                                CopyText = s
                            });
                        }
                    }
                    else
                    {
                        var e = o as LazyLoadedImage;

                        if (e != null)
                        {
                            words.Add(new Word
                            {
                                Type             = SpanType.LazyLoadedImage,
                                Value            = e,
                                Link             = new Link(LinkType.Url, e.Url),
                                Tooltip          = e.Tooltip,
                                CopyText         = e.Name,
                                HasTrailingSpace = e.HasTrailingSpace
                            });
                        }
                    }
                }

                var splitLength = 0;
                for (var j = 0; j < split.Length; j++)
                {
                    splitLength++;

                    if (char.IsHighSurrogate(split[j]))
                    {
                        j += 1;
                    }
                }

                i += splitLength + 1;
            }

            Words = words;

            RawMessage = text;

            if (!isReceivedWhisper && AppSettings.HighlightIgnoredUsers.ContainsKey(Username))
            {
                HighlightTab = false;
            }

            //w.Stop();
            //Console.WriteLine("Message parsed in " + w.Elapsed.TotalSeconds.ToString("0.000000") + " seconds");
        }
Beispiel #25
0
        /// <summary>
        /// Constructor for UserState.
        /// </summary>
        /// <param name="ircString"></param>
        public UserState(string ircString)
        {
            foreach (string part in ircString.Split(';'))
            {
                // The 'user-type' section does not have a ; suffix, we will account for this outside of for loop, we should exit loop immediately
                if (part.Contains(" :tmi.twitch.tv USERSTATE "))
                {
                    break;
                }
                if (!part.Contains("="))
                {
                    // This should never happen, unless Twitch changes their shit.
                    Console.WriteLine($"Unaccounted for [UserState]: {part}");
                    continue;
                }
                switch (part.Split('=')[0])
                {
                case "@badges":
                    string badges = part.Split('=')[1];
                    if (badges.Contains('/'))
                    {
                        if (!badges.Contains(","))
                        {
                            Badges.Add(new KeyValuePair <string, string>(badges.Split('/')[0], badges.Split('/')[1]));
                        }
                        else
                        {
                            foreach (string badge in badges.Split(','))
                            {
                                Badges.Add(new KeyValuePair <string, string>(badge.Split('/')[0], badge.Split('/')[1]));
                            }
                        }
                    }
                    break;

                case "color":
                    ColorHex = part.Split('=')[1];
                    break;

                case "display-name":
                    DisplayName = part.Split('=')[1];
                    break;

                case "emote-sets":
                    EmoteSet = part.Split('=')[1];
                    break;

                case "mod":
                    Moderator = part.Split('=')[1] == "1";
                    break;

                case "subscriber":
                    Subscriber = part.Split('=')[1] == "1";
                    break;

                default:
                    // This should never happen, unless Twitch changes their shit
                    Console.WriteLine($"Unaccounted for [UserState]: {part.Split('=')[0]}");
                    break;
                }
            }
            // Lets deal with that user-type
            switch (ircString.Split('=')[6].Split(' ')[0])
            {
            case "mod":
                UserType = Enums.UserType.Moderator;
                break;

            case "global_mod":
                UserType = Enums.UserType.GlobalModerator;
                break;

            case "admin":
                UserType = Enums.UserType.Admin;
                break;

            case "staff":
                UserType = Enums.UserType.Staff;
                break;

            default:
                UserType = Enums.UserType.Viewer;
                break;
            }
            Channel = ircString.Split(' ')[3].Replace("#", "");
            if (DisplayName.ToLower() == Channel.ToLower())
            {
                UserType = Enums.UserType.Broadcaster;
            }
        }