Ejemplo n.º 1
0
 static void Main(string[] args)
 {
     ZYVDiskInfo.FreeSpace("C:\\");
     ZYVDiskInfo.TypeOfFileSystem("C:\\");
     ZYVDiskInfo.DrivesInfo();
     Console.WriteLine(new string('-', 50));
     ZYVFileInfo.FullPath(@"C:\Users\xiaom\Desktop\univer\c#\Project12\lol.txt");
     ZYVFileInfo.FullInfo(@"C:\Users\xiaom\Desktop\univer\c#\Project12\lol.txt");
     ZYVFileInfo.TimeOfCreation(@"C:\Users\xiaom\Desktop\univer\c#\Project12\lol.txt");
     Console.WriteLine(new string('-', 50));
     ZYVDirInfo.GetFiles(@"C:\Users\xiaom\Desktop\univer\c#\Project12\");
     ZYVDirInfo.GetSubDir(@"C:\Users\xiaom\Desktop\univer\c#\Project12\");
     ZYVDirInfo.GetTime(@"C:\Users\xiaom\Desktop\univer\c#\Project12\");
     ZYVDirInfo.GetParentDir(@"C:\Users\xiaom\Desktop\univer\c#\Project12\");
     Console.WriteLine(new string('-', 50));
     ZYVFileManager.UltimateMethod(@"C:\Users\xiaom\Desktop\univer\c#\Project12");
 }
Ejemplo n.º 2
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]);
                }
            }
        }