diff options
| author | DemonKingSwarn <rockingswarn@gmail.com> | 2026-04-19 23:04:46 +0530 |
|---|---|---|
| committer | DemonKingSwarn <rockingswarn@gmail.com> | 2026-04-19 23:04:46 +0530 |
| commit | dacfac59f1cf60df7fc80a21cb7f3d63843aa591 (patch) | |
| tree | 281cb3697d5eaf873100101290002b2ce61bea93 /src/WatchLog.cs | |
| parent | 0dc53f2c6a5093344e6188b5510d1505cd3a4a2a (diff) | |
| download | hypr-wellbeing-dacfac59f1cf60df7fc80a21cb7f3d63843aa591.zip hypr-wellbeing-dacfac59f1cf60df7fc80a21cb7f3d63843aa591.tar.gz | |
chore: made sure the binary is static
Diffstat (limited to 'src/WatchLog.cs')
| -rw-r--r-- | src/WatchLog.cs | 106 |
1 files changed, 36 insertions, 70 deletions
diff --git a/src/WatchLog.cs b/src/WatchLog.cs index 9340822..99137db 100644 --- a/src/WatchLog.cs +++ b/src/WatchLog.cs @@ -5,7 +5,6 @@ namespace hyprwatch.Logger using System.Threading; using System.Diagnostics; using System.Collections.Generic; - using Newtonsoft.Json; using hyprwatch.Window; using hyprwatch.Time; @@ -14,50 +13,33 @@ namespace hyprwatch.Logger public static string GetTime() { string? t = null; - string? os = null; string homeDir = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); string configFile = Path.Combine(homeDir, ".config", "hypr-wellbeing", "config.json"); - - if(File.Exists(configFile)) - { - string content = File.ReadAllText(configFile); - var config = JsonConvert.DeserializeObject<Dictionary<string, string>>(content); - - os = config["os"]; - } - else + try { - os = "Linux"; - } - - if(os == "Linux") - { - try + Process process = new Process { - Process process = new Process + StartInfo = new ProcessStartInfo { - StartInfo = new ProcessStartInfo - { - FileName = "date", - Arguments = "+%T", - RedirectStandardOutput = true, - UseShellExecute = false, - CreateNoWindow = true, - } - }; + FileName = "date", + Arguments = "+%T", + RedirectStandardOutput = true, + UseShellExecute = false, + CreateNoWindow = true, + } + }; - process.Start(); + process.Start(); - string output = process.StandardOutput.ReadToEnd(); - process.WaitForExit(); + string output = process.StandardOutput.ReadToEnd(); + process.WaitForExit(); - t = output.Substring(0, output.Length - 1); - } - catch(Exception ex) - { - Console.WriteLine(ex.Message); - } + t = output.Substring(0, output.Length - 1); + } + catch(Exception ex) + { + Console.WriteLine(ex.Message); } return t ?? string.Empty; @@ -66,50 +48,34 @@ namespace hyprwatch.Logger public static string GetDate() { string? d = null; - string? os = null; string homeDir = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); string configFile = Path.Combine(homeDir, ".config", "hypr-wellbeing", "config.json"); - if(File.Exists(configFile)) + try { - string content = File.ReadAllText(configFile); - var config = JsonConvert.DeserializeObject<Dictionary<string, string>>(content); - - os = config["os"]; - } - else - { - os = "Linux"; - } - - if(os == "Linux") - { - try + Process process = new Process { - Process process = new Process + StartInfo = new ProcessStartInfo { - StartInfo = new ProcessStartInfo - { - FileName = "date", - Arguments = "+%d-%m-%Y", - RedirectStandardOutput = true, - UseShellExecute = false, - CreateNoWindow = true, - } - }; + FileName = "date", + Arguments = "+%d-%m-%Y", + RedirectStandardOutput = true, + UseShellExecute = false, + CreateNoWindow = true, + } + }; - process.Start(); + process.Start(); - string output = process.StandardOutput.ReadToEnd(); - process.WaitForExit(); + string output = process.StandardOutput.ReadToEnd(); + process.WaitForExit(); - d = output.Substring(0, output.Length - 1); - } - catch(Exception ex) - { - Console.WriteLine(ex.Message); - } + d = output.Substring(0, output.Length - 1); + } + catch(Exception ex) + { + Console.WriteLine(ex.Message); } return d ?? string.Empty; |
