-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRecordStarter.cs
40 lines (28 loc) · 1.32 KB
/
RecordStarter.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.IO;
using oi.core.network;
namespace oi.plugin.record {
public class RecordStarter : MonoBehaviour {
private UDPConnector[] clients;
private StreamWriter writer;
private string folderPath;
private void Start() {
var time = System.DateTime.UtcNow;
string timeString = time.Year.ToString("0000") + time.Month.ToString("00") + time.Day.ToString("00") + "_" + time.Hour.ToString("00") + time.Minute.ToString("00") + time.Second.ToString("00");
folderPath = "Recordings/" + timeString;
if (!Directory.Exists(folderPath)) {
DirectoryInfo di = Directory.CreateDirectory(folderPath);
}
clients = FindObjectsOfType<UDPConnector>();
foreach (UDPConnector client in clients) {
//if (client.socketID != "kinect1") continue;
ConnectorRecorder newLoggerIn = gameObject.AddComponent<ConnectorRecorder>() as ConnectorRecorder;
newLoggerIn.Init(folderPath, client, true);
ConnectorRecorder newLoggerOut = gameObject.AddComponent<ConnectorRecorder>() as ConnectorRecorder;
newLoggerOut.Init(folderPath, client, false);
}
}
}
}