-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClass1.cs
More file actions
95 lines (84 loc) · 2.81 KB
/
Class1.cs
File metadata and controls
95 lines (84 loc) · 2.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
namespace FileManager
{
class UsInterface
{
string gpath { get; set; }
int currentlist { get; set; }
public void SetDir(string St)
{
gpath = St;
Directory.SetCurrentDirectory(St);
}
public static void Print(string s, int x, int y, ConsoleColor fg = ConsoleColor.White, ConsoleColor bg = ConsoleColor.Black)
{
Console.ForegroundColor = fg;
Console.BackgroundColor = bg;
Console.SetCursorPosition(x, y);
Console.Write(s);
}
public static void PrintAllDirecCom(string path, int c)
{
var dirs = Directory.GetDirectories(path);
if (dirs.Length <= 30 + c)
for (int i = 0 + c; i < dirs.Length + c; i++)
UsInterface.Print(dirs[i], 3, i - c + 2);
else
{
for (int i = 0 + c; i < 30 + c; i++)
UsInterface.Print(dirs[i], 3, i - c + 2);
}
}
public static void PrintAllFiles(string path)
{
var dirs = Directory.GetFiles(path);
if (dirs.Length <= 30)
for (int i = 0; i < dirs.Length; i++)
UsInterface.Print(dirs[i], 65, i + 2);
else
for (int i = 0; i < 30; i++)
UsInterface.Print(dirs[i], 65, i + 2);
}
public static void PrintRect()
{
for (int i = 0; i < 120; i++)
{
Print("-", i, 0, ConsoleColor.DarkMagenta);
Print("-", i, 35, ConsoleColor.DarkMagenta);
Print("-", i, 37, ConsoleColor.DarkMagenta);
Print("-", i, 39, ConsoleColor.DarkMagenta);
}
for (int i = 1; i < 38; i++)
{
Print("|", 0, i, ConsoleColor.DarkMagenta);
Print("|", 119, i, ConsoleColor.DarkMagenta);
}
for (int i = 1; i < 35; i++)
{
Print("|", 60, i, ConsoleColor.DarkMagenta);
}
}
public static void DoComand(string com, string com1)
{
if (com == "NewDir" && com1 != "...")
{
Directory.CreateDirectory(com1);
}
else if (com == "DelDir" && com1 != " ")
{
Directory.Delete(com1);
}
else if (com == "NewFile" && com1 != "...")
{
File.Create(com1);
}
else if (com == "DelFile" && com1 != " ")
{
File.Delete(com1);
}
}
}
}