void Start() { player = GameObject.Find("Player"); //Step 2 - Initialize LogVariable objects using their constructors //End Step 2 int epoch = (int)(System.DateTime.UtcNow - new System.DateTime(1970, 1, 1)).TotalSeconds; //Epoch Time path = @"C:\Users\Public\Documents\Unity Projects\Roll a Ball\Roll a Ball\Logs\" + epoch.ToString() + "-"; //Log file path //path_trig = @"C:\Users\Public\Documents\Unity Projects\Roll a Ball\Roll a Ball\Logs\" + epoch.ToString() + "trig.txt"; //Log file of triggers path; port = 23456; ip = "10.132.128.202"; InitStream(ip, port); InitLogs(); EnqueueData(LogVariable.GetHeader()); doneSending = false; isSending = true; send = new Thread(ContinuousDataSend); send.Start(); }
public LogLine(ME7LoggerLog log, string group, int lineNumber, LogLine last, params string[] values) { this.Log = log; this.LineNumber = lineNumber; this.TimeStamp = decimal.Parse(values[0], VisualME7Logger.Log.ME7LoggerLog.CultureInfo); int i = 1; foreach (SessionVariable sv in Log.Session.Variables.Values) { string value = ""; LogVariable lv = sv as LogVariable; if (lv != null && lv.Group == group) { //set value from log value = values[i++].Trim(); } else if (last != null) { value = last.variablesByName[sv.Name].Value.ToString(); //set value from last log line } Variable v = new Variable(this, sv, value); variables.Add(v); if (!variablesByName.ContainsKey(v.SessionVariable.Name)) { variablesByName.Add(v.SessionVariable.Name, v); } else if (lv.Group == group) { variablesByName[v.SessionVariable.Name] = v; } } }
//End Step 1 // Use this for initialization private void Awake() { time = new LogVariable("U", "Time"); sp = new LogVariable("D2", "Speed"); vel = new LogVariable("D1", "Velocity"); dist = new LogVariable("D2", "Distance"); frame = new LogVariable("U", "Frame"); }
void InitLogs() { logs = new List <StreamWriter>(); for (int i = 0; i < LogVariable.GetIDs().Count; i++) { StreamWriter f = File.AppendText(path + LogVariable.GetIDs()[i] + ".txt"); logs.Add(f); } }
private static int CompareByDatId(LogVariable x, LogVariable y) { int a = x.GetDatID().CompareTo(y.GetDatID()); if (a == 0) { a = x.GetName().CompareTo(y.GetName()); } return(a); }
private static int CompareByDatId(LogVariable x, LogVariable y) { int a = x.dat_id.CompareTo(y.dat_id); if (a == 0) { a = x.name.CompareTo(y.name); } return(a); }
NetworkStream stream; //To store the stream from the device // Use this for initialization private void Awake() { //Example of logging various different variables. player = GameObject.Find("Player"); LogVariable time = new LogVariable("U", "Time", delegate() { return(Time.time.ToString()); }); LogVariable vel = new LogVariable("D2", "Velocity", delegate() { return(player.transform.GetComponent <Rigidbody>().velocity.ToString()); }); LogVariable sp = new LogVariable("D1", "Speed", delegate() { return(player.transform.GetComponent <Rigidbody>().velocity.magnitude.ToString()); }); LogVariable dist = new LogVariable("D1", "Distance", delegate() { return(player.transform.position.magnitude.ToString()); }); LogVariable frame = new LogVariable("U", "Frame", delegate() { return(Time.frameCount.ToString()); }); LogVariable pos = new LogVariable("D2", "Position", delegate() { return(player.transform.position.ToString()); }); }
public static LogVariable TranslateToLogVariable(LogVariableDTO data) { LogVariable log = new LogVariable(); log.id = data.id; log.logDate = data.logDate; log.logDescription = data.logDescription; log.logType = data.logType; log.userLevel = data.userLevel; log.userName = data.userName; log.userSurname = data.userSurname; return(log); }
//Function to send the first element of the buffer queue void DataSend() { //check whether queue is empty if (databuffer.Count != 0) { string dat = databuffer.Dequeue(); int id_index = LogVariable.GetIDs().IndexOf(dat.Split(sep)[0]); logs[id_index].Write(dat); byte[] msg = System.Text.Encoding.ASCII.GetBytes(dat); stream.Write(msg, 0, msg.Length); } }
public string insertToElasticsearch(LogVariableDTO data, string indexName) { //var createIndexResponse = elasticClient.Indices.Create(indexName, c => c // .Map<LogVariable>(m => m.AutoMap()) // ); LogVariable log = new LogVariable(); log = ElasticsearchTranslate.TranslateToLogVariable(data); var response = elasticClient.Index(log, i => i .Index(indexName)); return(response.DebugInformation.ToString()); }
//Function to send the first element of the buffer queue void DataSend(string data, bool network) { //check whether queue is empty try { if (network) { byte[] msg = System.Text.Encoding.ASCII.GetBytes(data); stream.Write(msg, 0, msg.Length); } else if (!network) { int id_index = LogVariable.GetIDs().IndexOf(data.Split(sep)[0]); logs[id_index].Write(data); } } catch (Exception e) { Debug.Log(e); Debug.Log(data); } }
// Update is called once per frame void Update() { //Step 3 - Set values of LogVariable objects pos.SetVal(GetPos(player).ToString()); vel.SetVal(GetVelocity(player).ToString()); time.SetVal(GetTime().ToString()); frame.SetVal(GetFrame().ToString()); sp.SetVal(GetVelocity(player).magnitude.ToString()); dist.SetVal(GetPos(player).magnitude.ToString()); //End Step 3 EnqueueData(LogVariable.GetVals()); if (GetFrame() % 100 == 0) { foreach (StreamWriter f in logs) { f.Flush(); } } }
void Start() { int epoch = (int)(System.DateTime.UtcNow - new System.DateTime(1970, 1, 1)).TotalSeconds; //Epoch Time path = @"C:\Users\Tejas Advait\Documents\Roll-a-ball\Logs\" + epoch.ToString() + "-"; //Log file path //path_trig = @"C:\Users\Public\Documents\Unity Projects\Roll a Ball\Roll a Ball\Logs\" + epoch.ToString() + "trig.txt"; //Log file of triggers path; //port = 23456; //ip = "10.132.128.68"; InitStream(ip, port); InitLogs(); EnqueueData(LogVariable.GetHeader()); doneSending = false; isSending = true; send = new Thread(ContinuousDataSend); send.Start(); }
private void LateUpdate() { EnqueueData(LogVariable.GetVals()); }