public bool DoesMeetRankRequirement(UserDataViewModel userData)
        {
            if (userData.IsCurrencyRankExempt)
            {
                return(true);
            }

            UserCurrencyViewModel currency = this.GetCurrency();

            if (currency == null)
            {
                return(false);
            }

            UserRankViewModel rank = this.RequiredRank;

            if (rank == null)
            {
                return(false);
            }

            if (!userData.HasCurrencyAmount(currency, rank.MinimumPoints))
            {
                return(false);
            }

            UserCurrencyDataViewModel userCurrencyData = userData.GetCurrency(currency);

            if (this.MustEqual && userCurrencyData.GetRank() != rank && !userData.IsCurrencyRankExempt)
            {
                return(false);
            }

            return(true);
        }
        private void DeleteRankButton_Click(object sender, RoutedEventArgs e)
        {
            Button            button = (Button)sender;
            UserRankViewModel rank   = (UserRankViewModel)button.DataContext;

            this.ranks.Remove(rank);
        }
        public bool DoesMeetCurrencyRequirement(UserDataViewModel userData)
        {
            if (userData.IsCurrencyRankExempt)
            {
                return(true);
            }

            UserCurrencyViewModel currency = this.GetCurrency();

            if (currency == null)
            {
                return(false);
            }

            UserRankViewModel rank = this.RequiredRank;

            if (rank == null)
            {
                return(false);
            }

            UserCurrencyDataViewModel userCurrencyData = userData.GetCurrency(currency);

            return(this.DoesMeetCurrencyRequirement(userCurrencyData.Amount));
        }
Example #4
0
        private async Task HandleUserSpecialIdentifiers(UserViewModel user, string identifierHeader)
        {
            if (user != null)
            {
                await user.RefreshDetails();

                if (ChannelSession.Settings.UserData.ContainsKey(user.ID))
                {
                    UserDataViewModel userData = ChannelSession.Settings.UserData[user.ID];

                    foreach (UserCurrencyViewModel currency in ChannelSession.Settings.Currencies.Values)
                    {
                        UserCurrencyDataViewModel currencyData = userData.GetCurrency(currency);
                        UserRankViewModel         rank         = currencyData.GetRank();
                        this.ReplaceSpecialIdentifier(identifierHeader + currency.UserRankNameSpecialIdentifier, rank.Name);
                        this.ReplaceSpecialIdentifier(identifierHeader + currency.UserAmountSpecialIdentifier, currencyData.Amount.ToString());
                    }

                    this.ReplaceSpecialIdentifier(identifierHeader + UserSpecialIdentifierHeader + "time", userData.ViewingTimeString);
                    this.ReplaceSpecialIdentifier(identifierHeader + UserSpecialIdentifierHeader + "hours", userData.ViewingHoursString);
                    this.ReplaceSpecialIdentifier(identifierHeader + UserSpecialIdentifierHeader + "mins", userData.ViewingMinutesString);
                }

                if (this.ContainsSpecialIdentifier(identifierHeader + UserSpecialIdentifierHeader + "game"))
                {
                    GameTypeModel game = await ChannelSession.Connection.GetGameType(user.GameTypeID);

                    if (game != null)
                    {
                        this.ReplaceSpecialIdentifier(identifierHeader + UserSpecialIdentifierHeader + "game", game.name.ToString());
                    }
                    else
                    {
                        this.ReplaceSpecialIdentifier(identifierHeader + UserSpecialIdentifierHeader + "game", "Unknown");
                    }
                }

                this.ReplaceSpecialIdentifier(identifierHeader + UserSpecialIdentifierHeader + "followage", user.FollowAgeString);
                this.ReplaceSpecialIdentifier(identifierHeader + UserSpecialIdentifierHeader + "subage", user.SubscribeAgeString);
                this.ReplaceSpecialIdentifier(identifierHeader + UserSpecialIdentifierHeader + "submonths", user.SubscribeMonths.ToString());

                this.ReplaceSpecialIdentifier(identifierHeader + UserSpecialIdentifierHeader + "avatar", user.AvatarLink);
                this.ReplaceSpecialIdentifier(identifierHeader + UserSpecialIdentifierHeader + "url", "https://www.mixer.com/" + user.UserName);
                this.ReplaceSpecialIdentifier(identifierHeader + UserSpecialIdentifierHeader + "name", user.UserName);
                this.ReplaceSpecialIdentifier(identifierHeader + UserSpecialIdentifierHeader + "id", user.ID.ToString());

                if (this.ContainsSpecialIdentifier(identifierHeader + UserSpecialIdentifierHeader + "followers"))
                {
                    ExpandedChannelModel channel = await ChannelSession.Connection.GetChannel(user.UserName);

                    this.ReplaceSpecialIdentifier(identifierHeader + UserSpecialIdentifierHeader + "followers", channel?.numFollowers.ToString() ?? "0");
                }
            }
        }
