-
Notifications
You must be signed in to change notification settings - Fork 0
/
KernelPDU.cs
133 lines (131 loc) · 5 KB
/
KernelPDU.cs
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
using System;
namespace Quantum
{
class KernelPDU
{
public static void interact(string[] parts)
{
string opinion = parts[1];
switch (opinion)
{
case "names":
{
VFS.Names();
break;
}
case "sizes":
{
VFS.Sizes();
break;
}
case "labels":
{
VFS.Labels();
break;
}
case "types":
{
VFS.Types();
break;
}
case "formats":
{
VFS.Formats();
break;
}
case "tsizes":
{
VFS.TotalSize();
break;
}
case "mbsizes":
{
VFS.MBSize();
break;
}
case "tmbsizes":
{
VFS.TMBSize();
break;
}
case "format":
{
VFS.Format(parts[2]);
break;
}
case "ir":
{
VFS.IsReady();
break;
}
case "summary":
{
VFS.Summary();
break;
}
case "slb":
{
int position = 2;
int index = int.Parse(parts[position++]);
string label = String.Empty;
for (; position < parts.Length; position++)
{
label += parts[position] + " ";
}
VFS.SLB(index, label);
break;
}
case "newpart":
{
try
{
int size = int.Parse(parts[2]);
int currentDisk = int.Parse(KernelShell.dir);
string path = Kernel.dir();
for (int i = 0; i < VFS.fs.GetDisks().Count; i++)
{
if (currentDisk == i)
{
VFS.fs.GetDisks()[i].CreatePartition(size);
VFS.fs.GetDisks()[i].FormatPartition(i, "FAT32");
break;
}
}
}
catch (Exception e)
{
Console.ForegroundColor = ConsoleColor.Red;
Kernel.print("pdu: exception: " + e.ToString());
Console.ResetColor();
}
break;
}
case "help":
{
Kernel.print(" PDU - Portable Disk Util. 1.0.0");
Kernel.print(" This software is part of Quantum-Project.");
Kernel.print("=========================================================");
Kernel.print("names - prints names of disks");
Kernel.print("sizes - prints sizes of disks");
Kernel.print("labels - prints labels of disks");
Kernel.print("types - prints types of disks (CDRom, Removable...)");
Kernel.print("formats - prints formats of disks(FAT32...)");
Kernel.print("tsizes - prints total sizes of disks");
Kernel.print("ir - is disks ready?");
Kernel.print("format ID - formats disk with ID");
Kernel.print("mbsizes - prints mb size of disks");
Kernel.print("tmbsizes - prints total mb size of disks");
Kernel.print("=========================================================");
break;
}
default:
{
Console.ForegroundColor = ConsoleColor.Red;
Kernel.print("pdu: unknown arg: " + opinion);
Console.ResetColor();
break;
}
}
}
}
}