public static ReadKey ( ) : |
||
Результат |
private void _BaseMethodsTest() { Console.WriteLine("BaseMethods test:"); using (Service svc = new Service("BaseMethodsTest")) { Console.WriteLine("DriveMode: {0}", svc.driveMode); Console.WriteLine("FPS: {0}", svc.fps); Console.WriteLine("frameInterval: {0}", svc.frameInterval); Console.WriteLine("isStarted: {0}", svc.isStarted); Console.WriteLine("svc type: {0}", svc.svcType); svc.fps = 1; Console.WriteLine("After set fps to 1, FPS: {0}, frameInterval: {1}", svc.fps, svc.frameInterval); try { svc.fps = LibConfig.commMaxServiceFPS + 10; } catch (Exception e) { Console.WriteLine("After set fps to {0}, exception occurred, right!", LibConfig.commMaxServiceFPS + 10); Console.WriteLine("exception:\n{0}", e); } } Console.WriteLine("Press any key to finish BaseMethods test..."); Console.ReadKey(); }
public void Run(string[] args) { Console.WriteLine("Core/Config/Ini test:"); using (var ini = new Ini()) { string file = "test_ini.ini"; Console.WriteLine("Load config file: {0}", file); ini.LoadFromFile(file); var helloSection = ini["Hello"]; Console.WriteLine("Hello section get: {0}", helloSection.sectionName); var unknownSection = ini.GetSection("sdfsafafas"); Console.WriteLine("Get not exist section, return: {0}", unknownSection); Console.WriteLine("[Hello] Cfg1 = {0}", ini.GetValue <int>("Hello", "Cfg1")); Console.WriteLine("[Hello] Cfg2 = {0}", ini.GetValue <string>("Hello", "Cfg2")); Console.WriteLine("[Hello] Cfg3 = {0}", ini.GetValue <string>("Hello", "Cfg3")); Console.WriteLine("[Hello] Cfg4 = {0}", ini.GetValue <bool>("Hello", "Cfg4")); Console.WriteLine("[World] Cfg1 = {0}", ini.GetValue <int>("World", "Cfg1")); Console.WriteLine("[World] Cfg2 = {0}", ini.GetValue <string>("World", "Cfg2")); Console.WriteLine("[World] Cfg3 = {0}", ini.GetValue <string>("World", "Cfg3")); Console.WriteLine("[World] Cfg4 = {0}", ini.GetValue <bool>("World", "Cfg4")); } Console.WriteLine("Press any key to exit..."); Console.ReadKey(); }
public void Run(string[] args) { Console.WriteLine("Timer test:"); using (Service svc = new Service("TimerTestSvc")) { svc.Start(); Console.WriteLine("Press any key to pause TimerTest..."); Console.ReadKey(); } }
public void Run(string[] args) { Console.WriteLine("Comm/Service test:"); // _BaseMethodsTest(); _StartStopTest(); // _ListenTest(); // _ConnectTest(); // _SendRecvTest(); // _PreHandleTest(); // _PacketExcTest(); // _FrameExcTest(); // _ExternalDriveTest(); Console.WriteLine("Press any key to exit..."); Console.ReadKey(); }
private void _StartStopTest() { Console.WriteLine("Start/Stop service test:"); using (Service svc = new Service("StartStopTest")) { svc.Start(); Console.WriteLine("Start service, wait 2 seconds..."); Thread.Sleep(2000); Console.WriteLine("Stop service..."); svc.Stop(); Console.WriteLine("ReStart service..."); svc.Start(2); Thread.Sleep(5000); Console.WriteLine("Stop service..."); svc.Stop(); } Console.WriteLine("Press any key to finish Start/Stop service test..."); Console.ReadKey(); }
public void Run(string[] args) { Console.WriteLine("Core/Log/Logger test:"); string logCfg = "Logger_Cfg.cfg"; LoggerMgr.Init(logCfg); // Test Root logger. Log.enabledLogFileInfo = true; Log.Dbg("A debug message from Log.Dbg()..."); Log.Info("A info message from Log.Info()..."); Log.Warn("A warn message from Log.Warn()..."); Log.Err("A error message from Log.Err()..."); Log.Fatal("A fatal message from Log.Fatal()..."); Log.Dbg <Log>("A debug message from Log.Dbg<Log>()..."); Log.Info <Log>("A debug message from Log.Dbg<Log>()..."); Log.Warn <Log>("A debug message from Log.Dbg<Log>()..."); Log.Err <Log>("A debug message from Log.Dbg<Log>()..."); Log.Fatal <Log>("A debug message from Log.Dbg<Log>()..."); // Get test logger to test. var testLogger = LoggerMgr.Get("test"); testLogger.Dbg("A debug message from testLogger.Dbg()..."); testLogger.Info("A info message from testLogger.Info()..."); testLogger.Warn("A warn message from testLogger.Warn()..."); testLogger.Err("A error message from testLogger.Err()..."); testLogger.Fatal("A fatal message from testLogger.Fatal()..."); Console.WriteLine("Press any key to exit test..."); Console.ReadKey(); LoggerMgr.Destroy(); }