示例#1
0
        bool MakeDir()
        {
            if (SetNewDirectory)
            {
                string Tempo = Partes[NumberPart.Get()].GetCurrentPath();
                Tempo += '\\' + MaKeys.GetText();

                try
                {
                    DirectoryInfo NewDir = Directory.CreateDirectory(@Tempo);
                    Global.AddToLogFile(@Tempo, "Maked Directory", "Success");
                    Global.Attention.AddContent(MyFunc.Set(2, 1), $"Successfully Maked Directory {@Tempo}");
                }
                catch (UnauthorizedAccessException)
                {
                    Global.Attention.AddContent(MyFunc.Set(2, 1), "Access Denied");
                    Global.AddToLogFile(@Tempo, "Trying to make Directory", "Access Denied");
                    return(false);
                }
                catch (Exception)
                {
                    Global.Attention.AddContent(MyFunc.Set(2, 1), "Can not make Directory");
                    Global.AddToLogFile(@Tempo, "Trying to make Directory", "Can not make Directory");
                    return(false);
                }

                SetNewDirectory     = false;
                NameEnterer.Enabled = false;
                return(true);
            }
            return(false);
        }
示例#2
0
        int DiskSelecterKeys()
        {
            if (!Enabled)
            {
                return(0);
            }

            if (MaKeys.Get(ConsoleKey.Escape))
            {
                Enabled = false;
                return(-1);
            }

            if (MaKeys.Get(ConsoleKey.LeftArrow))
            {
                Indexer.Do(1, 1);
                return(0);
            }
            if (MaKeys.Get(ConsoleKey.RightArrow))
            {
                Indexer.Do(1, 0);
                return(0);
            }

            if (MaKeys.Get(ConsoleKey.Enter))
            {
                NewPath = Drives[Indexer.Get()].Name;
                Enabled = false;
                return(1);
            }

            return(0);
        }
示例#3
0
        public bool HandleKeys()
        {
            if (!Enabled)
            {
                return(false);
            }

            if (MaKeys.Get(ConsoleKey.Escape))
            {
                Enabled = false;
                if (Data != null)
                {
                    Data.Clear();
                }
                return(false);
            }

            //Смещение маркера вверх или вниз
            if (MaKeys.Get(ConsoleKey.DownArrow))
            {
                Scroller001.OffSet(1);
                return(true);
            }
            if (MaKeys.Get(ConsoleKey.UpArrow))
            {
                Scroller001.OffSet(-1);
                return(true);;
            }

            //Постраничное смещение
            if (MaKeys.Get(ConsoleKey.PageDown))
            {
                Scroller001.OffSet(2);
                return(true);;
            }
            if (MaKeys.Get(ConsoleKey.PageUp))
            {
                Scroller001.OffSet(-2);
                return(true);;
            }

            //Перемещение в начало или конец
            if (MaKeys.Get(ConsoleKey.End))
            {
                Scroller001.OffSet(3);
                return(true);;
            }
            if (MaKeys.Get(ConsoleKey.Home))
            {
                Scroller001.OffSet(-3);
            }
            return(true);
        }
示例#4
0
        static void Main(string[] args)
        {
            Maximize();

            Global.Init(180, 54);
            FullCommander MaCommander = new FullCommander();

            MaCommander.Init();

            while (!MaCommander.Ended)
            {
                MaCommander.Show();
                Global.Show();

                MaKeys.Set();
                MaCommander.HandleKeys();

                Global.Clear();
                Console.Clear();
            }
        }
示例#5
0
        int OKCANCELKeys()
        {
            if (!Enabled)
            {
                return(0);
            }

            if (MaKeys.Get(ConsoleKey.Escape))
            {
                Enabled = false;
                return(-1);
            }

            if (MaKeys.Get(ConsoleKey.LeftArrow))
            {
                Indexer.Do(1, 1);
                return(0);
            }
            if (MaKeys.Get(ConsoleKey.RightArrow))
            {
                Indexer.Do(1, 0);
                return(0);
            }

            if (MaKeys.Get(ConsoleKey.Enter))
            {
                if (Indexer.Get() == 0)
                {
                    Enabled = false;
                    return(1);
                }
                if (Indexer.Get() == 1)
                {
                    Enabled = false;
                    return(-1);
                }
            }

            return(0);
        }
