zoukankan      html  css  js  c++  java
  • LocalDriveInfo

     1 using System;
     2 using System.Collections.Generic;
     3 using System.Text;
     4 using System.IO;
     5 
     6 namespace LocalDriveInfo
     7 {
     8     class Program
     9     {
    10         static void Main(string[] args)
    11         {
    12             string[] drives = System.Environment.GetLogicalDrives();
    13             DriveInfo driveInfo = null;
    14             System.Console.WriteLine(GetOperationSystemInName());
    15             System.Console.WriteLine("卷标 盘符 类型 文件系统 总大小(byte) 可用空间大小(byte)");
    16             for (int i = 0; i < drives.Length; i++)
    17             {
    18                 driveInfo = new DriveInfo(drives[i]);
    19                 if (driveInfo.IsReady)
    20                 {
    21                     System.Console.WriteLine("{0} {1} {2} {3} {4} {5}", driveInfo.VolumeLabel, driveInfo.Name,
    22                         driveInfo.DriveType, driveInfo.DriveFormat, driveInfo.TotalSize.ToString("###,###"/**//*/ (1024 * 1024)*/, driveInfo.AvailableFreeSpace.ToString("###,###"/**//*/ (1024*1024))*/);
    23                 }
    24                 else
    25                 {
    26                     System.Console.WriteLine("{0} {1} {2} {3} {4} {5}""", driveInfo.Name,
    27                         driveInfo.DriveType, """""""");
    28                 }
    29             }
    30             System.Console.ReadLine();
    31         }
    32 
    33         /**////<summary>
    34         /// 获取系统名称
    35         /// </summary>
    36         /// <returns></returns>
    37         public static string GetOperationSystemInName()
    38         {
    39             OperatingSystem os = System.Environment.OSVersion;
    40             string osName = "UNKNOWN";
    41             switch (os.Platform)
    42            {
    43                 case PlatformID.Win32Windows:
    44                     switch (os.Version.Minor)
    45                    {
    46                         case 0: osName = "Windows 95"break;
    47                         case 10: osName = "Windows 98"break;
    48                         case 90: osName = "Windows ME"break;
    49                     }
    50                     break;
    51                 case PlatformID.Win32NT:
    52                     switch (os.Version.Major)
    53                     {
    54                         case 3: osName = "Windws NT 3.51"break;
    55                         case 4: osName = "Windows NT 4"break;
    56                         case 5if (os.Version.Minor == 0)
    57                             {
    58                                 osName = "Windows 2000";
    59                             }
    60                             else if (os.Version.Minor == 1)
    61                             {
    62                                 osName = "Windows XP";
    63                             }
    64                             else if (os.Version.Minor == 2)
    65                             {
    66                                 osName = "Windows Server 2003";
    67                             }
    68                             break;
    69                         case 6: osName = "Longhorn"break;
    70                     }
    71                     break;
    72             }
    73             return String.Format("{0},{1}", osName, os.Version.ToString());
    74         }
    75     }
    76 }
  • 相关阅读:
    决策树算法小结
    低配置电脑播放 flash 视频时 占 cpu 资源过高的解决方法
    ts tp 高清播放软件 Elecard MPEG Player 6.0.130827
    KBS2 SBS MBC 高清播放地址 + mplayer 播放 录制
    MPlayer-ww 增加边看边剪切功能
    MPlayer 增加边看边剪切功能
    -fomit-frame-pointer 编译选项在gcc 4.8.2版本中的汇编代码研究
    ffplay mini 媒体播放器
    libavcodec/dxva2.h:40:5: error: unknown type name 'IDirectXVideoDecoder'
    ARGB32 to YUV12 利用 SDL1.2 SDL_ttf 在视频表面输出文本
  • 原文地址:https://www.cnblogs.com/tonybinlj/p/1328819.html
Copyright © 2011-2022 走看看