Esempio n. 1
0
        private void Send_Click(object sender, EventArgs e)
        {
            //テキストが入力されていないとき抜け出します
            if (WriteText.Text == "")
            {
                Send.Enabled = true;
                return;
            }

            //ボタン押下できないようにする
            Send.Enabled = false;

            //おくれなかったとき
            if (!appif.SendText(WriteText.Text))
            {
                WriteText.Clear();
                Send.Enabled = true;
                return;
            }

            DisplayMessage(WriteText.Text, 1);

            //テキストを送ったら削除する。
            WriteText.Clear();

            Send.Enabled = true;
        }
Esempio n. 2
0
 private void Multiplication_Click(object sender, RoutedEventArgs e)
 {
     d  = 3;
     s1 = WriteText.Text;
     WriteText.Clear();
     WriteD.Text = s1 + " * ";
 }
Esempio n. 3
0
 public void SetLogging(WriteTable WriteHorizontalMethod, WriteTable WriteVerticalMethod, WriteText WriteTextMethod)
 {
     WriteH    = WriteHorizontalMethod;
     WriteV    = WriteVerticalMethod;
     WriteStr  = WriteTextMethod;
     isLogging = true;
 }
Esempio n. 4
0
        //
        // Write Text Tab
        //

        private void WriteTextButton_Click(object sender, RoutedEventArgs e)
        {
            Command cmd = new WriteText((byte)timeout.Value, (bool)lockCheckBox.IsChecked, TextBox.Text ?? "");

            ShowPendingStatus("Waiting for tap");

            Callback repeatCommand = null;
            bool     repeat        = (bool)repeatTextWrite.IsChecked;
            Action   sendCommand   = () => tappy.SendCommand(cmd, ResponseCallback + repeatCommand);

            repeatCommand = (ResponseFrame frame, Exception exc) =>
            {
                if (repeat)
                {
                    if (CheckForErrorsOrTimeout(frame, exc))
                    {
                        return;
                    }
                    Thread.Sleep(1000);
                    ShowPendingStatus("Waiting for tap");
                    Dispatcher.BeginInvoke(sendCommand);
                }
            };

            tappy.SendCommand(cmd, ResponseCallback + repeatCommand);
        }
Esempio n. 5
0
 private void Separation_Click(object sender, RoutedEventArgs e)
 {
     d  = 4;
     s1 = WriteText.Text;
     WriteText.Clear();
     WriteD.Text = s1 + " / ";
 }
Esempio n. 6
0
        public void WriteText(string s, bool controlchar = true)
        {
            PrinterServiceFunction function = new WriteText(this);

            function.AddParameter("string", s);
            function.RunFunction();
        }
Esempio n. 7
0
 private void Minus_Click(object sender, RoutedEventArgs e)
 {
     d  = 2;
     s1 = WriteText.Text;
     WriteText.Clear();
     WriteD.Text = s1 + " - ";
 }
Esempio n. 8
0
    // Use this for initialization
    void Start()
    {
        //listener = new ListenerWrite();
        //controller = new Controller();
        log = new WriteText();

        //controller.AddListener(listener);
    }
Esempio n. 9
0
 public void DoDecrypt(string algName, string text, Dictionary <string, string> parameters) //Функция выбирает нужный алгоритм и запускает его
 {
     if (_algorythm?.Name != algName)
     {
         WriteResult?.Invoke("Сначала необходимо выполнить алгоритм.");
         return;
     }
     WriteText?.Invoke(_algorythm?.DeCrypt(text, parameters));
 }
Esempio n. 10
0
 private void Start()
 {
     writeText     = variableHolder.GetComponent <WriteText>();
     textHighlight = variableHolder.GetComponent <TextHighlight>();
     goText.color  = new Color(0, 255, 0, 1);
     wpm           = writeText.wpm;
     constWPM      = writeText.constWPM;
     gamePaused    = false;
     stopwatch     = writeText.stopwatch;
     numOfChars    = writeText.numOfChars;
     pauseUI.SetActive(false);
 }
Esempio n. 11
0
        private void Roots_Click(object sender, RoutedEventArgs e)
        {
            //d = 7;
            s = 7;
            r = WriteText.Text;
            string s4;


            if (WriteText.Text == "")
            {
                string Error = null;
                WriteText.Text = (Error);
            }

            else
            {
                if (d == 1)
                {
                    s4 = WriteText.Text;
                    WriteText.Clear();
                    WriteText.Text = Convert.ToString(Math.Sqrt(Convert.ToDouble(s4)));
                    WriteD.Text    = s1 + " + " + "√" + Convert.ToString(Math.Sqrt(Convert.ToDouble(s4)));
                }
                else if (d == 2)
                {
                    s4 = WriteText.Text;
                    WriteText.Clear();
                    WriteText.Text = Convert.ToString(Math.Sqrt(Convert.ToDouble(s4)));
                    WriteD.Text    = s1 + " - " + "√" + Convert.ToString(Math.Sqrt(Convert.ToDouble(s4)));
                }
                else if (d == 3)
                {
                    s4 = WriteText.Text;
                    WriteText.Clear();
                    WriteText.Text = Convert.ToString(Math.Sqrt(Convert.ToDouble(s4)));
                    WriteD.Text    = s1 + " * " + "√" + Convert.ToString(Math.Sqrt(Convert.ToDouble(s4)));
                }
                else if (d == 4)
                {
                    s4 = WriteText.Text;
                    WriteText.Clear();
                    WriteText.Text = Convert.ToString(Math.Sqrt(Convert.ToDouble(s4)));
                    WriteD.Text    = s1 + " / " + "√" + Convert.ToString(Math.Sqrt(Convert.ToDouble(s4)));
                }
                else
                {
                    WriteD.Text = " √ " + r;
                    double a = Convert.ToDouble(r);
                    a = Math.Sqrt(a);
                    WriteText.Text = Convert.ToDouble(a).ToString();
                }
            }
        }
