Exemple #1
0
        Result IExternalCommand.Execute(
            ExternalCommandData excmd,
            ref string mainmessage,
            ElementSet elemset)
        {
            CurrentApplication = excmd.Application;
            UiDocument         = CurrentApplication.ActiveUIDocument;
            CurrentDocument    = CurrentApplication.ActiveUIDocument.Document;

            // draw box for area or pick a named scope box
            var view = Create3DViewFromArea();

            if (view == null)
            {
                throw new CancellableException();
            }

            // create options for export
            var opts = new NavisworksExportOptions
            {
                ConvertElementProperties = true,
                Coordinates = NavisworksCoordinates.Shared,
                ExportLinks = true,
                ExportScope = NavisworksExportScope.View,
                ViewId      = CurrentDocument.ActiveView.Id
            };

            // if the export of a specific VIEW for each linked model doesn't work -
            // open other linked Revit models and create the same 3D for each

            // create folders and other variables
            var projFolder    = FindProjectFolder(CurrentDocument);
            var projNumber    = GetProjectNumber(projFolder);
            var navisFileName = $"{projNumber}_ALL";
            var fullNavPath   = Directory.GetParent(projFolder)?.Parent?.FullName + @"\NAVIS\" + navisFileName + ".nwc";
            var navisFolder   = Directory.GetParent(fullNavPath).FullName;

            // export to NWC
            const string testFolder = @"C:\_Revit\";

            CurrentDocument.Export(testFolder, navisFileName, opts);
            //CurrentDocument.Export(navisFolder, navisFileName, opts);

            // starts clash detection in separate thread
            //StartClashDetectionThread(fullNavPath);

            return(Result.Succeeded);

            // switch over to Navisworks context

            /*
             * Append all files
             * import Search Sets
             * import Clash Tests
             * Run Clash Tests
             * Split based on typical responsibility
             * Export to HTML
             * Export to Viewpoints
             */
        }
        public void NWC_Export(UIApplication uiapp, string FileName, string NWCFileName)
        {
            ModelPath mp = ModelPathUtils.ConvertUserVisiblePathToModelPath(FileName);

            OpenOptions options1 = new OpenOptions
            {
                DetachFromCentralOption = DetachFromCentralOption.DetachAndDiscardWorksets
            };

            Document doc = uiapp.Application.OpenDocumentFile(mp, options1);

            //Empty models exclusion
            DS_IsEmptyModel dS_IsEmptyModel = new DS_IsEmptyModel();

            if (dS_IsEmptyModel.IsEmptyModel(doc))
            {
                EmptyModels.Add(FileName);
                doc.Close(false);
                return;
            }

            //Linkes models exclusion
            if (doc.IsLinked)
            {
                LinkedDocs.Add(FileName);
                doc.Close(false);
                return;
            }

            string dirName = GetDirNWC(NWCFileName);

            // Get a reference to each file in that directory.
            string OutputPath = DestinationPath + "\\" + dirName + "\\";

            //Options for Navisworks export
            NavisworksExportOptions nweo = new NavisworksExportOptions
            {
                ExportScope          = NavisworksExportScope.View,
                ViewId               = NW_View(doc).Id,
                ExportRoomGeometry   = false,
                DivideFileIntoLevels = false,
                ExportParts          = true
            };

            doc.Export(OutputPath, NWCFileName, nweo);

            FileFiltered.Add(OutputPath + NWCFileName + ".nwc");

            doc.Close(false);
        }
