using EasyPipes; using IniParser.Model; using SoraV2Tools; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Diagnostics; using System.IO; using System.Linq; using System.ServiceProcess; using System.Text; using System.Threading.Tasks; using System.Timers; namespace SoraV2Utils_Service { public partial class SoraV2UtilsService : ServiceBase { Timer timer = new Timer(); DeviceTracker deviceTracker = new DeviceTracker(); public SoraV2UtilsService() { InitializeComponent(); } protected override void OnStart(string[] args) { ServiceLogger.Instance.Log("Started SoraV2Utils_Service"); Notification.SingleLine("SoraV2 Utils running..."); timer.Elapsed += new ElapsedEventHandler(OnElapsedTime); timer.Interval = ServiceSettings.Instance.intervall; timer.Enabled = true; OnElapsedTime(null, null); } protected override void OnStop() { ServiceLogger.Instance.Log("Stopped SoraV2Utils_Service"); Notification.SingleLine("SoraV2 Utils stopped..."); } private void OnElapsedTime(object source, ElapsedEventArgs e) { var ds = SoraV2Interface.GetDeviceStatus(); //byte charging = 0; //byte battery = 0; //new ServiceSettings().TryParseConfig("debug", "charging", ref charging); //new ServiceSettings().TryParseConfig("debug", "battery", ref battery); //ds.Charging = charging; //ds.Battery = battery; deviceTracker.processMouseData(ds); } public void OnDebug() { OnStart(null); } } }