mirror of
https://github.com/MewoLab/AquaDX.git
synced 2026-02-11 18:17:28 +08:00
[F] Refactor CustomCameraId and remove hard-coded enums / IDs (#71)
* refactor * Add PrintCameraList check * Separate PrintCameraList to a class * cleanup
This commit is contained in:
31
AquaMai/CustomCameraId/PrintCameraList.cs
Normal file
31
AquaMai/CustomCameraId/PrintCameraList.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using MelonLoader;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AquaMai.CustomCameraId;
|
||||
|
||||
public class PrintCameraList
|
||||
{
|
||||
public static void DoCustomPatch(HarmonyLib.Harmony _)
|
||||
{
|
||||
WebCamDevice[] devices = WebCamTexture.devices;
|
||||
string cameraList = "Connected Web Cameras:\n";
|
||||
for (int i = 0; i < devices.Length; i++)
|
||||
{
|
||||
WebCamDevice webCamDevice = devices[i];
|
||||
WebCamTexture webCamTexture = new WebCamTexture(webCamDevice.name);
|
||||
webCamTexture.Play();
|
||||
cameraList += "==================================================\n";
|
||||
cameraList += "Name: " + webCamDevice.name + "\n";
|
||||
cameraList += $"ID: {i}\n";
|
||||
cameraList += $"Resolution: {webCamTexture.width} * {webCamTexture.height}\n";
|
||||
cameraList += $"FPS: {webCamTexture.requestedFPS}\n";
|
||||
webCamTexture.Stop();
|
||||
}
|
||||
cameraList += "==================================================";
|
||||
|
||||
foreach (var line in cameraList.Split('\n'))
|
||||
{
|
||||
MelonLogger.Msg($"[CustomCameraId] {line}");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user