Beispiel #1
0
 private static bool TryLoadPlugin(IFilesystem filesystem, string fileName,
                                   out byte[] plugin,
                                   out ExitCode exitCode)
 {
     try
     {
         plugin   = filesystem.ReadAllBytes(fileName);
         exitCode = ExitCode.Success;
         return(true);
     }
     catch (DirectoryNotFoundException e)
     {
         Log.ErrorFormat("Unable to add plugin: {0}", e.Message);
         plugin   = null;
         exitCode = ExitCode.DirectoryNotFound;
         return(false);
     }
     catch (FileNotFoundException e)
     {
         Log.ErrorFormat("Unable to add plugin: {0}", e.Message);
         plugin   = null;
         exitCode = ExitCode.FileNotFound;
         return(false);
     }
 }