internal void Navi_m()
        {
            Consol.Next_bkg_col();
            Consol.Prev_bkg_col();

            Print_m(activ_w.pos);
            Nav1_menu1();
        }
示例#2
0
        //настройка консоли
        internal void Set_cons()
        {
            string         temp;
            ConsoleKeyInfo inp;

            do
            {
                Console.Clear();
                string menu = " prev_bkg_col ----------- 1\n" +
                              " next_bkg_col ----------- 2\n" +
                              " prev_frg_col ----------- 3\n" +
                              " next_frg_col ----------- 4\n" +
                              " WindowHeight (rows) ---- h\n" +
                              " WindowWidth (columns) -- w\n" +
                              " exit ------------------- esc";
                Console.WriteLine(menu);
                Console.WriteLine("Background -- " + Console.BackgroundColor.ToString());
                Console.WriteLine("Foreground -- " + Console.ForegroundColor.ToString());
                inp = Console.ReadKey(true);
                switch (inp.Key)
                {
                case ConsoleKey.D1:
                    Consol.Prev_bkg_col();
                    Console.WriteLine(Console.BackgroundColor.ToString());
                    break;

                case ConsoleKey.D2:
                    Consol.Next_bkg_col();
                    Console.WriteLine(Console.BackgroundColor.ToString());
                    break;

                case ConsoleKey.D3:
                    Consol.Prev_frg_col();
                    Console.WriteLine(Console.ForegroundColor.ToString());
                    break;

                case ConsoleKey.D4:
                    Consol.Next_frg_col();
                    Console.WriteLine(Console.ForegroundColor.ToString());
                    break;

                case ConsoleKey.H:
                    Console.WriteLine("rows? (min = 15, max = {0})  ", Console.LargestWindowHeight);
                    temp = Console.ReadLine();
                    Consol.Set_h(temp);
                    break;

                case ConsoleKey.W:
                    Console.WriteLine("columns? (min = 30, max = {0})  ", Console.LargestWindowWidth);
                    temp = Console.ReadLine();
                    Consol.Set_w(temp);
                    break;
                }
            } while (inp.Key != ConsoleKey.Escape);
        }
        internal void Print_m(int pos0)
        {
            len  = Console.WindowWidth / 2 - 3;
            rows = Console.WindowHeight - 9;

            string lin = "-".PadLeft(Console.WindowWidth - 1, '-');

            string menu1 = String.Format("{0}\n", lin) +
                           "F1 - help      F2 - next drive   F3 - read txt    F4 - compare txt    F5 - copy        F6 - move\n" +
                           "F7 - create    F8 - rename       DEL - del        F10 - exit          S - setting      F12 - command line ";


            string line_l;
            string line_r;
            string st;


            int ind_l = w_l.ind_start;
            int ind_r = w_r.ind_start;

            string l_name = w_l.current_dir.FullName.PadRight(len, ' ');
            string r_name = w_r.current_dir.FullName.PadRight(len, ' ');

            if (l_name.Length > len)
            {
                l_name = l_name.Remove(0, l_name.Length - len);
            }
            if (r_name.Length > len)
            {
                r_name = r_name.Remove(0, r_name.Length - len);
            }

            Console.Clear();
            foreach (DriveInfo dr in w_l.alldrives)
            {
                Console.Write(dr.Name + " (" + dr.VolumeLabel + ")\t");
            }

            Console.WriteLine("\n" + lin + "\n" + l_name + " | " + r_name + "\n" + lin + "\n");


            for (int k = 0; k < rows; ++k)
            {
                if ((ind_l > w_l.ind_end && ind_r > w_r.ind_end) || (ind_l >= w_l.list_all.Count && ind_r >= w_r.list_all.Count))
                {
                    break;
                }


                if (ind_l == -1)
                {
                    line_l = ". ..";
                }
                else
                {
                    if (ind_l < l_list.Count)
                    {
                        st = string.Format("{0}", (ind_l + 1).ToString()) + ". ";

                        line_l = string.Concat(st, l_list[ind_l]);
                        if (line_l.Length > len)
                        {
                            line_l = line_l.Remove(len);
                        }
                    }
                    else
                    {
                        line_l = " ";
                    }
                }
                line_l = line_l.PadRight(len, ' ');

                if (ind_r == -1)
                {
                    line_r = ". ..";
                }
                else
                {
                    if (ind_r < r_list.Count)
                    {
                        st = string.Format("{0}", (ind_r + 1).ToString()) + ". ";

                        line_r = string.Concat(st, r_list[ind_r]);
                        if (line_r.Length > len)
                        {
                            line_r = line_r.Remove(len);
                        }
                    }
                    else
                    {
                        line_r = " ";
                    }
                }
                line_r = line_r.PadRight(len, ' ');


                //меняем цвет и фон курсора
                if (lr && ind_l == pos0)
                {
                    Consol.Next_bkg_col();
                    Consol.Next_frg_col();
                    Console.Write(line_l);
                    Consol.Prev_bkg_col();
                    Consol.Prev_frg_col();
                    Console.Write(" | ");
                    Console.WriteLine(line_r);
                }
                else
                if (!lr && ind_r == pos0)
                {
                    Console.Write(line_l);
                    Console.Write(" | ");
                    Consol.Next_bkg_col();
                    Consol.Next_frg_col();
                    Console.WriteLine(line_r);
                    Consol.Prev_bkg_col();
                    Consol.Prev_frg_col();
                }
                else
                {
                    Console.WriteLine(line_l + " | " + line_r);//без изменения цвета
                }
                ++ind_l;
                ++ind_r;
            }
            Console.WriteLine(menu1);
        }