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