diff --git a/GameMemory.cs b/GameMemory.cs index 2555473..ce55958 100644 --- a/GameMemory.cs +++ b/GameMemory.cs @@ -38,10 +38,7 @@ public void StartReading() public void Stop() { - if (_cancelSource == null || _thread == null) - throw new InvalidOperationException(); - - if (_thread.Status != TaskStatus.Running) + if (_cancelSource == null || _thread == null || _thread.Status != TaskStatus.Running) return; _cancelSource.Cancel(); diff --git a/HaloSplitComponent.cs b/HaloSplitComponent.cs index 7c00245..44f5506 100644 --- a/HaloSplitComponent.cs +++ b/HaloSplitComponent.cs @@ -50,10 +50,10 @@ public HaloSplitComponent(LiveSplitState state) _gameMemory.StartReading(); } - ~HaloSplitComponent() + public void Dispose() { - // TODO: in LiveSplit 1.4, components will be IDisposable - //_gameMemory.Stop(); + if (_gameMemory != null) + _gameMemory.Stop(); } public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode) @@ -89,7 +89,7 @@ void PrepareDraw(LiveSplitState state) _deathCounter.NameLabel.HasShadow = _deathCounter.ValueLabel.HasShadow = state.LayoutSettings.DropShadows; } - void state_OnReset(object sender, EventArgs e) + void state_OnReset(object sender, TimerPhase t) { _deaths = 0; } diff --git a/HaloSplitFactory.cs b/HaloSplitFactory.cs index 8feb1d8..380bdee 100644 --- a/HaloSplitFactory.cs +++ b/HaloSplitFactory.cs @@ -7,20 +7,24 @@ namespace LiveSplit.HaloSplit { public class HaloSplitFactory : IComponentFactory { - private HaloSplitComponent _instance; - public string ComponentName { get { return "HaloSplit"; } } - public IComponent Create(LiveSplitState state) + public string Description + { + get { return "Auto-splitter for Halo PC"; } + } + + public ComponentCategory Category { - // TODO: in LiveSplit 1.4, components will be IDisposable - // this assumes the passed state is always the same one, until then - return _instance ?? (_instance = new HaloSplitComponent(state)); + get { return ComponentCategory.Control; } + } - // return new HaloSplitComponent(state); + public IComponent Create(LiveSplitState state) + { + return new HaloSplitComponent(state); } public string UpdateName diff --git a/LiveSplit.HaloSplit.csproj b/LiveSplit.HaloSplit.csproj index 8df7535..91e901b 100644 --- a/LiveSplit.HaloSplit.csproj +++ b/LiveSplit.HaloSplit.csproj @@ -17,7 +17,7 @@ true full false - bin\Debug\ + bin\ DEBUG;TRACE prompt 4 @@ -25,14 +25,14 @@ pdbonly true - bin\Release\ + bin\ TRACE prompt 4 - C:\Files\Apps\Gaming\LiveSplit 1.3\LiveSplit.Core.dll + C:\Files\Apps\Gaming\LiveSplit 1.4\LiveSplit.Core.dll False @@ -40,7 +40,7 @@ - C:\Files\Apps\Gaming\LiveSplit 1.3\UpdateManager.dll + C:\Files\Apps\Gaming\LiveSplit 1.4\UpdateManager.dll False