aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS_TheReturn/FileSkimmerBackend.cs
diff options
context:
space:
mode:
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)
{