[longomatch] Guard for more errors in projects imports



commit e440e8184c724b2a824c95d1ce712d151e1abf3f
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Mon Oct 6 07:51:02 2014 +0200

    Guard for more errors in projects imports

 LongoMatch.Services/Services/ToolsManager.cs |   45 ++++++++++++-------------
 1 files changed, 22 insertions(+), 23 deletions(-)
---
diff --git a/LongoMatch.Services/Services/ToolsManager.cs b/LongoMatch.Services/Services/ToolsManager.cs
index 0c601a7..dab8ba1 100644
--- a/LongoMatch.Services/Services/ToolsManager.cs
+++ b/LongoMatch.Services/Services/ToolsManager.cs
@@ -171,34 +171,33 @@ namespace LongoMatch.Services
                                } else {
                                        throw new Exception (Catalog.GetString ("Plugin not found"));
                                }
+                               if (importer.NeedsEdition) {
+                                       Config.EventsBroker.EmitNewProject (project);
+                               } else {
+                                       if (!project.Description.FileSet.CheckFiles ()) {
+                                               if (!guiToolkit.SelectMediaFiles (project)) {
+                                                       guiToolkit.ErrorMessage ("No valid video files 
associated. The project will not be imported");
+                                                       return;
+                                               }
+                                       }
+                                       /* If the project exists ask if we want to overwrite it */
+                                       if (DB.Exists (project)) {
+                                               var res = guiToolkit.QuestionMessage (Catalog.GetString ("A 
project already exists for this ID:") +
+                                                                                     project.ID + "\n" +     
  Catalog.GetString ("Do you want to overwrite it?"), null);
+                                               if (!res)
+                                                       return;
+                                               DB.UpdateProject (project);
+                                       } else {
+                                               DB.AddProject (project);
+                                       }
+                                       Config.EventsBroker.EmitOpenProjectID (project.ID);
+                               }
                        } catch (Exception ex) {
                                guiToolkit.ErrorMessage (Catalog.GetString ("Error importing project:") +
-                                       "\n" + ex.Message);
+                                                        "\n" + ex.Message);
                                Log.Exception (ex);
                                return;
                        }
-
-                       if (importer.NeedsEdition) {
-                               Config.EventsBroker.EmitNewProject (project);
-                       } else {
-                               if (!project.Description.FileSet.CheckFiles ()) {
-                                       if (!guiToolkit.SelectMediaFiles (project)) {
-                                               guiToolkit.ErrorMessage ("No valid video files associated. 
The project will not be imported");
-                                               return;
-                                       }
-                               }
-                               /* If the project exists ask if we want to overwrite it */
-                               if (DB.Exists (project)) {
-                                       var res = guiToolkit.QuestionMessage (Catalog.GetString ("A project 
already exists for this ID:") +
-                                               project.ID + "\n" +     Catalog.GetString ("Do you want to 
overwrite it?"), null);
-                                       if (!res)
-                                               return;
-                                       DB.UpdateProject (project);
-                               } else {
-                                       DB.AddProject (project);
-                               }
-                               Config.EventsBroker.EmitOpenProjectID (project.ID);
-                       }
                }
        }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]