[chronojump] RaceAnalyzerExport refactorized and improvements on ForceSensorExport



commit e34abce09062bc8dc1fb19888332f4e16c223425
Author: Xavier de Blas <xaviblas gmail com>
Date:   Mon Mar 8 19:53:56 2021 +0100

    RaceAnalyzerExport refactorized and improvements on ForceSensorExport

 po/POTFILES.in                 |   1 +
 r-scripts/sprintEncoder.R      |   4 +-
 src/Makefile.am                |   1 +
 src/exportFiles/exportFiles.cs |  26 ++++
 src/exportFiles/fs.cs          |  65 +++------
 src/exportFiles/re.cs          | 224 ++++++++++++++++++++++++++++++
 src/runEncoder.cs              | 300 -----------------------------------------
 src/utilEncoder.cs             |   4 -
 8 files changed, 275 insertions(+), 350 deletions(-)
---
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 79d4537f..e4c42d4b 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -56,6 +56,7 @@ src/execute/reactionTime.cs
 src/execute/run.cs
 src/exportFiles/exportFiles.cs
 src/exportFiles/fs.cs
+src/exportFiles/re.cs
 src/exportSession.cs
 src/forceSensor.cs
 src/gui/app1/chronojump.cs
diff --git a/r-scripts/sprintEncoder.R b/r-scripts/sprintEncoder.R
index 909918b8..a9c5db77 100644
--- a/r-scripts/sprintEncoder.R
+++ b/r-scripts/sprintEncoder.R
@@ -780,8 +780,8 @@ start <- function(op)
        dataFiles = read.csv(file = paste(tempPath, "/cj_race_analyzer_input_multi.csv", sep=""), sep=";", 
stringsAsFactors=F)
 
        #3) call doProcess
-       progressFolder = paste(tempPath, "/chronojump_race_analyzer_progress", sep ="")
-       tempGraphsFolder = paste(tempPath, "/chronojump_race_analyzer_graphs/", sep ="")
+       progressFolder = paste(tempPath, "/chronojump_export_progress", sep ="")
+       tempGraphsFolder = paste(tempPath, "/chronojump_race_analyzer_export_graphs/", sep ="")
        exportDF = NULL
 
        for(i in 1:length(dataFiles[,1]))
diff --git a/src/Makefile.am b/src/Makefile.am
index 138b106e..f1c2b9ab 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -183,6 +183,7 @@ SOURCES = \
        execute/multiChronopic.cs\
        exportFiles/exportFiles.cs\
        exportFiles/fs.cs\
+       exportFiles/re.cs\
        AssemblyInfo.cs\
        buildInfo.cs\
        chronojump.cs\
diff --git a/src/exportFiles/exportFiles.cs b/src/exportFiles/exportFiles.cs
index 7af5914c..03654179 100644
--- a/src/exportFiles/exportFiles.cs
+++ b/src/exportFiles/exportFiles.cs
@@ -94,10 +94,36 @@ public abstract class ExportFiles
                }
        }
 
+       // public method
+       public void Start(string exportURL)
+       {
+               prepare(exportURL);
+
+               thread = new Thread (new ThreadStart (exportDo));
+               GLib.Idle.Add (new GLib.IdleHandler (pulseExportGTK));
+               thread.Start();
+       }
+
+       protected void exportDo ()
+       {
+               if(! getData())
+               {
+                       LogB.Information("There's no data");
+                       noData = true;
+                       return;
+               }
+
+               processSets();
+       }
+
+       protected abstract bool getData ();
+
        protected string getTempProgressDir() {
                return Path.Combine(Path.GetTempPath(), "chronojump_export_progress");
        }
 
