Exemple #1
0
        public static void FileCompression()
        {
            var fileName = System.IO.Path.GetTempFileName();

            System.IO.File.WriteAllText(fileName, new string('1', 4096));
            var fi = new System.IO.FileInfo(fileName);

            if (!fi.GetNtfsCompression())
            {
                fi.SetNtfsCompression(true);
            }
            //var gt = fi.GetNtfsCompressionAsync();
            //gt.Wait();
            //AddTestResult("AsyncGet", "Compr", gt.Result);
            //var t = fi.SetNtfsCompressionAsync(false);
            //t.Wait();
            //AddTestResult("AsyncSet", "Compr", t.Status);
            AddTestResult(null + "Compr", fileName, $"{fi.GetNtfsCompression()}");
            fi.Delete();
        }