Example #5
0
        public void AddAmount(UserDataModel user, int amount)
        {
            if (!user.IsCurrencyRankExempt && amount > 0)
            {
                UserRankViewModel prevRank = this.GetRankForPoints(this.GetAmount(user));

                this.SetAmount(user, this.GetAmount(user) + amount);

                UserRankViewModel newRank = this.GetRankForPoints(this.GetAmount(user));
            }
        }
Example #6
0
        public UserRankViewModel GetNextRankForPoints(int points)
        {
            UserRankViewModel rank = UserCurrencyModel.NoRank;

            if (this.Ranks.Count > 0)
            {
                rank = this.Ranks.Where(r => r.MinimumPoints > points).OrderBy(r => r.MinimumPoints).FirstOrDefault();
                if (rank == null)
                {
                    rank = UserCurrencyModel.NoRank;
                }
            }
            return(rank);
        }
        private async void AddRankButton_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(this.RankNameTextBox.Text))
            {
                await MessageBoxHelper.ShowMessageDialog("A rank name must be specified");

                return;
            }

            int rankAmount = 0;

            if (string.IsNullOrEmpty(this.RankAmountTextBox.Text) || !int.TryParse(this.RankAmountTextBox.Text, out rankAmount) || rankAmount < 0)
            {
                await MessageBoxHelper.ShowMessageDialog("A minimum amount must be specified");

                return;
            }

            if (this.ranks.Any(r => r.Name.Equals(this.RankNameTextBox.Text) || r.MinimumPoints == rankAmount))
            {
                await MessageBoxHelper.ShowMessageDialog("Every rank must have a unique name and minimum amount");

                return;
            }

            UserRankViewModel newRank = new UserRankViewModel(this.RankNameTextBox.Text, rankAmount);

            this.ranks.Add(newRank);

            var tempRanks = this.ranks.ToList();

            this.ranks.Clear();
            foreach (UserRankViewModel rank in tempRanks.OrderBy(r => r.MinimumPoints))
            {
                this.ranks.Add(rank);
            }

            this.RankNameTextBox.Clear();
            this.RankAmountTextBox.Clear();
        }
 public CurrencyRequirementViewModel(UserCurrencyViewModel currency, UserRankViewModel rank, bool mustEqual = false)
 {
     this.CurrencyID = currency.ID;
     this.RankName   = rank.Name;
     this.MustEqual  = mustEqual;
 }
        private async Task HandleUserSpecialIdentifiers(UserViewModel user, string identifierHeader)
        {
            if (user != null && this.ContainsSpecialIdentifier(identifierHeader + UserSpecialIdentifierHeader))
            {
                await user.RefreshDetails();

                if (ChannelSession.Settings.UserData.ContainsKey(user.ID))
                {
                    UserDataViewModel userData = ChannelSession.Settings.UserData[user.ID];

                    foreach (UserCurrencyViewModel currency in ChannelSession.Settings.Currencies.Values.OrderByDescending(c => c.UserAmountSpecialIdentifier))
                    {
                        UserCurrencyDataViewModel currencyData = userData.GetCurrency(currency);
                        UserRankViewModel         rank         = currencyData.GetRank();
                        UserRankViewModel         nextRank     = currencyData.GetNextRank();

                        this.ReplaceSpecialIdentifier(identifierHeader + currency.UserRankNextNameSpecialIdentifier, nextRank.Name);
                        this.ReplaceSpecialIdentifier(identifierHeader + currency.UserAmountNextSpecialIdentifier, nextRank.MinimumPoints.ToString());

                        this.ReplaceSpecialIdentifier(identifierHeader + currency.UserRankNameSpecialIdentifier, rank.Name);
                        this.ReplaceSpecialIdentifier(identifierHeader + currency.UserAmountSpecialIdentifier, currencyData.Amount.ToString());
                    }

                    foreach (UserInventoryViewModel inventory in ChannelSession.Settings.Inventories.Values.OrderByDescending(c => c.UserAmountSpecialIdentifierHeader))
                    {
                        if (this.ContainsSpecialIdentifier(identifierHeader + inventory.UserAmountSpecialIdentifierHeader))
                        {
                            UserInventoryDataViewModel inventoryData = userData.GetInventory(inventory);
                            List <string> allItemsList = new List <string>();

                            foreach (UserInventoryItemViewModel item in inventory.Items.Values.OrderByDescending(i => i.Name))
                            {
                                int amount = inventoryData.GetAmount(item);
                                if (amount > 0)
                                {
                                    allItemsList.Add(item.Name + " x" + amount);
                                }

                                string itemSpecialIdentifier = identifierHeader + inventory.UserAmountSpecialIdentifierHeader + item.SpecialIdentifier;
                                this.ReplaceSpecialIdentifier(itemSpecialIdentifier, amount.ToString());
                            }

                            if (allItemsList.Count > 0)
                            {
                                this.ReplaceSpecialIdentifier(identifierHeader + inventory.UserAllAmountSpecialIdentifier, string.Join(", ", allItemsList.OrderBy(i => i)));
                            }
                            else
                            {
                                this.ReplaceSpecialIdentifier(identifierHeader + inventory.UserAllAmountSpecialIdentifier, "Nothing");
                            }
                        }
                    }

                    this.ReplaceSpecialIdentifier(identifierHeader + UserSpecialIdentifierHeader + "time", userData.ViewingTimeString);
                    this.ReplaceSpecialIdentifier(identifierHeader + UserSpecialIdentifierHeader + "hours", userData.ViewingHoursString);
                    this.ReplaceSpecialIdentifier(identifierHeader + UserSpecialIdentifierHeader + "mins", userData.ViewingMinutesString);

                    this.ReplaceSpecialIdentifier(identifierHeader + UserSpecialIdentifierHeader + "moderationstrikes", userData.ModerationStrikes.ToString());
                }

                this.ReplaceSpecialIdentifier(identifierHeader + UserSpecialIdentifierHeader + "primaryrole", user.PrimaryRoleString);
                this.ReplaceSpecialIdentifier(identifierHeader + UserSpecialIdentifierHeader + "avatar", user.AvatarLink);
                this.ReplaceSpecialIdentifier(identifierHeader + UserSpecialIdentifierHeader + "url", "https://www.mixer.com/" + user.UserName);
                this.ReplaceSpecialIdentifier(identifierHeader + UserSpecialIdentifierHeader + "name", user.UserName);
                this.ReplaceSpecialIdentifier(identifierHeader + UserSpecialIdentifierHeader + "id", user.ID.ToString());
                this.ReplaceSpecialIdentifier(identifierHeader + UserSpecialIdentifierHeader + "sparks", user.Sparks.ToString());

                this.ReplaceSpecialIdentifier(identifierHeader + UserSpecialIdentifierHeader + "mixerage", user.MixerAgeString);
                this.ReplaceSpecialIdentifier(identifierHeader + UserSpecialIdentifierHeader + "followage", user.FollowAgeString);
                this.ReplaceSpecialIdentifier(identifierHeader + UserSpecialIdentifierHeader + "subage", user.MixerSubscribeAgeString);
                this.ReplaceSpecialIdentifier(identifierHeader + UserSpecialIdentifierHeader + "submonths", user.SubscribeMonths.ToString());

                this.ReplaceSpecialIdentifier(identifierHeader + UserSpecialIdentifierHeader + "title", user.Title);

                this.ReplaceSpecialIdentifier(identifierHeader + UserSpecialIdentifierHeader + "fanprogressionnext", user.FanProgression?.level?.nextLevelXp.ToString());
                this.ReplaceSpecialIdentifier(identifierHeader + UserSpecialIdentifierHeader + "fanprogressionrank", user.FanProgression?.level?.level.ToString());
                this.ReplaceSpecialIdentifier(identifierHeader + UserSpecialIdentifierHeader + "fanprogressioncolor", user.FanProgression?.level?.color?.ToString());
                this.ReplaceSpecialIdentifier(identifierHeader + UserSpecialIdentifierHeader + "fanprogressionimage", user.FanProgression?.level?.LargeGIFAssetURL?.ToString());
                this.ReplaceSpecialIdentifier(identifierHeader + UserSpecialIdentifierHeader + "fanprogression", user.FanProgression?.level?.currentXp.ToString());

                if (this.ContainsSpecialIdentifier(identifierHeader + UserSpecialIdentifierHeader + "followers") || this.ContainsSpecialIdentifier(identifierHeader + UserSpecialIdentifierHeader + "game") ||
                    this.ContainsSpecialIdentifier(identifierHeader + UserSpecialIdentifierHeader + "channel"))
                {
                    ExpandedChannelModel channel = await ChannelSession.Connection.GetChannel(user.UserName);

                    this.ReplaceSpecialIdentifier(identifierHeader + UserSpecialIdentifierHeader + "followers", channel?.numFollowers.ToString() ?? "0");

                    if (channel.type != null)
                    {
                        this.ReplaceSpecialIdentifier(identifierHeader + UserSpecialIdentifierHeader + "gameimage", channel.type.coverUrl);
                        this.ReplaceSpecialIdentifier(identifierHeader + UserSpecialIdentifierHeader + "game", channel.type.name.ToString());
                    }

                    this.ReplaceSpecialIdentifier(identifierHeader + UserSpecialIdentifierHeader + "channelid", channel.id.ToString());
                    this.ReplaceSpecialIdentifier(identifierHeader + UserSpecialIdentifierHeader + "channellive", channel.online.ToString());
                    this.ReplaceSpecialIdentifier(identifierHeader + UserSpecialIdentifierHeader + "channelfeatured", channel.featured.ToString());
                }
            }
        }