Esempio n. 12
0
        private void _1_x_Click(object sender, RoutedEventArgs e)
        {
            // d = 6;
            s = 6;
            string s4;
            double one = 1;

            if (WriteText.Text == "")
            {
                string Error = null;
                WriteText.Text = (Error);
            }

            else
            {
                if (d == 1)
                {
                    s4 = WriteText.Text;
                    WriteText.Clear();
                    WriteText.Text = Convert.ToString(one / Convert.ToDouble(s4));
                    WriteD.Text    = s1 + " + " + "reciproc" + " (" + s4 + ")";
                }
                else if (d == 2)
                {
                    s4 = WriteText.Text;
                    WriteText.Clear();
                    WriteText.Text = Convert.ToString(one / Convert.ToDouble(s4));
                    WriteD.Text    = s1 + " - " + "reciproc" + " (" + s4 + ")";
                }
                else if (d == 3)
                {
                    s4 = WriteText.Text;
                    WriteText.Clear();
                    WriteText.Text = Convert.ToString(one / Convert.ToDouble(s4));
                    WriteD.Text    = s1 + " * " + "reciproc" + " (" + s4 + ")";
                }
                else if (d == 4)
                {
                    s4 = WriteText.Text;
                    WriteText.Clear();
                    WriteText.Text = Convert.ToString(one / Convert.ToDouble(s4));
                    WriteD.Text    = s1 + " / " + "reciproc" + " (" + s4 + ")";
                }
                else
                {
                    s1             = WriteText.Text;
                    WriteD.Text    = " reciproc" + " (" + s1 + ")";
                    s3             = Convert.ToString(Convert.ToUInt32(one));
                    WriteText.Text = Convert.ToString(Convert.ToDouble(s3) / Convert.ToDouble(s1));
                }
            }
        }
Esempio n. 13
0
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else
        {
            Destroy(gameObject);
        }

        damiresPanel.SetActive(false);
    }
Esempio n. 14
0
        public void DequeueOutputText()
        {
            if (!WriteText.IsWritable)
            {
                return;
            }

            while (OutputTextQueue.Count > 0)
            {
                var item = OutputTextQueue.Dequeue();
                WriteText.WriteText(item.Text, item.IsError);
            }
        }
Esempio n. 15
0
        private void Button1_Click(object sender, RoutedEventArgs e)
        {
            if (WriteText.Text == "0")
            {
                ZeroWT = true;
            }

            if (ZeroWT == true || EqCount == true)
            {
                WriteText.Clear();
                WriteText.Text += "1";
                ZeroWT          = false;
                EqCount         = false;
            }
            else
            {
                WriteText.Text += "1";
            }
        }
Esempio n. 16
0
        private void Per_Cent_Click(object sender, RoutedEventArgs e)
        {
            string s4;
            double hangred = 100;

            if (WriteText.Text == "")
            {
                string Error = null;
                WriteText.Text = (Error);
            }

            else
            {
                if (d == 1)
                {
                    s4 = WriteText.Text;
                    WriteText.Clear();
                    WriteText.Text = Convert.ToString(Convert.ToDouble(s1) * Convert.ToDouble(s4) / hangred);
                    WriteD.Text    = s1 + " + " + Convert.ToString(Convert.ToDouble(s1) * Convert.ToDouble(s4) / hangred);
                }
                else if (d == 2)
                {
                    s4 = WriteText.Text;
                    WriteText.Clear();
                    WriteText.Text = Convert.ToString(Convert.ToDouble(s1) * Convert.ToDouble(s4) / hangred);
                    WriteD.Text    = s1 + " - " + Convert.ToString(Convert.ToDouble(s1) * Convert.ToDouble(s4) / hangred);
                }
                else if (d == 3)
                {
                    s4 = WriteText.Text;
                    WriteText.Clear();
                    WriteText.Text = Convert.ToString(Convert.ToDouble(s1) * Convert.ToDouble(s4) / hangred);
                    WriteD.Text    = s1 + " * " + Convert.ToString(Convert.ToDouble(s1) * Convert.ToDouble(s4) / hangred);
                }
                else if (d == 4)
                {
                    s4 = WriteText.Text;
                    WriteText.Clear();
                    WriteText.Text = Convert.ToString(Convert.ToDouble(s1) * Convert.ToDouble(s4) / hangred);
                    WriteD.Text    = s1 + " / " + Convert.ToString(Convert.ToDouble(s1) * Convert.ToDouble(s4) / hangred);
                }
            }
        }
Esempio n. 17
0
        JsonSerializer(SerializationManager manager)
        {
            _manager  = manager;
            _maxDepth = manager.SerializerMaxDepth;
            if (manager.EnableAnonymousTypes)
            {
                _useExtensions      = false;
                _showReadOnlyFields = _showReadOnlyProperties = true;
            }
            else
            {
                _useExtensions          = manager.UseExtensions;
                _showReadOnlyProperties = manager.SerializeReadOnlyProperties;
                _showReadOnlyFields     = manager.SerializeReadOnlyFields;
            }
            switch (manager.NamingConvention)
            {
            case NamingConvention.Default:
                OutputName = WriteNameUnchanged;
                break;

            case NamingConvention.LowerCase:
                OutputName = WriteNameLowerCase;
                break;

            case NamingConvention.CamelCase:
                OutputName = WriteNameCamelCase;
                break;

            case NamingConvention.UpperCase:
                OutputName = WriteNameUpperCase;
                break;

            default:
                OutputName = WriteNameUnchanged;
                break;
            }
        }
        public void SaveText_ShouldThrowException()
        {
            WriteText      writeText      = new WriteText();
            TextDataAccess textDataAccess = new TextDataAccess(writeText);
            List <string>  lines          = new List <string>
            {
                "First line",
                "Second line",
                "Third line"
            };

            string filePath =
                $"This path is too long with 261     characters" +
                $"qwertyuiopasdfghjklzxcvbnm1234567890" +
                $"qwertyuiopasdfghjklzxcvbnm1234567890" +
                $"qwertyuiopasdfghjklzxcvbnm1234567890" +
                $"qwertyuiopasdfghjklzxcvbnm1234567890" +
                $"qwertyuiopasdfghjklzxcvbnm1234567890" +
                $"qwertyuiopasdfghjklzxcvbnm1234567890";

            TestDelegate testDelegate = () => textDataAccess.SaveText(filePath, lines);

            Assert.Throws <PathTooLongException>(testDelegate);
        }
 private void AddButton_Click(object sender, RoutedEventArgs e)
 {
     ShowText.Items.Add(WriteText.Text);
     WriteText.Clear();
 }
