Added test structure

This commit is contained in:
Felix Weiß
2023-02-27 16:01:47 +01:00
parent 43c7f72ac4
commit fb2bd8d56d
4 changed files with 124 additions and 18 deletions

View File

@@ -3,6 +3,7 @@ using System.Threading.Tasks;
using MewtocolNet;
using MewtocolNet.Logging;
using MewtocolNet.Registers;
using static System.Net.Mime.MediaTypeNames;
namespace Examples;
@@ -10,6 +11,14 @@ class Program {
static void Main(string[] args) {
AppDomain.CurrentDomain.UnhandledException += (s,e) => {
Console.WriteLine(e.ExceptionObject.ToString());
};
TaskScheduler.UnobservedTaskException += (s,e) => {
Console.WriteLine(e.Exception.ToString());
};
Console.WriteLine("Enter your scenario number:\n" +
"1 = Permanent connection\n" +
"2 = Dispose connection");
@@ -59,21 +68,21 @@ class Program {
}
});
//await interf.ConnectAsync((plcinf) => AfterConnect(interf, registers));
await interf.ConnectAsync();
bool flip = false;
while(true) {
//bool flip = false;
//while(true) {
if(!flip) {
await interf.ConnectAsync();
} else {
interf.Disconnect();
}
// if(!flip) {
// await interf.ConnectAsync();
// } else {
// interf.Disconnect();
// }
flip = !flip;
await Task.Delay(5000);
// flip = !flip;
// await Task.Delay(5000);
}
//}
});