diff --git a/Library/DisposableBase.cs b/Library/DisposableBase.cs
new file mode 100644
index 0000000..5b9309e
--- /dev/null
+++ b/Library/DisposableBase.cs
@@ -0,0 +1,26 @@
+using System;
+
+namespace Jellyfish.Library
+{
+ public abstract class DisposableBase : IDisposable
+ {
+ protected DisposableBase()
+ {
+ }
+
+ ~DisposableBase()
+ {
+ Dispose(false);
+ }
+
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ protected virtual void Dispose(bool disposing)
+ {
+ }
+ }
+}
diff --git a/Library/Silverlight/ApplicationBase.cs b/Library/Silverlight/ApplicationBase.cs
index 71ad584..221fc3f 100644
--- a/Library/Silverlight/ApplicationBase.cs
+++ b/Library/Silverlight/ApplicationBase.cs
@@ -10,14 +10,14 @@
namespace Jellyfish.Library
{
- public class ApplicationBase : Application
+ public abstract class ApplicationBase : Application
{
- public ApplicationBase() :
+ protected ApplicationBase() :
this(null)
{
}
- public ApplicationBase(string name)
+ protected ApplicationBase(string name)
{
Name = name;
diff --git a/Library/Silverlight/Jellyfish.Library.Silverlight.csproj b/Library/Silverlight/Jellyfish.Library.Silverlight.csproj
index 4f46319..1beb110 100644
--- a/Library/Silverlight/Jellyfish.Library.Silverlight.csproj
+++ b/Library/Silverlight/Jellyfish.Library.Silverlight.csproj
@@ -74,6 +74,9 @@
DispatcherExtensions.cs
+
+ DisposableBase.cs
+
FrameRateCounter.xaml.cs
FrameRateCounter.xaml
diff --git a/Library/Silverlight/Phone/Jellyfish.Library.Silverlight.Phone.csproj b/Library/Silverlight/Phone/Jellyfish.Library.Silverlight.Phone.csproj
index e65f7dc..914ea03 100644
--- a/Library/Silverlight/Phone/Jellyfish.Library.Silverlight.Phone.csproj
+++ b/Library/Silverlight/Phone/Jellyfish.Library.Silverlight.Phone.csproj
@@ -68,6 +68,9 @@
DispatcherExtensions.cs
+
+ DisposableBase.cs
+
GlobalSuppressions.cs
diff --git a/Library/Wpf/ApplicationBase.cs b/Library/Wpf/ApplicationBase.cs
index fbff44d..d1e4a8c 100644
--- a/Library/Wpf/ApplicationBase.cs
+++ b/Library/Wpf/ApplicationBase.cs
@@ -7,16 +7,16 @@
namespace Jellyfish.Library
{
- public class ApplicationBase : Application
+ public abstract class ApplicationBase : Application
{
[SecurityCritical]
- public ApplicationBase() :
+ protected ApplicationBase() :
this(null)
{
}
[SecurityCritical]
- public ApplicationBase(string name)
+ protected ApplicationBase(string name)
{
Name = name;
diff --git a/Library/Wpf/Jellyfish.Library.Wpf.csproj b/Library/Wpf/Jellyfish.Library.Wpf.csproj
index 01c4529..f26e716 100644
--- a/Library/Wpf/Jellyfish.Library.Wpf.csproj
+++ b/Library/Wpf/Jellyfish.Library.Wpf.csproj
@@ -66,6 +66,9 @@
DispatcherExtensions.cs
+
+ DisposableBase.cs
+
FrameRateCounter.xaml.cs
FrameRateCounter.xaml
diff --git a/Library/Xna/GameBase.cs b/Library/Xna/GameBase.cs
index 9cc9478..3f4266d 100644
--- a/Library/Xna/GameBase.cs
+++ b/Library/Xna/GameBase.cs
@@ -9,9 +9,9 @@
namespace Jellyfish.Library
{
- public class GameBase : Game
+ public abstract class GameBase : Game
{
- public GameBase(string name)
+ protected GameBase(string name)
{
Name = name;
diff --git a/Library/Xna/Jellyfish.Library.Xna.Phone.csproj b/Library/Xna/Jellyfish.Library.Xna.Phone.csproj
index d2deec5..c20f8d8 100644
--- a/Library/Xna/Jellyfish.Library.Xna.Phone.csproj
+++ b/Library/Xna/Jellyfish.Library.Xna.Phone.csproj
@@ -88,6 +88,9 @@
AssemblyCommentAttribute.cs
+
+ DisposableBase.cs
+
GlobalSuppressions.cs
diff --git a/Library/Xna/Jellyfish.Library.Xna.Xbox.csproj b/Library/Xna/Jellyfish.Library.Xna.Xbox.csproj
index 5b02fea..6bc6db0 100644
--- a/Library/Xna/Jellyfish.Library.Xna.Xbox.csproj
+++ b/Library/Xna/Jellyfish.Library.Xna.Xbox.csproj
@@ -103,6 +103,9 @@
AssemblyCommentAttribute.cs
+
+ DisposableBase.cs
+
GlobalSuppressions.cs
diff --git a/Library/Xna/Jellyfish.Library.Xna.csproj b/Library/Xna/Jellyfish.Library.Xna.csproj
index 65eee2c..7deeeb4 100644
--- a/Library/Xna/Jellyfish.Library.Xna.csproj
+++ b/Library/Xna/Jellyfish.Library.Xna.csproj
@@ -106,6 +106,9 @@
AssemblyCommentAttribute.cs
+
+ DisposableBase.cs
+
GCHandleHelpers.cs
diff --git a/Virtu/Machine.cs b/Virtu/Machine.cs
index 0c769ee..e1acf16 100644
--- a/Virtu/Machine.cs
+++ b/Virtu/Machine.cs
@@ -48,11 +48,6 @@ public void Dispose()
_unpauseEvent.Close();
}
- public IEnumerable GetCards() where T : PeripheralCard
- {
- return Slots.Where(card => card is T).Cast();
- }
-
public void Reset()
{
foreach (var component in Components)
@@ -192,7 +187,7 @@ private void Run() // machine thread
{
//_debugService = Services.GetService();
_storageService = Services.GetService();
- _bootDiskII = GetCards().Last();
+ _bootDiskII = Slots.OfType().Last();
Initialize();
Reset();
diff --git a/Virtu/Services/MachineService.cs b/Virtu/Services/MachineService.cs
index 1cb4420..8c2b246 100644
--- a/Virtu/Services/MachineService.cs
+++ b/Virtu/Services/MachineService.cs
@@ -3,7 +3,7 @@
namespace Jellyfish.Virtu.Services
{
- public abstract class MachineService : IDisposable
+ public abstract class MachineService : DisposableBase
{
protected MachineService(Machine machine)
{
@@ -12,21 +12,6 @@ protected MachineService(Machine machine)
_debugService = new Lazy(() => Machine.Services.GetService());
}
- ~MachineService()
- {
- Dispose(false);
- }
-
- public void Dispose()
- {
- Dispose(true);
- GC.SuppressFinalize(this);
- }
-
- protected virtual void Dispose(bool disposing)
- {
- }
-
protected Machine Machine { get; private set; }
protected DebugService DebugService { get { return _debugService.Value; } }