Программирование - это просто
Advertisement
arrow arrow Visual C# arrow Visual C# . 6. (: DriveInfo, StringBuilder
01.02.2023 .
1:
C#
Delphi
Web-
Excel-
.
Visual C# . 6. (: DriveInfo, StringBuilder E-mail
megabax   
22.05.2011 .
Delphi

Visual C# . 6. (: DriveInfo, StringBuilder, Environment)

 

C#. . C# DriveInfo - , StringBuilder - , Environment - , ().

. . 3

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();

        }

    }

}

:

Visual C#  .  6.    (: DriveInfo, StringBuilder, Environment)

DInfo - . Programm,   DInfo  . . 

, , . DriveInfo, DriveType, TotalSize TotalFreeSpace.

Visual C#

()

 

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