示例#1
0
        public static void DiskReader(StreamWriter sd, string s)
        {
            KUALog.KUAWriter(sd, "Создание KUAInspect");
            Directory.CreateDirectory("KUAInspect");
            FileStream fs = File.Create("KUAInspect\\kuadirinfo.txt");

            fs.Close();
            KUALog.KUAWriter(sd, "Создание kuadirinfo.txt");
            StreamWriter  sw = new StreamWriter("KUAInspect\\kuadirinfo.txt");
            DirectoryInfo di = new DirectoryInfo(s);

            if (di.Exists)
            {
                DirectoryInfo[] d = di.GetDirectories();
                FileInfo[]      f = di.GetFiles();

                for (int i = 0; i < d.Length; i++)
                {
                    Console.WriteLine($"{d[i].Name}");
                    sw.WriteLine(d[i].Name);
                }
                for (int i = 0; i < f.Length; i++)
                {
                    Console.WriteLine($"{f[i].Name}");
                    sw.WriteLine(f[i].Name);
                }
                sw.Close();
                KUALog.KUAWriter(sd, "Создание копирование из kuadirinfo в kuadirinfocopy");
                if (File.Exists("KUAInspect\\kuadirinfocopy.txt"))
                {
                    File.Delete("KUAInspect\\kuadirinfocopy.txt");
                }
                FileInfo q = new FileInfo("KUAInspect\\kuadirinfo.txt");
                q.CopyTo("KUAInspect\\kuadirinfocopy.txt");
                File.Delete("KUAInspect\\kuadirinfo.txt");
                Directory.CreateDirectory("KUAFiles");
                KUALog.KUAWriter(sd, "Создание KUAFiles");
                KUALog.KUAWriter(sd, "Запись в KUAFile");
                for (int i = 0; i < f.Length; i++)
                {
                    if (f[i].Extension == ".pdf")
                    {
                        if (File.Exists("KUAFiles\\" + f[i].Name))
                        {
                            File.Delete("KUAFiles\\" + f[i].Name);
                        }
                        f[i].CopyTo("KUAFiles\\" + f[i].Name);
                    }
                }
                DirectoryInfo d1 = new DirectoryInfo("KUAFiles");
                d1.MoveTo("KUAInspect\\KUAFiles");
                KUALog.KUAWriter(sd, "Перемещение KUAFiles");
                KUALog.KUAWriter(sd, "Архивирование KUAFiles");
                KUALog.KUAWriter(sd, "Разархивирование KUAFiles");
                ZipFile.CreateFromDirectory("KUAInspect\\KUAFiles", "KUA.zip");
                ZipFile.ExtractToDirectory("KUA.zip", "KUAEnd");
            }
        }
示例#2
0
        public static void CreationTime(StreamWriter sw, string s)
        {
            KUALog.KUAWriter(sw, "Время создания");
            DirectoryInfo di = new DirectoryInfo(s);

            if (di.Exists)
            {
                Console.WriteLine($"Creation Time: {di.CreationTime}");
            }
        }
示例#3
0
        public static void ParentsCount(StreamWriter sw, string s)
        {
            KUALog.KUAWriter(sw, "Количество родительских каталогов");
            DirectoryInfo di = new DirectoryInfo(s);

            if (di.Exists)
            {
                Console.WriteLine($"Root: {di.Root}");
            }
        }
示例#4
0
        public static void FullDirection(StreamWriter sw, string f)
        {
            KUALog.KUAWriter(sw, "Полный путь");
            FileInfo fi = new FileInfo(f);

            if (fi.Exists)
            {
                Console.WriteLine($"Full Direction: {fi.DirectoryName}\\{fi.Name}");
            }
        }
示例#5
0
        public static void CreationTime(StreamWriter sw, string f)
        {
            KUALog.KUAWriter(sw, "Время создания");
            FileInfo fi = new FileInfo(f);

            if (fi.Exists)
            {
                Console.WriteLine($"Creation Time: {fi.CreationTime}");
            }
        }
示例#6
0
        public static void FileInfo(StreamWriter sw, string f)
        {
            KUALog.KUAWriter(sw, "Информация о файлах");
            FileInfo fi = new FileInfo(f);

            if (fi.Exists)
            {
                Console.WriteLine($"Size: {fi.Length},Extension: {fi.Extension}, Name: {fi.Name}");
            }
        }
示例#7
0
        public static void DirCount(StreamWriter sw, string s)
        {
            KUALog.KUAWriter(sw, "Количество каталогов");
            DirectoryInfo di = new DirectoryInfo(s);

            if (di.Exists && di.Extension == "")
            {
                DirectoryInfo[] d = di.GetDirectories();
                Console.WriteLine($"Directory Count: {d.Length}");
            }
        }
示例#8
0
        public static void FileCount(StreamWriter sw, string s)
        {
            KUALog.KUAWriter(sw, "Количество файлов");
            DirectoryInfo di = new DirectoryInfo(s);

            if (di.Exists)
            {
                FileInfo[] fi = di.GetFiles();
                Console.WriteLine($"File Count: {fi.Length}");
            }
        }
示例#9
0
 public static void DiskInfo(StreamWriter sw)
 {
     KUALog.KUAWriter(sw, "Информация о диске");
     for (int i = 0; i < allDrives.Length; i++)
     {
         if (allDrives[i].IsReady)
         {
             Console.WriteLine($"[{allDrives[i].Name}] Total Size: {allDrives[i].TotalSize}, Avaible Free Space: {allDrives[i].AvailableFreeSpace}, Label: {allDrives[i].VolumeLabel}");
         }
     }
 }
示例#10
0
 public static void FreeSpace(StreamWriter sw)
 {
     KUALog.KUAWriter(sw, "Свободное место");
     for (int i = 0; i < allDrives.Length; i++)
     {
         if (allDrives[i].IsReady)
         {
             Console.WriteLine($"[{allDrives[i].Name}]Avaible Free Space: {allDrives[i].AvailableFreeSpace}");
         }
     }
 }
示例#11
0
 public static void FileSystemInfo(StreamWriter sw)
 {
     KUALog.KUAWriter(sw, "Информация о системе");
     Console.WriteLine($"File System Info: {allDrives[0].DriveFormat}");
 }