static void Main(string[] args) { string path = "C:/Users/malik/Desktop/far"; //задаем путь FarManager far = new FarManager(path); //создаем обьект класса ФарМанаджер far.Start(); //запускаем оснавную функцию }
static void Main(string[] args) { FarManager far = new FarManager(); //задаю класс far.Start(@"C:\Users\User\Desktop\Damn\C#"); // даю путь где он должен начаться и передаю значение в функцию Start }
static void Main(string[] args) { DirectoryInfo dir = new DirectoryInfo(Console.ReadLine()); FarManager l = new FarManager { Content = dir.GetFileSystemInfos(), SelectedIndex = 0, }; Stack <FarManager> history = new Stack <FarManager>(); history.Push(l); bool esc = false; FSIMode curMode = FSIMode.DirectoryInfo; while (!esc) { if (curMode == FSIMode.DirectoryInfo) { history.Peek().Show(); } ConsoleKeyInfo KeyInfo = Console.ReadKey(); switch (KeyInfo.Key) { case ConsoleKey.UpArrow: history.Peek().SelectedIndex--; break; case ConsoleKey.DownArrow: history.Peek().SelectedIndex++; break; case ConsoleKey.Enter: int index = history.Peek().SelectedIndex; FileSystemInfo fs = history.Peek().Content[index]; if (fs.GetType() == typeof(DirectoryInfo)) { curMode = FSIMode.DirectoryInfo; DirectoryInfo dr = fs as DirectoryInfo; history.Push(new FarManager { Content = dr.GetFileSystemInfos(), SelectedIndex = 0 }); } else { curMode = FSIMode.FileInfo; FileStream fsm = new FileStream(fs.FullName, FileMode.Open, FileAccess.Read); StreamReader sr = new StreamReader(fsm); Console.BackgroundColor = ConsoleColor.White; Console.ForegroundColor = ConsoleColor.Black; Console.Clear(); Console.WriteLine(sr.ReadToEnd()); } break; case ConsoleKey.Backspace: if (curMode == FSIMode.DirectoryInfo) { history.Pop(); } else { curMode = FSIMode.DirectoryInfo; Console.ResetColor(); } break; case ConsoleKey.Delete: history.Peek().Delete(); break; case ConsoleKey.Tab: history.Peek().ReName(); break; case ConsoleKey.Escape: esc = true; break; } } }
static void Main(string[] args) { FarManager far = new FarManager(); far.Start(@"C:\Users\User\Desktop\Damn\C#"); }