2022-10-16 16:18:17 +02:00
|
|
|
using UnityEngine;
|
|
|
|
using System.Diagnostics;
|
|
|
|
using System.IO;
|
2022-11-08 23:43:35 +01:00
|
|
|
using Lavender.Systems;
|
2022-10-16 16:18:17 +02:00
|
|
|
|
|
|
|
public class StartBatchManager : MonoBehaviour
|
|
|
|
{
|
2022-12-05 23:15:03 +01:00
|
|
|
uint pid = 0;
|
2022-10-16 16:18:17 +02:00
|
|
|
private void Start()
|
|
|
|
{
|
|
|
|
ConfigManager.EnsureInitialization();
|
2022-11-08 23:43:35 +01:00
|
|
|
if (ConfigManager.config.batFileLocation != "")
|
2022-12-05 23:15:03 +01:00
|
|
|
pid = StartExternalProcess.Start(ConfigManager.config.batFileLocation);
|
|
|
|
UnityEngine.Debug.Log("Batch file with PID: " + pid);
|
2022-11-08 23:43:35 +01:00
|
|
|
//Process.Start(Path.GetFullPath(ConfigManager.config.batFileLocation));
|
2022-10-16 16:18:17 +02:00
|
|
|
}
|
2022-12-05 23:15:03 +01:00
|
|
|
private void OnDestroy()
|
|
|
|
{
|
|
|
|
if (pid != 0)
|
|
|
|
{
|
|
|
|
StartExternalProcess.KillProcess(pid);
|
|
|
|
UnityEngine.Debug.Log("Batch file with PID: " + pid + " killed");
|
|
|
|
}
|
|
|
|
}
|
2022-10-16 16:18:17 +02:00
|
|
|
}
|