コード例 #1
0
ファイル: AddPlugin.cs プロジェクト: radtek/Tailviewer
 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);
     }
 }