static void Main(string[] args) { var handle = GetConsoleWindow(); if (args.Length > 0) { if(args[0].Equals("debug")){ ShowWindow(handle, SW_SHOW); // show the console window for debug purposes } else { ShowWindow(handle, SW_HIDE); // hdie the console } } else { ShowWindow(handle, SW_HIDE); // hide the console } HttpServer httpServer; httpServer = new MyHttpServer(8090); Thread thread = new Thread(new ThreadStart(httpServer.listen)); thread.Start(); //var handle = GetConsoleWindow(); // Hide //ShowWindow(handle, SW_HIDE); // Show //ShowWindow(handle, SW_SHOW); }
//public IPAddress SendIp { get; set; } //public int SendPort { get; set; } //public int Ttl { get; set; } //public int Id { get; set; } //public int Noask { get; set; } //public UdpClient receivingClient { get; set; } //public UdpClient sendingClient { get; set; } //public Thread receivingThread { get; set; } public Form1(String[] args) { InitializeComponent(); HttpServer httpServer; httpServer = new MyHttpServer(Int32.Parse(Utilities.LocalPort())); Thread thread = new Thread(new ThreadStart(httpServer.listen)); thread.Start(); }
public static int Main(String[] args) { HttpServer httpServer; if (args.GetLength(0) > 0) { httpServer = new MyHttpServer(Convert.ToInt16(args[0])); } else { httpServer = new MyHttpServer(8080); } Thread thread = new Thread(new ThreadStart(httpServer.listen)); thread.Start(); return 0; }
public static int Main(String[] args) { HttpServer httpServer; if (args.GetLength(0) > 0) { httpServer = new MyHttpServer(Convert.ToInt16(args[0])); } else { httpServer = new MyHttpServer(57001); } Thread thread = new Thread(new ThreadStart(httpServer.listen)); thread.Start(); return(0); }
public static int Main(String[] args) { string ipaddress = getIPAddress(); string url = "http://transgame.csail.mit.edu:9537/?varname=win7ipaddress&set=" + ipaddress; WebClient webClient = new WebClient(); webClient.DownloadString(url); Console.WriteLine("done uploading ip"); HttpServer httpServer; if (args.GetLength(0) > 0) { httpServer = new MyHttpServer(Convert.ToInt16(args[0])); } else { httpServer = new MyHttpServer(8080); } Thread thread = new Thread(new ThreadStart(httpServer.listen)); thread.Start(); Console.WriteLine("server started"); return(0); }
private SkeneClient(string characterName = "") : base("Skene", characterName) { this.Targets = new Dictionary<string, TargetInfo>(); this.PersonGazeDirection = new Dictionary<int, GazeEnum>(); this.PersonLocation = new Dictionary<int, Vector2D>(); this.PersonLocation[0] = new Vector2D(-30, 0); this.PersonLocation[1] = new Vector2D(30, 0); GazeManager = new GazeManager(this); IdleManager = new IdleManager(this); SetPublisher<ISkenePublisher>(); SkPublisher = new SkenePublisher(Publisher, this); _questionsFinishEventDelaySeconds = Properties.Settings.Default.QuestionsFinishEventDelaySeconds; this.NewClientConnected += ((name, newClientId) => {if (name.Contains("NAO")) RedetectMutualGaze();}); this.ClientConnected += (() => RedetectMutualGaze()); LoadUtteranceValidators(); if (utteranceValidationSets.Count > 0) { if (utteranceValidationSets.ContainsKey(Properties.Settings.Default.UtteranceValidationSet)) utteranceValidationSet = utteranceValidationSets[Properties.Settings.Default.UtteranceValidationSet]; else { foreach(UtteranceValidationSet uvs in utteranceValidationSets.Values) { UtteranceValidationSet = uvs; } } Debug("Using Utterance Validation Set: '{0}'", Path.GetFileNameWithoutExtension(utteranceValidationSet.Filename)); } else { utteranceValidationSet = new UtteranceValidationSet(targetInstructionsValidator, nonTargetInstructionsValidator, animationsValidator, gameInstructionsValidator, tagsValidator, targetsValidator, faceExpressionsValidator, ttsValidator); Debug("Using Default Utterance Validation Set."); } SetTarget(GazeTarget.Person); SetTarget(GazeTarget.Person2); SetTarget(GazeTarget.Clicks); SetTarget(GazeTarget.Random); SetTarget(GazeTarget.ThroughMap); SetTarget(GazeTarget.AcrossRoom); SetAngleTarget("topLeft", new Vector2D(-30, 30)); SetAngleTarget("middleLeft", new Vector2D(-30, 0)); SetAngleTarget("bottomLeft", new Vector2D(-30, -20)); SetAngleTarget("topFront", new Vector2D(0, 30)); SetAngleTarget("middleFront", new Vector2D(0, 0)); SetAngleTarget("bottomFront", new Vector2D(0, -20)); SetAngleTarget("topRight", new Vector2D(30, 30)); SetAngleTarget("middleRight", new Vector2D(30, 0)); SetAngleTarget("bottomRight", new Vector2D(30, -20)); SetTarget(SpeakerRapport.Speaker.LeftSpeaker.ToString(), GazeTarget.Person2.ToString()); SetTarget(SpeakerRapport.Speaker.RightSpeaker.ToString(), GazeTarget.Person.ToString()); LoadUtteranceLibraries(); httpServer = new MyHttpServer(2729); httpServer.PostRequest += ((requestName, requestData) => this.PerformUtterance("", new Utterance(requestData.Replace("/", "")) )); httpServer.Targets = Targets.Keys.ToList(); httpServer.Instructions = new List<string>() { "<GAZEANDPOINTANDHIGHLIGHT(target)>", "<GLANCEANDPOINTANDHIGHLIGHT(target)>", "<GLANCEANDWAVEANDHIGHLIGHT(target)>", "<GAZEANDPOINT(target)>", "<GAZEANDWAVE(target)>", "<GAZEANDHIGHLIGHT(target)>", "<GLANCEANDPOINT(target)>", "<GLANCEANDWAVE(target)>", "<GLANCEANDHIGHLIGHT(target)>", "<POINTANDHIGHLIGHT(target)>", "<WAVEANDHIGHLIGHT(target)>", "<GAZE(target)>", "<GLANCE(target)>", "<POINT(target)>", "<WAVE(target)>", "<HIGHLIGHT(target)>", "<ANIMATE(animationName)>", "<HEADNOD(count)>", "<HEADNODNEGATIVE(count)>", "<GAME(gameAction)>", "<FACE(expression)>", "<FACESHIFT(expression)>", "<EYEBLINK(count)>", "<SLOWEYEBLINK(count)>"}; httpThread = new Thread(new ThreadStart(httpServer.listen)); httpThread.Start(); utterancesQueueThread = new Thread(new ThreadStart(UtteranceQueueCycle)); utterancesQueueThread.Start(); }
public static int Main(String[] args) { HttpServer httpServer; string[] cName = new string[10]; // 開啟設定檔 int counter = 0; string line; try { // Read the file and display it line by line. System.IO.StreamReader file = new System.IO.StreamReader("SimpleHttpServer.txt"); while ((line = file.ReadLine()) != null) { cName[counter] = line; Console.WriteLine(line + "允許在中午吃飯時間開機。"); counter++; } file.Close(); } catch { } if (args.GetLength(0) > 0) { httpServer = new MyHttpServer(Convert.ToInt16(args[0])); Console.WriteLine("自動關機伺服器啟動中...連接埠 {0}",args[0]); } else { httpServer = new MyHttpServer(1234); Console.WriteLine("自動關機伺服器啟動中...連接埠 1234"); } httpServer.ClassNameArray = cName; Thread thread = new Thread(new ThreadStart(httpServer.listen)); thread.Start(); return 0; }