Пример #1
0
        private async Task ApplyCommandAndTweet(string text)
        {
            text = text.TrimEnd('\r', '\n');

            if (string.IsNullOrEmpty(text) && FirstMediaPath == null)
            {
                ToolStripStatusLabel.Text = @"しっぱいしました(X3)";
                _kibotterSetting.ExperiencePoint--;
                return;
            }

            string[] splitedText = text.Split(' ');
            if ((splitedText[0] == "!addTag" ||
                 splitedText[0] == "!addtag" ||
                 splitedText[0] == "!setTag" ||
                 splitedText[0] == "!settag" ||
                 splitedText[0] == "!tag") &&
                splitedText.Length >= 2)
            {
                if (splitedText[1][0] == '#')
                {
                    LiveTag += $" {splitedText[1]}";
                    ToolStripStatusLabel.Text = $@"たぐ({splitedText[1]})をついかしました(:3)";
                }
                else
                {
                    LiveTag += $" #{splitedText[1]}";
                    ToolStripStatusLabel.Text = $@"たぐ(#{splitedText[1]})をついかしました(:3)";
                }

                return;
            }
            if ((splitedText[0] == "!deleteTag" ||
                 splitedText[0] == "!deletetag" ||
                 splitedText[0] == "!removeTag" ||
                 splitedText[0] == "!removetag" ||
                 splitedText[0] == "!resetTag" ||
                 splitedText[0] == "!resettag") &&
                splitedText.Length == 1)
            {
                LiveTag = string.Empty;
                ToolStripStatusLabel.Text = @"たぐをぜんぶけしました(:3)";
                return;
            }
            if ((splitedText[0] == "!checkTag" ||
                 splitedText[0] == "!checktag" ||
                 splitedText[0] == "!tagCheck" ||
                 splitedText[0] == "!tagcheck") &&
                splitedText.Length == 1)
            {
                ToolStripStatusLabel.Text = $@"たぐ:{LiveTag}";
                return;
            }

            if (SushiModeToolStripMenuItem.Checked)
            {
                var sushiText = string.Empty;
                int linage    = text.Split(new[] { Environment.NewLine }, StringSplitOptions.None).Length;
                int length    = text.Length - linage + 1;

                for (int i = 0; i < length; i++)
                {
                    sushiText += "🍣";
                }

                text = sushiText;
                _kibotterSetting.ExperiencePoint += 2;
            }
            else if (MorseToolStripMenuItem.Checked)
            {
                MorseCode mc = new MorseCode();
                text = mc.ConvertToMorse(text);
                if (text == "error")
                {
                    ToolStripStatusLabel.Text = @"もーるすしんごうにできませんでした(X3)";
                    _kibotterSetting.ExperiencePoint--;
                    return;
                }
                _kibotterSetting.ExperiencePoint += 2;
            }

            if (text == "!poker" || text == "!pkr")
            {
                text = string.Empty;

                if (RepliedPokerToolStripMenuItem.Checked)
                {
                    text = "@KIBOUDIED \r\n";
                }

                text += CommandPoker();
                _kibotterSetting.ExperiencePoint -= 16;

                if (text.Contains("Straight Flush"))
                {
                    _kibotterSetting.ExperiencePoint += 66667;
                }

                else if (text.Contains("Four Cards"))
                {
                    _kibotterSetting.ExperiencePoint += 41667;
                }

                else if (text.Contains("Full House"))
                {
                    _kibotterSetting.ExperiencePoint += 714;
                }

                else if (text.Contains("Flush"))
                {
                    _kibotterSetting.ExperiencePoint += 500;
                }

                else if (text.Contains("Straight"))
                {
                    _kibotterSetting.ExperiencePoint += 256;
                }

                else if (text.Contains("Three Cards"))
                {
                    _kibotterSetting.ExperiencePoint += 48;
                }

                else if (text.Contains("Two Pair"))
                {
                    _kibotterSetting.ExperiencePoint += 21;
                }

                else if (text.Contains("One Pair"))
                {
                    _kibotterSetting.ExperiencePoint += 2;
                }

                try
                {
                    await Tokens.Statuses.UpdateAsync(text, 1010167866182651904);
                }
                catch
                {
                    ToolStripStatusLabel.Text = @"ぽーかーにしっぱいしました(X3)";
                }
                return;
            }
            if (text == "!bill")
            {
                Random rnd  = new Random(int.Parse(DateTime.Now.ToString("yyyyMMdd")));
                int    bill = rnd.Next();
                text = $"本日のTwitter利用料 {bill:#,0}円";
                _kibotterSetting.ExperiencePoint++;
            }
            else if (text == "!level" || text == "!lvl")
            {
                Prime p = new Prime();
                if (_kibotterSetting.ExperiencePoint < int.MaxValue - 3)
                {
                    int level = p.GetPrimeList((int)_kibotterSetting.ExperiencePoint).Count;
                    text = $"レベル {level} (EXP: {_kibotterSetting.ExperiencePoint} ) なう (:3)";
                }
                else
                {
                    long level = p.GetPrimeList(_kibotterSetting.ExperiencePoint).Count;
                    text = $"レベル {level} (EXP: {_kibotterSetting.ExperiencePoint} ) なう (:3)";
                }
                _kibotterSetting.ExperiencePoint++;
            }

            int startIndex;

            if (0 <= (startIndex = text.IndexOf("!now", StringComparison.Ordinal)))
            {
                text = text.Remove(startIndex, 4).Insert(startIndex, DateTime.Now.ToString(CultureInfo.CurrentCulture));
                _kibotterSetting.ExperiencePoint++;
            }

            text += LiveTag;

            if (FirstMediaPath != null)
            {
                await TweetWithMedia(text);

                return;
            }

            await Tweet(text, 1);
        }
Пример #2
0
        private void OriginalTextBox_TextChanged(object sender, EventArgs e)
        {
            MorseCode mc = new MorseCode();

            ConvertedTextBox.Text = mc.Convert(OriginalTextBox.Text, DotTextBox.Text, DashTextBox.Text, SpaceTextBox.Text);
        }