All 5 phases of the open-source Decal rebuild: Phase 1: 14 decompiled .NET projects (Interop.*, Adapter, FileService, DecalUtil) Phase 2: 10 native DLLs rewritten as C# COM servers with matching GUIDs - DecalDat, DHS, SpellFilter, DecalInput, DecalNet, DecalFilters - Decal.Core, DecalControls, DecalRender, D3DService Phase 3: C++ shims for Inject.DLL (D3D9 hooking) and LauncherHook.DLL Phase 4: DenAgent WinForms tray application Phase 5: WiX installer and build script 25 C# projects building with 0 errors. Native C++ projects require VS 2022 + Windows SDK (x86). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
59 lines
1.5 KiB
C#
59 lines
1.5 KiB
C#
using System;
|
|
using System.Runtime.InteropServices;
|
|
using Decal.Interop.Input;
|
|
|
|
namespace Decal.DecalInput
|
|
{
|
|
[ComVisible(true)]
|
|
[Guid("79497C87-92E1-416B-AE5C-9D6C4C59133C")]
|
|
[ClassInterface(ClassInterfaceType.None)]
|
|
[ComSourceInterfaces(typeof(ITimerEvents))]
|
|
[ProgId("DecalInput.Timer")]
|
|
public class TimerImpl : IDecalTimer
|
|
{
|
|
private object _tag;
|
|
private bool _running;
|
|
private int _interval;
|
|
private uint _startTime;
|
|
|
|
public event ITimerEvents_TimeoutEventHandler Timeout;
|
|
|
|
public void Start(int Interval)
|
|
{
|
|
_interval = Interval;
|
|
_startTime = GetTickCount();
|
|
_running = true;
|
|
|
|
InputServiceImpl.Instance?.RegisterTimer(this);
|
|
}
|
|
|
|
public void Stop()
|
|
{
|
|
_running = false;
|
|
InputServiceImpl.Instance?.UnregisterTimer(this);
|
|
}
|
|
|
|
public object Tag
|
|
{
|
|
get => _tag;
|
|
set => _tag = value;
|
|
}
|
|
|
|
public bool Running => _running;
|
|
|
|
internal bool CheckTimeout(uint currentTime)
|
|
{
|
|
if (!_running) return false;
|
|
if (currentTime - _startTime >= (uint)_interval)
|
|
{
|
|
_startTime = currentTime;
|
|
Timeout?.Invoke((Timer)(object)this);
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
[DllImport("kernel32.dll")]
|
|
private static extern uint GetTickCount();
|
|
}
|
|
}
|