Made Nuclex.Support compileable on the XBox 360; added new XNA 3.0 project to compile Nuclex.Support on the XBox 360; added my own AssemblyLoadEventArgs implementation since the XBox 360 XNA framework doesn't provide it; other minor fixes so Nuclex.Support can cope with the XBox 360 XNA framework

git-svn-id: file:///srv/devel/repo-conversion/nusu@113 d2e56fa2-650e-0410-a79f-9358c0239efd
This commit is contained in:
Markus Ewald 2009-01-13 18:50:52 +00:00
parent 8f6616f79a
commit 0a483b4d44
19 changed files with 473 additions and 28 deletions

View file

@ -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 {
/// <summary>Unit Test for the assembly load event argument container</summary>
[TestFixture]
public class AssemblyLoadEventArgsTest {
/// <summary>
/// Tests whether the argument container correctly stores an assembly reference
/// </summary>
[Test]
public void TestEmployerDefaultConstructorDetection() {
Assembly assembly = Assembly.GetExecutingAssembly();
AssemblyLoadEventArgs testArguments = new AssemblyLoadEventArgs(assembly);
Assert.AreSame(assembly, testArguments.LoadedAssembly);
}
}
} // namespace Nuclex.Support.Plugins
#endif // UNITTEST

View file

@ -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 {
/// <summary>Signature for the AssemblyLoad event</summary>
/// <param name="sender">Object that is reporting that an assembly was loaded</param>
/// <param name="arguments">Contains the loaded assembly</param>
public delegate void AssemblyLoadEventHandler(
object sender, AssemblyLoadEventArgs arguments
);
/// <summary>Argument container for the AssemblyLoad event arguments</summary>
public class AssemblyLoadEventArgs : EventArgs {
/// <summary>Initializes a new event argument container</summary>
/// <param name="loadedAssembly">Assembly that has been loaded</param>
public AssemblyLoadEventArgs(Assembly loadedAssembly) {
this.loadedAssembly = loadedAssembly;
}
/// <summary>Assembly that was loaded by the sender of the event</summary>
public Assembly LoadedAssembly {
get { return this.loadedAssembly; }
}
/// <summary>Loaded assembly that will be provided to the event receivers</summary>
private Assembly loadedAssembly;
}
} // namespace Nuclex.Support.Plugins

View file

@ -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;

View file

@ -50,7 +50,7 @@ namespace Nuclex.Support.Plugins {
/// <param name="path">Path the assembly will be loaded from</param>
/// <returns>The loaded assembly</returns>
protected virtual Assembly LoadAssemblyFromFile(string path) {
return Assembly.LoadFile(path);
return Assembly.LoadFrom(path);
}
/// <summary>Tries to loads an assembly from a file</summary>
@ -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) {