//Append the touch log to the file public static void AppendData() { StreamWriter file; string log = GestureManager.GetLog(); file = new StreamWriter(Application.persistentDataPath + FILE_NAME, true); file.WriteLine(log); file.Close(); }
//Submit the information of the GestureManager to the database static public IEnumerator SubmitLog() { WWWForm form = new WWWForm(); form.AddField("data", GestureManager.GetLog()); var link = new WWW(LOG_ADDRESS, form); yield return(link); }
//Save the log into a file. public void SaveFile() { StreamWriter file; string log = GestureManager.GetLog(); //If the log is empty skip the serialization if (log != "{ \"info\":{} }") { if (File.Exists(Application.persistentDataPath + FILE_NAME)) { file = new StreamWriter(Application.persistentDataPath + FILE_NAME, true); } else { file = new StreamWriter(Application.persistentDataPath + FILE_NAME, false); } file.WriteLine(log); file.Close(); Debug.Log("Log File: " + Application.persistentDataPath + FILE_NAME); } }