Exemple #1
0
        public JointLogger(string logFile)
        {
            LogFile = logFile;
            var appName     = Fnc.GetUnityApplicationName();
            var session     = ((long)(DateTime.Now - new DateTime(1970, 1, 1)).TotalMilliseconds).ToString(CultureInfo.InvariantCulture);
            var logFileInfo = !string.IsNullOrEmpty(LogFile) ? new FileInfo(LogFile.Replace("{app_name}", appName).Replace("{session}", session)) : null;

            if (logFileInfo == null || logFileInfo.Directory == null)
            {
                throw new Exception("Invalid log file specified!");
            }

            if (!logFileInfo.Directory.Exists)
            {
                logFileInfo.Directory.Create();
            }
            _dataStream = new StreamWriter(new FileStream(logFileInfo.FullName, FileMode.Append, FileAccess.Write));
            var header = "Timestamp,PlayerId," + string.Join(",", Enum.GetNames(typeof(Joints)).Select(joint => joint + ".x," + joint + ".y," + joint + ".z").ToArray()) + ",Gesture";

            _dataStream.WriteLine(header);
        }
Exemple #2
0
        public ScoreLogger(string logFile)
        {
            LogFile = logFile;
            var appName     = Fnc.GetUnityApplicationName();
            var session     = ((long)(DateTime.Now - new DateTime(1970, 1, 1)).TotalMilliseconds).ToString(CultureInfo.InvariantCulture);
            var logFileInfo = !string.IsNullOrEmpty(LogFile) ? new FileInfo(LogFile.Replace("{app_name}", appName).Replace("{session}", session)) : null;

            if (logFileInfo == null || logFileInfo.Directory == null)
            {
                throw new Exception("Invalid log file specified!");
            }

            if (!logFileInfo.Directory.Exists)
            {
                logFileInfo.Directory.Create();
            }
            _dataStream = new StreamWriter(new FileStream(logFileInfo.FullName, FileMode.Append, FileAccess.Write));
            const string header = "Timestamp,PlayerId,Round,Round Score,Total Score";

            _dataStream.WriteLine(header);
        }