Ejemplo n.º 1
0
 public MainWindow()
 {
     InitializeComponent();
     Languege.Libra("ru");
     SeriesCollection  = new SeriesCollection();
     SeriesCollection2 = new SeriesCollection();
 }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            Languege.Libra("ru");
            var crt  = new ChineseRemainderTheorem();
            var el3  = new TheLinearCongruentialMethod();
            var el11 = new TheLinearCongruentialMethod();

            el3.CreatePeriod(3, 1);
            el11.CreatePeriod(11, 4);
            crt.CreatePeriod(el3.Period, el11.Period);
            foreach (var e in el3.Period)
            {
                Console.Write($"{e} ");
            }
            Console.WriteLine();
            foreach (var e in el11.Period)
            {
                Console.Write($"{e} ");
            }
            Console.WriteLine();
            foreach (var e in crt.Period)
            {
                Console.Write($"{e} ");
            }
            Console.ReadKey();

            //var candidat = new List<string>();
            //candidat.Add("собакц");
            //candidat.Add("сингапцр");
            //var ans = Bodymethod(@"Russian.dic", @"Russian.aff", -1, candidat);
            //foreach (var a in ans)
            //    Console.WriteLine(a);
            //Console.ReadKey();
        }
Ejemplo n.º 3
0
 static void Main()
 {
     Languege.Libra("ru");
     #region
     FileStream   fs       = new FileStream("hillNewUpdateDatabase.txt", FileMode.OpenOrCreate);
     StreamWriter hillBase = new StreamWriter(fs, Encoding.Default);
     //Random rnd = new Random();
     #endregion
     #region
     var    lcm3  = new TheLinearCongruentialMethod();
     var    lcm11 = new TheLinearCongruentialMethod();
     var    china = new ChineseRemainderTheorem();
     Random rnd   = new Random();
     while (true)
     {
         var text = Console.ReadLine();
         if (text == "end")
         {
             break;
         }
         var staticKey = Generate.CreateKeysMatrix(text.Length);
         var libra     = new WordAndKey <List <Matrix <double> > >(text, staticKey);
         var tr        = new Hill();
         lcm11.CreatePeriod(11, rnd.Next(0, 11));
         lcm3.CreatePeriod(3, rnd.Next(0, 3));
         china.CreatePeriod(lcm3.Period, lcm11.Period);
         tr.Code(libra, china.Period);
         hillBase.WriteLine(string.Join(" ", lcm3.Period));
         hillBase.WriteLine(string.Join(" ", lcm11.Period));
         hillBase.WriteLine(libra.Word);
         hillBase.WriteLine(libra.Encoded);
         foreach (var l in libra.Key)
         {
             hillBase.WriteLine(l.ToMatrixString());
         }
     }
     hillBase.Close();
     #endregion //
     #region
     //key.Add(Matrix<double>.Build.DenseOfArray(new double[,] { { 7, 2 }, { 29, 29 } }));
     //key.Add(Matrix<double>.Build.DenseOfArray(new double[,] { { 15 }, { 6 } }));
     //var libra = new WordAndKey<List<Matrix<double>>>("БУБЛИКИ", key);
     //var tr = new Hill();
     //tr.Code(libra);
     //Console.WriteLine(libra.Encoded);
     #endregion
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Переключение языков
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void RadioButton_Checked(object sender, RoutedEventArgs e)
        {
            RadioButton pressed = (RadioButton)sender;

            Languege.Libra(pressed.Name);
        }
Ejemplo n.º 5
0
        static void Main(string[] args)
        {
            Dictionary <int, string> daysOfweekOnRussian = new Dictionary <int, string>
            {
                { 1, "Понедельник" },
                { 2, "Вторник" },
                { 3, "Среда" },
                { 4, "Четверг" },
                { 5, "Пятница" },
                { 6, "Суббота" },
                { 7, "Воскресенье" },
            };

            Languege languege = Languege.English;



            do
            {
                Console.Clear();


                switch (languege)
                {
                case Languege.English:
                {
                    DrawEnglishScheudle();

                    switch (Console.ReadKey(true).Key)
                    {
                    case ConsoleKey.T:
                        #region ENTER NUMBER
                    {
                        Console.WriteLine("Enter number");

                        int number = 0;

                        switch (Console.ReadKey(true).Key)
                        {
                        case ConsoleKey.D1:
                        {
                            number = (int)DaysOfWeek.Monday;

                            break;
                        }

                        case ConsoleKey.D2:
                        {
                            number = (int)DaysOfWeek.Tuesday;

                            break;
                        }

                        case ConsoleKey.D3:
                        {
                            number = (int)DaysOfWeek.Wednesday;

                            break;
                        }

                        case ConsoleKey.D4:
                        {
                            number = (int)DaysOfWeek.Thursday;

                            break;
                        }

                        case ConsoleKey.D5:
                        {
                            number = (int)DaysOfWeek.Friday;

                            break;
                        }

                        case ConsoleKey.D6:
                        {
                            number = (int)DaysOfWeek.Sunday;

                            break;
                        }

                        case ConsoleKey.D7:
                        {
                            number = (int)DaysOfWeek.Saturday;

                            break;
                        }
                        }

                        if (number != 0)
                        {
                            Console.WriteLine("This is a {0} ", (DaysOfWeek)number);
                        }
                        else
                        {
                            Console.WriteLine("Error");
                        }


                        Console.WriteLine("Press any button that to continue");



                        break;
                    }

                        #endregion
                    case ConsoleKey.Y:
                        #region ENTER DAY OF WEEK
                    {
                        Console.WriteLine("Enter day of week and programm wiil show number ");

                        string str = Console.ReadLine();

                        DaysOfWeek day;

                        if (Enum.TryParse <DaysOfWeek>(str, out day))
                        {
                            Console.WriteLine((int)day);
                        }
                        else
                        {
                            Console.WriteLine("Error");
                        }

                        Console.WriteLine("Press any button that continue");


                        break;
                    }

                        #endregion
                    case ConsoleKey.R:
                        #region CHANGE LANGUAGE ON RUSSIAN
                    {
                        languege = Languege.Russian;


                        break;
                    }
                        #endregion
                    }

                    break;
                }

                case Languege.Russian:
                {
                    DrawRussianSchedule();

                    switch (Console.ReadKey(true).Key)
                    {
                    case ConsoleKey.T:
                        #region ENTER NUMBER
                    {
                        Console.WriteLine("Введите число");

                        int number = 0;

                        switch (Console.ReadKey(true).Key)
                        {
                        case ConsoleKey.D1:
                        {
                            number = (int)DaysOfWeek.Monday;

                            break;
                        }

                        case ConsoleKey.D2:
                        {
                            number = (int)DaysOfWeek.Tuesday;

                            break;
                        }

                        case ConsoleKey.D3:
                        {
                            number = (int)DaysOfWeek.Wednesday;

                            break;
                        }

                        case ConsoleKey.D4:
                        {
                            number = (int)DaysOfWeek.Thursday;

                            break;
                        }

                        case ConsoleKey.D5:
                        {
                            number = (int)DaysOfWeek.Friday;

                            break;
                        }

                        case ConsoleKey.D6:
                        {
                            number = (int)DaysOfWeek.Sunday;

                            break;
                        }

                        case ConsoleKey.D7:
                        {
                            number = (int)DaysOfWeek.Saturday;

                            break;
                        }
                        }

                        if (number != 0)
                        {
                            Console.WriteLine("Это {0} ", daysOfweekOnRussian[number]);
                        }
                        else
                        {
                            Console.WriteLine("Ошибка");
                        }


                        Console.WriteLine("Нажмите любую кнопкку что бы продолжить");



                        break;
                    }

                        #endregion
                    case ConsoleKey.Y:
                        #region ENTER DAY OF WEEK
                    {
                        Console.WriteLine("Введите название дня недели и программа выведит число ");

                        string str = Console.ReadLine();

                        DaysOfWeek day;

                        if (Enum.TryParse <DaysOfWeek>(str, out day))
                        {
                            Console.WriteLine((int)day);
                        }
                        else
                        {
                            Console.WriteLine("Ошибка");
                        }

                        Console.WriteLine("Нажмите любое число чтобы продолжить");


                        break;
                    }

                        #endregion
                    case ConsoleKey.E:
                        #region CHANGE LANGUAGE ON ENGLISH
                    {
                        languege = Languege.English;


                        break;
                    }
                        #endregion
                    }

                    break;
                }
                }
            } while (Console.ReadKey(true).Key != ConsoleKey.Escape);
        }