aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS_TheReturn/FileSkimmerBackend.cs
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-06-28 08:19:44 -0400
committerMichael <[email protected]>2017-06-28 08:19:44 -0400
commit00cd41ea928781ad760cff3d14bd78d60758679d (patch)
tree1ce9714d71831cef82ebfd161827a4db54d90405 /ShiftOS_TheReturn/FileSkimmerBackend.cs
parentcd2190f6caa16e8d909aa1d662996d690772a67f (diff)
downloadshiftos_thereturn-00cd41ea928781ad760cff3d14bd78d60758679d.tar.gz
shiftos_thereturn-00cd41ea928781ad760cff3d14bd78d60758679d.tar.bz2
shiftos_thereturn-00cd41ea928781ad760cff3d14bd78d60758679d.zip
Slight... very slight... fileskimmer mods
Diffstat (limited to 'ShiftOS_TheReturn/FileSkimmerBackend.cs')
-rw-r--r--ShiftOS_TheReturn/FileSkimmerBackend.cs20
1 files changed, 13 insertions, 7 deletions
diff --git a/ShiftOS_TheReturn/FileSkimmerBackend.cs b/ShiftOS_TheReturn/FileSkimmerBackend.cs
index 090dc8e..ac20d34 100644
--- a/ShiftOS_TheReturn/FileSkimmerBackend.cs
+++ b/ShiftOS_TheReturn/FileSkimmerBackend.cs
@@ -46,14 +46,20 @@ namespace ShiftOS.Engine
/// <param name="path">The path to open.</param>
public static void OpenFile(string path)
{
- _fs.OpenFile(path);
+ if (!Objects.ShiftFS.Utils.FileExists(path))
+ throw new System.IO.FileNotFoundException("ShiftFS could not find the file specified.", path);
+ foreach (var type in ReflectMan.Types.Where(x => x.GetInterfaces().Contains(typeof(IFileHandler)) && Shiftorium.UpgradeAttributesUnlocked(x)))
+ {
+ foreach(FileHandlerAttribute attrib in type.GetCustomAttributes(false).Where(x => x is FileHandlerAttribute))
+ {
+ if (path.ToLower().EndsWith(attrib.Extension))
+ {
+ var obj = (IFileHandler)Activator.CreateInstance(type);
+ obj.OpenFile(path);
+ }
+ }
+ }
}
-
- /// <summary>
- /// Gets the file type of a given path.
- /// </summary>
- /// <param name="path">The path to check</param>
- /// <returns>The FileType of the path</returns>
public static FileType GetFileType(string path)
{