From 00cd41ea928781ad760cff3d14bd78d60758679d Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 28 Jun 2017 08:19:44 -0400 Subject: Slight... very slight... fileskimmer mods --- ShiftOS_TheReturn/FileSkimmerBackend.cs | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'ShiftOS_TheReturn/FileSkimmerBackend.cs') 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 /// The path to open. 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); + } + } + } } - - /// - /// Gets the file type of a given path. - /// - /// The path to check - /// The FileType of the path public static FileType GetFileType(string path) { -- cgit v1.2.3