static void Main(string[] args) { Console.Title = "Mactown Server Communication Interface"; Console.WriteLine("MSCI v1.0"); GameInterface = new Game(); ServerInterface = new GCPS(); GCSInterface = new GCS(); ServerInterface.OnGameDataArrived += ServerInterface_OnGameDataArrived; // test //GameInterface.AddPlayer(0, "Arsslen"); //GameInterface.CreatePacketStore(0); //GameInterface.AddToken(0, "000000000000000000000000000000"); // END Console.WriteLine("Starting Game Server..."); AsyncExec a1 = new AsyncExec(ServerInterface.Start); a1.BeginInvoke(null, null); Console.WriteLine("Starting GCS Server..."); AsyncExec a2 = new AsyncExec(GCSInterface.StartLocalServer); a2.BeginInvoke(null, null); Console.WriteLine("Monitoring..."); Streamer.Initialize(); while (Console.ReadLine() != "quit") { Console.WriteLine("To Exit type : quit"); } GCSInterface.Disconnect(); }
public void execute(System.Action <HTTPResponse> callback) { if (Application.internetReachability == NetworkReachability.NotReachable) { HTTPResponse response = new HTTPResponse(); response.url = url; response.error = true; response.errorMsg = "Internet not reachable"; callback(response); return; } if (method == HTTPMethod.POST) { if (postData == null) { postData = new byte[0]; } AsyncExec.runWithCallback <HTTPRequest, HTTPResponse>(executePost, this, callback); } else { AsyncExec.runWithCallback <HTTPRequest, HTTPResponse>(executeGet, this, callback); } }
private void retry() { if (!keepRetrying) { return; } HTTPRequest req = request.getClone(); req.execute(HTTPCallback); if (retryPosition < retryDelayTable.Length && (!useDeadline || Time.realtimeSinceStartup < retryDeadline)) { int delay = retryDelayTable[retryPosition++]; if (delay > 0) { AsyncExec.runWithDelay(delay, retry); } else { keepRetrying = false; } } else { keepRetrying = false; } }
public Home() { InitializeComponent(); try { Region = System.Drawing.Region.FromHrgn(CreateRoundRectRgn(0, 0, Width, Height, 20, 20)); GigSpace.MainForm = this; GigSpace.MessageArrived += new OnNotif(GigSpace_MessageArrived); GigSpace.NotificationArrived += new OnNotif(GigSpace_NotificationArrived); // Run Thread AsyncExec exec = new AsyncExec(GigSpace.Run); exec.BeginInvoke(null, null); } catch { } }
public void execute(System.Action <HTTPResponse> eventCallback) { callback = eventCallback; keepRetrying = true; callbackDelivered = false; if (useDeadline) { retryDeadline = Time.realtimeSinceStartup + deadlineDelay; } retry(); if (useDeadline) { AsyncExec.runWithDelay(deadlineDelay, executeDeadline); } }
public override void Execute(IrcMessage message, string args) { if (Limiter.AttemptOperation(message.Level)) { bool silent = false; if (args == "<silent>") { args = DefaultChannel; silent = true; } string stream = args.Length == 0 ? DefaultChannel : args; string uri = "https://api.twitch.tv/kraken/streams/" + stream; if (Uri.IsWellFormedUriString(uri, UriKind.Absolute)) { if (cache.ContainsKey(stream)) { Cache item = cache[stream]; if (item == null) { //already pending return; } else if ((DateTime.UtcNow - item.retrieved).TotalMinutes <= 1.0) { //in cache if (!silent) { item.Report(message); } return; } } //add new request if (cache.ContainsKey(stream)) cache.Remove(stream); cache.Add(stream, null); AsyncExec async = new AsyncExec(); async.request = WebRequest.Create(uri); async.message = message; async.stream = stream; async.silent = silent; async.Execute(); } else if (!silent) { message.ReplyPrivate("The stream you specified is invalid"); } } }