using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace ConsoleApplicationDInfo
{
class Program
{
//
static void DInfo(string
path)
{
string none = "---";
string d = path[0].ToString().ToUpper();
// -
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);
}
static void
Main(string[] args)
{
Console.WriteLine(" DiskInfo\n");
Console.WriteLine("
Disk type
size(K) Free
(K)\n");
Console.WriteLine(new
String('=',40));
DInfo(Environment.CurrentDirectory);
//
Console.WriteLine("Press
any key to contimue\n");
Console.ReadLine();
}
}
}
|