Программирование - это просто
Advertisement
arrow arrow Visual C# arrow Visual C# . 7. DiskInfo (: DriveInfo, StringBuilde
01.02.2023 .
1:
C#
Delphi
Web-
Excel-
.
Visual C# . 7. DiskInfo (: DriveInfo, StringBuilde E-mail
megabax   
15.10.2011 .
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 C#  .  7.   DiskInfo (: DriveInfo, StringBuilder, Environment)

  , :). , :

Visual C#  .  7.   DiskInfo (: DriveInfo, StringBuilder, Environment)

, Visual Studio, *:

Visual C#  .  7.   DiskInfo (: DriveInfo, StringBuilder, Environment)

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 C#  .  7.   DiskInfo (: DriveInfo, StringBuilder, Environment)

Visual Studio, *:

Visual C#  .  7.   DiskInfo (: DriveInfo, StringBuilder, Environment)

Debug Command line arguments*:

Visual C#  .  7.   DiskInfo (: DriveInfo, StringBuilder, Environment)

:

Visual C#  .  7.   DiskInfo (: DriveInfo, StringBuilder, Environment)

 


, *,   "Microsoft Visual Studio 2010 Professional", Microsoft.. 


 

 

()

 

( 25.03.2014 . )
 
« .   . »
 
© 2023 Программирование - это просто
Joomla! - , GNU/GPL.
© 2005-2008 Joom.Ru - Joomla!
Design by Mamboteam.com | Powered by Mambobanner.de
  .