Ejemplo n.º 1
0
 static public FileTool LoadFile(UniFile file, FileTypePlugin plugin)
 {
     if (!AllowOpeningFilesTwice && s_openTools.ContainsKey(file.FilePath))
         return s_openTools[file.FilePath];
     FileTool tool;
     try
     {
         tool = plugin.LoadFile(file);
     }
     catch
     {
         UIHelper.ShowError("Can't open the selected file " + file.FileName + " using " + plugin.PluginName + ", version: " + plugin.Version + ".");
         return null;
     }
     tool.OnSaved += FileTool_OnSaved;
     if (s_openTools.ContainsKey(file.FilePath))
         s_openTools.Add(file.FilePath, tool);
     if (FileLoaded != null)
         FileLoaded(file, tool);
     return tool;
 }
Ejemplo n.º 2
0
 static public FileTool LoadFile(string path, FileTypePlugin plugin)
 {
     if (!File.Exists(path))
         return null;
     var file = new UniFile(path);
     return LoadFile(file, plugin);
 }