1
using System
.Net
.Sockets
;
4 using static System
.Console
;
6 var vgaControl
= new CVGAControl(true);
7 vgaControl
.Initialize(false);
8 int numOfAdaptors
= vgaControl
.GetNumOfAdaptors();
10 WriteLine($"Number of adaptors: {numOfAdaptors}");
12 for (int i
= 0; i
< numOfAdaptors
; i
++)
14 //vgaControl.SelectAdaptor(i);
15 /*var id = vgaControl.GetAdaptorID(i);
16 var name = vgaControl.GetAdaptorName(i);
17 WriteLine($"Id: {id}, name: {name}");
19 WriteLine($"Id: {vgaControl.GetAdaptorID(i)}");
20 WriteLine($"Name: {vgaControl.GetAdaptorName(i)}");
23 var nbEffects
= CVGAControl
.GetNumOfEffects(1);
24 for (int nEffect
= 0; nEffect
< nbEffects
; ++nEffect
)
26 WriteLine($"Effect id: {CVGAControl.GetEffectID(1, nEffect)}, name: {CVGAControl.GetEffectName(1, nEffect)}");
28 CVGAControl
.GetEffectOptionTypes(1, nEffect
, out nOptionTypes
);
29 WriteLine($"option types: {nOptionTypes}");
30 WriteLine($"----------");
34 for (int i = 0; i <= 100; i++)
36 var n = 1.0 - (double)i / 100;
37 vgaControl.SetLEDColor(1, (byte)(255.0 * (1.0 - n)), (byte)(255.0 * n), (byte)(20.0 * n));
44 int nType
= (optionType
& 32) != 0 ? 0 : 1;
46 vgaControl
.SetLEDBehavior(
50 (byte)optionType
, // nParams
59 vgaControl
.SetLEDColor(1, 0, 255, 40);
61 vgaControl
.SetLEDBehavior(
65 (byte)optionType
, // nParams
74 vgaControl
.SetLEDColor(1, 0, 255, 40);
76 var server
= new TcpListener(IPAddress
.Loopback
, 6577);
78 var buffer
= new byte[3];
82 WriteLine("Waiting new client...");
83 var socket
= server
.AcceptSocket();
84 socket
.Blocking
= true;
85 socket
.ReceiveTimeout
= 10_000;
89 while (socket
.Connected
)
91 var n
= socket
.Receive(buffer
, buffer
.Length
, SocketFlags
.None
);
97 //WriteLine($"n: {n}, {socket.Connected}");
103 //WriteLine($"RGB: {r}, {g}, {b}");
104 vgaControl
.SetLEDColor(1, r
, g
, b
);
107 catch (SocketException exception
)
109 WriteLine(exception
.ToString());
113 vgaControl
.Terminate();
115 WriteLine("Press any key");