示例#1
0
        public static void FullPath(string Path)
        {
            ZYVLOG.WriteLog("FullPath");
            FileInfo f = new FileInfo(Path);

            Console.WriteLine(f.DirectoryName);
        }
示例#2
0
        public static void FullInfo(string Path)
        {
            ZYVLOG.WriteLog("FullInfo");
            FileInfo f = new FileInfo(Path);

            Console.WriteLine($"{f.Name} - {f.Extension} - {f.Length}");
        }
示例#3
0
        public static void GetTime(string Path)
        {
            ZYVLOG.WriteLog("GetTime");
            DirectoryInfo d = new DirectoryInfo(Path);

            Console.WriteLine(d.CreationTime);
        }
示例#4
0
        public static void TimeOfCreation(string Path)
        {
            ZYVLOG.WriteLog("TimeOfCreation");
            FileInfo f = new FileInfo(Path);

            Console.WriteLine(f.CreationTime);
        }
示例#5
0
        public static void GetParentDir(string Path)
        {
            ZYVLOG.WriteLog("GetParentDir");
            DirectoryInfo d = new DirectoryInfo(Path);

            foreach (var f in d.Parent.GetDirectories())
            {
                Console.WriteLine(f.FullName);
            }
        }
示例#6
0
        public static void DrivesInfo()
        {
            ZYVLOG.WriteLog("DrivesInfo");
            var Driveinfo = DriveInfo.GetDrives();

            foreach (var d in Driveinfo)
            {
                if (d.IsReady)
                {
                    Console.WriteLine($"{d.Name} - {d.TotalFreeSpace} bytes / {d.TotalSize} bytes  -- {d.VolumeLabel}");
                }
            }
        }
示例#7
0
        public static void TypeOfFileSystem(string DN)
        {
            ZYVLOG.WriteLog("TypeOfFileSystem");
            var Driveinfo = DriveInfo.GetDrives();

            foreach (var d in Driveinfo)
            {
                if (d.Name == DN)
                {
                    Console.WriteLine($"{d.Name} - {d.DriveFormat}");
                }
            }
        }
示例#8
0
        public static void FreeSpace(string DN)
        {
            ZYVLOG.WriteLog("FreeSpace");
            var Driveinfo = DriveInfo.GetDrives();

            foreach (var d in Driveinfo)
            {
                if (d.Name == DN)
                {
                    Console.WriteLine($"{ d.Name} - {d.TotalFreeSpace} bytes");
                }
            }
        }
示例#9
0
        public static void UltimateMethod(string Path)
        {
            ZYVLOG.WriteLog("UltimateMethod");
            DirectoryInfo d = new DirectoryInfo(Path);

            ZYVDirInfo.GetFiles(Path);
            ZYVDirInfo.GetSubDir(Path);
            d.CreateSubdirectory("ZYVInspect");
            var        file = new FileInfo(Path + @"\ZYVDirinfo.txt");
            FileStream fs   = file.Open(FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None);

            byte[] arr = System.Text.Encoding.Default.GetBytes("kekekekekek");
            fs.Write(arr, 0, arr.Length);
            fs.Dispose();
            file.CopyTo(Path + @"\lolol.txt", true);
            d.CreateSubdirectory("ZYVFiles");
            foreach (var f in d.GetFiles())
            {
                if (f.Extension == ".txt" && f.Name != "lol.txt" && f.Name != "ZYVlog.txt")
                {
                    f.MoveTo(@"C:\Users\xiaom\Desktop\univer\c#\Project12\ZYVFiles" + @"\" + f.Name);
                }
            }
            DirectoryInfo d1 = new DirectoryInfo(Path + @"\ZYVFiles");

            d1.MoveTo(Path + @"\ZYVInspect\ZYVFiles");
            ZipFile.CreateFromDirectory(Path + @"\ZYVInspect\ZYVFiles", Path + @"\ZYVInspect\zip.zip");
            ZipFile.ExtractToDirectory(Path + @"\ZYVInspect\zip.zip", Path);
            string[] s = File.ReadAllLines(Path + @"\ZYVlog.txt");
            for (int i = 0; i < s.Length; i++)
            {
                Console.WriteLine(s[i]);
            }
            Console.WriteLine(s.Length + " Записей");
            for (int i = 0; i < s.Length; i++)
            {
                if (s[i].Contains(DateTime.Now.Day.ToString()) && s[i].Contains("13:48"))
                {
                    Console.WriteLine(s[i]);
                }
            }
        }