/// <summary> /// Erases the log file /// </summary> public void ResetCSVFile() { try { if (System.IO.File.Exists(_logCSVFilePath)) { TraceLogger.LogInformation("Deleting CSV file {0}", _logCSVFilePath); System.IO.File.Delete(_logFilePath); } } catch (Exception e) { TraceLogger.LogError(e, "resetCSVFile failed with message {0}", e.Message); } }
/// <summary> /// Appends a line to the CSV file path /// </summary> /// <param name="_line"></param> public void WriteToCSVFile(string _line) { if (!string.IsNullOrEmpty(_line)) { try { _totalRows++; System.IO.File.AppendAllLines(_logCSVFilePath, new[] { _line }); } catch (Exception e) { TraceLogger.LogError(e, "WriteToCSVFile failed with message {0}", e.Message); } } }
void Update() { if (queue.notEmpty()) { CallResponse call = queue.remove(); try{ //Debug.Log("Trying to eval '" + call.getCall() + "'"); if (call.getCall().Equals("\n")) { call.setResponse(""); } else { if (!call.getCall().StartsWith("util.")) { TraceLogger.LogTrace(call.getCall()); } object ret = Eval.eval(call.getCall(), ObjectManager.GetObjects(), new Util()); string response = ""; if (ret != null) { response = ret.ToString(); } //Debug.Log("Response was " + response); call.setResponse(response); } call.respond(); } catch (Exception e) { Debug.Log(e.Message); Debug.Log(e.StackTrace); call.setResponse("Error: " + e.ToString().Replace("\n", "")); TraceLogger.LogError(call.getResponse()); call.respond(); } } }