+       protected abstract bool processSets ();
+
        public void Cancel()
        {
                cancel = true;
diff --git a/src/exportFiles/fs.cs b/src/exportFiles/fs.cs
index 5ca679b8..649ae9b0 100644
--- a/src/exportFiles/fs.cs
+++ b/src/exportFiles/fs.cs
@@ -19,9 +19,9 @@
  */
 
 
-using System.IO;               //for detect OS //TextWriter
-using System.Collections; //ArrayList
-using System.Collections.Generic; //List<T>
+using System.IO;                       //Directory, ...
+using System.Collections;              //ArrayList
+using System.Collections.Generic;      //List<T>
 using System.Threading;
 using Mono.Unix;
 
@@ -43,7 +43,6 @@ public class ForceSensorExport : ExportFiles
        private ArrayList personSession_l;
        private ArrayList fsEx_l;
        private static int totalRepsToExport;
-       private List<string> exportedRFDs;
 
        public ForceSensorExport (
                        Gtk.Notebook notebook,
@@ -81,58 +80,35 @@ public class ForceSensorExport : ExportFiles
                this.forceSensorAnalyzeMaxAVGInWindowSeconds = forceSensorAnalyzeMaxAVGInWindowSeconds;
        }
 
-       private string getForceSensorTempGraphsDir() {
+       private string getTempGraphsDir() {
                return Path.Combine(Path.GetTempPath(), "chronojump_force_sensor_export_graphs_rfd");
        }
-       private string getForceSensorTempGraphsABDir() {
+       private string getTempGraphsABDir() {
                return Path.Combine(Path.GetTempPath(), "chronojump_force_sensor_export_graphs_ab");
        }
+       private string getTempCSVFileName() {
+               return Path.Combine(Path.GetTempPath(), "chronojump_force_sensor_export.csv");
+       }
 
        protected override void createOrEmptyDirs()
        {
                //create progressbar and graph files dirs or delete their contents
                createOrEmptyDir(getTempProgressDir());
-               createOrEmptyDir(getForceSensorTempGraphsDir());
-               createOrEmptyDir(getForceSensorTempGraphsABDir());
-       }
-
-       ///public method
-       public void Start(string exportURL)
-       {
-               prepare(exportURL);
-
-               thread = new Thread (new ThreadStart (forceSensorExportDo));
-               GLib.Idle.Add (new GLib.IdleHandler (pulseExportGTK));
-               thread.Start();
-       }
-
-       private void forceSensorExportDo()
-       {
-               getData();
-
-               if(fs_l.Count == 0)
-               {
-                       LogB.Information("There's no data");
-                       noData = true;
-                       return;
-               }
-
-//             if(processForceSensorSets()) //false if cancelled
-//                     writeFile();
-               processForceSensorSets();
+               createOrEmptyDir(getTempGraphsDir());
+               createOrEmptyDir(getTempGraphsABDir());
        }
 
-       private void getData ()
+       protected override bool getData ()
        {
                fs_l = SqliteForceSensor.Select(false, -1, personID, sessionID);
                personSession_l = SqlitePersonSession.SelectCurrentSessionPersons(sessionID, true);
                fsEx_l = SqliteForceSensorExercise.Select (false, -1, false);
-               exportedRFDs = new List<string>();
-               //totalUnitsToExport = 0;
                totalRepsToExport = 0;
+
+               return fs_l.Count > 0;
        }
 
-       private bool processForceSensorSets ()
+       protected override bool processSets ()
        {
                Person p = new Person();
                PersonSession ps = new PersonSession();
@@ -238,7 +214,7 @@ public class ForceSensorExport : ExportFiles
                        */
 
                        //delete result file
-                       Util.FileDelete(UtilEncoder.GetmifExportFileName());
+                       Util.FileDelete(getTempCSVFileName());
 
                        bool addedSet = false;
                        int repCount = 1;
@@ -362,11 +338,12 @@ public class ForceSensorExport : ExportFiles
                                        includeImages
                                        );
 
-                       bool success = fsg.CallR(imageWidth, imageHeight, false);
+                       if(! fsg.CallR(imageWidth, imageHeight, false))
+                               return false;
                }
 
                LogB.Information("Waiting creation of file... ");
-               while ( ! ( Util.FileReadable(UtilEncoder.GetmifExportFileName()) || cancel ) )
+               while ( ! ( Util.FileReadable(getTempCSVFileName()) || cancel ) )
                        ;
 
                if(cancel)
@@ -380,7 +357,7 @@ public class ForceSensorExport : ExportFiles
 
                        try{
                                // 1) rfd graphs
-                               string sourceFolder = getForceSensorTempGraphsDir();
+                               string sourceFolder = getTempGraphsDir();
                                DirectoryInfo sourceDirInfo = new DirectoryInfo(sourceFolder);
 
                                string destFolder = Path.Combine(exportURL, 
"chronojump_force_sensor_export_graphs_rfd");
@@ -390,7 +367,7 @@ public class ForceSensorExport : ExportFiles
                                        file.CopyTo(destFolder, true);
 
                                // 2) AB graphs
-                               sourceFolder = getForceSensorTempGraphsABDir();
+                               sourceFolder = getTempGraphsABDir();
                                sourceDirInfo = new DirectoryInfo(sourceFolder);
 
                                destFolder = Path.Combine(exportURL, 
"chronojump_force_sensor_export_graphs_ab");
@@ -406,7 +383,7 @@ public class ForceSensorExport : ExportFiles
                }
 
                //copy the CSV
-               File.Copy(UtilEncoder.GetmifExportFileName(), exportURL, true);
+               File.Copy(getTempCSVFileName(), exportURL, true);
 
                return true;
        }
diff --git a/src/exportFiles/re.cs b/src/exportFiles/re.cs
new file mode 100644
index 00000000..07ccb56b
--- /dev/null
+++ b/src/exportFiles/re.cs
@@ -0,0 +1,224 @@
+/*
+ * This file is part of ChronoJump
+ *
+ * Chronojump is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 2 of the License, or
+ *    (at your option) any later version.
+ *
+ * Chronojump is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *    GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Copyright (C) 2021   Xavier de Blas <xaviblas gmail com>
+ */
+
+using System.IO;                       //Directory, ...
+using System.Collections;              //ArrayList
+using System.Collections.Generic;      //List<T>
+using System.Threading;
+using Mono.Unix;
+
+public class RunEncoderExport : ExportFiles
+{
+       private double startAccel;
+       private bool plotRawAccel;
+       private bool plotFittedAccel;
+       private bool plotRawForce;
+       private bool plotFittedForce;
+       private bool plotRawPower;
+       private bool plotFittedPower;
+       private char exportDecimalSeparator;
+
+       private List<RunEncoder> re_l;
+       ArrayList personSession_l;
+       private ArrayList reEx_l;
+
+       //constructor
+       public RunEncoderExport (
+                       Gtk.Notebook notebook,
+                       Gtk.ProgressBar progressbar,
+                       Gtk.Label labelResult,
+                       bool includeImages,
+                       int imageWidth, int imageHeight,
+                       bool isWindows,
+                       int personID,
+                       int sessionID,
+                       double startAccel,
+                       bool plotRawAccel, bool plotFittedAccel,
+                       bool plotRawForce, bool plotFittedForce,
+                       bool plotRawPower, bool plotFittedPower,
+                       char exportDecimalSeparator
+                       )
+       {
+               Button_done = new Gtk.Button();
+
+               assignParams(notebook, progressbar, labelResult, includeImages,
+                               imageWidth, imageHeight, isWindows, personID, sessionID);
+
+               this.startAccel = startAccel;
+               this.plotRawAccel = plotRawAccel;
+               this.plotFittedAccel = plotFittedAccel;
+               this.plotRawForce = plotRawForce;
+               this.plotFittedForce = plotFittedForce;
+               this.plotRawPower = plotRawPower;
+               this.plotFittedPower = plotFittedPower;
+               this.exportDecimalSeparator = exportDecimalSeparator;
+       }
+
+       private string getTempGraphsDir() {
+               return Path.Combine(Path.GetTempPath(), "chronojump_race_analyzer_export_graphs");
+       }
+       
+       protected override void createOrEmptyDirs()
+       {
+               createOrEmptyDir(getTempProgressDir());
+               createOrEmptyDir(getTempGraphsDir());
+       }
+
+       protected override bool getData ()
+       {
+               re_l = SqliteRunEncoder.Select(false, -1, personID, sessionID);
+               personSession_l = SqlitePersonSession.SelectCurrentSessionPersons(sessionID, true);
+               reEx_l = SqliteRunEncoderExercise.Select (false, -1, false);
+
+               return re_l.Count > 0;
+       }
+
+       protected override bool processSets ()
+       {
+               Person p = new Person();
+               PersonSession ps = new PersonSession();
+
+               List<RunEncoderGraphExport> rege_l = new List<RunEncoderGraphExport>();
+
+               int count = 1;
+               foreach(RunEncoder re in re_l)
+               {
+                       // 1) checks
+                       //check fs is ok
+                       if(re == null || ! Util.FileExists(re.FullURL))
+                               continue;
+
+                       //check fs has data
+                       List<string> contents = Util.ReadFileAsStringList(re.FullURL);
+                       if(contents.Count < 3)
+                       {
+                               //new DialogMessage(Constants.MessageTypes.WARNING, Constants.FileEmptyStr());
+                               //return;
+                               continue;
+                       }
+
+                       // 2) get the person
+                       bool found = false;
+                       foreach(PersonAndPS paps in personSession_l)
+                       {
+                               if(paps.p.UniqueID == re.PersonID)
+                               {
+                                       p = paps.p;
+                                       ps = paps.ps;
+
+                                       found = true;
+                                       break;
+                               }
+                       }
+                       if(! found)
+                               continue;
+
+                       // 3) get the exercise
+                       found = false;
+                       RunEncoderExercise reEx = new RunEncoderExercise();
+                       foreach(RunEncoderExercise reExTemp in reEx_l)
+                               if(reExTemp.UniqueID == re.ExerciseID)
+                               {
+                                       reEx = reExTemp;
+                                       found = true;
+                                       break;
+                               }
+                       if(! found)
+                               continue;
+
+                       // 4) create the export row
+                       string title = Util.ChangeSpaceAndMinusForUnderscore(p.Name) + "-" +
+                               Util.ChangeSpaceAndMinusForUnderscore(reEx.Name);
+
+                       RunEncoderGraphExport rege = new RunEncoderGraphExport (
+                                       re.FullURL,
+                                       ps.Weight, ps.Height,
+                                       re.Device,
+                                       re.Temperature, re.Distance,
+                                       reEx, title, re.DateTimePublic,
+                                       re.Comments
+                                       );
+                       rege_l.Add(rege);
+
+               }
+
+               Util.FileDelete(RunEncoder.GetCSVResultsFileName());
+
+               // call the graph
+
+               if(rege_l.Count > 0)
+               {
+                       RunEncoderGraph reg = new RunEncoderGraph(
+                                       startAccel,
+                                       plotRawAccel, plotFittedAccel,
+                                       plotRawForce, plotFittedForce,
+                                       plotRawPower, plotFittedPower,
+                                       //triggerList,
+                                       rege_l,
+                                       exportDecimalSeparator,
+                                       includeImages
+                                       );
+
+                       if(! reg.CallR(imageWidth, imageHeight, false))
+                               return 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 = getTempGraphsDir();
+                               DirectoryInfo sourceDirInfo = new DirectoryInfo(sourceFolder);
+
+                               string destFolder = Path.Combine(exportURL, 
"chronojump_race_analyzer_export_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;
+       }
+
+       protected override void setProgressBarTextAndFraction (int fileCount)
+       {
+               progressbar.Text = string.Format(Catalog.GetString("Exporting {0}/{1}"),
+                               fileCount, re_l.Count);
+               progressbar.Fraction = UtilAll.DivideSafeFraction(fileCount, re_l.Count);
+       }
+}
diff --git a/src/runEncoder.cs b/src/runEncoder.cs
index 543dc743..c4c2bdf2 100644
--- a/src/runEncoder.cs
+++ b/src/runEncoder.cs
@@ -410,306 +410,6 @@ public class RunEncoderCSV
        }
 }
 
-public class RunEncoderExport
-{
-       public Gtk.Button Button_done;
-
-       //passed variables
-       private Gtk.Notebook notebook;
-       private Gtk.ProgressBar progressbar;
-       private Gtk.Label labelResult;
-       private bool includeImages;
-       private int imageWidth;
-       private int imageHeight;
-       private string exportURL; //folder or .csv depending on includeImages
-       private bool isWindows;
-       private int personID; // -1: all
-       private int sessionID;
-       private double startAccel;
-       private bool plotRawAccel;
-       private bool plotFittedAccel;
-       private bool plotRawForce;
-       private bool plotFittedForce;
-       private bool plotRawPower;
-       private bool plotFittedPower;
-       private char exportDecimalSeparator;
-
-       private static Thread thread;
-       private static bool cancel;
-       private static bool noData;
-       private static bool cannotCopy;
-       private static string messageToProgressbar;
-
-       private List<RunEncoder> re_l;
-       ArrayList personSession_l;
-       private ArrayList reEx_l;
-
-       //constructor
-       public RunEncoderExport (
-                       Gtk.Notebook notebook,
-                       Gtk.ProgressBar progressbar,
-                       Gtk.Label labelResult,
-                       bool includeImages,
-                       int imageWidth, int imageHeight,
-                       bool isWindows,
-                       int personID,
-                       int sessionID,
-                       double startAccel,
-                       bool plotRawAccel, bool plotFittedAccel,
-                       bool plotRawForce, bool plotFittedForce,
-                       bool plotRawPower, bool plotFittedPower,
-                       char exportDecimalSeparator
-                       )
-       {
-               this.notebook = notebook;
-               this.progressbar = progressbar;
-               this.labelResult = labelResult;
-               this.includeImages = includeImages;
-               this.imageWidth = imageWidth;
-               this.imageHeight = imageHeight;
-               this.isWindows = isWindows;
-               this.personID = personID;
-               this.sessionID = sessionID;
-               this.startAccel = startAccel;
-               this.plotRawAccel = plotRawAccel;
-               this.plotFittedAccel = plotFittedAccel;
-               this.plotRawForce = plotRawForce;
-               this.plotFittedForce = plotFittedForce;
-               this.plotRawPower = plotRawPower;
-               this.plotFittedPower = plotFittedPower;
-               this.exportDecimalSeparator = exportDecimalSeparator;
-
-               Button_done = new Gtk.Button();
-       }
-
-       ///public method
-       public void Start(string exportURL)
-       {
-               this.exportURL = exportURL;
-
-               //create progressbar and graph files dirs or delete their contents
-               createOrEmptyDir(Util.GetRunEncoderTempProgressDir());
-               createOrEmptyDir(Util.GetRunEncoderTempGraphsDir());
-
-               cancel = false;
-               noData = false;
-               cannotCopy = false;
-               progressbar.Fraction = 0;
-               messageToProgressbar = "";
-               notebook.CurrentPage = 1;
-
-               thread = new Thread (new ThreadStart (runEncoderExportDo));
-               GLib.Idle.Add (new GLib.IdleHandler (pulseRunEncoderExportGTK));
-               thread.Start();
-       }
-
-       private void createOrEmptyDir(string dir)
-       {
-               if( ! Directory.Exists(dir))
-                       Directory.CreateDirectory (dir);
-               else {
-                       DirectoryInfo dirInfo = new DirectoryInfo(dir);
-                       foreach (FileInfo file in dirInfo.GetFiles())
-                               file.Delete();
-               }
-       }
-
-       public void Cancel()
-       {
-               cancel = true;
-       }
-
-       private bool pulseRunEncoderExportGTK ()
-       {
-               if(! thread.IsAlive || cancel)
-               {
-                       if(cancel)
-                               LogB.Information("pulseRunEncoderExportGTK cancelled");
-
-                       LogB.Information("pulseRunEncoderExportGTK ending here");
-                       LogB.ThreadEnded();
-
-                       progressbar.Fraction = 1;
-                       notebook.CurrentPage = 0;
-
-                       if(cancel)
-                               labelResult.Text = Catalog.GetString("Cancelled.");
-                       else if (noData)
-                               labelResult.Text = Catalog.GetString("Missing data.");
-                       else if (cannotCopy)
-                               labelResult.Text = string.Format(Catalog.GetString("Cannot copy to {0} "), 
exportURL);
-                       else
-                               labelResult.Text = string.Format(Catalog.GetString("Exported to {0}"), 
exportURL);// +
-                                               //Constants.GetSpreadsheetString(CSVExportDecimalSeparator)
-                                               //);
-                       Button_done.Click();
-
-                       return false;
-               }
-
-               DirectoryInfo dirInfo = new DirectoryInfo(Util.GetRunEncoderTempProgressDir());
-               //LogB.Information(string.Format("pulse files: {0}", dirInfo.GetFiles().Length));
-
-               int files = dirInfo.GetFiles().Length;
-               if(files == 0) {
-                       progressbar.Text = messageToProgressbar;
-                       progressbar.Pulse();
-               } else {
-                       progressbar.Text = string.Format(Catalog.GetString("Exporting {0}/{1}"), files, 
re_l.Count);
-                       progressbar.Fraction = UtilAll.DivideSafeFraction(files, re_l.Count);
-               }
-
-               Thread.Sleep (100);
-               return true;
-       }
-
-       private void runEncoderExportDo()
-       {
-               getData();
-
-               if(re_l.Count == 0)
-               {
-                       LogB.Information("There's no data");
-                       noData = true;
-                       return;
-               }
-
-               processRunEncoderSets();
-       }
-
-       private void getData ()
-       {
-               re_l = SqliteRunEncoder.Select(false, -1, personID, sessionID);
-               personSession_l = SqlitePersonSession.SelectCurrentSessionPersons(sessionID, true);
-               reEx_l = SqliteRunEncoderExercise.Select (false, -1, false);
-       }
-
-       private bool processRunEncoderSets ()
-       {
-               Person p = new Person();
-               PersonSession ps = new PersonSession();
-
-               List<RunEncoderGraphExport> rege_l = new List<RunEncoderGraphExport>();
-
-               int count = 1;
-               foreach(RunEncoder re in re_l)
-               {
-                       // 1) checks
-                       //check fs is ok
-                       if(re == null || ! Util.FileExists(re.FullURL))
-                               continue;
-
-                       //check fs has data
-                       List<string> contents = Util.ReadFileAsStringList(re.FullURL);
-                       if(contents.Count < 3)
-                       {
-                               //new DialogMessage(Constants.MessageTypes.WARNING, Constants.FileEmptyStr());
-                               //return;
-                               continue;
-                       }
-
-                       // 2) get the person
-                       bool found = false;
-                       foreach(PersonAndPS paps in personSession_l)
-                       {
-                               if(paps.p.UniqueID == re.PersonID)
-                               {
-                                       p = paps.p;
-                                       ps = paps.ps;
-
-                                       found = true;
-                                       break;
-                               }
-                       }
-                       if(! found)
-                               continue;
-
-                       // 3) get the exercise
-                       found = false;
-                       RunEncoderExercise reEx = new RunEncoderExercise();
-                       foreach(RunEncoderExercise reExTemp in reEx_l)
-                               if(reExTemp.UniqueID == re.ExerciseID)
-                               {
-                                       reEx = reExTemp;
-                                       found = true;
-                                       break;
-                               }
-                       if(! found)
-                               continue;
-
-                       // 4) create the export row
-                       string title = Util.ChangeSpaceAndMinusForUnderscore(p.Name) + "-" +
-                               Util.ChangeSpaceAndMinusForUnderscore(reEx.Name);
-
-                       RunEncoderGraphExport rege = new RunEncoderGraphExport (
-                                       re.FullURL,
-                                       ps.Weight, ps.Height,
-                                       re.Device,
-                                       re.Temperature, re.Distance,
-                                       reEx, title, re.DateTimePublic,
-                                       re.Comments
-                                       );
-                       rege_l.Add(rege);
-
-               }
-
-               Util.FileDelete(RunEncoder.GetCSVResultsFileName());
-
-               // call the graph
-
-               if(rege_l.Count > 0)
-               {
-                       RunEncoderGraph reg = new RunEncoderGraph(
-                                       startAccel,
-                                       plotRawAccel, plotFittedAccel,
-                                       plotRawForce, plotFittedForce,
-                                       plotRawPower, plotFittedPower,
-                                       //triggerList,
-                                       rege_l,
-                                       exportDecimalSeparator,
-                                       includeImages
-                                       );
-
-                       bool success = reg.CallR(imageWidth, imageHeight, 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;
-       }
-
-}
-
 //this class creates the rows of each force sensor AB for the csv input multi that is read by R
 public class RunEncoderGraphExport
 {
diff --git a/src/utilEncoder.cs b/src/utilEncoder.cs
index b1fe0bb7..34fd2afb 100644
--- a/src/utilEncoder.cs
+++ b/src/utilEncoder.cs
@@ -266,10 +266,6 @@ public class UtilEncoder
        public static string GetmifTempFileName() {
                return Path.Combine(Path.GetTempPath(), "cj_mif_Graph.png");
        }
-       //R exports here, then C# move it and rename it
-       public static string GetmifExportFileName() {
-               return Path.Combine(Path.GetTempPath(), "chronojump_force_sensor_export.csv");
-       }
 
        /********** end of r-scripts paths ************/
 


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