From 50bd1ab402918ede7e4e365ca91b2300ebc20741 Mon Sep 17 00:00:00 2001 From: RogueAI42 Date: Fri, 16 Jun 2017 23:20:10 +1000 Subject: Fix Intro on Linux MORE LUNIX, MORE FUN also replaced drive type with drive format --- ShiftOS.WinForms/OobeStory.cs | 56 ++++++++++++++++++++++++++----------------- 1 file changed, 34 insertions(+), 22 deletions(-) (limited to 'ShiftOS.WinForms') diff --git a/ShiftOS.WinForms/OobeStory.cs b/ShiftOS.WinForms/OobeStory.cs index f2a4930..cab1ec8 100644 --- a/ShiftOS.WinForms/OobeStory.cs +++ b/ShiftOS.WinForms/OobeStory.cs @@ -85,28 +85,40 @@ namespace ShiftOS.WinForms ConsoleEx.ForegroundColor = ConsoleColor.White; Console.WriteLine(@"We'll now begin formatting your drive. Please be patient."); Console.WriteLine(); - var dinf = new DriveInfo("C:\\"); - decimal bytesFree = ((dinf.AvailableFreeSpace / 1024) / 1024) / 1024; - decimal totalBytes = ((dinf.TotalSize / 1024) / 1024) / 1024; - string type = dinf.DriveType.ToString(); - string name = dinf.Name; - ConsoleEx.Bold = true; - Console.Write("Drive name: "); - ConsoleEx.Bold = false; - Console.WriteLine(name); - ConsoleEx.Bold = true; - Console.Write("Drive type: "); - ConsoleEx.Bold = false; - Console.WriteLine(type); - ConsoleEx.Bold = true; - Console.Write("Total space: "); - ConsoleEx.Bold = false; - Console.WriteLine(totalBytes.ToString() + " GB"); - ConsoleEx.Bold = true; - Console.Write("Free space: "); - Console.WriteLine(bytesFree.ToString() + " GB"); - Console.WriteLine(); - + double bytesFree, totalBytes; + string type, name; + dynamic dinf; + try + { + if (Lunix.InWine) + dinf = new Lunix.DFDriveInfo("/"); + else + dinf = new DriveInfo("C:\\"); + bytesFree = dinf.AvailableFreeSpace / 1073741824.0; + totalBytes = dinf.TotalSize / 1073741824.0; + type = dinf.DriveFormat.ToString(); + name = dinf.Name; + ConsoleEx.Bold = true; + Console.Write("Drive name: "); + ConsoleEx.Bold = false; + Console.WriteLine(name); + ConsoleEx.Bold = true; + Console.Write("Drive type: "); + ConsoleEx.Bold = false; + Console.WriteLine(type); + ConsoleEx.Bold = true; + Console.Write("Total space: "); + ConsoleEx.Bold = false; + Console.WriteLine(String.Format("{0:F1}", totalBytes) + " GB"); + ConsoleEx.Bold = true; + Console.Write("Free space: "); + Console.WriteLine(String.Format("{0:F1}", bytesFree) + " GB"); + Console.WriteLine(); + } + catch (Exception ex) + { + Console.WriteLine(ex.ToString()); + } ConsoleEx.Bold = false; ConsoleEx.BackgroundColor = ConsoleColor.Black; -- cgit v1.2.3