[chronojump] Encoder: better saving of stuff
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Encoder: better saving of stuff
- Date: Tue, 29 May 2012 20:41:29 +0000 (UTC)
commit f3528065782f30f60d6ecae27f6a1600f52f1cf1
Author: Xavier de Blas <xaviblas gmail com>
Date: Tue May 29 22:41:02 2012 +0200
Encoder: better saving of stuff
glade/chronojump.glade | 205 ++++++++++++++++++++++++++++++++++++------------
src/gui/chronojump.cs | 12 +++-
src/gui/encoder.cs | 110 ++++++++++++++------------
src/sqlite/encoder.cs | 2 +-
src/util.cs | 35 ++++++--
5 files changed, 255 insertions(+), 109 deletions(-)
---
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index 746eb02..cc8324a 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -14816,7 +14816,7 @@ by you</property>
<property name="has_tooltip">True</property>
<property name="tooltip" translatable="yes">Edit selected person (p)</property>
<signal name="clicked" handler="on_edit_current_person_clicked"/>
- <accelerator key="p" signal="clicked"/>
+ <accelerator key="p" signal="clicked" modifiers="GDK_CONTROL_MASK"/>
<child>
<widget class="GtkImage" id="image1977">
<property name="visible">True</property>
@@ -24563,12 +24563,12 @@ Evaluator can use real name or nickname.</property>
<property name="visible">True</property>
<property name="spacing">20</property>
<child>
- <widget class="GtkButton" id="button_encoder_delete_selected">
- <property name="label">Delete selected</property>
+ <widget class="GtkButton" id="button_encoder_delete_curve">
+ <property name="label">Delete curve</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <signal name="clicked" handler="on_button_encoder_delete_selected_clicked"/>
+ <signal name="clicked" handler="on_button_encoder_delete_curve_clicked"/>
</widget>
<packing>
<property name="expand">False</property>
@@ -24581,17 +24581,36 @@ Evaluator can use real name or nickname.</property>
<property name="visible">True</property>
<property name="spacing">12</property>
<child>
- <widget class="GtkButton" id="button_encoder_save_selected">
- <property name="label">Save selected</property>
+ <widget class="GtkLabel" id="label_encoder_capture_comment">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Add comment</property>
+ </widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkEntry" id="entry_encoder_capture_comment">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">â</property>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton" id="button_encoder_save_curve">
+ <property name="label">Save curve</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <signal name="clicked" handler="on_button_encoder_save_selected_clicked"/>
+ <signal name="clicked" handler="on_button_encoder_save_clicked"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">0</property>
+ <property name="position">2</property>
</packing>
</child>
<child>
@@ -24600,12 +24619,12 @@ Evaluator can use real name or nickname.</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <signal name="clicked" handler="on_button_encoder_save_stream_clicked"/>
+ <signal name="clicked" handler="on_button_encoder_save_clicked"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">1</property>
+ <property name="position">3</property>
</packing>
</child>
</widget>
@@ -24643,11 +24662,95 @@ Evaluator can use real name or nickname.</property>
<child>
<widget class="GtkVBox" id="vbox6">
<property name="visible">True</property>
- <property name="spacing">8</property>
+ <property name="spacing">6</property>
<child>
<widget class="GtkVBox" id="vbox7">
<property name="visible">True</property>
- <property name="spacing">12</property>
+ <property name="spacing">4</property>
+ <child>
+ <widget class="GtkFrame" id="frame17">
+ <property name="visible">True</property>
+ <property name="label_xalign">0</property>
+ <property name="label_yalign">0.69999998807907104</property>
+ <property name="shadow_type">out</property>
+ <child>
+ <widget class="GtkAlignment" id="alignment20">
+ <property name="visible">True</property>
+ <property name="left_padding">12</property>
+ <child>
+ <widget class="GtkHBox" id="hbox63">
+ <property name="visible">True</property>
+ <property name="spacing">20</property>
+ <child>
+ <widget class="GtkRadioButton" id="radiobutton_encoder_analyze_data_current_stream">
+ <property name="label" translatable="yes">Current stream</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox73">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkRadioButton" id="radiobutton_encoder_analyze_data_user_curves">
+ <property name="label" translatable="yes">User curves</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">radiobutton_encoder_analyze_data_current_stream</property>
+ </widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton" id="button_encoder_analyze_data_select_user_curves">
+ <property name="label" translatable="yes">Select</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label72">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"><b>Data</b></property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="type">label_item</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
<child>
<widget class="GtkFrame" id="frame14">
<property name="visible">True</property>
@@ -24865,56 +24968,58 @@ Evaluator can use real name or nickname.</property>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="padding">4</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox75">
+ <property name="visible">True</property>
+ <property name="homogeneous">True</property>
+ <child>
+ <widget class="GtkButton" id="button_encoder_analyze">
+ <property name="label" translatable="yes">Analyze</property>
+ <property name="width_request">150</property>
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_underline">True</property>
+ <signal name="clicked" handler="on_button_encoder_analyze_clicked"/>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">12</property>
<property name="position">0</property>
</packing>
</child>
<child>
- <widget class="GtkHBox" id="hbox75">
+ <widget class="GtkProgressBar" id="encoder_pulsebar_analyze">
+ <property name="width_request">150</property>
<property name="visible">True</property>
- <property name="homogeneous">True</property>
- <child>
- <widget class="GtkButton" id="button_encoder_analyze">
- <property name="label" translatable="yes">Analyze</property>
- <property name="width_request">150</property>
- <property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
- <signal name="clicked" handler="on_button_encoder_analyze_clicked"/>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="padding">12</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <widget class="GtkProgressBar" id="encoder_pulsebar_analyze">
- <property name="width_request">150</property>
- <property name="visible">True</property>
- <property name="activity_mode">True</property>
- <property name="show_text">True</property>
- <property name="pulse_step">0.10000000149</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
+ <property name="activity_mode">True</property>
+ <property name="show_text">True</property>
+ <property name="pulse_step">0.10000000149</property>
</widget>
<packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
- <property name="padding">4</property>
- <property name="position">0</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
</packing>
</child>
<child>
@@ -24965,7 +25070,7 @@ Evaluator can use real name or nickname.</property>
</child>
</widget>
<packing>
- <property name="position">1</property>
+ <property name="position">2</property>
</packing>
</child>
</widget>
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index f2b682f..f82e1fe 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -5015,7 +5015,7 @@ Console.WriteLine("X");
Constants.MessageTypes.INFO,
Catalog.GetString("Use these keys in order to work faster.") + "\n\n" +
"- " + Catalog.GetString("On execute test tab:") + "\n\n" +
- "<tt><b>p</b></tt> " + Catalog.GetString("Edit selected person") + "\n" +
+ "<tt><b>CTRL+p</b></tt> " + Catalog.GetString("Edit selected person") + "\n" +
"<tt><b>CTRL+" + Catalog.GetString("CURSOR_UP") + "</b></tt> " + Catalog.GetString("Select previous person") + "\n" +
"<tt><b>CTRL+" + Catalog.GetString("CURSOR_DOWN") + "</b></tt> " + Catalog.GetString("Select next person") + "\n" +
"<tt><b>(space)</b></tt> " + Catalog.GetString("Execute test") + "\n" +
@@ -5106,6 +5106,8 @@ Console.WriteLine("X");
hbox_execute_test.Sensitive = false;
button_execute_test.Sensitive = false;
button_encoder_capture.Sensitive = false;
+ button_encoder_recalculate.Sensitive = false;
+ button_encoder_load_stream.Sensitive = false;
eventExecuteHideAllTables();
}
@@ -5130,6 +5132,8 @@ Console.WriteLine("X");
hbox_jumps_rj.Sensitive = false;
button_execute_test.Sensitive = false;
button_encoder_capture.Sensitive = false;
+ button_encoder_recalculate.Sensitive = false;
+ button_encoder_load_stream.Sensitive = false;
notebook_execute.Sensitive = false;
notebook_results.Sensitive = false;
@@ -5145,6 +5149,8 @@ Console.WriteLine("X");
hbox_jumps_rj.Sensitive = true;
button_execute_test.Sensitive = true;
button_encoder_capture.Sensitive = true;
+ button_encoder_recalculate.Sensitive = true;
+ button_encoder_load_stream.Sensitive = true;
notebook_execute.Sensitive = true;
notebook_results.Sensitive = true;
@@ -5178,6 +5184,8 @@ Console.WriteLine("X");
button_execute_test.Sensitive = false;
button_encoder_capture.Sensitive = false;
+ button_encoder_recalculate.Sensitive = false;
+ button_encoder_load_stream.Sensitive = false;
//hbox
hbox_jumps.Sensitive = false;
hbox_jumps_rj.Sensitive = false;
@@ -5202,6 +5210,8 @@ Console.WriteLine("X");
button_execute_test.Sensitive = true;
button_encoder_capture.Sensitive = true;
+ button_encoder_recalculate.Sensitive = true;
+ button_encoder_load_stream.Sensitive = true;
//hbox
hbox_jumps.Sensitive = true;
hbox_jumps_rj.Sensitive = true;
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index 9ca12fb..c515a42 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -36,6 +36,7 @@ public partial class ChronoJumpWindow
[Widget] Gtk.Button button_encoder_capture;
[Widget] Gtk.Button button_encoder_recalculate;
+ [Widget] Gtk.Button button_encoder_load_stream;
[Widget] Gtk.Label label_encoder_person_weight;
[Widget] Gtk.RadioButton radiobutton_encoder_concentric;
[Widget] Gtk.RadioButton radiobutton_encoder_capture_bar;
@@ -46,8 +47,9 @@ public partial class ChronoJumpWindow
[Widget] Gtk.Image image_encoder_capture;
[Widget] Gtk.TreeView treeview_encoder_curves;
[Widget] Gtk.ProgressBar encoder_pulsebar_capture;
- [Widget] Gtk.Button button_encoder_delete_selected;
- [Widget] Gtk.Button button_encoder_save_selected;
+ [Widget] Gtk.Entry entry_encoder_capture_comment;
+ [Widget] Gtk.Button button_encoder_delete_curve;
+ [Widget] Gtk.Button button_encoder_save_curve;
[Widget] Gtk.Button button_encoder_save_stream;
[Widget] Gtk.Button button_encoder_analyze;
@@ -82,9 +84,12 @@ public partial class ChronoJumpWindow
GenericWindow genericWinForEncoder;
//TODO: store encoder data: auto save, and show on a treeview.
+ //TODO: auto close capturing window
+ //TODO: fix date of creation-saving stream and curve
//TODO: put chronopic detection in a generic place. Done But:
//TODO: solve the problem of connecting two different chronopics
+
private void encoderInitializeVariables() {
encoder_pulsebar_capture.Fraction = 1;
@@ -251,7 +256,7 @@ public partial class ChronoJumpWindow
return treeviewEncoderCurvesGetCurve(selectedID);
}
- void on_button_encoder_delete_selected_clicked (object o, EventArgs args)
+ void on_button_encoder_delete_curve_clicked (object o, EventArgs args)
{
int selectedID = treeviewEncoderCurvesEventSelectedID();
EncoderCurve curve = getCurve(selectedID);
@@ -274,66 +279,75 @@ public partial class ChronoJumpWindow
if(curve.Start != null) {
//Log.WriteLine(curveStart + "->" + duration);
- Util.EncoderDeleteRow(Util.GetEncoderDataTempFileName(), curveStart, duration);
+ Util.EncoderDeleteCurve(Util.GetEncoderDataTempFileName(), curveStart, duration);
}
//force a recalculate
on_button_encoder_recalculate_clicked (o, args);
}
- void on_button_encoder_save_selected_clicked (object o, EventArgs args)
+ void on_button_encoder_save_clicked (object o, EventArgs args)
{
- int selectedID = treeviewEncoderCurvesEventSelectedID();
- EncoderCurve curve = getCurve(selectedID);
-
- //some start at ,5 because of the spline filtering
- int curveStart = Convert.ToInt32(decimal.Truncate(Convert.ToDecimal(curve.Start)));
-
- int duration = Convert.ToInt32(decimal.Truncate(Convert.ToDecimal(curve.Duration)));
- if(ecconLast != "c") {
- EncoderCurve curveNext = treeviewEncoderCurvesGetCurve(selectedID+1);
- duration += Convert.ToInt32(decimal.Truncate(Convert.ToDecimal(curveNext.Duration)));
+ string type = "";
+ string feedback = "";
+ string fileSaved = "";
+ string path = "";
+
+ Gtk.Button button = (Gtk.Button) o;
+ if(button == button_encoder_save_curve) {
+ type = "curve";
+ decimal curveNum = (decimal) treeviewEncoderCurvesEventSelectedID(); //on c and ec: 1,2,3,4,...
+ if(ecconLast != "c")
+ curveNum = decimal.Truncate((curveNum +1) /2); //1,1,2,2,...
+ feedback = string.Format(Catalog.GetString("Curve {0} saved"), curveNum);
+ } else { //(button == button_encoder_save_stream) {
+ type = "stream";
+ feedback = Catalog.GetString("Stream saved");
}
-
- //Log.WriteLine(curveStart + "->" + duration);
- Util.EncoderSaveRow(Util.GetEncoderDataTempFileName(), curveStart, duration);
- //force a recalculate
- //on_button_encoder_recalculate_clicked (o, args);
- }
+ string desc = entry_encoder_capture_comment.Text.ToString();
+ //Log.WriteLine(desc);
- void on_button_encoder_save_stream_clicked (object o, EventArgs args)
- {
- genericWinForEncoder = GenericWindow.Show(Catalog.GetString("Add an optional description"), Constants.GenericWindowShow.TEXTVIEW);
- genericWinForEncoder.SetTextview("");
- genericWinForEncoder.SetButtonAcceptLabel(Catalog.GetString("Save"));
+ if(type == "curve") {
+ int selectedID = treeviewEncoderCurvesEventSelectedID();
+ EncoderCurve curve = getCurve(selectedID);
- genericWinForEncoder.Button_accept.Clicked += new EventHandler(on_save_stream_description_add_accepted);
- }
-
- private void on_save_stream_description_add_accepted (object o, EventArgs args) {
- genericWinForEncoder.Button_accept.Clicked -= new EventHandler(on_save_stream_description_add_accepted);
- string desc = genericWinForEncoder.TextviewSelected;
-
- Log.WriteLine(desc);
-
- //Saving file
- //Util.MoveTempEncoderData (currentSession.UniqueID, currentPerson.UniqueID);
- string fileName = Util.CopyTempEncoderData (currentSession.UniqueID, currentPerson.UniqueID, currentPerson.Name);
+ //some start at ,5 because of the spline filtering
+ int curveStart = Convert.ToInt32(decimal.Truncate(Convert.ToDecimal(curve.Start)));
+
+ int duration = Convert.ToInt32(decimal.Truncate(Convert.ToDecimal(curve.Duration)));
+ if(ecconLast != "c") {
+ EncoderCurve curveNext = treeviewEncoderCurvesGetCurve(selectedID+1);
+ duration += Convert.ToInt32(decimal.Truncate(Convert.ToDecimal(curveNext.Duration)));
+ }
+
+ //Log.WriteLine(curveStart + "->" + duration);
+ fileSaved = Util.EncoderSaveCurve(Util.GetEncoderDataTempFileName(), curveStart, duration,
+ currentSession.UniqueID, currentPerson.UniqueID, currentPerson.Name);
+ path = Util.GetEncoderSessionDataCurveDir(currentSession.UniqueID);
+ } else { //stream
+ fileSaved = Util.CopyTempEncoderData (currentSession.UniqueID, currentPerson.UniqueID, currentPerson.Name);
+ path = Util.GetEncoderSessionDataStreamDir(currentSession.UniqueID);
+ }
+
+ if(radiobutton_encoder_capture_bar.Active)
+ type += "BAR";
+ else
+ type += "JUMP";
//Adding on SQL
SqliteEncoder.Insert(false, "-1",
currentPerson.UniqueID, currentSession.UniqueID,
- fileName,
- Util.GetEncoderSessionDataDir(currentSession.UniqueID), //url
- (! radiobutton_encoder_capture_bar.Active).ToString(),
- findMass(false), //when save on sql, do not include person weight
- findEccon(true), //force ecS (ecc-conc separated)
+ fileSaved,
+ path, //url
+ type,
+ findMass(false), //when save on sql, do not include person weight
+ findEccon(true), //force ecS (ecc-conc separated)
(int) spin_encoder_capture_time.Value,
(int) spin_encoder_capture_min_height.Value,
(double) spin_encoder_smooth.Value,
desc);
- encoder_pulsebar_capture.Text = Catalog.GetString("Saved.");
+ encoder_pulsebar_capture.Text = feedback;
}
@@ -364,8 +378,6 @@ public partial class ChronoJumpWindow
Util.RunPythonEncoder(Constants.EncoderScriptGraphCall, es, false);
}
-//TODO: auto close capturing window
-
//show curve_num only on simple and superpose
private void on_radiobutton_encoder_analyze_single_toggled (object obj, EventArgs args) {
label_encoder_analyze_curve_num.Sensitive=true;
@@ -436,7 +448,7 @@ public partial class ChronoJumpWindow
//returns curves num
private int createTreeViewEncoder(string contents) {
string [] columnsString = {
- "n",
+ Catalog.GetString("Curve") + "\n",
Catalog.GetString("Start") + "\n (s)",
Catalog.GetString("Duration") + "\n (s)",
Catalog.GetString("Height") + "\n (cm)",
@@ -789,8 +801,8 @@ public partial class ChronoJumpWindow
}
private void sensitiveEncoderRowButtons(bool sensitive) {
- button_encoder_delete_selected.Sensitive = sensitive;
- button_encoder_save_selected.Sensitive = sensitive;
+ button_encoder_delete_curve.Sensitive = sensitive;
+ button_encoder_save_curve.Sensitive = sensitive;
}
/* end of TreeView stuff */
diff --git a/src/sqlite/encoder.cs b/src/sqlite/encoder.cs
index 18febd6..c8c1686 100644
--- a/src/sqlite/encoder.cs
+++ b/src/sqlite/encoder.cs
@@ -45,7 +45,7 @@ class SqliteEncoder : Sqlite
"sessionID INT, " +
"name TEXT, " +
"url TEXT, " +
- "type TEXT, " + //"bar" or "jump"
+ "type TEXT, " + //"streamBAR", "streamJUMP", "curveBAR", "curveJUMP"
"extraWeight TEXT, " + //string because can contain "33%" or "50Kg"
"eccon TEXT, " + //"c" or "ec"
"time INT, " +
diff --git a/src/util.cs b/src/util.cs
index 877ab2d..9922a83 100644
--- a/src/util.cs
+++ b/src/util.cs
@@ -819,13 +819,23 @@ public class Util
return GetEncoderSessionDir(sessionID) + Path.DirectorySeparatorChar + "data";
}
+ public static string GetEncoderSessionDataCurveDir (int sessionID) {
+ return GetEncoderSessionDataDir(sessionID) + Path.DirectorySeparatorChar + "curve";
+ }
+
+ public static string GetEncoderSessionDataStreamDir (int sessionID) {
+ return GetEncoderSessionDataDir(sessionID) + Path.DirectorySeparatorChar + "stream";
+ }
+
public static string GetEncoderSessionGraphsDir (int sessionID) {
return GetEncoderSessionDir(sessionID) + Path.DirectorySeparatorChar + "graphs";
}
public static void CreateEncoderSessionDirsIfNeeded (int sessionID) {
- string [] dirs = { GetEncoderSessionDir(sessionID),
- GetEncoderSessionDataDir(sessionID), GetEncoderSessionGraphsDir(sessionID) };
+ string [] dirs = {
+ GetEncoderSessionDir(sessionID), GetEncoderSessionDataDir(sessionID),
+ GetEncoderSessionDataCurveDir(sessionID), GetEncoderSessionDataStreamDir(sessionID),
+ GetEncoderSessionGraphsDir(sessionID) };
foreach (string d in dirs) {
if( ! Directory.Exists(d)) {
Directory.CreateDirectory (d);
@@ -845,7 +855,8 @@ public class Util
}
// public static void MoveTempEncoderData(int sessionID, int uniqueID) {
- public static string CopyTempEncoderData(int sessionID, int uniqueID, string personName) {
+ public static string CopyTempEncoderData(int sessionID, int uniqueID, string personName)
+ {
string fileName="";
if(File.Exists(GetEncoderDataTempFileName())) {
CreateEncoderSessionDirsIfNeeded(sessionID);
@@ -854,8 +865,9 @@ public class Util
// } catch {
fileName = uniqueID.ToString() + "-" + personName + "-" +
UtilDate.ToFile(DateTime.Now) + ".txt";
+
File.Copy(GetEncoderDataTempFileName(),
- GetEncoderSessionDataDir(sessionID) +
+ GetEncoderSessionDataStreamDir(sessionID) +
Path.DirectorySeparatorChar + fileName);
// }
}
@@ -1045,7 +1057,7 @@ public class Util
return returnStr;
}
- public static void EncoderDeleteRow(string fileName, int start, int duration) {
+ public static void EncoderDeleteCurve(string fileName, int start, int duration) {
string contents = ReadFile(fileName);
string [] startAndDuration = encoderFindPos(contents, start, duration);
@@ -1061,18 +1073,25 @@ public class Util
((IDisposable)writer).Dispose();
}
- public static void EncoderSaveRow(string fileName, int start, int duration) {
- string contents = ReadFile(fileName);
+ public static string EncoderSaveCurve(string fileNameStream, int start, int duration,
+ int sessionID, int uniqueID, string personName)
+ {
+ string contents = ReadFile(fileNameStream);
string [] startAndDuration = encoderFindPos(contents, start, duration);
contents = contents.Substring(
Convert.ToInt32(startAndDuration[0]),
Convert.ToInt32(startAndDuration[1])-1); //-1 is for not ending file with a comma
+
+ string fileCurve = uniqueID.ToString() + "-" + personName + "-" + UtilDate.ToFile(DateTime.Now) + ".txt";
+ string fileCurveFull = GetEncoderSessionDataCurveDir(sessionID) + Path.DirectorySeparatorChar + fileCurve;
- TextWriter writer = File.CreateText(fileName + "-testrow");
+ TextWriter writer = File.CreateText(fileCurveFull);
writer.Write(contents);
writer.Flush();
((IDisposable)writer).Dispose();
+
+ return fileCurve;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]