[chronojump] encoder: recording data with different names



commit d3421f7e62fbb339fd1bf98d2548947ef2253ff6
Author: Xavier de Blas <xaviblas gmail com>
Date:   Fri May 18 20:17:21 2012 +0200

    encoder: recording data with different names

 src/gui/encoder.cs |    4 ++--
 src/util.cs        |    9 ++++++---
 2 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index 0247bae..161f1c3 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -222,12 +222,12 @@ public partial class ChronoJumpWindow
 	
 		//Saving file
 		//Util.MoveTempEncoderData (currentSession.UniqueID, currentPerson.UniqueID);
-		Util.CopyTempEncoderData (currentSession.UniqueID, currentPerson.UniqueID);
+		string fileName = Util.CopyTempEncoderData (currentSession.UniqueID, currentPerson.UniqueID, currentPerson.Name);
 
 		//Adding on SQL
 		SqliteEncoder.Insert(false, "-1", 
 				currentPerson.UniqueID, currentSession.UniqueID, 
-				"put an automatic name",	//TODO: using uniqueID and a counter, or maybe it's sql id autoincrement
+				fileName,
 				Util.GetEncoderSessionDataDir(currentSession.UniqueID),	//url
 				(! radiobutton_encoder_capture_bar.Active).ToString(),
 				findMass(false), //when save on sql, do not include person weight
diff --git a/src/util.cs b/src/util.cs
index fc730a3..188caa2 100644
--- a/src/util.cs
+++ b/src/util.cs
@@ -845,18 +845,21 @@ public class Util
 	}
 
 //	public static void MoveTempEncoderData(int sessionID, int uniqueID) {
-	public static void CopyTempEncoderData(int sessionID, int uniqueID) {
+	public static string CopyTempEncoderData(int sessionID, int uniqueID, string personName) {
+		string fileName="";
 		if(File.Exists(GetEncoderDataTempFileName())) {
 			CreateEncoderSessionDirsIfNeeded(sessionID);
 //			try {
 //				File.Move(GetEncoderDataTempFileName(), GetEncoderSessionDataDir(sessionID));
 //			} catch {
+				fileName = uniqueID.ToString() + "-" + personName + "-" +
+						UtilDate.ToFile(DateTime.Now) + ".txt";
 				File.Copy(GetEncoderDataTempFileName(), 
 						GetEncoderSessionDataDir(sessionID) + 
-						Path.DirectorySeparatorChar + 
-						"encoder-copied.txt");
+						Path.DirectorySeparatorChar + fileName);
 //			}
 		}
+		return fileName;
 	}
 	
 	



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