Esempio n. 20
0
        public int EvenOrOddBet(int spin)

        {
            WheelSpin wheel = new WheelSpin();

            string evenOrOdd;

            int winnings = 0;

            int bet = 0;

            int[] red = { 1, 3, 5, 7, 9, 12, 14, 16, 18, 19, 21, 23, 25, 27, 30, 32, 34, 36 };

            int[] black = { 2, 4, 6, 8, 10, 11, 13, 15, 17, 20, 22, 24, 26, 28, 29, 31, 33, 35 };

            int[] green = { 0, 37 };

            WriteText.WriteLine("Evens/Odds Bet:", ConsoleColor.Yellow);

            WriteText.Write("Please enter even or odd ", ConsoleColor.Red);

            evenOrOdd = Console.ReadLine();

            evenOrOdd.ToLower();



            WriteText.Write($"You have ${Player.money}. Please enter how much you would like to bet: ", ConsoleColor.Red);

            bet = Int32.Parse(Console.ReadLine());

            if (bet > Player.money)

            {
                throw new System.IndexOutOfRangeException("You bet more than you have.");
            }

            if (bet <= Player.money)

            {
                Player.money = Player.money - bet;



                if (red.Contains(spin))

                {
                    WriteText.WriteLine($"The spin was {spin} red.", ConsoleColor.Red);
                }

                if (black.Contains(spin))

                {
                    WriteText.WriteLine($"The spin was {spin} black.", ConsoleColor.Red);
                }

                if (green.Contains(spin))

                {
                    if (spin == 00)

                    {
                        WriteText.WriteLine($"The spin was {spin} green.", ConsoleColor.Red);
                    }

                    else

                    {
                        WriteText.WriteLine($"The spin was {spin} green.", ConsoleColor.Red);
                    }
                }

                if (spin % 2 == 0 && evenOrOdd == "even")

                {
                    winnings = bet * 2;

                    Player.money = winnings + Player.money;

                    WriteText.WriteLine($"You won ${winnings}. You now have ${Player.money}.", ConsoleColor.Green);
                }

                else if (spin % 2 == 1 && evenOrOdd == "odd")

                {
                    winnings = bet * 2;

                    Player.money = winnings + Player.money;

                    WriteText.WriteLine($"You won ${winnings}. You now have ${Player.money}.", ConsoleColor.Green);
                }

                else

                {
                    WriteText.WriteLine($"You lost ${bet}. You now have ${Player.money}.", ConsoleColor.Red);
                }
            }

            return(Player.money);
        }