Example #10
0
        public IActionResult Index()
        {
            UserRankViewModel urvm     = new UserRankViewModel();
            IndexViewModel    model    = new IndexViewModel();
            List <Animal>     animals  = new List <Animal>();
            List <Weather>    weathers = new List <Weather>();
            List <User>       users    = new List <User>();

            animals  = dbContext.GetAnimals();
            weathers = dbContext.GetWeathers();
            users    = dbContext.GetUsers();

            // räknar antalet observationer till varje användare
            int      observationCounter    = 0;
            DateTime mostRecentObservation = new DateTime(1900, 1, 1);

            foreach (var user in users)
            {
                foreach (var item in animals)
                {
                    if (item.UserId == user.UserId)
                    {
                        observationCounter++;
                        if (item.Datetime > mostRecentObservation)
                        {
                            mostRecentObservation = item.Datetime;
                        }
                    }
                }
                foreach (var item in weathers)
                {
                    if (item.UserId == user.UserId)
                    {
                        observationCounter++;
                        if (item.Datetime > mostRecentObservation)
                        {
                            mostRecentObservation = item.Datetime;
                        }
                    }
                }
                if (observationCounter > 0)
                {
                    model.UserRankList.Add(new UserRankViewModel()
                    {
                        User            = user,
                        observationNum  = observationCounter,
                        lastObservation = mostRecentObservation
                    });
                }
                observationCounter    = 0;
                mostRecentObservation = new DateTime(1900, 1, 1);
            }

            //sorterar listan i descending order
            model.UserRankList = model.UserRankList.OrderByDescending(x => x.observationNum).ThenBy(x => x.lastObservation).Take(20).ToList();

            //sätter position property
            int position = 1;

            foreach (var user in model.UserRankList)
            {
                user.position = position;
                position++;
            }
            return(View(model));
        }
        public async Task ReplaceCommonSpecialModifiers(UserViewModel user, IEnumerable <string> arguments = null)
        {
            foreach (string counter in ChannelSession.Counters.Keys)
            {
                this.ReplaceSpecialIdentifier(counter, ChannelSession.Counters[counter].ToString());
            }

            foreach (var kvp in SpecialIdentifierStringBuilder.CustomSpecialIdentifiers)
            {
                this.ReplaceSpecialIdentifier(kvp.Key, kvp.Value);
            }

            this.ReplaceSpecialIdentifier("date", DateTimeOffset.Now.ToString("d"));
            this.ReplaceSpecialIdentifier("time", DateTimeOffset.Now.ToString("t"));
            this.ReplaceSpecialIdentifier("datetime", DateTimeOffset.Now.ToString("g"));

            if (user != null)
            {
                if (string.IsNullOrEmpty(user.AvatarLink))
                {
                    user.AvatarLink = UserViewModel.DefaultAvatarLink;
                }

                if (user.AvatarLink.Equals(UserViewModel.DefaultAvatarLink))
                {
                    UserModel avatarUser = await ChannelSession.Connection.GetUser(user.UserName);

                    if (!string.IsNullOrEmpty(user.AvatarLink))
                    {
                        user.AvatarLink = avatarUser.avatarUrl;
                    }
                }

                for (int i = 0; i < ChannelSession.Settings.Currencies.Count; i++)
                {
                    UserCurrencyViewModel     currency     = ChannelSession.Settings.Currencies.Values.ElementAt(i);
                    UserCurrencyDataViewModel currencyData = user.Data.GetCurrency(currency);

                    UserRankViewModel rank = currencyData.GetRank();
                    this.ReplaceSpecialIdentifier(currency.UserRankNameSpecialIdentifier, rank.Name);
                    this.ReplaceSpecialIdentifier(currency.UserAmountSpecialIdentifier, currencyData.Amount.ToString());
                }
                this.ReplaceSpecialIdentifier("usertime", user.Data.ViewingTimeString);
                this.ReplaceSpecialIdentifier("userhours", user.Data.ViewingHoursString);
                this.ReplaceSpecialIdentifier("usermins", user.Data.ViewingMinutesString);

                this.ReplaceSpecialIdentifier("userfollowage", user.FollowAgeString);
                this.ReplaceSpecialIdentifier("usersubage", user.SubscribeAgeString);
                this.ReplaceSpecialIdentifier("usersubmonths", user.SubscribeMonths.ToString());

                if (this.ContainsSpecialIdentifier("usergame"))
                {
                    GameTypeModel game = await ChannelSession.Connection.GetGameType(user.GameTypeID);

                    this.ReplaceSpecialIdentifier("usergame", game.name.ToString());
                }

                this.ReplaceSpecialIdentifier("useravatar", user.AvatarLink);
                this.ReplaceSpecialIdentifier("userurl", "https://www.mixer.com/" + user.UserName);
                this.ReplaceSpecialIdentifier("username", user.UserName);
                this.ReplaceSpecialIdentifier("userid", user.ID.ToString());
            }

            if (arguments != null)
            {
                for (int i = 0; i < arguments.Count(); i++)
                {
                    string username = arguments.ElementAt(i);
                    username = username.Replace("@", "");

                    UserModel argUserModel = await ChannelSession.Connection.GetUser(username);

                    if (argUserModel != null)
                    {
                        UserViewModel argUser = new UserViewModel(argUserModel);
                        await argUser.SetDetails();

                        if (ChannelSession.Settings.UserData.ContainsKey(argUser.ID))
                        {
                            UserDataViewModel userData = ChannelSession.Settings.UserData[argUser.ID];

                            for (int c = 0; c < ChannelSession.Settings.Currencies.Count; c++)
                            {
                                UserCurrencyViewModel     currency     = ChannelSession.Settings.Currencies.Values.ElementAt(i);
                                UserCurrencyDataViewModel currencyData = userData.GetCurrency(currency);

                                UserRankViewModel rank = currencyData.GetRank();
                                this.ReplaceSpecialIdentifier("arg" + (i + 1) + currency.UserRankNameSpecialIdentifier, rank.Name);
                                this.ReplaceSpecialIdentifier("arg" + (i + 1) + currency.UserAmountSpecialIdentifier, currencyData.Amount.ToString());
                            }
                            this.ReplaceSpecialIdentifier("arg" + (i + 1) + "usertime", userData.ViewingTimeString);
                            this.ReplaceSpecialIdentifier("arg" + (i + 1) + "userhours", userData.ViewingHoursString);
                            this.ReplaceSpecialIdentifier("arg" + (i + 1) + "usermins", userData.ViewingMinutesString);
                        }

                        if (this.ContainsSpecialIdentifier("arg" + (i + 1) + "usergame"))
                        {
                            GameTypeModel game = await ChannelSession.Connection.GetGameType(argUser.GameTypeID);

                            this.ReplaceSpecialIdentifier("arg" + (i + 1) + "usergame", game.name.ToString());
                        }

                        this.ReplaceSpecialIdentifier("arg" + (i + 1) + "userfollowage", argUser.FollowAgeString);
                        this.ReplaceSpecialIdentifier("arg" + (i + 1) + "usersubage", argUser.SubscribeAgeString);
                        this.ReplaceSpecialIdentifier("arg" + (i + 1) + "usersubmonths", argUser.SubscribeMonths.ToString());

                        this.ReplaceSpecialIdentifier("arg" + (i + 1) + "useravatar", argUser.AvatarLink);
                        this.ReplaceSpecialIdentifier("arg" + (i + 1) + "userurl", "https://www.mixer.com/" + argUser.UserName);
                        this.ReplaceSpecialIdentifier("arg" + (i + 1) + "username", argUser.UserName);
                        this.ReplaceSpecialIdentifier("arg" + (i + 1) + "userid", argUser.ID.ToString());
                    }

                    this.ReplaceSpecialIdentifier("arg" + (i + 1) + "text", arguments.ElementAt(i));
                }

                this.ReplaceSpecialIdentifier("allargs", string.Join(" ", arguments));
            }
        }