Exemple #3
0
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            UIApplication rvtUIAPP = commandData.Application;
            UIDocument    uidoc    = rvtUIAPP.ActiveUIDocument;

            m_rvtDoc = uidoc.Document;
            m_rvtApp = rvtUIAPP.Application;
            Configuration config = ConfigurationManager.OpenExeConfiguration
                                       (System.Reflection.Assembly.GetExecutingAssembly().Location);
            string familyRepo = config.AppSettings.Settings["Family_repo_folder"].Value;
            string serverAPI  = config.AppSettings.Settings["Server_API"].Value;

            try
            {
                string[] filePaths = Directory.GetFiles(@familyRepo, "*.rfa");
                foreach (string path in filePaths)
                {
                    Document doc      = m_rvtApp.OpenDocumentFile(path);
                    string   filename = Path.GetFileName(path).Split('.')[0] + ".nwc";
                    try
                    {
                        NavisworksExportOptions options = new NavisworksExportOptions();
                        options.ExportScope = NavisworksExportScope.Model;
                        options.ViewId      = uidoc.ActiveView.Id;

                        //doc.ActiveView.DetailLevel = ViewDetailLevel.Fine;
                        //doc.ActiveView.DisplayStyle = DisplayStyle.Realistic;
                        doc.Export(@familyRepo, filename, options);
                    }
                    catch (Exception e)
                    {
                        TaskDialog.Show("Error", filename + ":\n" + e.Message);
                    }
                }

                return(Result.Succeeded);
            }
            catch (Exception e)
            {
                message = e.Message;
                return(Result.Failed);
            }
        }
        public Result Execute(
            ExternalCommandData commandData,
            ref string message,
            ElementSet elements)
        {
#if !VERSION2014
            Debug.Print("Version 2013");
#else
            Debug.Print("Version 2014");
#endif // VERSION2014
            UIApplication uiapp = commandData.Application;
            UIDocument    uidoc = uiapp.ActiveUIDocument;
            Application   app   = uiapp.Application;
            Document      doc   = uidoc.Document;

            bool isNavisAvailable = OptionalFunctionalityUtils.IsNavisworksExporterAvailable();
            if (isNavisAvailable)
            {
                _default3dView = new FilteredElementCollector(doc).OfClass(typeof(View3D)).FirstElement() as View3D;

                NavisworksExportOptions neo = new NavisworksExportOptions();
                m_neo                      = neo;
                m_neo.ExportScope          = NavisworksExportScope.View;
                m_neo.FindMissingMaterials = false;

                Form1 formDialog = new Form1(doc, m_neo);
                System.Windows.Forms.DialogResult dr = formDialog.ShowDialog();

                if (dr == System.Windows.Forms.DialogResult.OK)
                {
                    return(Result.Succeeded);
                }
                else
                {
                    return(Result.Cancelled);
                }
            }
            else
            {
                TaskDialog.Show("Error", "No Compatible Navisworks plugins found. Please install a compatible Navisworks exporter to use with Revit.");
                return(Result.Failed);
            }
        }
        public static bool GetExportOptionsInfo(Document doc, NavisworksExportOptions neo)
        {
            try
            {
                string projectPath = doc.PathName;
                string optionsFile = projectPath.Substring(0, projectPath.Length - 4) + fileExtension;

                if (File.Exists(optionsFile))
                {
                    StreamReader sr = new StreamReader(optionsFile);

                    while (!sr.EndOfStream)
                    {
                        string s = sr.ReadLine();
                        string[] splitter = s.Split('|');
                        if (splitter[0] == "ViewId")
                        {
                            int id = -1;
                            int.TryParse(splitter[1], out id);
                            neo.ViewId = new ElementId(id);
                            Options._exportView = doc.GetElement(neo.ViewId) as View3D;
                        }
                        if (splitter[0] == "Folder")
                        {
                            Options._folderExport = splitter[1];
                        }
                    }
                    sr.Close();
                    return true;
                }
                else
                {
                    Options._exportView = Options._default3dView;
                    return true;
                }
            }
            catch (Exception)
            {
                TaskDialog.Show("Error", "Please save your project before editing Navisworks Export Options.");
                return false;
            }
        }
        public static bool GetExportOptionsInfo(Document doc, NavisworksExportOptions neo)
        {
            try
            {
                string projectPath = doc.PathName;
                string optionsFile = projectPath.Substring(0, projectPath.Length - 4) + fileExtension;

                if (File.Exists(optionsFile))
                {
                    StreamReader sr = new StreamReader(optionsFile);

                    while (!sr.EndOfStream)
                    {
                        string   s        = sr.ReadLine();
                        string[] splitter = s.Split('|');
                        if (splitter[0] == "ViewId")
                        {
                            int id = -1;
                            int.TryParse(splitter[1], out id);
                            neo.ViewId          = new ElementId(id);
                            Options._exportView = doc.GetElement(neo.ViewId) as View3D;
                        }
                        if (splitter[0] == "Folder")
                        {
                            Options._folderExport = splitter[1];
                        }
                    }
                    sr.Close();
                    return(true);
                }
                else
                {
                    Options._exportView = Options._default3dView;
                    return(true);
                }
            }
            catch (Exception)
            {
                TaskDialog.Show("Error", "Please save your project before editing Navisworks Export Options.");
                return(false);
            }
        }
        public Result Execute(
          ExternalCommandData commandData,
          ref string message,
          ElementSet elements)
        {
            #if !VERSION2014
            Debug.Print("Version 2013");
            #else
            Debug.Print("Version 2014");
            #endif // VERSION2014
            UIApplication uiapp = commandData.Application;
            UIDocument uidoc = uiapp.ActiveUIDocument;
            Application app = uiapp.Application;
            Document doc = uidoc.Document;

            bool isNavisAvailable = OptionalFunctionalityUtils.IsNavisworksExporterAvailable();
            if (isNavisAvailable)
            {

                _default3dView = new FilteredElementCollector(doc).OfClass(typeof(View3D)).FirstElement() as View3D;

                NavisworksExportOptions neo = new NavisworksExportOptions();
                m_neo = neo;
                m_neo.ExportScope = NavisworksExportScope.View;
                m_neo.FindMissingMaterials = false;

                Form1 formDialog = new Form1(doc, m_neo);
                System.Windows.Forms.DialogResult dr = formDialog.ShowDialog();

                if (dr == System.Windows.Forms.DialogResult.OK)
                {
                    return Result.Succeeded;
                }
                else
                    return Result.Cancelled;
            }
            else
            {
                TaskDialog.Show("Error", "No Compatible Navisworks plugins found. Please install a compatible Navisworks exporter to use with Revit.");
                return Result.Failed;
            }
        }
        public static bool WriteExportOptionsInfo(Document doc, NavisworksExportOptions neo)
        {
            string projectPath = doc.PathName;
            string optionsFile = projectPath.Substring(0, projectPath.Length - 4) + fileExtension;

            StreamWriter sw = new StreamWriter(optionsFile, false);

            foreach (PropertyInfo p in neo.GetType().GetProperties())
            {
                string s = p.Name + "|" + p.GetValue(neo, null).ToString();
                sw.WriteLine(s);
            }

            //Write Path for save
            sw.WriteLine("Folder|" + Options._folderExport);

            //Write viewName for save
            sw.WriteLine("ViewName|" + Options._exportView.Name);

            sw.Close();
            return(true);
        }
        private bool ExportNWC(Document doc, string folder, string name, ElementId viewid, bool shared)
        {
            NavisworksExportOptions navisoptions = new NavisworksExportOptions();

            if (shared)
            {
                navisoptions.Coordinates = NavisworksCoordinates.Shared;
            }
            else
            {
                navisoptions.Coordinates = NavisworksCoordinates.Internal;
            }

            navisoptions.ConvertElementProperties = true;
            navisoptions.Parameters = NavisworksParameters.All;
            navisoptions.ConvertLinkedCADFormats = true;
            navisoptions.ExportLinks             = false;
            navisoptions.ExportRoomAsAttribute   = true;
            navisoptions.ExportUrls           = true;
            navisoptions.DivideFileIntoLevels = true;
            navisoptions.ExportRoomGeometry   = true;
            navisoptions.ViewId               = viewid;
            navisoptions.FacetingFactor       = 1;
            navisoptions.FindMissingMaterials = true;
            navisoptions.ExportScope          = NavisworksExportScope.View;

            try
            {
                doc.Export(folder, name, navisoptions);
                return(true);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message, "Error");
                //string message = e.Message;
                return(false);
            }
        }