Esempio n. 21
0
        public ObservableCollection <DictionaryPasswordElement> Recognize(string textToRecognize, Dictionary <string, string> dictionary)
        {
            _textToRecognize = textToRecognize;
            _dictionary      = dictionary;

            try
            {
                //znalezienie i wycięcie pierwszego słowa
                GetDefiniendum.Get(ref _textToRecognize, _dictionary, _obserColl);

                var regex3       = new Regex(@"⌂");
                var t            = regex3.Match(_textToRecognize);
                var triangleText = "";

                if (t.Success)
                {
                    triangleText     = _textToRecognize.Substring(t.Index);
                    _textToRecognize = _textToRecognize.Replace(triangleText, "");
                }

                var splitText = _textToRecognize.Split(' ');

                foreach (string s in splitText)
                {
                    if (_dictionary.ContainsKey(s))
                    {
                        if (s == "p.")
                        {
                            AddDescriptionToShortcutAndDelete.Get(ref _textToRecognize, s.Replace(",", ""), _dictionary, _obserColl);

                            var regex1 = new Regex(@"\/+ \w+");
                            var match1 = regex1.Match(_textToRecognize);

                            if (match1.Success)
                            {
                                var text = _textToRecognize.Substring(0, match1.Index);
                                WriteText.Write(text.Trim(), "definiens", _obserColl);
                                break;
                            }
                            else
                            {
                                WriteText.Write(_textToRecognize.Trim(), "odsyłanie do haseł", _obserColl);
                                break;
                            }
                        }
                        if (s == "a.")
                        {
                            AddDescriptionToShortcutAndDelete.Get(ref _textToRecognize, s.Replace(",", ""), _dictionary, _obserColl);

                            var regex1 = new Regex(@"\w+");
                            var match1 = regex1.Match(_textToRecognize);

                            if (match1.Success)
                            {
                                var text = _textToRecognize.Substring(0, match1.Length);
                                WriteText.Write(text.Trim(), "definiendum", _obserColl);
                                _textToRecognize = _textToRecognize.Replace(text, "");
                                break;
                            }
                        }
                        if (s == "przym.")
                        {
                            AddDescriptionToShortcutAndDelete.Get(ref _textToRecognize, s.Replace(",", ""), _dictionary, _obserColl);

                            var regex1 = new Regex(@"\D*:");
                            var match1 = regex1.Match(_textToRecognize);

                            if (match1.Success)
                            {
                                var text = _textToRecognize.Substring(0, match1.Length - 1);
                                WriteText.Write(text.Trim(), "definiens", _obserColl);
                                _textToRecognize = _textToRecognize.Replace(text.TrimEnd(':'), "");


                                if (!GetCitation.Contains(_textToRecognize))
                                {
                                    var regex2 = new Regex(@"\D* \/");
                                    var match2 = regex2.Match(_textToRecognize);
                                    WriteText.Write(match2.Value.TrimEnd('/', ' '), "przykład/połączenie wyrazowe (kolokacja)/związek frazeologiczny", _obserColl);
                                    _textToRecognize = _textToRecognize.Replace(match2.Value.TrimEnd('/'), "");
                                }
                                else
                                {
                                    GetCitation.Get(ref _textToRecognize, _obserColl);
                                }

                                break;
                            }
                        }
                        else
                        {
                            AddDescriptionToShortcutAndDelete.Get(ref _textToRecognize, s.Replace(",", ""), _dictionary, _obserColl);
                        }
                    }
                    else if (s[0] == '~')
                    {
                        AnalizeText.Get(s, _dictionary, _obserColl);
                        _textToRecognize = _textToRecognize.Remove(0, s.Length + 1);
                    }
                    else
                    {
                        break;
                    }
                }



                var regex = new Regex(@"\(p\.\D*?\).?");
                var match = regex.Match(_textToRecognize);
                if (match.Success)
                {
                    var text = _textToRecognize.Substring(0, match.Index);
                    WriteText.Write(text.Trim(), "definiens", _obserColl);
                    _textToRecognize = _textToRecognize.Replace(text, "");

                    if (match.Length == 4)
                    {
                        var e = RecognizeMeaningWord.Get(match.Value.Replace(",", ""), _dictionary);
                        WriteText.Write(match.Value.Replace(",", ""), e, _obserColl);
                    }
                    else
                    {
                        WriteText.Write(match.Value.Replace(",", ""), "patrz + bezokolicznik", _obserColl);
                    }
                }

                GetDefiniens.Get(ref _textToRecognize, _obserColl);
                GetCitation.Get(ref _textToRecognize, _obserColl);
                GetReferenceToDictionary.Get(ref _textToRecognize, _dictionary, _obserColl);


                if (t.Success)
                {
                    var e = RecognizeMeaningWord.Get(triangleText[0].ToString(), _dictionary);
                    WriteText.Write(triangleText[0].ToString(), e, _obserColl);
                    triangleText = triangleText.Remove(0, 2);

                    regex3 = new Regex(@"\D*?«");
                    t      = regex3.Match(triangleText);
                    WriteText.Write(t.Value.Replace("«", ""), "uszczegółowienie", _obserColl);
                    triangleText = triangleText.Remove(0, t.Length - 1);

                    GetDefiniens.Get(ref triangleText, _obserColl);
                    GetCitation.Get(ref triangleText, _obserColl);
                    GetReferenceToDictionary.Get(ref triangleText, _dictionary, _obserColl);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }

            return(_obserColl);
        }
Esempio n. 22
0
        public int SplitBet(int spin)

        {
            WheelSpin wheel = new WheelSpin();

            int splitNumber1;

            int splitNumber2 = 0;

            int winnings = 0;

            int bet = 0;

            int[] red = { 1, 3, 5, 7, 9, 12, 14, 16, 18, 19, 21, 23, 25, 27, 30, 32, 34, 36 };

            int[] black = { 2, 4, 6, 8, 10, 11, 13, 15, 17, 20, 22, 24, 26, 28, 29, 31, 33, 35 };

            int[] green = { 0, 37 };

            int[] column1 = { 1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 34 };

            int[] column2 = { 2, 5, 8, 11, 14, 17, 20, 23, 26, 29, 32, 35 };

            int[] column3 = { 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36 };

            WriteText.WriteLine("Split Bet:", ConsoleColor.Yellow);

            WriteText.Write("You are making a split bet. Select your first number: ", ConsoleColor.Red);

            splitNumber1 = Int32.Parse(Console.ReadLine());

            if (column1.Contains(splitNumber1))

            {
                if (splitNumber1 == 1)

                {
                    WriteText.Write("Please enter the number you wish to split with (2, or 4): ", ConsoleColor.Red);

                    splitNumber2 = Int32.Parse(Console.ReadLine());
                }

                if (splitNumber1 == 34)

                {
                    WriteText.Write("Please enter the number you wish to split with (31, or 35): ", ConsoleColor.Red);

                    splitNumber2 = Int32.Parse(Console.ReadLine());
                }

                if (splitNumber1 != 1 && splitNumber1 != 34)

                {
                    WriteText.Write($"Please enter the number you wish to split with ({splitNumber1 - 3}, {splitNumber1 + 1}, or {splitNumber1 + 3}): ", ConsoleColor.Red);

                    splitNumber2 = Int32.Parse(Console.ReadLine());
                }
            }

            if (column2.Contains(splitNumber1))

            {
                if (splitNumber1 == 2)

                {
                    WriteText.Write("Please enter the number you wish to split with (1, 3, or 5): ", ConsoleColor.Red);

                    splitNumber2 = Int32.Parse(Console.ReadLine());
                }

                if (splitNumber1 == 35)

                {
                    WriteText.Write("Please enter the number you wish to split with (32, 34, 36): ", ConsoleColor.Red);

                    splitNumber2 = Int32.Parse(Console.ReadLine());
                }

                if (splitNumber1 != 2 && splitNumber1 != 35)

                {
                    WriteText.Write($"Please enter the number you wish to split with ({splitNumber1 - 3}, {splitNumber1 - 1}, {splitNumber1 + 1}, or {splitNumber1 + 3}): ", ConsoleColor.Red);

                    splitNumber2 = Int32.Parse(Console.ReadLine());
                }
            }

            if (column3.Contains(splitNumber1))

            {
                if (splitNumber1 == 3)

                {
                    WriteText.Write("Please enter the number you wish to split with (2, or 6): ", ConsoleColor.Red);

                    splitNumber2 = Int32.Parse(Console.ReadLine());
                }

                if (splitNumber1 == 36)

                {
                    WriteText.Write("Please enter the number you wish to split with (33, or 35): ", ConsoleColor.Red);

                    splitNumber2 = Int32.Parse(Console.ReadLine());
                }

                if (splitNumber1 != 3 && splitNumber1 != 36)

                {
                    WriteText.Write($"Please enter the number you wish to split with ({splitNumber1 - 3}, {splitNumber1 - 1}, or {splitNumber1 + 3}): ", ConsoleColor.Red);

                    splitNumber2 = Int32.Parse(Console.ReadLine());
                }
            }



            WriteText.Write($"You have ${Player.money}. Please enter how much you would like to bet: ", ConsoleColor.Red);

            bet = Int32.Parse(Console.ReadLine());

            if (bet > Player.money)

            {
                throw new System.IndexOutOfRangeException("You bet more than you have.");
            }

            if (bet <= Player.money)

            {
                Player.money = Player.money - bet;

                if (red.Contains(spin))

                {
                    if (spin == splitNumber1 || spin == splitNumber2)

                    {
                        winnings = 17 * bet;

                        Player.money = winnings + Player.money;

                        WriteText.WriteLine($"The spin was {spin} red.", ConsoleColor.Green);

                        WriteText.WriteLine($"You won ${winnings}. You now have ${Player.money}.", ConsoleColor.Green);
                    }

                    if (spin != splitNumber1 || spin != splitNumber2)

                    {
                        WriteText.WriteLine($"The spin was {spin} red.", ConsoleColor.Red);

                        WriteText.WriteLine($"You lost ${bet}. You now have ${Player.money}.", ConsoleColor.Red);
                    }
                }

                if (black.Contains(spin))

                {
                    if (spin == splitNumber1 || spin == splitNumber2)

                    {
                        winnings = 17 * bet;

                        Player.money = winnings + Player.money;

                        WriteText.WriteLine($"The spin was {spin} black.", ConsoleColor.Green);

                        WriteText.WriteLine($"You won ${winnings}. You now have ${Player.money}.", ConsoleColor.Green);
                    }

                    if (spin != splitNumber1 || spin != splitNumber2)

                    {
                        WriteText.WriteLine($"The spin was {spin} black.", ConsoleColor.Red);

                        WriteText.WriteLine($"You lost ${bet}. You now have ${Player.money}.", ConsoleColor.Red);
                    }
                }

                if (spin == 0 || spin == 00)

                {
                    WriteText.WriteLine($"The spin was {spin} green.", ConsoleColor.Red);

                    WriteText.WriteLine($"You lost ${bet}. You now have ${Player.money}.", ConsoleColor.Red);
                }
            }

            return(Player.money);
        }
        public ObservableCollection <DictionaryPasswordElement> Recognize(string textToRecognize, Dictionary <string, string> dictionary)
        {
            _textToRecognize = textToRecognize;
            _dictionary      = dictionary;

            try
            {
                //znalezienie i wycięcie pierwszego słowa
                GetDefiniendum.Get(ref _textToRecognize, _dictionary, _obserColl);

                //znalezienie i wycięcie tekstu do pierwszego znaku '«'
                GetDescriptionList.Get(ref _textToRecognize, _dictionary, _obserColl);

                //wyszukanie znaczenia słowa z podwojnych nawiasach skosnych
                GetDefiniens.Get(ref _textToRecognize, _obserColl);

                //pobranie elementów po znaku ◊
                var phraseologicalList = GetPhraseologicalGroup.Get(ref _textToRecognize);

                //trzy próby znalezienia cytatu
                GetCitation.Get(ref _textToRecognize, _obserColl);

                //rozpoznanie znaczen pomiedzy <>
                GetEtymologicalExplanation.Get(ref _textToRecognize, _obserColl);

                //rozpoznanie elemntów po znaku ◊
                foreach (string s in phraseologicalList)
                {
                    var text = s;

                    //wykrycie znaku ◊ i dodanie opisu
                    var regex = new Regex("◊");
                    var match = regex.Match(text);
                    if (match.Success)
                    {
                        AddDescriptionToShortcutAndDelete.Get(ref text, match.Value, _dictionary, _obserColl);
                    }

                    regex = new Regex(@"/+");
                    match = regex.Match(text);
                    if (match.Success)
                    {
                        GetReferenceToDictionary.Get(ref text, _dictionary, _obserColl);
                        GetEtymologicalExplanation.Get(ref text, _obserColl);
                    }


                    //wykrycie pierwszego słowa z kropką - skrót
                    regex = new Regex(@"\w+.");
                    match = regex.Match(text);

                    //zależnie od wykrytego skrótu
                    switch (match.Value)
                    {
                    case "fraz.":
                    {
                        //nadanie opisu skrótowi
                        AddDescriptionToShortcutAndDelete.Get(ref text, match.Value, _dictionary, _obserColl);


                        //wykrycie do znaku « i nadanie opisu
                        regex = new Regex(@"\D*«");
                        match = regex.Match(text);

                        if (match.Success)
                        {
                            WriteText.Write(match.Value.Replace(" «", ""), "przykład/połączenie wyrazowe (kolokacja)/związek frazeologiczny", _obserColl);
                            text = text.Remove(0, match.Length - 1);
                        }

                        GetDefiniens.Get(ref text, _obserColl);

                        //wykrycie sytatów
                        GetCitation.Get(ref text, _obserColl);


                        break;
                    }

                    case "przen.":
                    {
                        //nadanie opisu skrótowi
                        AddDescriptionToShortcutAndDelete.Get(ref text, match.Value, _dictionary, _obserColl);


                        GetDefiniens.Get(ref text, _obserColl);

                        //wykrycie sytatów
                        GetCitation.Get(ref text, _obserColl);


                        GetReferenceToDictionary.Get(ref text, _dictionary, _obserColl);


                        GetEtymologicalExplanation.Get(ref text, _obserColl);
                        break;
                    }
                    }


                    //wykrycie ⌂
                    regex = new Regex(@"⌂");
                    match = regex.Match(text);

                    if (match.Success)
                    {
                        var e = RecognizeMeaningWord.Get(match.Value, _dictionary);
                        WriteText.Write(match.Value, e, _obserColl);
                        text = text.Remove(0, match.Length);
                    }

                    if (match.Success)
                    {
                        regex = new Regex(@"\D*«");
                        match = regex.Match(text);

                        if (match.Success)
                        {
                            WriteText.Write(match.Value.Replace(" «", ""), "przykład/połączenie wyrazowe (kolokacja)/związek frazeologiczny", _obserColl);
                            text = text.Remove(0, match.Length - 1);

                            GetDefiniens.Get(ref text, _obserColl);
                            GetCitation.Get(ref text, _obserColl);
                            GetEtymologicalExplanation.Get(ref text, _obserColl);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }

            return(_obserColl);
        }
Esempio n. 24
0
        public int DozensBet(int spin)

        {
            WheelSpin wheel = new WheelSpin();

            string dozen;

            int winnings = 0;

            int bet = 0;

            int[] red = { 1, 3, 5, 7, 9, 12, 14, 16, 18, 19, 21, 23, 25, 27, 30, 32, 34, 36 };

            int[] black = { 2, 4, 6, 8, 10, 11, 13, 15, 17, 20, 22, 24, 26, 28, 29, 31, 33, 35 };

            int[] green = { 0, 37 };



            WriteText.Write("For dozen (1-12) type first:\n" +

                            "For dozen (13-24) type second:\n" +

                            "For dozen (25-36) type third:", ConsoleColor.Red);

            dozen = Console.ReadLine();

            dozen.ToLower();



            WriteText.Write($"You have ${Player.money}. Please enter how much you would like to bet: ", ConsoleColor.Red);

            bet = Int32.Parse(Console.ReadLine());

            if (bet > Player.money)

            {
                throw new System.IndexOutOfRangeException("You bet more than you have.");
            }

            if (bet <= Player.money)

            {
                Player.money = Player.money - bet;

                if (red.Contains(spin))

                {
                    if (spin <= 12 && spin >= 1 && dozen == "first")

                    {
                        winnings = 3 * bet;

                        Player.money = winnings + Player.money;

                        WriteText.WriteLine($"The spin was {spin} red.", ConsoleColor.Green);

                        WriteText.WriteLine($"You won ${winnings}. You now have ${Player.money}.", ConsoleColor.Green);
                    }

                    if (spin <= 12 && spin >= 1 && dozen != "first")

                    {
                        WriteText.WriteLine($"The spin was {spin} red.", ConsoleColor.Red);

                        WriteText.WriteLine($"You lost ${bet}. You now have ${Player.money}.", ConsoleColor.Red);
                    }

                    if (spin >= 13 && spin <= 24 && dozen == "second")

                    {
                        winnings = 3 * bet;

                        Player.money = winnings + Player.money;

                        WriteText.WriteLine($"The spin was {spin} red.", ConsoleColor.Green);

                        WriteText.WriteLine($"You won ${winnings}. You now have ${Player.money}.", ConsoleColor.Green);
                    }

                    if (spin >= 13 && spin <= 24 && dozen != "second")

                    {
                        WriteText.WriteLine($"The spin was {spin} red.", ConsoleColor.Red);

                        WriteText.WriteLine($"You lost ${bet}. You now have ${Player.money}.", ConsoleColor.Red);
                    }

                    if (spin >= 25 && spin <= 36 && dozen == "third")

                    {
                        winnings = 3 * bet;

                        Player.money = winnings + Player.money;

                        WriteText.WriteLine($"The spin was {spin} red.", ConsoleColor.Green);

                        WriteText.WriteLine($"You won ${winnings}. You now have ${Player.money}.", ConsoleColor.Green);
                    }

                    if (spin >= 25 && spin <= 36 && dozen != "third")

                    {
                        WriteText.WriteLine($"The spin was {spin} red.", ConsoleColor.Red);

                        WriteText.WriteLine($"You lost ${bet}. You now have ${Player.money}.", ConsoleColor.Red);
                    }
                }

                if (black.Contains(spin))

                {
                    if (spin <= 12 && spin >= 1 && dozen == "first")

                    {
                        winnings = 3 * bet;

                        Player.money = winnings + Player.money;

                        WriteText.WriteLine($"The spin was {spin} black.", ConsoleColor.Green);

                        WriteText.WriteLine($"You won ${winnings}. You now have ${Player.money}.", ConsoleColor.Green);
                    }

                    if (spin <= 12 && spin >= 1 && dozen != "first")

                    {
                        WriteText.WriteLine($"The spin was {spin} black.", ConsoleColor.Red);

                        WriteText.WriteLine($"You lost ${bet}. You now have ${Player.money}.", ConsoleColor.Red);
                    }

                    if (spin >= 13 && spin <= 24 && dozen == "second")

                    {
                        winnings = 3 * bet;

                        Player.money = winnings + Player.money;

                        WriteText.WriteLine($"The spin was {spin} black.", ConsoleColor.Green);

                        WriteText.WriteLine($"You won ${winnings}. You now have ${Player.money}.", ConsoleColor.Green);
                    }

                    if (spin >= 13 && spin <= 24 && dozen != "second")

                    {
                        WriteText.WriteLine($"The spin was {spin} black.", ConsoleColor.Red);

                        WriteText.WriteLine($"You lost ${bet}. You now have ${Player.money}.", ConsoleColor.Red);
                    }

                    if (spin >= 25 && spin <= 36 && dozen == "third")

                    {
                        winnings = 3 * bet;

                        Player.money = winnings + Player.money;

                        WriteText.WriteLine($"The spin was {spin} black.", ConsoleColor.Green);

                        WriteText.WriteLine($"You won ${winnings}. You now have ${Player.money}.", ConsoleColor.Green);
                    }

                    if (spin >= 25 && spin <= 36 && dozen != "third")

                    {
                        WriteText.WriteLine($"The spin was {spin} black.", ConsoleColor.Red);

                        WriteText.WriteLine($"You lost ${bet}. You now have ${Player.money}.", ConsoleColor.Red);
                    }
                }

                if (spin == 0 || spin == 00)

                {
                    WriteText.WriteLine($"The spin was {spin} green.", ConsoleColor.Red);

                    WriteText.WriteLine($"You lost ${bet}. You now have ${Player.money}.", ConsoleColor.Red);
                }
            }

            return(Player.money);
        }
Esempio n. 25
0
 void Awake()
 {
     instance = this;
     printing = false;
 }
Esempio n. 26
0
        public int NumbersBet(int spin)

        {
            WheelSpin wheel = new WheelSpin();

            int bet = 0;

            int number = 0;

            int winnings = 0;

            int[] red = { 1, 3, 5, 7, 9, 12, 14, 16, 18, 19, 21, 23, 25, 27, 30, 32, 34, 36 };

            int[] black = { 2, 4, 6, 8, 10, 11, 13, 15, 17, 20, 22, 24, 26, 28, 29, 31, 33, 35 };

            int[] green = { 0, 37 };

            WriteText.WriteLine("Number Bet:", ConsoleColor.Yellow);

            WriteText.Write("Please enter the number you would like to bet on up to 36: ", ConsoleColor.Red);

            number = Int32.Parse(Console.ReadLine());

            WriteText.Write($"You have ${Player.money}. Please enter how much you would like to bet: ", ConsoleColor.Red);

            bet = Int32.Parse(Console.ReadLine());

            while (bet > Player.money)

            {
                throw new System.IndexOutOfRangeException("You bet more than you have.");
            }

            if (bet <= Player.money)

            {
                Player.money = Player.money - bet;



                if (red.Contains(spin))

                {
                    WriteText.WriteLine($"The spin was {spin} red.", ConsoleColor.Red);
                }

                if (black.Contains(spin))

                {
                    WriteText.WriteLine($"The spin was {spin} black.", ConsoleColor.Red);
                }

                if (green.Contains(spin))

                {
                    if (spin == 00)

                    {
                        WriteText.WriteLine($"The spin was {spin} green.", ConsoleColor.Red);
                    }

                    else

                    {
                        WriteText.WriteLine($"The spin was {spin} green.", ConsoleColor.Red);
                    }
                }

                if (spin == number)

                {
                    winnings = 35 * bet;

                    Player.money = winnings + Player.money;

                    WriteText.WriteLine($"You won ${winnings}. You now have ${Player.money}.", ConsoleColor.Green);
                }

                if (spin != number)

                {
                    WriteText.WriteLine($"You lost ${bet}. You now have ${Player.money}.", ConsoleColor.Red);
                }
            }

            return(Player.money);
        }
Esempio n. 27
0
 private void Awake()
 {
     write = GetComponent <WriteText>();
 }
Esempio n. 28
0
        public int RedOrBlackBet(int spin)

        {
            WheelSpin wheel = new WheelSpin();

            string redOrBlack;

            int winnings = 0;

            int bet = 0;

            int[] red = { 1, 3, 5, 7, 9, 12, 14, 16, 18, 19, 21, 23, 25, 27, 30, 32, 34, 36 };

            int[] black = { 2, 4, 6, 8, 10, 11, 13, 15, 17, 20, 22, 24, 26, 28, 29, 31, 33, 35 };

            int[] green = { 0, 37 };

            WriteText.WriteLine("Red/Black Bet:", ConsoleColor.Yellow);

            WriteText.Write("Please Enter red or black: ", ConsoleColor.Red);

            redOrBlack = Console.ReadLine();

            redOrBlack.ToLower();



            WriteText.Write($"You have ${Player.money}. Please enter how much you would like to bet: ", ConsoleColor.Red);

            bet = Int32.Parse(Console.ReadLine());

            if (bet > Player.money)

            {
                throw new System.IndexOutOfRangeException("You bet more than you have.");
            }

            if (bet <= Player.money)

            {
                Player.money = Player.money - bet;



                if (red.Contains(spin) && redOrBlack == "red")

                {
                    winnings = 2 * bet;

                    Player.money = winnings + Player.money;

                    WriteText.WriteLine($"The spin was {spin} red.", ConsoleColor.Green);

                    WriteText.WriteLine($"You won ${winnings}. You now have ${Player.money}.", ConsoleColor.Green);
                }

                if (red.Contains(spin) && redOrBlack != "red")

                {
                    WriteText.WriteLine($"The spin was {spin} red.", ConsoleColor.Red);

                    WriteText.WriteLine($"You lost ${bet}. You now have ${Player.money}.", ConsoleColor.Red);
                }

                if (black.Contains(spin) && redOrBlack == "black")

                {
                    winnings = 2 * bet;

                    Player.money = winnings + Player.money;

                    WriteText.WriteLine($"The spin was {spin} black.", ConsoleColor.Green);

                    WriteText.WriteLine($"You won ${winnings}. You now have ${Player.money}.", ConsoleColor.Green);
                }

                if (black.Contains(spin) && redOrBlack != "black")

                {
                    WriteText.WriteLine($"The spin was {spin} black.", ConsoleColor.Red);

                    WriteText.WriteLine($"You lost ${bet}. You now have ${Player.money}.", ConsoleColor.Red);
                }

                if (spin == 0 || spin == 00)

                {
                    WriteText.WriteLine($"The spin was {spin} green.", ConsoleColor.Red);

                    WriteText.WriteLine($"You lost ${bet}. You now have ${Player.money}.", ConsoleColor.Red);
                }
            }

            return(Player.money);
        }
Esempio n. 29
0
        public int LowOrHighBet(int spin)

        {
            WheelSpin wheel = new WheelSpin();

            string lowOrHigh;

            int winnings = 0;

            int bet = 0;

            int[] red = { 1, 3, 5, 7, 9, 12, 14, 16, 18, 19, 21, 23, 25, 27, 30, 32, 34, 36 };

            int[] black = { 2, 4, 6, 8, 10, 11, 13, 15, 17, 20, 22, 24, 26, 28, 29, 31, 33, 35 };

            int[] green = { 0, 37 };

            WriteText.WriteLine("Lows/Highs Bet:", ConsoleColor.Yellow);

            WriteText.Write("lows (1-18) or highs (19-36)? Please enter low/high: ", ConsoleColor.Red);

            lowOrHigh = Console.ReadLine();

            lowOrHigh.ToLower();



            WriteText.Write($"You have ${Player.money}. Please enter how much you would like to bet: ", ConsoleColor.Red);

            bet = Int32.Parse(Console.ReadLine());

            if (bet > Player.money)

            {
                throw new System.IndexOutOfRangeException("You bet more than you have.");
            }

            if (bet <= Player.money)

            {
                if (red.Contains(spin))

                {
                    Player.money = Player.money - bet;

                    if (spin <= 18 && spin >= 1 && lowOrHigh == "low")

                    {
                        winnings = 2 * bet;

                        Player.money = winnings + Player.money;

                        WriteText.WriteLine($"The spin was {spin} red.", ConsoleColor.Green);

                        WriteText.WriteLine($"You won ${winnings}. You now have ${Player.money}.", ConsoleColor.Green);
                    }

                    if (spin <= 18 && spin >= 1 && lowOrHigh != "low")

                    {
                        WriteText.WriteLine($"The spin was {spin} red.", ConsoleColor.Red);

                        WriteText.WriteLine($"You lost ${bet}. You now have ${Player.money}.", ConsoleColor.Red);
                    }

                    if (spin >= 19 && lowOrHigh == "high")

                    {
                        winnings = 2 * bet;

                        Player.money = winnings + Player.money;

                        WriteText.WriteLine($"The spin was {spin} red.", ConsoleColor.Green);

                        WriteText.WriteLine($"You won ${winnings}. You now have ${Player.money}.", ConsoleColor.Green);
                    }

                    if (spin >= 19 && lowOrHigh != "high")

                    {
                        WriteText.WriteLine($"The spin was {spin} red.", ConsoleColor.Red);

                        WriteText.WriteLine($"You lost ${bet}. You now have ${Player.money}.", ConsoleColor.Red);
                    }

                    if (spin == 0 || spin == 00)

                    {
                        WriteText.WriteLine($"The spin was {spin} red.", ConsoleColor.Red);

                        WriteText.WriteLine($"You lost ${bet}. You now have ${Player.money}.", ConsoleColor.Red);
                    }
                }

                if (black.Contains(spin))

                {
                    Player.money = Player.money - bet;

                    if (spin <= 18 && spin >= 1 && lowOrHigh == "low")

                    {
                        winnings = 2 * bet;

                        Player.money = winnings + Player.money;

                        WriteText.WriteLine($"The spin was {spin} black.", ConsoleColor.Green);

                        WriteText.WriteLine($"You won ${winnings}. You now have ${Player.money}.", ConsoleColor.Green);
                    }

                    if (spin <= 18 && spin >= 1 && lowOrHigh != "low")

                    {
                        WriteText.WriteLine($"The spin was {spin} black.", ConsoleColor.Red);

                        WriteText.WriteLine($"You lost ${bet}. You now have ${Player.money}.", ConsoleColor.Red);
                    }

                    if (spin >= 19 && lowOrHigh == "high")

                    {
                        winnings = 2 * bet;

                        Player.money = winnings + Player.money;

                        WriteText.WriteLine($"The spin was {spin} black.", ConsoleColor.Green);

                        WriteText.WriteLine($"You won ${winnings}. You now have ${Player.money}.", ConsoleColor.Green);
                    }

                    if (spin >= 19 && lowOrHigh != "high")

                    {
                        WriteText.WriteLine($"The spin was {spin} black.", ConsoleColor.Red);

                        WriteText.WriteLine($"You lost ${bet}. You now have ${Player.money}.", ConsoleColor.Red);
                    }
                }

                if (green.Contains(spin))

                {
                    if (spin == 0 || spin == 00)

                    {
                        WriteText.WriteLine($"The spin was {spin} green.", ConsoleColor.Red);

                        WriteText.WriteLine($"You lost ${bet}. You now have ${Player.money}.", ConsoleColor.Red);
                    }
                }
            }

            return(Player.money);
        }
Esempio n. 30
0
 internal JsonSerializer(SerializationManager manager, TextWriter writer) : this(manager) {
     OutputChar      = writer.Write;
     OutputCharArray = writer.Write;
     OutputText      = writer.Write;
     OutputString    = manager.UseEscapedUnicode ? WriteStringEscapeUnicode : (WriteText)WriteString;
 }
Esempio n. 31
0
        public ObservableCollection <DictionaryPasswordElement> Recognize(string textToRecognize, Dictionary <string, string> dictionary)
        {
            _textToRecognize = textToRecognize;
            _dictionary      = dictionary;

            var moreanswer = new List <string>();

            try
            {
                //znalezienie i wycięcie pierwszego słowa
                GetDefiniendum.Get(ref _textToRecognize, _dictionary, _obserColl);

                //znalezienie i wyciecie kolejnych opisów hasła
                var regex   = new Regex(@" [1-9]\. ");
                var matches = regex.Matches(_textToRecognize);
                for (var i = 0; i < matches.Count - 1; i++)
                {
                    moreanswer.Add(_textToRecognize.Substring(matches[0].Index, matches[1].Index - matches[0].Index));
                }
                moreanswer.Add(_textToRecognize.Substring(matches[matches.Count - 1].Index));

                foreach (var value in moreanswer)
                {
                    _textToRecognize = _textToRecognize.Replace(value, "");
                }

                //znalezienie i wycięcie tekstu do pierwszego znaku '«'
                GetDescriptionList.Get(ref _textToRecognize, _dictionary, _obserColl);

                //wyszukanie znaczenia słowa z podwojnych nawiasach skosnych
                GetDefiniens.Get(ref _textToRecognize, _obserColl);

                AnalizeText.Get(_textToRecognize, _dictionary, _obserColl);

                foreach (var value in moreanswer)
                {
                    regex = new Regex(@" [1-9]\. ");
                    var match = regex.Match(value);
                    WriteText.Write(match.Value.Trim(), "liczbowy podział definicji", _obserColl);
                    var privatetextToRecognize = value.Replace(match.Value, "");


                    GetDefiniens.Get(ref privatetextToRecognize, _obserColl);

                    GetCitation.Get(ref privatetextToRecognize, _obserColl);


                    if (privatetextToRecognize.Length > 1)
                    {
                        regex = new Regex(@"<.*>");
                        match = regex.Match(privatetextToRecognize);

                        if (match.Success)
                        {
                            privatetextToRecognize = privatetextToRecognize.Replace(match.Value, "");
                            WriteText.Write(privatetextToRecognize.Trim(),
                                            "przykład/połączenie wyrazowe (kolokacja)/związek frazeologiczny", _obserColl);
                            WriteText.Write(match.Value.Trim(), "wyjaśnienie etymologiczne wyrazu", _obserColl);
                        }
                        else
                        {
                            WriteText.Write(privatetextToRecognize.Trim(), "przykład/połączenie wyrazowe (kolokacja)/związek frazeologiczny", _obserColl);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }

            return(_obserColl);
        }