示例#6
0
        public void HandleKeys()
        {
            //Смещение маркера вверх или вниз
            if (MaKeys.Get(ConsoleKey.DownArrow))
            {
                VertIndex.Do(1, 0);
                VisIndex.Do(1, 0);

                if (VisIndex.IsMax())
                {
                    BorderUp.Do(1, 0);
                    BorderDown.Do(1, 0);
                }
                return;
            }
            if (MaKeys.Get(ConsoleKey.UpArrow))
            {
                VertIndex.Do(1, 1);
                VisIndex.Do(1, 1);
                if (VisIndex.IsMin())
                {
                    BorderUp.Do(1, 1);
                    BorderDown.Do(1, 1);
                }
                return;
            }

            //Постраничное смещение
            if (MaKeys.Get(ConsoleKey.PageDown))
            {
                VertIndex.Do(VertStep, 0);
                VisIndex.Do(VertStep, 0);

                BorderUp.Do(VertStep, 0);
                BorderDown.Do(VertStep, 0);
                return;
            }
            if (MaKeys.Get(ConsoleKey.PageUp))
            {
                VertIndex.Do(VertStep, 1);
                VisIndex.Do(VertStep, 1);

                BorderUp.Do(VertStep, 1);
                BorderDown.Do(VertStep, 1);
                return;
            }

            //Перемещение в начало или конец списка
            if (MaKeys.Get(ConsoleKey.End))
            {
                VertIndex.Maximalize();
                VisIndex.Maximalize();
                BorderUp.Maximalize();
                BorderDown.Maximalize();
                return;
            }
            if (MaKeys.Get(ConsoleKey.Home))
            {
                VertIndex.Minimalize();
                VisIndex.Minimalize();
                BorderUp.Minimalize();
                BorderDown.Minimalize();
            }
        }
示例#7
0
        public void HandleKeys()
        {
            if (!Active)
            {
                return;
            }
            Global.Attention.Show("");

            //Отмена выделений
            if (MaKeys.Get(ConsoleKey.Escape))
            {
                Global.ResetTextPainter();
                return;
            }

            //Переход по уровням директорий
            if (MaKeys.Get(ConsoleKey.Enter))
            {
                Global.ResetTextPainter();
                ListFullNames.Clear();
                ListNames.Clear();
                ListTypes.Clear();

                if (CurrentContent.GetType(MainMarker.GetIndex()) == Global.Types.LevelUp)
                {
                    MainMarker.SetDirection(true);
                    MaWalker.LevelUp();
                    PrepareDirectory();
                    return;
                }
                if (CurrentContent.GetType(MainMarker.GetIndex()) == Global.Types.Directory)
                {
                    MainMarker.SetDirection(false);
                    if (MaWalker.LevelDown(CurrentContent.GetName(MainMarker.GetIndex())))
                    {
                        PrepareDirectory();
                    }
                    return;
                }
            }

            if (MaKeys.Get(ConsoleKey.Backspace))
            {
                Global.ResetTextPainter();

                MainMarker.SetDirection(true);
                MaWalker.LevelUp();
                PrepareDirectory();
                return;

                /*
                 * if(!MaWalker.IsMinimum())
                 * {
                 *
                 * }   **/
            }

            if (MaKeys.Get(ConsoleKey.Spacebar))
            {
                Global.AddTextPainterKoords(MainMarker.GetIndex(), TableContent.GetKoords().Secundus + 1, MainMarker.GetHorizKoords());
                //ListFullNames.Add(MaWalker.GetPath() + '\\' + CurrentContent.GetName(MainMarker.GetIndex()));
                ListFullNames.Add(Path.Combine(MaWalker.GetPath(), CurrentContent.GetName(MainMarker.GetIndex())));
                ListNames.Add(CurrentContent.GetName(MainMarker.GetIndex()));
                ListTypes.Add(CurrentContent.GetType(MainMarker.GetIndex()));
                return;
            }

            MainMarker.HandleKeys();
        }
