[chronojump] RunEncoder export copies the files to user selected/created folders



commit 1b38323d032f54572132b189e218e33cbede7d6e
Author: Xavier de Blas <xaviblas gmail com>
Date:   Thu Mar 4 12:54:27 2021 +0100

    RunEncoder export copies the files to user selected/created folders

 src/runEncoder.cs | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
---
diff --git a/src/runEncoder.cs b/src/runEncoder.cs
index e5e7aedb..e9a68857 100644
--- a/src/runEncoder.cs
+++ b/src/runEncoder.cs
@@ -650,6 +650,8 @@ public class RunEncoderExport
 
                }
 
+               Util.FileDelete(RunEncoder.GetCSVResultsFileName());
+
                // call the graph
 
                if(rege_l.Count > 0)
@@ -668,6 +670,38 @@ public class RunEncoderExport
                        bool success = reg.CallR(imageWidth -5, imageHeight -5, false);
                }
 
+               LogB.Information("Waiting creation of file... ");
+               while ( ! ( Util.FileReadable(RunEncoder.GetCSVResultsFileName()) || cancel ) )
+                       ;
+
+               if(cancel)
+                       return false;
+
+               if(includeImages)
+               {
+                       LogB.Information("going to copy export files with images ...");
+                       if( ! Directory.Exists(exportURL))
+                                Directory.CreateDirectory (exportURL);
+
+                       try{
+                               string sourceFolder = Util.GetRunEncoderTempGraphsDir();
+                               DirectoryInfo sourceDirInfo = new DirectoryInfo(sourceFolder);
+
+                               string destFolder = Path.Combine(exportURL, 
"chronojump_race_analyzer_graphs");
+                               Directory.CreateDirectory (destFolder);
+
+                               foreach (FileInfo file in sourceDirInfo.GetFiles())
+                                       file.CopyTo(destFolder, true);
+                       } catch {
+                               return false;
+                       }
+
+                       //LogB.Information("done copy export files with images!");
+               }
+
+               // copy the CSV
+               File.Copy(RunEncoder.GetCSVResultsFileName(), exportURL, true);
+
                return true;
        }
 


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