Exemple #10
0
 public Form1(Document doc, NavisworksExportOptions neo)
 {
     InitializeComponent();
     m_doc = doc;
     m_neo = neo;
 }
Exemple #11
0
        // Method definition. This kind of Revit methods has to return a Result
        public Result Execute(
            ExternalCommandData commandData,
            ref string message,
            ElementSet elements)
        {
            // Get application and document objects
            UIApplication uiapp = commandData.Application;
            UIDocument    uidoc = uiapp.ActiveUIDocument;

            Autodesk.Revit.ApplicationServices.Application app = uiapp.Application;
            Autodesk.Revit.DB.Document doc = uidoc.Document;

            // Get 3D views which name ends with "NWC"
            List <Autodesk.Revit.DB.View> NWC3DViews = new FilteredElementCollector(doc).
                                                       OfClass(typeof(Autodesk.Revit.DB.View)).ToElements().
                                                       Cast <Autodesk.Revit.DB.View>().
                                                       // Select only 3D views which name ends with "IFC"
                                                       Where(x => x.ViewType == ViewType.ThreeD &&
                                                             !x.IsTemplate &&
                                                             x.ViewName.ToLower().EndsWith("nwc")).
                                                       ToList();

            // Initialize the file browser and its settings
            CommonOpenFileDialog foldBrowser = FolderBrowserInitializer();

            // Overwrite some settings
            foldBrowser.Title       = "Select Export Folder";
            foldBrowser.Multiselect = false;

            // Initialise variable to store folder path
            string folder = null;

            // Check if user's input
            if (foldBrowser.ShowDialog() == CommonFileDialogResult.Ok)
            {
                // Store folder destination from folder browser
                folder = foldBrowser.FileName;
            }
            else
            {
                // Create pop up message to interact with user
                MessageBox.Show("Ok, no worries. I'll be here when you need me.",
                                "Abort",
                                // Set which buttons to show in window
                                MessageBoxButtons.OK,
                                // Set symbol to show in window
                                MessageBoxIcon.Information);
                return(Result.Cancelled);
            }

            // Create options object
            NavisworksExportOptions options = new NavisworksExportOptions();

            // You can leave it as it is if you don't want to customise any option
            options.DivideFileIntoLevels  = false;
            options.ExportRoomGeometry    = false;
            options.ExportRoomAsAttribute = false;
            options.ExportUrls            = false;
            options.FindMissingMaterials  = false;

            // Initialise counter
            int count = 0;

            // Loop through all views in list above (do something for each of them)
            foreach (Autodesk.Revit.DB.View v in NWC3DViews)
            {
                // Set remaining options for each view
                options.ExportScope = NavisworksExportScope.View;
                options.ViewId      = v.Id;
                options.ExportLinks = true;

                // Try-Catch = try to do this, but if you catch an error, do that
                try
                {
                    // Export view. The method requires a path where to save,
                    // the name of the file to save and any option
                    doc.Export(folder, v.Name + ".nwc", options);
                    // Add one to the counter
                    count++;
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString(), "Ooops, something happened");
                }
            }

            // Recap to user telling the process is done
            Autodesk.Revit.UI.TaskDialog.Show("Recap", $"I successfully exported {count} views!");

            // If everything's fine, tell Revit it succeeded.
            return(Result.Succeeded);
        }
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            //Get application and documnet objects
            UIApplication uiapp = commandData.Application;
            Document      doc   = uiapp.ActiveUIDocument.Document;

            //Navisworks export settings
            NavisworksExportOptions opt = new NavisworksExportOptions
            {
                ExportScope              = NavisworksExportScope.View,
                Coordinates              = NavisworksCoordinates.Internal,
                DivideFileIntoLevels     = true,
                ExportUrls               = false,
                ExportRoomGeometry       = false,
                ConvertElementProperties = true,
                ExportElementIds         = true,
                ExportLinks              = false
            };

            //Initiates Radio buttons form for choosing export coordinates
            var f = new Export_3d_views.Select_Settings();

            f.ShowDialog();

            //sets coordinates setting based on buttons in form
            if (f.rdoChecked == "shared")
            {
                opt.Coordinates = NavisworksCoordinates.Shared;
                TaskDialog.Show("Coordinates", "Using" + " " + opt.Coordinates.ToString() + " " + "Coordinates");
            }
            else
            {
                TaskDialog.Show("Coordinates", "Using" + " " + opt.Coordinates.ToString() + " " + "Coordinates");
            }

            //sets Export linked files setting based on buttons in form
            if (f.LrdoChecked == "yes")
            {
                opt.ExportLinks = true;
                TaskDialog.Show("Linked Files", "Linked files will be exported");
            }
            else
            {
                TaskDialog.Show("Linked Files", "Linked files will NOT be exported");
            }

            //collect #d views in revit
            FilteredElementCollector viewCollector = new FilteredElementCollector(doc);

            viewCollector.OfClass(typeof(View3D));

            //list of views to send to the from
            List <string> listViewNames = new List <string>();

            foreach (View3D view in viewCollector)
            {
                listViewNames.Add(view.Name);
            }

            //initate list of views form
            var l = new Export_3d_views.ViewList(listViewNames);

            l.ShowDialog();


            //select save folder
            string folderPath = "";
            FolderBrowserDialog folderBrowserDialog1 = new FolderBrowserDialog();

            if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
            {
                folderPath = folderBrowserDialog1.SelectedPath;
            }

            //list of views exported
            List <string> threeDlist = new List <string>();

            //check if revit view is in list and export to NWC if it is
            if (l.ExportViewList.Count > 0)
            {
                foreach (View3D view in viewCollector)
                {
                    foreach (var item in l.ExportViewList)
                    {
                        if (view.Name == item)
                        {
                            opt.ViewId = view.Id;
                            threeDlist.Add(view.Name);
                            doc.Export(folderPath, view.Name + ".nwc", opt);
                        }
                    }
                }
            }
            else
            {
                TaskDialog.Show("view error", "Must select one view for export");
                l.ShowDialog();
            }

            //Display form listing views that were exported
            var d = new Export_3d_views.ExportedList(threeDlist);

            d.ShowDialog();

            return(Result.Succeeded);
        }