示例#8
0
        public void HandleKeys()
        {
            switch (CurrentState)
            {
            case 0:
                MainKeys();
                break;

            case 1:
                if (MaKeys.Get(ConsoleKey.F1))
                {
                    Helper.Enabled = false;
                    ChangeActivity(1);
                    CurrentState = 0;
                    return;
                }
                if (MaKeys.Get(ConsoleKey.Escape))
                {
                    Helper.Enabled = false;
                    ChangeActivity(1);
                    CurrentState = 0;
                    return;
                }
                break;

            case 2:
                switch (DiskSelecter.HandleKeys())
                {
                case -1:
                    //Partes[NumberPart.Get()].Reset();
                    ChangeActivity(1);
                    CurrentState = 0;
                    break;

                case 0:
                    break;

                case 1:
                    Partes[NumberPart.Get()].SetNewPath(DiskSelecter.GetNewPath());
                    Partes[NumberPart.Get()].PrepareDirectory();
                    ChangeActivity(1);
                    CurrentState = 0;
                    break;
                }
                break;

            case 3:
                if (!MaShouwar.HandleKeys())
                {
                    ChangeActivity(1);
                    CurrentState = 0;
                }
                break;

            case 4:
                break;

            case 5:
                switch (Confirmer.HandleKeys())
                {
                case -1:
                    Partes[NumberPart.Get()].Reset();
                    ChangeActivity(1);
                    CurrentState = 0;
                    break;

                case 0:
                    break;

                case 1:
                    Copy();
                    ChangeActivity(1);
                    CurrentState = 0;
                    break;
                }
                break;

            case 6:
                if (MakeFile())
                {
                    Partes[NumberPart.Get()].PrepareDirectory();
                    ChangeActivity(1);
                    CurrentState = 0;
                }
                break;

            case 7:
                if (MakeDir())
                {
                    Partes[NumberPart.Get()].PrepareDirectory();
                    ChangeActivity(1);
                    CurrentState = 0;
                }
                break;

            case 8:
                switch (Confirmer.HandleKeys())
                {
                case -1:
                    Partes[NumberPart.Get()].Reset();
                    ChangeActivity(1);
                    CurrentState = 0;
                    break;

                case 0:
                    break;

                case 1:
                    Delete();
                    ChangeActivity(1);
                    CurrentState = 0;
                    break;
                }
                break;

            case 9:
                if (!MaShouwar.HandleKeys())
                {
                    ChangeActivity(1);
                    CurrentState = 0;
                }
                break;
                //case 10:
                //Partes[0].Save();
                //Partes[1].Save();
                //Ended = true;
                //break;
            }
        }
示例#9
0
        void MainKeys()
        {
            if (MaKeys.Get(ConsoleKey.Tab))
            {
                Partes[NumberPart.Get()].Reset();
                Partes[0].Active = !Partes[0].Active;
                Partes[1].Active = !Partes[1].Active;
                NumberPart.Do(1, 1);
                return;
            }


            if (MaKeys.Get(ConsoleKey.F1))
            {
                CurrentState   = 1;
                Helper.Enabled = true;
                ChangeActivity(0);
                return;
            }
            if (MaKeys.Get(ConsoleKey.F2))
            {
                CurrentState = 2;
                ChangeActivity(0);

                DiskSelecter.Enabled = true;
                return;
            }
            if (MaKeys.Get(ConsoleKey.F3))
            {
                MakeFileReader();
                return;
            }
            if (MaKeys.Get(ConsoleKey.F5))
            {
                CurrentState = 5;
                ChangeActivity(0);

                Confirmer.Enabled = true;
                Confirmer.SetLabel(" Do you Realy want to COPY? ", 1);
                return;
            }
            if (MaKeys.Get(ConsoleKey.F6))
            {
                CurrentState = 6;
                ChangeActivity(0);

                NameEnterer.SetLabel(MyFunc.Set(2, 0), " Enter a name for the new File ");
                SetNewFile          = true;
                NameEnterer.Enabled = true;
                MaKeys.ReadText(MyFunc.Set(NameEnterer.GetKoords().Primis + 2, NameEnterer.GetKoords().Secundus + 1), true);
                return;
            }
            if (MaKeys.Get(ConsoleKey.F7))
            {
                CurrentState = 7;
                ChangeActivity(0);

                NameEnterer.SetLabel(MyFunc.Set(2, 0), " Enter a name for the new Directory ");
                SetNewDirectory     = true;
                NameEnterer.Enabled = true;
                MaKeys.ReadText(MyFunc.Set(NameEnterer.GetKoords().Primis + 2, NameEnterer.GetKoords().Secundus + 1), true);
            }
            if (MaKeys.Get(ConsoleKey.F8))
            {
                CurrentState = 8;
                ChangeActivity(0);

                Confirmer.Enabled = true;
                Confirmer.SetLabel(" Do you Realy want to DELETE? ", 1);
                return;
            }
            if (MaKeys.Get(ConsoleKey.F9))
            {
                MakeTreeViewer();
                return;
            }
            if (MaKeys.Get(ConsoleKey.F10))
            {
                Partes[0].Save();
                Partes[1].Save();
                Ended = true;
                //CurrentState = 10;
                //ChangeActivity(0);
                return;
            }

            Partes[0].HandleKeys();
            Partes[1].HandleKeys();
        }