Example #12
0
        public void ProcessData(UserCurrencyViewModel currency, UserCurrencyViewModel rank)
        {
            this.Requirements = new RequirementViewModel();

            if (this.Cooldown > 0)
            {
                this.Requirements.Cooldown = new CooldownRequirementViewModel(CooldownTypeEnum.Individual, this.Cooldown);
            }

            if (!string.IsNullOrEmpty(this.Permission))
            {
                switch (this.Permission)
                {
                case "Subscriber":
                    this.Requirements.Role = new RoleRequirementViewModel(MixerRoleEnum.Subscriber);
                    break;

                case "Moderator":
                    this.Requirements.Role = new RoleRequirementViewModel(MixerRoleEnum.Mod);
                    break;

                case "Editor":
                    this.Requirements.Role = new RoleRequirementViewModel(MixerRoleEnum.ChannelEditor);
                    break;

                case "Min_Points":
                    this.Requirements.Role = new RoleRequirementViewModel(MixerRoleEnum.User);
                    if (!string.IsNullOrEmpty(this.PermInfo) && int.TryParse(this.PermInfo, out int cost))
                    {
                        this.Requirements.Currency = new CurrencyRequirementViewModel(currency, cost);
                    }
                    break;

                case "Min_Rank":
                    this.Requirements.Role = new RoleRequirementViewModel(MixerRoleEnum.User);
                    if (!string.IsNullOrEmpty(this.PermInfo))
                    {
                        UserRankViewModel minRank = rank.Ranks.FirstOrDefault(r => r.Name.ToLower().Equals(this.PermInfo.ToLower()));
                        if (rank != null)
                        {
                            this.Requirements.Rank = new CurrencyRequirementViewModel(rank, minRank);
                        }
                    }
                    break;

                default:
                    this.Requirements.Role = new RoleRequirementViewModel(MixerRoleEnum.User);
                    break;
                }
            }

            this.Response = SpecialIdentifierStringBuilder.ConvertStreamlabsChatBotText(this.Response);

            int readCount = 1;

            this.Response = this.GetRegexEntries(this.Response, ReadLineRegexHeaderPattern, (string entry) =>
            {
                string si = "read" + readCount;
                this.Actions.Add(new FileAction(FileActionTypeEnum.ReadFromFile, si, entry));
                readCount++;
                return("$" + si);
            });

            this.Response = this.GetRegexEntries(this.Response, ReadRandomLineRegexHeaderPattern, (string entry) =>
            {
                string si = "read" + readCount;
                this.Actions.Add(new FileAction(FileActionTypeEnum.ReadRandomLineFromFile, si, entry));
                readCount++;
                return("$" + si);
            });

            this.Response = this.GetRegexEntries(this.Response, ReadRandomLineRegexHeaderPattern, (string entry) =>
            {
                string si = "read" + readCount;

                string[] splits        = entry.Split(new char[] { ',' });
                FileAction action      = new FileAction(FileActionTypeEnum.ReadSpecificLineFromFile, si, splits[0]);
                action.LineIndexToRead = splits[1];
                this.Actions.Add(action);

                readCount++;
                return("$" + si);
            });

            int webRequestCount = 1;

            this.Response = this.GetRegexEntries(this.Response, ReadAPIRegexHeaderPattern, (string entry) =>
            {
                string si = "webrequest" + webRequestCount;
                this.Actions.Add(WebRequestAction.CreateForSpecialIdentifier(entry, si));
                webRequestCount++;
                return("$" + si);
            });

            this.Response = this.GetRegexEntries(this.Response, SaveToFileRegexHeaderPattern, (string entry) =>
            {
                string[] splits        = entry.Split(new char[] { ',' });
                FileAction action      = new FileAction(FileActionTypeEnum.AppendToFile, splits[1], splits[0]);
                action.LineIndexToRead = splits[1];
                this.Actions.Add(action);
                return(string.Empty);
            });

            this.Response = this.GetRegexEntries(this.Response, OverwriteFileRegexHeaderPattern, (string entry) =>
            {
                string[] splits        = entry.Split(new char[] { ',' });
                FileAction action      = new FileAction(FileActionTypeEnum.SaveToFile, splits[1], splits[0]);
                action.LineIndexToRead = splits[1];
                this.Actions.Add(action);
                return(string.Empty);
            });

            ChatAction chat = new ChatAction(this.Response);

            if (!string.IsNullOrEmpty(this.Usage) && this.Usage.Equals("SW"))
            {
                chat.IsWhisper = true;
            }
            this.Actions.Add(chat);
        }