diff --git a/Nuclex.Support (Xbox 360).csproj b/Nuclex.Support (Xbox 360).csproj
index d01ac1e..d716fe7 100644
--- a/Nuclex.Support (Xbox 360).csproj
+++ b/Nuclex.Support (Xbox 360).csproj
@@ -122,6 +122,16 @@
PrototypeFactory.cs
+
+ DefaultTimeSource.cs
+
+
+
+
+
+
+ WindowsTimeSource.cs
+
AppDomainTypeLister.cs
diff --git a/Nuclex.Support.csproj b/Nuclex.Support.csproj
index 443ddae..2d2affa 100644
--- a/Nuclex.Support.csproj
+++ b/Nuclex.Support.csproj
@@ -104,6 +104,16 @@
PrototypeFactory.cs
+
+ DefaultTimeSource.cs
+
+
+
+
+
+
+ WindowsTimeSource.cs
+
AppDomainTypeLister.cs
diff --git a/Source/Scheduling/AbortedException.Test.cs b/Source/Scheduling/AbortedException.Test.cs
index f9417d6..a536aa5 100644
--- a/Source/Scheduling/AbortedException.Test.cs
+++ b/Source/Scheduling/AbortedException.Test.cs
@@ -25,7 +25,6 @@ using System.Collections.Generic;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
-
using NUnit.Framework;
using NMock2;
diff --git a/Source/Scheduling/DefaultTimeSource.Test.cs b/Source/Scheduling/DefaultTimeSource.Test.cs
new file mode 100644
index 0000000..9f2fe2f
--- /dev/null
+++ b/Source/Scheduling/DefaultTimeSource.Test.cs
@@ -0,0 +1,97 @@
+#region CPL License
+/*
+Nuclex Framework
+Copyright (C) 2002-2009 Nuclex Development Labs
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the IBM Common Public License as
+published by the IBM Corporation; either version 1.0 of the
+License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+IBM Common Public License for more details.
+
+You should have received a copy of the IBM Common Public
+License along with this library
+*/
+#endregion
+
+#if UNITTEST
+
+using System;
+using System.Collections.Generic;
+using System.Threading;
+
+using NUnit.Framework;
+
+namespace Nuclex.Support.Scheduling {
+
+ /// Unit Test for the default scheduler time source
+ [TestFixture]
+ public class DefaultTimeSourceTest {
+
+ ///
+ /// Verifies that the time source's default constructor is working
+ ///
+ [Test]
+ public void TestDefaultConstructor() {
+ DefaultTimeSource timeSource = new DefaultTimeSource();
+ }
+
+ ///
+ /// Verifies that the time source can provide the current UTC time
+ ///
+ [Test]
+ public void TestCurrentUtcTime() {
+ DefaultTimeSource timeSource = new DefaultTimeSource();
+
+ Assert.That(
+ timeSource.CurrentUtcTime, Is.EqualTo(DateTime.UtcNow).Within(10).Seconds
+ );
+ }
+
+ ///
+ /// Verifies that the default time source's tick property is working if
+ /// the Stopwatch class is used to measure time
+ ///
+ [Test]
+ public void TestTicksWithStopwatch() {
+ DefaultTimeSource timeSource = new DefaultTimeSource(true);
+ long ticks1 = timeSource.Ticks;
+ long ticks2 = timeSource.Ticks;
+
+ Assert.That(ticks2, Is.GreaterThanOrEqualTo(ticks1));
+ }
+
+ ///
+ /// Verifies that the default time source's tick property is working if
+ /// Environment.TickCount is used to measure time
+ ///
+ [Test]
+ public void TestTicksWithTickCount() {
+ DefaultTimeSource timeSource = new DefaultTimeSource(false);
+ long ticks1 = timeSource.Ticks;
+ long ticks2 = timeSource.Ticks;
+
+ Assert.That(ticks2, Is.GreaterThanOrEqualTo(ticks1));
+ }
+
+ ///
+ /// Verifies that the default time source's WaitOne() method works correctly
+ ///
+ [Test]
+ public void TestWaitOne() {
+ DefaultTimeSource timeSource = new DefaultTimeSource();
+ AutoResetEvent waitEvent = new AutoResetEvent(true);
+
+ Assert.IsTrue(timeSource.WaitOne(waitEvent, TimeSpan.FromMilliseconds(1).Ticks));
+ Assert.IsFalse(timeSource.WaitOne(waitEvent, TimeSpan.FromMilliseconds(1).Ticks));
+ }
+
+ }
+
+} // namespace Nuclex.Support.Scheduling
+
+#endif // UNITTEST
diff --git a/Source/Scheduling/DefaultTimeSource.cs b/Source/Scheduling/DefaultTimeSource.cs
new file mode 100644
index 0000000..52862a1
--- /dev/null
+++ b/Source/Scheduling/DefaultTimeSource.cs
@@ -0,0 +1,137 @@
+#region CPL License
+/*
+Nuclex Framework
+Copyright (C) 2002-2009 Nuclex Development Labs
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the IBM Common Public License as
+published by the IBM Corporation; either version 1.0 of the
+License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+IBM Common Public License for more details.
+
+You should have received a copy of the IBM Common Public
+License along with this library
+*/
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Threading;
+
+namespace Nuclex.Support.Scheduling {
+
+ ///
+ /// Default time source implementation using the Stopwatch or Environment.TickCount
+ ///
+ public class DefaultTimeSource : ITimeSource {
+
+ /// Number of ticks (100 ns intervals) in a millisecond
+ private const long TicksPerMillisecond = 10000;
+
+ /// Called when the system date/time are adjusted
+ ///
+ /// An adjustment is a change out of the ordinary, eg. when a time synchronization
+ /// alters the current system time, when daylight saving time takes effect or
+ /// when the user manually adjusts the system date/time.
+ ///
+ public event EventHandler DateTimeAdjusted;
+
+ /// Initializes the static fields of the default time source
+ static DefaultTimeSource() {
+ tickFrequency = 10000000.0;
+ tickFrequency /= (double)Stopwatch.Frequency;
+ }
+
+ /// Initializes the default time source
+ public DefaultTimeSource() : this(Stopwatch.IsHighResolution) { }
+
+ /// Initializes the default time source
+ ///
+ /// Whether to use the Stopwatch class for measuring time
+ ///
+ ///
+ ///
+ /// Normally it's a good idea to use the default constructor. If the Stopwatch
+ /// is unable to use the high-resolution timer, it will fall back to
+ /// DateTime.Now (as stated on MSDN). This is bad because then the tick count
+ /// will jump whenever the system time changes (eg. when the system synchronizes
+ /// its time with a time server).
+ ///
+ ///
+ /// Your can safely use this constructor if you always set its arugment to 'false',
+ /// but then your won't profit from the high-resolution timer if one is available.
+ ///
+ ///
+ public DefaultTimeSource(bool useStopwatch) {
+ this.useStopwatch = useStopwatch;
+ }
+
+ /// Waits for an AutoResetEvent become signalled
+ /// WaitHandle the method will wait for
+ /// Number of ticks to wait
+ ///
+ /// True if the WaitHandle was signalled, false if the timeout was reached
+ ///
+ public virtual bool WaitOne(AutoResetEvent waitHandle, long ticks) {
+
+ // Force a timeout at least each second so the caller can check the system time
+ // since we're not able to provide the DateTimeAdjusted notification
+ int milliseconds = (int)(ticks / TicksPerMillisecond);
+ return waitHandle.WaitOne(Math.Min(1000, milliseconds), false);
+
+ }
+
+ /// Current system time in UTC format
+ public DateTime CurrentUtcTime {
+ get { return DateTime.UtcNow; }
+ }
+
+ /// How long the time source has been running
+ ///
+ /// There is no guarantee this value starts at zero (or anywhere near it) when
+ /// the time source is created. The only requirement for this value is that it
+ /// keeps increasing with the passing of time and that it stays unaffected
+ /// (eg. doesn't skip or jump back) when the system date/time are changed.
+ ///
+ public long Ticks {
+ get {
+
+ // The docs say if Stopwatch.IsHighResolution is false, it will return
+ // DateTime.Now (actually DateTime.UtcNow). This means that the Stopwatch is
+ // prone to skips and jumps during DST crossings and NTP synchronizations,
+ // so we cannot use it in that case.
+ if(this.useStopwatch) {
+ double timestamp = (double)Stopwatch.GetTimestamp();
+ return (long)(timestamp * tickFrequency);
+ }
+
+ // Fallback: Use Environment.TickCount instead. Not as accurate, but at least
+ // it will not jump around when the date or time are adjusted.
+ return Environment.TickCount * TicksPerMillisecond;
+
+ }
+ }
+
+ /// Called when the system time is changed
+ /// Not used
+ /// Not used
+ protected virtual void OnDateTimeAdjusted(object sender, EventArgs arguments) {
+ EventHandler copy = DateTimeAdjusted;
+ if(copy != null) {
+ copy(sender, arguments);
+ }
+ }
+
+ /// Number of ticks per Stopwatch time unit
+ private static double tickFrequency;
+ /// Whether ot use the Stopwatch class for measuring time
+ private bool useStopwatch;
+
+ }
+
+} // namespace Nuclex.Support.Scheduling
diff --git a/Source/Scheduling/ITimeSource.cs b/Source/Scheduling/ITimeSource.cs
new file mode 100644
index 0000000..72dd5c6
--- /dev/null
+++ b/Source/Scheduling/ITimeSource.cs
@@ -0,0 +1,67 @@
+#region CPL License
+/*
+Nuclex Framework
+Copyright (C) 2002-2009 Nuclex Development Labs
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the IBM Common Public License as
+published by the IBM Corporation; either version 1.0 of the
+License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+IBM Common Public License for more details.
+
+You should have received a copy of the IBM Common Public
+License along with this library
+*/
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Threading;
+
+namespace Nuclex.Support.Scheduling {
+
+ /// Provides time measurement and change notification services
+ interface ITimeSource {
+
+ /// Called when the system date/time are adjusted
+ ///
+ /// An adjustment is a change out of the ordinary, eg. when a time synchronization
+ /// alters the current system time, when daylight saving time takes effect or
+ /// when the user manually adjusts the system date/time.
+ ///
+ event EventHandler DateTimeAdjusted;
+
+ /// Waits for an AutoResetEvent become signalled
+ /// WaitHandle the method will wait for
+ /// Number of ticks to wait
+ ///
+ /// True if the WaitHandle was signalled, false if the timeout was reached
+ /// or the time source thinks its time to recheck the system date/time.
+ ///
+ ///
+ /// Depending on whether the system will provide notifications when date/time
+ /// is adjusted, the time source will be forced to let thid method block for
+ /// less than the indicated time before returning a timeout in order to give
+ /// the caller a chance to recheck the system time.
+ ///
+ bool WaitOne(AutoResetEvent waitHandle, long ticks);
+
+ /// Current system time in UTC format
+ DateTime CurrentUtcTime { get; }
+
+ /// How long the time source has been running
+ ///
+ /// There is no guarantee this value starts at zero (or anywhere near it) when
+ /// the time source is created. The only requirement for this value is that it
+ /// keeps increasing with the passing of time and that it stays unaffected
+ /// (eg. doesn't skip or jump back) when the system date/time are changed.
+ ///
+ long Ticks { get; }
+
+ }
+
+} // namespace Nuclex.Support.Scheduling
diff --git a/Source/Scheduling/Scheduler.cs b/Source/Scheduling/Scheduler.cs
new file mode 100644
index 0000000..f13fa24
--- /dev/null
+++ b/Source/Scheduling/Scheduler.cs
@@ -0,0 +1,42 @@
+#region CPL License
+/*
+Nuclex Framework
+Copyright (C) 2002-2009 Nuclex Development Labs
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the IBM Common Public License as
+published by the IBM Corporation; either version 1.0 of the
+License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+IBM Common Public License for more details.
+
+You should have received a copy of the IBM Common Public
+License along with this library
+*/
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Threading;
+using System.Diagnostics;
+
+namespace Nuclex.Support.Scheduling {
+
+#if false
+
+ /// Schedules actions for execution at a future point in time
+ public class Scheduler : IDisposable {
+
+ /// Immediately releases all resources owned by the instance
+ public void Dispose() {
+ }
+
+
+ }
+
+#endif
+
+} // namespace Nuclex.Support.Scheduling
diff --git a/Source/Scheduling/WindowsTimeSource.Test.cs b/Source/Scheduling/WindowsTimeSource.Test.cs
new file mode 100644
index 0000000..1d5ff11
--- /dev/null
+++ b/Source/Scheduling/WindowsTimeSource.Test.cs
@@ -0,0 +1,164 @@
+#region CPL License
+/*
+Nuclex Framework
+Copyright (C) 2002-2009 Nuclex Development Labs
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the IBM Common Public License as
+published by the IBM Corporation; either version 1.0 of the
+License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+IBM Common Public License for more details.
+
+You should have received a copy of the IBM Common Public
+License along with this library
+*/
+#endregion
+
+#if UNITTEST
+
+#if !XBOX360
+
+using System;
+using System.Collections.Generic;
+using System.Runtime.InteropServices;
+using System.Threading;
+
+using Microsoft.Win32;
+
+using NUnit.Framework;
+
+namespace Nuclex.Support.Scheduling {
+
+ /// Unit Test for the windows time source
+ [TestFixture]
+ public class WindowsTimeSourceTest {
+
+ #region class TestWindowsTimeSource
+
+ /// Windows time source used for testing
+ private class TestWindowsTimeSource : WindowsTimeSource {
+
+ ///
+ /// Forces a time change notification even if the system time was not adjusted
+ ///
+ public void ForceTimeChange() {
+ OnDateTimeAdjusted(this, EventArgs.Empty);
+ }
+ }
+
+ #endregion // class TestWindowsTimeSource
+
+ #region class TestTimeChangedSubscriber
+
+ /// Dummy subscriber used to test the time changed event
+ private class TestTimeChangedSubscriber {
+
+ /// Callback subscribed to the TimeChanged event
+ /// Not used
+ /// Not used
+ public void TimeChanged(object sender, EventArgs arguments) {
+ ++this.CallCount;
+ }
+
+ /// Number of times the callback was invoked
+ public int CallCount;
+
+ }
+
+ #endregion // class TestTimeChangedSubscriber
+
+ ///
+ /// Verifies that the time source's default constructor is working
+ ///
+ [Test]
+ public void TestDefaultConstructor() {
+ using(WindowsTimeSource timeSource = new WindowsTimeSource()) { }
+ }
+
+ ///
+ /// Verifies that the time source can provide the current UTC time
+ ///
+ [Test]
+ public void TestCurrentUtcTime() {
+ using(WindowsTimeSource timeSource = new WindowsTimeSource()) {
+
+ Assert.That(
+ timeSource.CurrentUtcTime, Is.EqualTo(DateTime.UtcNow).Within(10).Seconds
+ );
+ }
+ }
+
+ ///
+ /// Verifies that the time source's tick property is working if
+ /// the Stopwatch class is used to measure time
+ ///
+ [Test]
+ public void TestTicks() {
+ using(WindowsTimeSource timeSource = new WindowsTimeSource()) {
+ long ticks1 = timeSource.Ticks;
+ long ticks2 = timeSource.Ticks;
+
+ Assert.That(ticks2, Is.GreaterThanOrEqualTo(ticks1));
+ }
+ }
+
+ ///
+ /// Verifies that the time source's WaitOne() method works correctly
+ ///
+ [Test]
+ public void TestWaitOne() {
+ using(WindowsTimeSource timeSource = new WindowsTimeSource()) {
+ AutoResetEvent waitEvent = new AutoResetEvent(true);
+
+ Assert.IsTrue(timeSource.WaitOne(waitEvent, TimeSpan.FromMilliseconds(1).Ticks));
+ Assert.IsFalse(timeSource.WaitOne(waitEvent, TimeSpan.FromMilliseconds(1).Ticks));
+ }
+ }
+
+ ///
+ /// Verifies that the default time source's WaitOne() method works correctly
+ ///
+ [Test]
+ public void TestTimeChange() {
+ using(TestWindowsTimeSource timeSource = new TestWindowsTimeSource()) {
+ TestTimeChangedSubscriber subscriber = new TestTimeChangedSubscriber();
+
+ EventHandler callbackDelegate = new EventHandler(subscriber.TimeChanged);
+ timeSource.DateTimeAdjusted += callbackDelegate;
+ try {
+ timeSource.ForceTimeChange();
+ }
+ finally {
+ timeSource.DateTimeAdjusted -= callbackDelegate;
+ }
+
+ // Using greater than because during the test run a real time change notification
+ // might have happened, increasing the counter to 2 or more.
+ Assert.That(subscriber.CallCount, Is.GreaterThanOrEqualTo(1));
+ }
+ }
+
+ ///
+ /// Tests whether the Windows-specific time source can reports its availability on
+ /// the current platform
+ ///
+ [Test]
+ public void TestAvailability() {
+ bool isAvailable = WindowsTimeSource.Available;
+ Assert.IsTrue(
+ (isAvailable == true) ||
+ (isAvailable == false)
+ );
+ }
+
+ }
+
+} // namespace Nuclex.Support.Scheduling
+
+#endif // !XBOX360
+
+#endif // UNITTEST
diff --git a/Source/Scheduling/WindowsTimeSource.cs b/Source/Scheduling/WindowsTimeSource.cs
new file mode 100644
index 0000000..0747c87
--- /dev/null
+++ b/Source/Scheduling/WindowsTimeSource.cs
@@ -0,0 +1,77 @@
+#region CPL License
+/*
+Nuclex Framework
+Copyright (C) 2002-2009 Nuclex Development Labs
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the IBM Common Public License as
+published by the IBM Corporation; either version 1.0 of the
+License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+IBM Common Public License for more details.
+
+You should have received a copy of the IBM Common Public
+License along with this library
+*/
+#endregion
+
+#if !XBOX360
+
+using System;
+using System.Collections.Generic;
+using System.Threading;
+
+using Microsoft.Win32;
+
+namespace Nuclex.Support.Scheduling {
+
+ ///
+ /// Time source that makes use of additional features only available on Windows
+ ///
+ public class WindowsTimeSource : DefaultTimeSource, IDisposable {
+
+ /// Number of ticks (100 ns intervals) in a millisecond
+ private const long TicksPerMillisecond = 10000;
+
+ /// Initializes a new Windows time source
+ public WindowsTimeSource() {
+ this.onDateTimeAdjustedDelegate = new EventHandler(OnDateTimeAdjusted);
+ SystemEvents.TimeChanged += this.onDateTimeAdjustedDelegate;
+ }
+
+ /// Immediately releases all resources owned by the instance
+ public void Dispose() {
+ if(this.onDateTimeAdjustedDelegate != null) {
+ SystemEvents.TimeChanged -= this.onDateTimeAdjustedDelegate;
+ this.onDateTimeAdjustedDelegate = null;
+ }
+ }
+
+ /// Waits for an AutoResetEvent become signalled
+ /// WaitHandle the method will wait for
+ /// Number of ticks to wait
+ ///
+ /// True if the WaitHandle was signalled, false if the timeout was reached
+ ///
+ public override bool WaitOne(AutoResetEvent waitHandle, long ticks) {
+ return waitHandle.WaitOne((int)(ticks / TicksPerMillisecond));
+ }
+
+ ///
+ /// Whether the Windows time source can be used on the current platform
+ ///
+ public static bool Available {
+ get { return Environment.OSVersion.Platform == PlatformID.Win32NT; }
+ }
+
+ /// Delegate for the timeChanged() callback method
+ private EventHandler onDateTimeAdjustedDelegate;
+
+ }
+
+} // namespace Nuclex.Support.Scheduling
+
+#endif // !XBOX360
diff --git a/Source/Services/AppDomainTypeLister.Test.cs b/Source/Services/AppDomainTypeLister.Test.cs
index 827c2d5..ef8d128 100644
--- a/Source/Services/AppDomainTypeLister.Test.cs
+++ b/Source/Services/AppDomainTypeLister.Test.cs
@@ -26,6 +26,8 @@ using System.Reflection;
using NUnit.Framework;
+#if ENABLE_SERVICEMANAGER
+
namespace Nuclex.Support.Services {
/// Unit Test for the cached app domain type lister
@@ -70,4 +72,6 @@ namespace Nuclex.Support.Services {
} // namespace Nuclex.Support.Services
+#endif // ENABLE_SERVICEMANAGER
+
#endif // UNITTEST
diff --git a/Source/Services/AppDomainTypeLister.cs b/Source/Services/AppDomainTypeLister.cs
index 4956d4f..34f84ad 100644
--- a/Source/Services/AppDomainTypeLister.cs
+++ b/Source/Services/AppDomainTypeLister.cs
@@ -22,6 +22,8 @@ using System;
using System.Collections.Generic;
using System.Reflection;
+#if ENABLE_SERVICEMANAGER
+
namespace Nuclex.Support.Services {
#if !XBOX360
@@ -57,3 +59,5 @@ namespace Nuclex.Support.Services {
#endif // !XBOX360
} // namespace Nuclex.Support.Services
+
+#endif // ENABLE_SERVICEMANAGER
diff --git a/Source/Services/ExplicitTypeLister.Test.cs b/Source/Services/ExplicitTypeLister.Test.cs
index f4839ff..7e8535f 100644
--- a/Source/Services/ExplicitTypeLister.Test.cs
+++ b/Source/Services/ExplicitTypeLister.Test.cs
@@ -26,6 +26,8 @@ using System.Reflection;
using NUnit.Framework;
+#if ENABLE_SERVICEMANAGER
+
namespace Nuclex.Support.Services {
/// Unit Test for the predefined type lister
@@ -100,4 +102,6 @@ namespace Nuclex.Support.Services {
} // namespace Nuclex.Support.Services
+#endif // ENABLE_SERVICEMANAGER
+
#endif // UNITTEST
diff --git a/Source/Services/ExplicitTypeLister.cs b/Source/Services/ExplicitTypeLister.cs
index 728f32b..b5c6342 100644
--- a/Source/Services/ExplicitTypeLister.cs
+++ b/Source/Services/ExplicitTypeLister.cs
@@ -22,6 +22,8 @@ using System;
using System.Collections.Generic;
using System.Text;
+#if ENABLE_SERVICEMANAGER
+
namespace Nuclex.Support.Services {
/// Type lister that returns a predefined list of types
@@ -58,3 +60,5 @@ namespace Nuclex.Support.Services {
}
} // namespace Nuclex.Support.Services
+
+#endif // ENABLE_SERVICEMANAGER
diff --git a/Source/Services/ITypeLister.cs b/Source/Services/ITypeLister.cs
index e3fecee..a3ae050 100644
--- a/Source/Services/ITypeLister.cs
+++ b/Source/Services/ITypeLister.cs
@@ -24,6 +24,8 @@ using System.Reflection;
using Nuclex.Support.Plugins;
+#if ENABLE_SERVICEMANAGER
+
namespace Nuclex.Support.Services {
///
@@ -40,3 +42,5 @@ namespace Nuclex.Support.Services {
}
} // namespace Nuclex.Support.Services
+
+#endif // ENABLE_SERVICEMANAGER
diff --git a/Source/Services/Instancing.cs b/Source/Services/Instancing.cs
index cc06de9..95439f3 100644
--- a/Source/Services/Instancing.cs
+++ b/Source/Services/Instancing.cs
@@ -23,6 +23,8 @@ using System.Collections.Generic;
using Nuclex.Support.Plugins;
+#if ENABLE_SERVICEMANAGER
+
namespace Nuclex.Support.Services {
/// Modes in which services can be instantiated
@@ -43,3 +45,5 @@ namespace Nuclex.Support.Services {
}
} // namespace Nuclex.Support.Services
+
+#endif // ENABLE_SERVICEMANAGER
diff --git a/Source/Services/MultiAssemblyTypeLister.Test.cs b/Source/Services/MultiAssemblyTypeLister.Test.cs
index 5247549..08a1993 100644
--- a/Source/Services/MultiAssemblyTypeLister.Test.cs
+++ b/Source/Services/MultiAssemblyTypeLister.Test.cs
@@ -26,6 +26,8 @@ using System.Reflection;
using NUnit.Framework;
+#if ENABLE_SERVICEMANAGER
+
namespace Nuclex.Support.Services {
/// Unit Test for the cached assembly type lister
@@ -135,4 +137,7 @@ namespace Nuclex.Support.Services {
} // namespace Nuclex.Support.Services
+#endif // ENABLE_SERVICEMANAGER
+
#endif // UNITTEST
+
diff --git a/Source/Services/MultiAssemblyTypeLister.cs b/Source/Services/MultiAssemblyTypeLister.cs
index 7d4aec7..6efc59d 100644
--- a/Source/Services/MultiAssemblyTypeLister.cs
+++ b/Source/Services/MultiAssemblyTypeLister.cs
@@ -22,6 +22,8 @@ using System;
using System.Collections.Generic;
using System.Reflection;
+#if ENABLE_SERVICEMANAGER
+
namespace Nuclex.Support.Services {
/// Lists all types in a changing set of assemblies
@@ -160,3 +162,5 @@ namespace Nuclex.Support.Services {
}
} // namespace Nuclex.Support.Services
+
+#endif // ENABLE_SERVICEMANAGER
diff --git a/Source/Services/ProgressTracking/IProgressCollectingService.cs b/Source/Services/ProgressTracking/IProgressCollectingService.cs
index 883617e..031799e 100644
--- a/Source/Services/ProgressTracking/IProgressCollectingService.cs
+++ b/Source/Services/ProgressTracking/IProgressCollectingService.cs
@@ -23,6 +23,8 @@ using System.Collections.Generic;
using Nuclex.Support.Tracking;
+#if ENABLE_SERVICEMANAGER
+
namespace Nuclex.Support.Services.ProgressTracking {
/// Allows application-wide tracking of progress
@@ -86,3 +88,5 @@ namespace Nuclex.Support.Services.ProgressTracking {
}
} // namespace Nuclex.Support.DependencyInjection.ProgressTracking
+
+#endif // ENABLE_SERVICEMANAGER
diff --git a/Source/Services/ProgressTracking/IProgressPublishingService.cs b/Source/Services/ProgressTracking/IProgressPublishingService.cs
index 3d5969e..520ca56 100644
--- a/Source/Services/ProgressTracking/IProgressPublishingService.cs
+++ b/Source/Services/ProgressTracking/IProgressPublishingService.cs
@@ -23,6 +23,8 @@ using System.Collections.Generic;
using Nuclex.Support.Tracking;
+#if ENABLE_SERVICEMANAGER
+
namespace Nuclex.Support.Services.ProgressTracking {
/// Reports the progress of tracked background processes
@@ -52,3 +54,5 @@ namespace Nuclex.Support.Services.ProgressTracking {
}
} // namespace Nuclex.Support.DependencyInjection.ProgressTracking
+
+#endif // ENABLE_SERVICEMANAGER
diff --git a/Source/Services/ProgressTracking/ITrackedProcess.cs b/Source/Services/ProgressTracking/ITrackedProcess.cs
index 1a49cc3..147cb89 100644
--- a/Source/Services/ProgressTracking/ITrackedProcess.cs
+++ b/Source/Services/ProgressTracking/ITrackedProcess.cs
@@ -23,6 +23,8 @@ using System.Collections.Generic;
using Nuclex.Support.Tracking;
+#if ENABLE_SERVICEMANAGER
+
namespace Nuclex.Support.Services.ProgressTracking {
/// Process whose progress is being tracked
@@ -47,3 +49,5 @@ namespace Nuclex.Support.Services.ProgressTracking {
}
} // namespace Nuclex.Support.DependencyInjection.ProgressTracking
+
+#endif // ENABLE_SERVICEMANAGER
diff --git a/Source/Services/ProgressTracking/ProgressTrackingComponent.cs b/Source/Services/ProgressTracking/ProgressTrackingComponent.cs
index 0ec7b32..65ca0b8 100644
--- a/Source/Services/ProgressTracking/ProgressTrackingComponent.cs
+++ b/Source/Services/ProgressTracking/ProgressTrackingComponent.cs
@@ -23,10 +23,10 @@ using System.Collections.Generic;
using Nuclex.Support.Tracking;
-namespace Nuclex.Support.Services.ProgressTracking {
-
#if ENABLE_SERVICEMANAGER
+namespace Nuclex.Support.Services.ProgressTracking {
+
/// Tracks the progress of running background processes
public class ProgressTrackingComponent :
IProgressCollectingService,
@@ -73,6 +73,6 @@ namespace Nuclex.Support.Services.ProgressTracking {
}
-#endif // ENABLE_SERVICEMANAGER
-
} // namespace Nuclex.Support.Services.ProgressTracking
+
+#endif // ENABLE_SERVICEMANAGER
diff --git a/Source/Services/RepositoryTypeLister.Test.cs b/Source/Services/RepositoryTypeLister.Test.cs
index aaa08a4..42470e3 100644
--- a/Source/Services/RepositoryTypeLister.Test.cs
+++ b/Source/Services/RepositoryTypeLister.Test.cs
@@ -26,6 +26,8 @@ using System.Reflection;
using NUnit.Framework;
+#if ENABLE_SERVICEMANAGER
+
namespace Nuclex.Support.Services {
/// Unit Test for the cached assembly repository type lister
@@ -60,4 +62,6 @@ namespace Nuclex.Support.Services {
} // namespace Nuclex.Support.Services
+#endif // ENABLE_SERVICEMANAGER
+
#endif // UNITTEST
diff --git a/Source/Services/RepositoryTypeLister.cs b/Source/Services/RepositoryTypeLister.cs
index 0cfaa88..a78d536 100644
--- a/Source/Services/RepositoryTypeLister.cs
+++ b/Source/Services/RepositoryTypeLister.cs
@@ -24,6 +24,8 @@ using System.Reflection;
using Nuclex.Support.Plugins;
+#if ENABLE_SERVICEMANAGER
+
namespace Nuclex.Support.Services {
///
@@ -70,3 +72,5 @@ namespace Nuclex.Support.Services {
}
} // namespace Nuclex.Support.Services
+
+#endif // ENABLE_SERVICEMANAGER
diff --git a/Source/Services/ServiceManager.Analyzer.cs b/Source/Services/ServiceManager.Analyzer.cs
index 6488831..c762ebc 100644
--- a/Source/Services/ServiceManager.Analyzer.cs
+++ b/Source/Services/ServiceManager.Analyzer.cs
@@ -22,10 +22,10 @@ using System;
using System.Collections.Generic;
using System.Reflection;
-namespace Nuclex.Support.Services {
-
#if ENABLE_SERVICEMANAGER
+namespace Nuclex.Support.Services {
+
partial class ServiceManager {
#region class Analyzer
@@ -48,6 +48,6 @@ namespace Nuclex.Support.Services {
}
-#endif // ENABLE_SERVICEMANAGER
-
} // namespace Nuclex.Support.Services
+
+#endif // ENABLE_SERVICEMANAGER
diff --git a/Source/Services/ServiceManager.For.cs b/Source/Services/ServiceManager.For.cs
index 414389d..fc3caf9 100644
--- a/Source/Services/ServiceManager.For.cs
+++ b/Source/Services/ServiceManager.For.cs
@@ -22,10 +22,10 @@ using System;
using System.Collections.Generic;
using System.Text;
-namespace Nuclex.Support.Services {
-
#if ENABLE_SERVICEMANAGER
+namespace Nuclex.Support.Services {
+
partial class ServiceManager {
#region class ForContext
@@ -111,6 +111,6 @@ namespace Nuclex.Support.Services {
}
-#endif // ENABLE_SERVICEMANAGER
-
} // namespace Nuclex.Support.Services
+
+#endif // ENABLE_SERVICEMANAGER
diff --git a/Source/Services/ServiceManager.Test.cs b/Source/Services/ServiceManager.Test.cs
index 01edae2..72a82ff 100644
--- a/Source/Services/ServiceManager.Test.cs
+++ b/Source/Services/ServiceManager.Test.cs
@@ -18,19 +18,19 @@ License along with this library
*/
#endregion
+#if UNITTEST
+
using System;
using System.IO;
using Nuclex.Support.Plugins;
-#if UNITTEST
-
using NUnit.Framework;
-namespace Nuclex.Support.Services {
-
#if ENABLE_SERVICEMANAGER
+namespace Nuclex.Support.Services {
+
/// Unit Test for the service manager class
[TestFixture]
public class ServiceManagerTest {
@@ -192,8 +192,8 @@ namespace Nuclex.Support.Services {
}
-#endif // ENABLE_SERVICEMANAGER
-
} // namespace Nuclex.Support.Services
+#endif // ENABLE_SERVICEMANAGER
+
#endif // UNITTEST
diff --git a/Source/Services/ServiceManager.cs b/Source/Services/ServiceManager.cs
index b161a14..c2c0811 100644
--- a/Source/Services/ServiceManager.cs
+++ b/Source/Services/ServiceManager.cs
@@ -26,10 +26,10 @@ using System.Threading;
using Nuclex.Support.Plugins;
-namespace Nuclex.Support.Services {
-
#if ENABLE_SERVICEMANAGER
+namespace Nuclex.Support.Services {
+
// Allow Dependency on Container
// public Foo(IServiceProvider serviceProvider)
// public Foo(IserviceLocator serviceLocator)
@@ -84,7 +84,7 @@ namespace Nuclex.Support.Services {
///
public partial class ServiceManager : IServiceProvider {
- #region class Contract
+#region class Contract
/// Stores the settings for an individual contract
private class Contract {
@@ -321,6 +321,6 @@ namespace Nuclex.Support.Services {
}
-#endif // ENABLE_SERVICEMANAGER
-
} // namespace Nuclex.Support.Services
+
+#endif // ENABLE_SERVICEMANAGER
diff --git a/Source/Tracking/Internal/WeightedTransactionWrapperCollection.Test.cs b/Source/Tracking/Internal/WeightedTransactionWrapperCollection.Test.cs
index 2e5f648..7cef748 100644
--- a/Source/Tracking/Internal/WeightedTransactionWrapperCollection.Test.cs
+++ b/Source/Tracking/Internal/WeightedTransactionWrapperCollection.Test.cs
@@ -29,7 +29,9 @@ using NMock2;
namespace Nuclex.Support.Tracking {
- /// Unit Test for the observation wrapper collection of weighted transactions
+ ///
+ /// Unit Test for the observation wrapper collection of weighted transactions
+ ///
[TestFixture]
public class WeightedTransactionWrapperCollectionTest {
@@ -42,11 +44,12 @@ namespace Nuclex.Support.Tracking {
Transaction.EndedDummy
);
- ObservedWeightedTransaction observed = new ObservedWeightedTransaction(
- transaction,
- endedCallback,
- progressUpdatedCallback
- );
+ ObservedWeightedTransaction observed =
+ new ObservedWeightedTransaction(
+ transaction,
+ endedCallback,
+ progressUpdatedCallback
+ );
WeightedTransactionWrapperCollection wrapper =
new WeightedTransactionWrapperCollection(
diff --git a/Source/Tracking/TransactionGroup.cs b/Source/Tracking/TransactionGroup.cs
index d67bd4b..eca3a47 100644
--- a/Source/Tracking/TransactionGroup.cs
+++ b/Source/Tracking/TransactionGroup.cs
@@ -146,7 +146,7 @@ namespace Nuclex.Support.Tracking {
/// Fires the progress update event
/// Progress to report (ranging from 0.0 to 1.0)
///
- /// Informs the observers of this transactions about the achieved progress.
+ /// Informs the observers of this transaction about the achieved progress.
///
protected virtual void OnAsyncProgressChanged(float progress) {
OnAsyncProgressChanged(new ProgressReportEventArgs(progress));