Exemple #1
0
        static void SerializedDisksInfo(/*string file*/)
        {
            string          file      = @"../../Disks Info.txt";
            FileStream      s1        = new FileStream(file, FileMode.Create);
            List <DiskInfo> list      = PCStatus.DisksInfo();
            BinaryFormatter formatter = new BinaryFormatter();

            using (s1)
            {
                formatter.Serialize(s1, list);
            }
            Console.WriteLine($"SerializedDisksInfo() done at {Math.Round(sec, 1)} sec");
        }
Exemple #2
0
        static void DisksInfo(/*string file*/)
        {
            string       file   = @"../../Disks Info.txt";
            StreamWriter writer = new StreamWriter(new FileStream(file, FileMode.Create));

            foreach (var elem in PCStatus.DisksInfo())
            {
                writer.WriteLine(elem.GetFields());
                writer.WriteLine("----------------");
            }
            writer.Close();
            Console.WriteLine($"DisksInfo() done at {Math.Round(sec, 1)} sec");
        }