//[DllImport("user32.dll", CharSet = CharSet.Unicode)]
        //public static extern int MessageBox(IntPtr hWnd, String text, String caption, uint type);


        static void Main(string[] args)
        {
            //MessageBox(new IntPtr(0), "Hello World!", "Hello Dialog", 0);



            // read_file rf = new read_file();
            //rf.read_f();
            //rf.read_d();


            Window       main_l = new Window();
            Window       main_r = new Window();
            Read_command r      = new Read_command();

            // main_r.next_drive();


            Window_manager w_m = new Window_manager(main_l, main_r);

            w_m.Navi_m();

            Console.ReadKey();
        }
示例#2
0
        //работа с командной строки
        internal void Navi()
        {
            List <string> inp;

            inp = Read_command.Read(current_dir.FullName);

            switch (inp[0])
            {
            case "exit":
                Environment.Exit(0);
                break;

            case "copy":
                Copy(inp);
                break;

            case "move":
                Move(inp);
                break;

            case "create":
                Create(inp);
                break;

            case "read":
                List <string> t = null;

                if (Read(inp, out t))
                {
                    Console.Clear();
                    foreach (string st in t)
                    {
                        Console.WriteLine(st);
                    }
                    Console.WriteLine("press any key");
                    Console.ReadKey();
                }
                break;

            case "restart":
                Restart();
                break;

            case "find":
                List <DirectoryInfo> di = new List <DirectoryInfo>();
                List <FileInfo>      fi = new List <FileInfo>();
                int            ind      = 1;
                ConsoleKeyInfo inp_key;

                Find0(inp, di, fi);
                Console.Clear();

                foreach (DirectoryInfo d in di)
                {
                    try
                    {
                        Console.WriteLine(ind++.ToString() + " " + d.FullName);
                    }
                    catch
                    {
                        Console.WriteLine("long name");
                    }
                }
                foreach (FileInfo f in fi)
                {
                    try
                    {
                        Console.WriteLine(ind++.ToString() + " " + f.FullName);
                    }
                    catch
                    {
                        Console.WriteLine("long name");
                    }
                }

                Console.WriteLine("for go to a file or dir -- press space, go back -- any key");
                inp_key = Console.ReadKey(true);

                if (inp_key.Key == ConsoleKey.Spacebar)
                {
                    Cd0(di, fi);
                }

                Refresh();
                pos       = 0;
                ind_start = 0;
                ind_end   = ind_start + 21;
                break;

            case "rename":
                Rename(inp);
                break;

            case "del":
                Del(inp);
                break;

            case "compare":
                //if(comp(inp))
                //    Console.WriteLine("Y");
                //else
                //    Console.WriteLine("N");
                //Console.WriteLine("press any key");
                //Console.ReadKey();
                break;

            case "cd":
                Cd(inp);

                Refresh();


                pos       = -1;
                ind_start = -1;
                ind_end   = ind_start + 21;
                break;

            case "cdd":
                Next_drive();

                Refresh();
                pos = -1;

                ind_start = -1;
                ind_end   = ind_start + 21;
                break;

            case "set":
                Set_cons();
                break;

            case "man":
                Mann(inp, null);

                break;
            }
        }