diff --git a/OpenRa.Core/FileSystem.cs b/OpenRa.Core/FileSystem.cs deleted file mode 100644 index f1ddf5f648..0000000000 --- a/OpenRa.Core/FileSystem.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.IO; - -namespace OpenRa.Core -{ - public static class FileSystem - { - static List packages = new List(); - - public static void Mount(IPackage package) - { - packages.Add(package); - } - - internal static Stream GetItem(string filename) - { - foreach (IPackage package in packages) - { - Stream s = package.GetItem(filename); - if (s != null) - return s; - } - - return null; - } - } -} diff --git a/OpenRa.Core/IPackage.cs b/OpenRa.Core/IPackage.cs deleted file mode 100644 index e303ea8d31..0000000000 --- a/OpenRa.Core/IPackage.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.IO; - -namespace OpenRa.Core -{ - public interface IPackage - { - Stream GetItem(string filename); - } -} diff --git a/OpenRa.Core/OpenRa.Core.csproj b/OpenRa.Core/OpenRa.Core.csproj deleted file mode 100644 index f8449b8ca8..0000000000 --- a/OpenRa.Core/OpenRa.Core.csproj +++ /dev/null @@ -1,53 +0,0 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {1B60782F-B2DD-43F1-B51D-B798485F317C} - Library - Properties - OpenRa.Core - OpenRa.Core - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/OpenRa.Core/Properties/AssemblyInfo.cs b/OpenRa.Core/Properties/AssemblyInfo.cs deleted file mode 100644 index 2827833515..0000000000 --- a/OpenRa.Core/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("OpenRa.Core")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("OpenRa.Core")] -[assembly: AssemblyCopyright("Copyright © 2007")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -[assembly: ComVisible(false)] - -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/OpenRa.Core/Reflect.cs b/OpenRa.Core/Reflect.cs deleted file mode 100644 index 09a5d4bb5e..0000000000 --- a/OpenRa.Core/Reflect.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenRa.Core -{ - static class Reflect - { - public static T GetAttribute(Type t) - where T : Attribute - { - T[] attribs = (T[])t.GetCustomAttributes(typeof(T), false); - if (attribs == null || attribs.Length == 0) - return null; - return attribs[0]; - } - } -} diff --git a/OpenRa.Core/Resource.cs b/OpenRa.Core/Resource.cs deleted file mode 100644 index 5dbd559f91..0000000000 --- a/OpenRa.Core/Resource.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenRa.Core -{ - public interface IResource { } - - public abstract class Resource : IResource - where T : Resource - { - public static T Get(string filename) - { - return (T)ResourceCache.Get(filename); - } - } -} diff --git a/OpenRa.Core/ResourceBindingAttribute.cs b/OpenRa.Core/ResourceBindingAttribute.cs deleted file mode 100644 index f6c950c015..0000000000 --- a/OpenRa.Core/ResourceBindingAttribute.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenRa.Core -{ - public class ResourceBindingAttribute : Attribute - { - internal readonly string[] Extensions; - - public ResourceBindingAttribute(params string[] extensions) - { - Extensions = extensions; - } - } -} diff --git a/OpenRa.Core/ResourceCache.cs b/OpenRa.Core/ResourceCache.cs deleted file mode 100644 index b1748344ba..0000000000 --- a/OpenRa.Core/ResourceCache.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.IO; - -namespace OpenRa.Core -{ - static class ResourceCache - { - static Dictionary items = new Dictionary(); - - public static void Flush() - { - items.Clear(); - } - - public static IResource Get(string filename) - { - IResource r; - if (!items.TryGetValue(filename, out r)) - items.Add(filename, r = Load(filename)); - return r; - } - - static IResource Load(string filename) - { - Converter loader = - ResourceLoader.GetLoader(Path.GetExtension(filename)); - - if (loader == null) - return null; - - Stream s = FileSystem.GetItem(filename); - - if (s == null) - return null; - - return loader(s); - } - } -} diff --git a/OpenRa.Core/ResourceLoader.cs b/OpenRa.Core/ResourceLoader.cs deleted file mode 100644 index c15b4bc447..0000000000 --- a/OpenRa.Core/ResourceLoader.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Reflection; - -namespace OpenRa.Core -{ - static class ResourceLoader - { - static Dictionary> loaders = - new Dictionary>(); - - static ResourceLoader() - { - foreach (Assembly a in AppDomain.CurrentDomain.GetAssemblies()) - BindTypes(a); - - AppDomain.CurrentDomain.AssemblyLoad += - delegate(object unused, AssemblyLoadEventArgs e) { BindTypes(e.LoadedAssembly); }; - } - - static void BindTypes(Assembly a) - { - foreach (Type t in a.GetTypes()) - BindType(t); - } - - static void BindType(Type t) - { - ResourceBindingAttribute a = Reflect.GetAttribute(t); - if (a == null) - return; - - ConstructorInfo ctor = t.GetConstructor(new Type[] { typeof(Stream) }); - if (ctor == null) - return; - - Converter loader = delegate(Stream s) - { - return (IResource)ctor.Invoke(new object[] { s }); - }; - - foreach (string extension in a.Extensions) - loaders.Add(extension, loader); - } - - public static Converter GetLoader(string extension) - { - Converter result; - loaders.TryGetValue(extension.ToLowerInvariant(), out result); - return result; - } - } -} diff --git a/OpenRa.FileFormats/OpenRa.FileFormats.csproj b/OpenRa.FileFormats/OpenRa.FileFormats.csproj index 200e98133b..a5d6eb0fa8 100644 --- a/OpenRa.FileFormats/OpenRa.FileFormats.csproj +++ b/OpenRa.FileFormats/OpenRa.FileFormats.csproj @@ -54,12 +54,6 @@ - - - {1B60782F-B2DD-43F1-B51D-B798485F317C} - OpenRa.Core - -