diff --git a/Nuclex.Support (Xbox 360).csproj b/Nuclex.Support (Xbox 360).csproj new file mode 100644 index 0000000..2f957ad --- /dev/null +++ b/Nuclex.Support (Xbox 360).csproj @@ -0,0 +1,294 @@ + + + {DFFEAB70-51B8-4714-BCA6-79B733BBC520} + {2DF5C3F4-5A5F-47a9-8E94-23B4456F55E2};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Debug + Xbox 360 + Library + Properties + Nuclex.Support + Nuclex.Support + v3.5 + v3.0 + Xbox 360 + 334850d5-951c-4098-aeed-40d9a06c9df1 + + + true + full + false + bin\Xbox 360\Debug + TRACE;DEBUG;XBOX;XBOX360;COMPACTFRAMEWORK + prompt + 4 + true + false + true + bin\Xbox 360\Debug\Nuclex.Support.xml + + + pdbonly + true + bin\Xbox 360\Release + TRACE;XBOX;XBOX360;COMPACTFRAMEWORK + prompt + 4 + true + false + true + bin\Xbox 360\Release\Nuclex.Support.xml + + + + False + + + False + + + False + + + False + + + False + + + 3.5 + False + + + 3.5 + False + + + + + + + AssertHelper.cs + + + + ItemEventArgs.cs + + + + ObservableCollection.cs + + + + PairPriorityQueue.cs + + + + Parentable.cs + + + + ParentingCollection.cs + + + + PriorityItemPair.cs + + + + PriorityQueue.cs + + + + ReadOnlyCollection.cs + + + + ReadOnlyDictionary.cs + + + + ReadOnlyList.cs + + + + ReverseComparer.cs + + + + RingMemoryStream.cs + + + + TransformingReadOnlyCollection.cs + + + TransformingReadOnlyCollection.cs + + + + FloatHelper.cs + + + + IntegerHelper.cs + + + + LicenseKey.cs + + + CommandLine.cs + + + CommandLine.cs + + + CommandLine.cs + + + + BrokenCommandLineParser.cs + + + + CommandLine.cs + + + + PathHelper.cs + + + + AssemblyLoadEventArgs.cs + + + + Employer.cs + + + FactoryEmployer.cs + + + + InstanceEmployer.cs + + + + + + + NoPluginAttribute.cs + + + + PluginHelper.cs + + + + PluginHost.cs + + + + PluginRepository.cs + + + + AbortedException.cs + + + + + Operation.cs + + + + OperationQueue.cs + + + + ThreadCallbackOperation.cs + + + + ThreadOperation.cs + + + + Shared.cs + + + + StringHelper.cs + + + + StringSegment.cs + + + + IdleStateEventArgs.cs + + + + ObservedWeightedTransaction.cs + + + + WeightedTransactionWrapperCollection.cs + + + + + + ProgressReportEventArgs.cs + + + + ProgressTracker.cs + + + + Request.cs + + + StatusReportEventArgs.cs + + + Transaction.cs + + + + TransactionGroup.cs + + + + + + WeightedTransaction.cs + + + + WeakReference.cs + + + + + + + + + + d5a9e893-70bf-4882-bcbd-c9b6b6054a0e + False + + + + + + \ No newline at end of file diff --git a/Nuclex.Support.csproj b/Nuclex.Support.csproj index f27b3cc..bfc9c8c 100644 --- a/Nuclex.Support.csproj +++ b/Nuclex.Support.csproj @@ -139,6 +139,10 @@ PathHelper.cs + + + AssemblyLoadEventArgs.cs + Employer.cs diff --git a/Source/Collections/ReadOnlyDictionary.Test.cs b/Source/Collections/ReadOnlyDictionary.Test.cs index bfdbc38..81fd62b 100644 --- a/Source/Collections/ReadOnlyDictionary.Test.cs +++ b/Source/Collections/ReadOnlyDictionary.Test.cs @@ -18,14 +18,14 @@ License along with this library */ #endregion +#if UNITTEST + using System; using System.Collections; using System.Collections.Generic; using System.IO; using System.Runtime.Serialization.Formatters.Binary; -#if UNITTEST - using NUnit.Framework; namespace Nuclex.Support.Collections { diff --git a/Source/Collections/ReadOnlyDictionary.cs b/Source/Collections/ReadOnlyDictionary.cs index 8c6c6ce..7d0e52d 100644 --- a/Source/Collections/ReadOnlyDictionary.cs +++ b/Source/Collections/ReadOnlyDictionary.cs @@ -31,10 +31,14 @@ namespace Nuclex.Support.Collections { /// Type of the values used in the Dictionary [Serializable] public class ReadOnlyDictionary : - IDictionary, - IDictionary, +#if !COMPACTFRAMEWORK ISerializable, - IDeserializationCallback { + IDeserializationCallback, +#endif + IDictionary, + IDictionary { + +#if !COMPACTFRAMEWORK #region class SerializedDictionary @@ -65,13 +69,6 @@ namespace Nuclex.Support.Collections { #endregion // class SerializeDictionary - /// Initializes a new read-only Dictionary wrapper - /// Dictionary that will be wrapped - public ReadOnlyDictionary(IDictionary dictionary) { - this.typedDictionary = dictionary; - this.objectDictionary = (this.typedDictionary as IDictionary); - } - /// /// Initializes a new instance of the System.WeakReference class, using deserialized /// data from the specified serialization and stream objects. @@ -90,6 +87,16 @@ namespace Nuclex.Support.Collections { protected ReadOnlyDictionary(SerializationInfo info, StreamingContext context) : this(new SerializedDictionary(info, context)) { } +#endif // !COMPACTFRAMEWORK + + /// Initializes a new read-only Dictionary wrapper + /// Dictionary that will be wrapped + public ReadOnlyDictionary(IDictionary dictionary) { + this.typedDictionary = dictionary; + this.objectDictionary = (this.typedDictionary as IDictionary); + } + + /// Whether the directory is write-protected public bool IsReadOnly { get { return true; } @@ -360,6 +367,7 @@ namespace Nuclex.Support.Collections { #endregion +#if !COMPACTFRAMEWORK #region ISerializable implementation /// Serializes the Dictionary @@ -380,6 +388,7 @@ namespace Nuclex.Support.Collections { } #endregion +#endif //!COMPACTFRAMEWORK /// The wrapped Dictionary under its type-safe interface private IDictionary typedDictionary; diff --git a/Source/IntegerHelper.Test.cs b/Source/IntegerHelper.Test.cs index 788d7f3..a0e2fe1 100644 --- a/Source/IntegerHelper.Test.cs +++ b/Source/IntegerHelper.Test.cs @@ -18,6 +18,8 @@ License along with this library */ #endregion +#if UNITTEST + using System; using System.Collections.Generic; @@ -99,3 +101,5 @@ namespace Nuclex.Support { } } // namespace Nuclex.Support + +#endif // UNITTEST \ No newline at end of file diff --git a/Source/Licensing/LicenseKey.cs b/Source/Licensing/LicenseKey.cs index 43ff5c2..8c6a6f0 100644 --- a/Source/Licensing/LicenseKey.cs +++ b/Source/Licensing/LicenseKey.cs @@ -182,10 +182,10 @@ namespace Nuclex.Support.Licensing { ); // Now build a nice, readable string from the decoded characters - resultBuilder.Insert(5, '-'); - resultBuilder.Insert(11, '-'); - resultBuilder.Insert(17, '-'); - resultBuilder.Insert(23, '-'); + resultBuilder.Insert(5, keyDelimiter, 0, 1); + resultBuilder.Insert(11, keyDelimiter, 0, 1); + resultBuilder.Insert(17, keyDelimiter, 0, 1); + resultBuilder.Insert(23, keyDelimiter, 0, 1); return resultBuilder.ToString(); } @@ -215,6 +215,13 @@ namespace Nuclex.Support.Licensing { } } + /// Character used to delimit each 5 digit group in a license key + /// + /// Required to be a char array because the .NET Compact Framework only provides + /// an overload for char[] in the StringBuilder.Insert() method. + /// + private static char[] keyDelimiter = new char[] { '-' }; + /// Table with the individual characters in a key private static readonly string codeTable = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; diff --git a/Source/Plugins/AssemblyLoadEventArgs.Test.cs b/Source/Plugins/AssemblyLoadEventArgs.Test.cs new file mode 100644 index 0000000..8843546 --- /dev/null +++ b/Source/Plugins/AssemblyLoadEventArgs.Test.cs @@ -0,0 +1,52 @@ +#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.IO; +using System.Reflection; + +using NUnit.Framework; +using NUnit.Framework.SyntaxHelpers; + +namespace Nuclex.Support.Plugins { + + /// Unit Test for the assembly load event argument container + [TestFixture] + public class AssemblyLoadEventArgsTest { + + /// + /// Tests whether the argument container correctly stores an assembly reference + /// + [Test] + public void TestEmployerDefaultConstructorDetection() { + Assembly assembly = Assembly.GetExecutingAssembly(); + + AssemblyLoadEventArgs testArguments = new AssemblyLoadEventArgs(assembly); + + Assert.AreSame(assembly, testArguments.LoadedAssembly); + } + + } + +} // namespace Nuclex.Support.Plugins + +#endif // UNITTEST diff --git a/Source/Plugins/AssemblyLoadEventArgs.cs b/Source/Plugins/AssemblyLoadEventArgs.cs new file mode 100644 index 0000000..2efd42e --- /dev/null +++ b/Source/Plugins/AssemblyLoadEventArgs.cs @@ -0,0 +1,53 @@ +#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.Reflection; + +namespace Nuclex.Support.Plugins { + + /// Signature for the AssemblyLoad event + /// Object that is reporting that an assembly was loaded + /// Contains the loaded assembly + public delegate void AssemblyLoadEventHandler( + object sender, AssemblyLoadEventArgs arguments + ); + + /// Argument container for the AssemblyLoad event arguments + public class AssemblyLoadEventArgs : EventArgs { + + /// Initializes a new event argument container + /// Assembly that has been loaded + public AssemblyLoadEventArgs(Assembly loadedAssembly) { + this.loadedAssembly = loadedAssembly; + } + + /// Assembly that was loaded by the sender of the event + public Assembly LoadedAssembly { + get { return this.loadedAssembly; } + } + + /// Loaded assembly that will be provided to the event receivers + private Assembly loadedAssembly; + + } + +} // namespace Nuclex.Support.Plugins diff --git a/Source/Plugins/Employer.Test.cs b/Source/Plugins/Employer.Test.cs index fb2bdeb..5bd8b32 100644 --- a/Source/Plugins/Employer.Test.cs +++ b/Source/Plugins/Employer.Test.cs @@ -18,11 +18,11 @@ License along with this library */ #endregion +#if UNITTEST + using System; using System.IO; -#if UNITTEST - using NUnit.Framework; using NUnit.Framework.SyntaxHelpers; diff --git a/Source/Plugins/PluginRepository.cs b/Source/Plugins/PluginRepository.cs index 8ec42eb..b3a4568 100644 --- a/Source/Plugins/PluginRepository.cs +++ b/Source/Plugins/PluginRepository.cs @@ -50,7 +50,7 @@ namespace Nuclex.Support.Plugins { /// Path the assembly will be loaded from /// The loaded assembly protected virtual Assembly LoadAssemblyFromFile(string path) { - return Assembly.LoadFile(path); + return Assembly.LoadFrom(path); } /// Tries to loads an assembly from a file @@ -66,6 +66,7 @@ namespace Nuclex.Support.Plugins { loadedAssembly = LoadAssemblyFromFile(path); return true; } +#if !COMPACTFRAMEWORK // File not found - Most likely a missing dependency of the assembly we // attempted to load since the assembly itself has been found by the GetFiles() method catch(DllNotFoundException) { @@ -73,6 +74,7 @@ namespace Nuclex.Support.Plugins { "Assembly '" + path + "' or one of its dependencies is missing" ); } +#endif // !COMPACTFRAMEWORK // Unauthorized acccess - Either the assembly is not trusted because it contains // code that imposes a security risk on the system or a user rights problem catch(UnauthorizedAccessException) { diff --git a/Source/Scheduling/AbortedException.Test.cs b/Source/Scheduling/AbortedException.Test.cs index d8ef9e4..43e39e3 100644 --- a/Source/Scheduling/AbortedException.Test.cs +++ b/Source/Scheduling/AbortedException.Test.cs @@ -18,12 +18,13 @@ License along with this library */ #endregion +#if UNITTEST + using System; using System.Collections.Generic; using System.IO; using System.Runtime.Serialization.Formatters.Binary; -#if UNITTEST using NUnit.Framework; using NMock2; diff --git a/Source/Scheduling/AbortedException.cs b/Source/Scheduling/AbortedException.cs index 9c63922..30f8dda 100644 --- a/Source/Scheduling/AbortedException.cs +++ b/Source/Scheduling/AbortedException.cs @@ -43,6 +43,8 @@ namespace Nuclex.Support.Scheduling { /// Preceding exception that has caused this exception public AbortedException(string message, Exception inner) : base(message, inner) { } +#if !COMPACTFRAMEWORK + /// Initializes the exception from its serialized state /// Contains the serialized fields of the exception /// Additional environmental informations @@ -52,6 +54,8 @@ namespace Nuclex.Support.Scheduling { ) : base(info, context) { } +#endif // !COMPACTFRAMEWORK + } } // namespace Nuclex.Support.Scheduling diff --git a/Source/Scheduling/Operation.Test.cs b/Source/Scheduling/Operation.Test.cs index a881232..2ed91c8 100644 --- a/Source/Scheduling/Operation.Test.cs +++ b/Source/Scheduling/Operation.Test.cs @@ -18,12 +18,13 @@ License along with this library */ #endregion +#if UNITTEST + using System; using System.Collections.Generic; using System.IO; using System.Runtime.Serialization.Formatters.Binary; -#if UNITTEST using NUnit.Framework; using NMock2; diff --git a/Source/Scheduling/ThreadCallbackOperation.Test.cs b/Source/Scheduling/ThreadCallbackOperation.Test.cs index 8ea5ea4..7ff5858 100644 --- a/Source/Scheduling/ThreadCallbackOperation.Test.cs +++ b/Source/Scheduling/ThreadCallbackOperation.Test.cs @@ -18,14 +18,14 @@ License along with this library */ #endregion +#if UNITTEST + using System; using System.Collections.Generic; using System.IO; using System.Runtime.Serialization.Formatters.Binary; using System.Threading; -#if UNITTEST - using NUnit.Framework; using NMock2; diff --git a/Source/Scheduling/ThreadOperation.Test.cs b/Source/Scheduling/ThreadOperation.Test.cs index 7194c21..60895e2 100644 --- a/Source/Scheduling/ThreadOperation.Test.cs +++ b/Source/Scheduling/ThreadOperation.Test.cs @@ -18,12 +18,13 @@ License along with this library */ #endregion +#if UNITTEST + using System; using System.Collections.Generic; using System.IO; using System.Runtime.Serialization.Formatters.Binary; -#if UNITTEST using NUnit.Framework; using NMock2; diff --git a/Source/Scheduling/ThreadOperation.cs b/Source/Scheduling/ThreadOperation.cs index 3727196..3efeef8 100644 --- a/Source/Scheduling/ThreadOperation.cs +++ b/Source/Scheduling/ThreadOperation.cs @@ -57,9 +57,9 @@ namespace Nuclex.Support.Scheduling { "Operations cannot be re-run" ); if(useThreadPool) { - ThreadPool.QueueUserWorkItem(callMethod); + ThreadPool.QueueUserWorkItem(new WaitCallback(callMethod)); } else { - Thread thread = new Thread(callMethod); + Thread thread = new Thread(new ThreadStart(callMethod)); thread.Name = "Nuclex.Support.Scheduling.ThreadOperation"; thread.IsBackground = true; thread.Start(); @@ -72,6 +72,11 @@ namespace Nuclex.Support.Scheduling { /// Invokes the delegate passed as an argument /// Not used private void callMethod(object state) { + callMethod(); + } + + /// Invokes the delegate passed as an argument + private void callMethod() { try { Execute(); Debug.Assert( diff --git a/Source/Tracking/Transaction.cs b/Source/Tracking/Transaction.cs index 2d4f74e..2fa579a 100644 --- a/Source/Tracking/Transaction.cs +++ b/Source/Tracking/Transaction.cs @@ -127,6 +127,8 @@ namespace Nuclex.Support.Tracking { WaitHandle.WaitOne(); } +#if !COMPACTFRAMEWORK + /// Waits until the background process finishes or a timeout occurs /// /// Time span after which to stop waiting and return immediately @@ -138,6 +140,8 @@ namespace Nuclex.Support.Tracking { return WaitHandle.WaitOne(timeout, false); } +#endif // !COMPACTFRAMEWORK + /// Waits until the background process finishes or a timeout occurs /// /// Number of milliseconds after which to stop waiting and return immediately diff --git a/Source/WeakReference.Test.cs b/Source/WeakReference.Test.cs index be65a21..2de849e 100644 --- a/Source/WeakReference.Test.cs +++ b/Source/WeakReference.Test.cs @@ -18,12 +18,12 @@ License along with this library */ #endregion +#if UNITTEST + using System; using System.IO; using System.Runtime.Serialization.Formatters.Binary; -#if UNITTEST - using NUnit.Framework; using NUnit.Framework.SyntaxHelpers; diff --git a/Source/WeakReference.cs b/Source/WeakReference.cs index a8f3aba..271e92d 100644 --- a/Source/WeakReference.cs +++ b/Source/WeakReference.cs @@ -52,6 +52,8 @@ namespace Nuclex.Support { public WeakReference(ReferencedType target, bool trackResurrection) : base(target, trackResurrection) { } +#if !COMPACTFRAMEWORK + /// /// Initializes a new instance of the WeakReference class, using deserialized /// data from the specified serialization and stream objects. @@ -70,6 +72,8 @@ namespace Nuclex.Support { protected WeakReference(SerializationInfo info, StreamingContext context) : base(info, context) { } +#endif // !COMPACTFRAMEWORK + /// /// Gets or sets the object (the target) referenced by the current WeakReference /// object.