Files
GSS2Rework/GSS2.Core/Hardware/UsbService.cs
T
amkovkov 3cc4d21947 feat: massive rework
1) GSS2.Core:
- strip prefixes in GSS2.Core.Analysis.AmineContent namespace class names
- add IEnumerable<double>.Variance extension
- remake analysis + update database so not needed to store all every file, calibration data also stored in database, also currently capturing images stored in system temporary directory and rewriting every time
2) GSS.UI.Core: AsyncImageRecordViewModel make zoom and pans public
3) GSS:
- remove image-storage-clear command
- remove ResultsView and ResultsViewModel, results presented in analysis
- rework calibration views
- add analysis views
- add text and number fields editors view
- add confirmation view on danger buttons
2026-05-13 12:56:32 +03:00

73 lines
1.9 KiB
C#

using System.Device.I2c;
using Microsoft.Extensions.Logging;
using GSS2.Core.Abstractions;
using System.Diagnostics;
namespace GSS2.Core.Hardware;
[Obsolete("Not implemented")]
public class UsbService : IDisposable
{
private bool _disposedValue;
private readonly ILogger<UsbService> _logger;
private readonly Process _monitor;
public UsbService(ILogger<UsbService> logger)
{
_logger = logger;
_logger.LogInformation("Инициализация");
_monitor = new Process();
_monitor.StartInfo = new ProcessStartInfo()
{
FileName = "udisksctl",
Arguments = "monitor",
RedirectStandardOutput = true,
RedirectStandardError = true
};
_monitor.OutputDataReceived += MonitorDataReceived;
_monitor.ErrorDataReceived += MonitorDataReceived;
_monitor.Exited += (s, ea) => _logger.LogWarning("Монитор udisksctl отключен");
if (_monitor.Start())
_logger.LogInformation("Монитор udisksctl запущен");
else
_logger.LogError("Не удалось запустить монитор udisksctl");
_monitor.BeginOutputReadLine();
_monitor.BeginErrorReadLine();
_logger.LogInformation("Инициализировано");
}
private void MonitorDataReceived(object sender, DataReceivedEventArgs ea)
{
if (ea.Data is null)
return;
_logger.LogInformation("Data rec {}", ea.Data);
}
protected virtual void Dispose(bool disposing)
{
if (!_disposedValue)
{
if (disposing)
{
try
{
_monitor.Close();
}
catch { }
}
_disposedValue = true;
}
}
void IDisposable.Dispose()
{
Dispose(disposing: true);
GC.SuppressFinalize(this);
}
}