From dacfac59f1cf60df7fc80a21cb7f3d63843aa591 Mon Sep 17 00:00:00 2001 From: DemonKingSwarn Date: Sun, 19 Apr 2026 23:04:46 +0530 Subject: chore: made sure the binary is static --- src/WatchLog.cs | 106 +++++++++++++++++++------------------------------------- 1 file changed, 36 insertions(+), 70 deletions(-) (limited to 'src/WatchLog.cs') 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>(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>(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; -- cgit v1.1