// static public string ToXML(object o) // { // var stringwriter = new System.IO.StringWriter(); // var serializer = new XmlSerializer(o.GetType()); // serializer.Serialize(stringwriter, o); // return stringwriter.ToString(); // } public static void Main(string[] args) { // cmdInstance.CRCLCommand = getStatus; // Console.WriteLine (ToXML (cmdInstance)); int port = Schemas.CRCL.Defaults.PORT; long cycle_millis = 200; for (int i = 0; i < args.Length - 1; i++) { if (args [i].Equals("-p")) { port = Convert.ToInt32(args [i + 1]); i++; } else if (args [i].Equals("-t")) { cycle_millis = Convert.ToInt32(args [i + 1]); i++; } } aTimer = new System.Timers.Timer(cycle_millis); // Hook up the Elapsed event for the timer. aTimer.Elapsed += OnTimedEvent; aTimer.Enabled = true; Console.WriteLine("Starting C# SimRobotServer on port " + port + " with " + cycle_millis + "ms cycle_time"); Console.WriteLine("Use -p [port] to change port."); Console.WriteLine("Use -t [millis] to change cycletime."); AsynchronousSocketListener asl = new AsynchronousSocketListener(status, new AsynchronousSocketListener.HandleNewCommandDelegate(handleNewCommand), port); asl.StartListening(); // Console.WriteLine ("Starting C# SimRobotServer on port "+port); }
// static public string ToXML(object o) // { // var stringwriter = new System.IO.StringWriter(); // var serializer = new XmlSerializer(o.GetType()); // serializer.Serialize(stringwriter, o); // return stringwriter.ToString(); // } public static void Main (string[] args) { // cmdInstance.CRCLCommand = getStatus; // Console.WriteLine (ToXML (cmdInstance)); int port = Schemas.CRCL.Defaults.PORT; long cycle_millis = 200; for (int i = 0; i < args.Length - 1; i++) { if (args [i].Equals ("-p")) { port = Convert.ToInt32 (args [i + 1]); i++; } else if (args [i].Equals ("-t")) { cycle_millis = Convert.ToInt32 (args [i + 1]); i++; } } aTimer = new System.Timers.Timer(cycle_millis); // Hook up the Elapsed event for the timer. aTimer.Elapsed += OnTimedEvent; aTimer.Enabled = true; Console.WriteLine ("Starting C# SimRobotServer on port "+port +" with "+cycle_millis +"ms cycle_time"); Console.WriteLine ("Use -p [port] to change port."); Console.WriteLine ("Use -t [millis] to change cycletime."); AsynchronousSocketListener asl = new AsynchronousSocketListener (status, new AsynchronousSocketListener.HandleNewCommandDelegate(handleNewCommand), port); asl.StartListening (); // Console.WriteLine ("Starting C# SimRobotServer on port "+port); }