Delphi
Visual C# . 7.
DiskInfo (:
DriveInfo, StringBuilder, Environment)
,
.
, .
DInfo,
,
(, ,
,
):
static void
DInfo(string path)
{
string none = "---";
string d = path[0].ToString().ToUpper();
//
if (d[0] < 'A' || d[0] > 'Z')
{
Console.WriteLine(d[0].ToString()
+ "
");
return;
}
//
DriveInfo di = new
DriveInfo(d);
StringBuilder s = new
StringBuilder(40);
s.AppendFormat(" {0,-4}",d);
if (di.DriveType != DriveType.NoRootDirectory)
{
s.AppendFormat(" {0,-9}",
di.DriveType);
if (di.IsReady)
{
s.AppendFormat("{0,12:N0}
{1,12:N0}", di.TotalSize / 1024, di.TotalFreeSpace / 1024);
}
else s.AppendFormat("{0,12}
{0,12}", none);
}
else s.AppendFormat("
{0,-9}{0,12} {0,12}", none);
Console.WriteLine(s);
}
|
,
:
if (d[0] < 'A' || d[0] > 'Z')
{
Console.WriteLine(d[0].ToString()
+ "
");
return;
}
|
? ,
(,
,
#), :

,
:). , :

,
Visual Studio,
*:

Main:
static void
Main(string[] args)
{
Console.WriteLine(" DiskInfo\n");
Console.WriteLine("
Disk type
size(K) Free
(K)\n");
Console.WriteLine(new
String('=',40));
if (args.Length == 0)
DInfo(Environment.CurrentDirectory);
else
foreach (string
d in args) DInfo(d);
Console.WriteLine("Press
any key to contimue\n");
Console.ReadLine();
}
|
,
.
- ,
,
-
.
? ""
*:

Visual Studio,
*:

Debug Command line arguments*:

:

, *,
"Microsoft Visual Studio 2010 Professional",
Microsoft..
()
|