Compare commits

..

3 Commits

Author SHA1 Message Date
Serge
85725fb782 Slash lightning (#2058)
* Slash Lightning

* Slash lightning UI tweaks

* Slash Lightning tweaks

* Minor tweaks

* Slash Interval settings

* UI tweaks

* Slash tweaks

* More slash modes

* Cleanup
2024-02-12 18:43:27 +01:00
Serge
d2cb6965e0 Make app log longer 2024-02-12 18:29:39 +01:00
Serge
3f8083be50 Exception handling for case when USB device refuses to open https://github.com/seerge/g-helper/issues/2057 2024-02-12 18:24:11 +01:00
3 changed files with 20 additions and 14 deletions

View File

@@ -30,7 +30,7 @@ public static class Logger
try try
{ {
var file = File.ReadAllLines(logFile); var file = File.ReadAllLines(logFile);
int skip = Math.Max(0, file.Count() - 1000); int skip = Math.Max(0, file.Count() - 2000);
File.WriteAllLines(logFile, file.Skip(skip).ToArray()); File.WriteAllLines(logFile, file.Skip(skip).ToArray());
} }
catch { } catch { }

View File

@@ -66,7 +66,7 @@ namespace GHelper.Input
} }
catch (Exception ex) catch (Exception ex)
{ {
Logger.WriteLine(ex.ToString()); Logger.WriteLine($"Listener exited: {ex.Message}");
} }
} }

View File

@@ -90,18 +90,24 @@ public static class AsusHid
if (devices is null) return; if (devices is null) return;
foreach (var device in devices) foreach (var device in devices)
using (var stream = device.Open()) try
foreach (var data in dataList) {
try using (var stream = device.Open())
{ foreach (var data in dataList)
stream.Write(data); try
Logger.WriteLine($"{log} {device.ProductID.ToString("X")}: {BitConverter.ToString(data)}"); {
} stream.Write(data);
catch (Exception ex) Logger.WriteLine($"{log} {device.ProductID.ToString("X")}: {BitConverter.ToString(data)}");
{ }
Logger.WriteLine($"Error writing {log} {device.ProductID.ToString("X")}: {ex.Message} {BitConverter.ToString(data)} "); catch (Exception ex)
} {
Logger.WriteLine($"Error writing {log} {device.ProductID.ToString("X")}: {ex.Message} {BitConverter.ToString(data)} ");
}
}
catch (Exception ex)
{
Logger.WriteLine($"Error opening {log} {device.ProductID.ToString("X")}: {ex.Message}");
}
} }
public static void WriteAura(byte[] data) public static void WriteAura(byte[] data)