Exemple #13
0
        public static bool WriteExportOptionsInfo(Document doc, NavisworksExportOptions neo)
        {
            string projectPath = doc.PathName;
            string optionsFile = projectPath.Substring(0, projectPath.Length - 4) + fileExtension;

            StreamWriter sw = new StreamWriter(optionsFile,false);

            foreach (PropertyInfo p in neo.GetType().GetProperties())
            {
                string s = p.Name + "|" + p.GetValue(neo, null).ToString();
                sw.WriteLine(s);
            }

            //Write Path for save
            sw.WriteLine("Folder|" + Options._folderExport);

            //Write viewName for save
            sw.WriteLine("ViewName|" + Options._exportView.Name);

            sw.Close();
            return true;
        }
Exemple #14
0
        public Result Execute(
            ExternalCommandData commandData,
            ref string message,
            ElementSet elements)
        {
            UIApplication uiapp     = commandData.Application;
            UIDocument    uidoc     = uiapp.ActiveUIDocument;
            Application   app       = uiapp.Application;
            Document      doc       = uidoc.Document;
            ViewSet       myViewSet = new ViewSet();

            //create NWExportOptions
            NavisworksExportOptions nweOptions = new NavisworksExportOptions();

            nweOptions.ExportScope = NavisworksExportScope.View;


            // create a new ViewSet - add views to it that match the desired criteria

            string match = "Export";

            // Use Title on Sheet for select the export views.
            string display = "List of Views:";

            foreach (View vs in new FilteredElementCollector(doc).OfClass(typeof(View)).Cast <View>())
            {
                if (vs.IsTemplate == false && vs.Category != null && vs.get_Parameter(BuiltInParameter.VIEW_DESCRIPTION).AsString().Contains(match))
                {
                    myViewSet.Insert(vs);
                    display = display + Environment.NewLine + vs.Title;
                }
            }

            Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
            Nullable <bool> result             = dlg.ShowDialog();

            if (result == true)
            {
                string path = dlg.FileName;
                path = path.Remove(dlg.FileName.LastIndexOf(@"\")) + "\\NWC";
                TaskDialog td = new TaskDialog("Exporting Navis");
                td.MainInstruction = myViewSet.Size + " Views will be Exported to: " + path;
                td.CommonButtons   = TaskDialogCommonButtons.Ok | TaskDialogCommonButtons.No;
                td.ExpandedContent = display;
                TaskDialogResult response = td.Show();
                if ((response != TaskDialogResult.Cancel) && (response != TaskDialogResult.No))
                {
                    if (!Directory.Exists(path))
                    {
                        Directory.CreateDirectory(path);
                    }

                    foreach (View View in myViewSet)
                    {
                        nweOptions.ViewId = View.Id;
                        doc.Export(path, View.get_Parameter(BuiltInParameter.VIEW_NAME).AsString() + ".nwc", options: nweOptions);
                    }
                }
            }
            return(Result.Succeeded);
        }
Exemple #15
0
 public bool ValidateExportOptions(Document document, string folder, string name, NavisworksExportOptions options,
                                   out string exceptionMessage)
 {
     throw new NotImplementedException();
 }
Exemple #16
0
 public void Export(Document document, string folder, string name, NavisworksExportOptions options)
 {
     throw new NotImplementedException();
 }
Exemple #17
0
 public Form1(Document doc, NavisworksExportOptions neo)
 {
     InitializeComponent();
     m_doc = doc;
     m_neo = neo;
 }
Exemple #18
0
        public Result Execute(
            ExternalCommandData commandData,
            ref string message,
            ElementSet elements)
        {
            UIApplication uiapp     = commandData.Application;
            UIDocument    uidoc     = uiapp.ActiveUIDocument;
            Application   app       = uiapp.Application;
            Document      doc       = uidoc.Document;
            ViewSet       myViewSet = new ViewSet();

            //create ExportOptions
            DWGExportOptions DwgOptions = new DWGExportOptions();

            DwgOptions.ExportingAreas = false;
            DwgOptions.MergedViews    = true;

            NavisworksExportOptions nweOptions = new NavisworksExportOptions();

            nweOptions.ExportScope = NavisworksExportScope.View;

            // create a new ViewSet - add views to it that match the desired criteria

            string match = "Export";

            // Use Title on Sheet for select the export views

            foreach (View vs in new FilteredElementCollector(doc).OfClass(typeof(View)).Cast <View>())
            {
                if (vs.IsTemplate == false && vs.Category != null && vs.get_Parameter(BuiltInParameter.VIEW_DESCRIPTION).AsString().Contains(match))
                {
                    myViewSet.Insert(vs);
                }
            }

            List <ElementId> viewIds = new List <ElementId>();
            string           display = "List of Views:";

            Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
            Nullable <bool> result             = dlg.ShowDialog();

            if (result == true)
            {
                string path     = dlg.FileName;
                string rootpath = path.Remove(dlg.FileName.LastIndexOf(@"\"));
                path = path.Remove(dlg.FileName.LastIndexOf(@"\")) + "\\NWC";
                TaskDialog td = new TaskDialog("Exporting DWGs");
                td.MainInstruction = myViewSet.Size + " Views will be Exported to: " + path;
                td.CommonButtons   = TaskDialogCommonButtons.Ok | TaskDialogCommonButtons.No;
                td.ExpandedContent = display;
                TaskDialogResult response = td.Show();
                if ((response != TaskDialogResult.Cancel) && (response != TaskDialogResult.No))
                {
                    if (!Directory.Exists(path))
                    {
                        Directory.CreateDirectory(path);
                    }

                    TaskDialog.Show("Exporting to Navis and DWG", myViewSet.Size + " Views will be Exported to: " + rootpath);
                    // export
                    var ToRename = new List <String>();
                    foreach (View View in myViewSet)
                    {
                        nweOptions.ViewId = View.Id;
                        doc.Export(path, View.get_Parameter(BuiltInParameter.VIEW_NAME).AsString() + ".nwc", options: nweOptions);
                        viewIds.Add(View.Id);
                        display = display + Environment.NewLine + View.Title;
                        String Filename = doc.Title.Replace(" ", "") + "-" + View.get_Parameter(BuiltInParameter.ELEM_TYPE_PARAM).AsValueString() + " - " + View.Name + ".dwg";
                        ToRename.Add(Filename);
                    }
                    path = rootpath + "\\DWG";
                    if (!Directory.Exists(path))
                    {
                        Directory.CreateDirectory(path);
                    }
                    doc.Export(path, "", viewIds, DwgOptions);

                    for (int i = 0; i < ToRename.Count; i++)
                    {
                        if (File.Exists(path + "\\" + ToRename[i].Substring(ToRename[i].LastIndexOf(" - ") + 3)))
                        {
                            File.Delete(path + "\\" + ToRename[i].Substring(ToRename[i].LastIndexOf(" - ") + 3));
                        }
                        File.Move(path + "\\" + ToRename[i], path + "\\" + ToRename[i].Substring(ToRename[i].LastIndexOf(" - ") + 3));
                    }
                }
            }
            return(Result.Succeeded);
        }