Esempio n. 1
0
 public static bool CheckAbsoluteOutputFileName(string fn, string extensions)
 {
     try
     {
         if (!Path.IsPathRooted(fn))
         {
             StdDialog.ShowError("s_please_enter_full_path_to_file");
             return(false);
         }
         string dir = Path.GetDirectoryName(fn);
         if (!Directory.Exists(dir))
         {
             StdDialog.ShowError("s_output_directory_does_not_exist");
             return(false);
         }
         if (!IOTool.FileHasOneOfExtension(fn, extensions))
         {
             StdDialog.ShowError(Texts.Get("s_incorrect_file$extension", "extension", extensions.ToLower()));
             return(false);
         }
     }
     catch (Exception err)
     {
         StdDialog.ShowError(err.Message);
         return(false);
     }
     if (File.Exists(fn) && !StdDialog.ReallyOverwriteFile(fn))
     {
         return(false);
     }
     return(true);
 }