private void sendUpdatePacmans() { for (int i = 0; i < players.Count; i++) { pacmans[i][0] = i; pacmans[i][1] = players[i].getLeft(); pacmans[i][2] = players[i].getTop(); pacmans[i][3] = players[i].getScore(); } for (int i = 0; i < players.Count; i++) { try { ClientInterface c = (ClientInterface)Activator.GetObject(typeof(ClientInterface), players[i].getUrl()); c.updatePacmans(pacmans, round); } catch (Exception e) { Console.WriteLine("ERRO3" + i); failureDetector.getKnownProcessById(i.ToString()).addFail(new Fail()); players[i].setAlive(false); } } }
internal InstructDriver(PassportClient client) { LogHelper.CreateLog(null, string.Format("ID为{0}的Passport客户端启动", client.ClientID), "passport.log"); this.Client = client; this.InstructList = new Queue <Instruct>(this.QueueSize); watch = new Stopwatch(); ClientService = new ClientInterface(); ClientService.Url = UrlUtil.JoinUrl(Client.Url.Trim(), client.APIFilePath); ClientService.AllowAutoRedirect = true; LastSuccessTime = DateTime.Now; LoadDbInstruct();//载入数据库数据 if (this.InstructList.Count > 0) { this.thread = new Thread(ThreadStart); thread.IsBackground = true; thread.Start(); } else { this.IsOpenQueue = true; //没有数据库记录, 打开队列 } }
public void ThenICallCurrencyConvertorWithINRAndUSD(string baseCurrency, string toCurrency) { ClientInterface currencyconverter = new ClientInterface(); CurrencyConversionResponse response = currencyconverter.GetCurrencyCoverted(baseCurrency, toCurrency); rates = (Math.Round(response.result, 3)); }
public int push(MeetingProposal meeting, string node) { // Console.WriteLine(node + " pushed " + command.commandId()); ClientInterface client = null; try { client = (ClientInterface)Activator.GetObject(typeof(ClientInterface), node); if (client != null) { PullRemoteAsyncDelegate RemoteDel = new PullRemoteAsyncDelegate(client.pull); IAsyncResult RemAr = RemoteDel.BeginInvoke(meeting, null, null); RemAr.AsyncWaitHandle.WaitOne(); int status = RemoteDel.EndInvoke(RemAr); return(status); } else { return(0); } } catch (Exception) { return(0); } }
public void ping() { for (int i = 0; i < knownProcesses.Count; i++) { string alive; try { if (knownProcesses[i].getId().Equals("server")) { ServerInterface s = (ServerInterface)Activator.GetObject( typeof(ServerInterface), knownProcesses[i].getUrl()); //alive = s.ping(); } else { ClientInterface c = (ClientInterface)Activator.GetObject( typeof(ClientInterface), knownProcesses[i].getUrl()); // alive = c.ping(); } // if (!alive.Equals("alive")) { //todo // } } catch (Exception e) { knownProcesses[i].addFail(new Fail()); } } }
public override void handleClientSide(ClientInterface clientInterface) { if (user != null) clientInterface.GiveUserResponse(user); else clientInterface.GiveUserResponse(users); }
public void DoSpreadMessage(Proposal p, int actualRound, int totalRounds, int numberOfMessages, String clientToSendURL) { Console.WriteLine("Mandei ao/a " + clientToSendURL); ClientInterface chosenClient = (ClientInterface)Activator.GetObject(typeof(ClientInterface), clientToSendURL); chosenClient.Gossip(p, actualRound + 1, totalRounds, numberOfMessages); }
public void processCommand(string line) { string[] linesplit = line.Split(null); if (linesplit[0].Equals("skip")) { return; } else if (linesplit[0].Equals("GlobalStatus")) //globalstatus on client!!! improve globalstatus on server { globalStatus(); } else if (linesplit[0].Equals("Crash")) //CRASH PID { if (serversUrl.Contains(mapa[linesplit[1]])) { ServerInterface s = (ServerInterface)Activator.GetObject( typeof(ServerInterface), mapa[linesplit[1]]); s.crash(); serversUrl.Remove(mapa[linesplit[1]]); mapa.Remove(linesplit[1]); } else if (clientsUrl.Contains(mapa[linesplit[1]])) { ClientInterface c = (ClientInterface)Activator.GetObject( typeof(ClientInterface), mapa[linesplit[1]]); c.crash(); clientsUrl.Remove(mapa[linesplit[1]]); mapa.Remove(linesplit[1]); } } else if (linesplit[0].Equals("LocalState")) /*todo*/ } {
public void notifyAllPlayers() { List <string> clientsUrl = new List <string>(); for (int i = 0; i < maxPlayersServer; i++) { clientsUrl.Add(players[i].getUrl()); } for (int i = 0; i < maxPlayersServer; i++) { try { Console.WriteLine(players[i].getUrl()); ClientInterface c = (ClientInterface)Activator.GetObject(typeof(ClientInterface), players[i].getUrl()); c.notifyGameStart(); // c.updatePlayersOnClient(clientsUrl); } catch (Exception e) { Console.WriteLine(e); failureDetector.getKnownProcessById(i.ToString()).addFail(new Fail()); //make thread to try again with this client players[i].setAlive(false); } } Console.WriteLine("All players notified"); }
public void Initialize(DalamudPluginInterface pluginInterface) { this.pluginInterface = pluginInterface; ci = new ClientInterface(pluginInterface.TargetModuleScanner, pluginInterface.Data); try { var macroCallPtr = pluginInterface.TargetModuleScanner.ScanText("E8 ?? ?? ?? ?? E9 ?? ?? ?? ?? 48 8D 4D 28"); macroCallHook = new Hook <MacroCallDelegate>(macroCallPtr, new MacroCallDelegate(MacroCallDetour)); macroCallHook?.Enable(); pluginInterface.CommandManager.AddHandler("/nextmacro", new Dalamud.Game.Command.CommandInfo(OnMacroCommandHandler) { HelpMessage = "Executes the next macro.", ShowInHelp = true }); pluginInterface.CommandManager.AddHandler("/runmacro", new Dalamud.Game.Command.CommandInfo(OnRunMacroCommand) { HelpMessage = "Execute a macro (Not usable inside macros). - /runmacro ## [individual|shared].", ShowInHelp = true }); pluginInterface.Framework.OnUpdateEvent += FrameworkUpdate; } catch (Exception ex) { PluginLog.LogError(ex.ToString()); } }
/** * Each HTTP processor object handles one client. If Keep-Alive is enabled then this * object will be reused for subsequent requests until the client breaks keep-alive. * This usually happens when it times out. Because this could easily lead to a DoS * attack, we keep track of the number of open processors and only allow 100 to be * persistent active at any one time. Additionally, we do not allow more than 500 * outstanding requests. */ internal HttpProcessor(Socket socket, ref ClientInterface commonCode, TimeSpan cacheTime) { _socket = socket; _headers = new Hashtable(); _commonCode = commonCode; _cacheTime = cacheTime; }
public void SendLogNMessages(string meeting_topic, List <string> client_addresses) { Console.WriteLine("Propagating \"" + meeting_topic + "\" to log2(" + client_addresses.Count + ") servers."); int number_clients = client_addresses.Count; if (number_clients != 0) { double clients_double = Convert.ToDouble(number_clients); double clients_log = Math.Log(clients_double, 2); // se for 0 e porque so havia um if (clients_log != 0) { double log_round = Math.Ceiling(clients_log); string[] random_clients = this.PickNRandomClients((int)log_round, client_addresses); for (int i = 0; i < random_clients.Length; i++) { ClientInterface client = (ClientInterface)Activator.GetObject(typeof(ClientInterface), "tcp://" + random_clients[i]); SendMeetingToClientGossipAsyncDelegate RemoteDel = new SendMeetingToClientGossipAsyncDelegate(client.SendMeetingGossip); AsyncCallback RemoteCallback = new AsyncCallback(ClientCommunication.SendMeetingToClientGossipAsyncCallBack); IAsyncResult RemAr = RemoteDel.BeginInvoke(meeting_topic, 1, "OPEN", null, client_addresses, RemoteCallback, null); } } } Console.WriteLine("Propagation was successfully done!"); }
public void Initialize(DalamudPluginInterface pluginInterface) { generalStopwatch.Start(); cacheTimer.Start(); #if DEBUG drawConfigWindow = true; #endif this.PluginInterface = pluginInterface; LoadConfig(); PluginInterface.Framework.OnUpdateEvent += FrameworkUpdate; IconManager = new IconManager(pluginInterface); actionManagerStatic = pluginInterface.TargetModuleScanner.GetStaticAddressFromSig("48 89 05 ?? ?? ?? ?? C3 CC C2 00 00 CC CC CC CC CC CC CC CC CC CC CC CC CC 48 8D 0D ?? ?? ?? ?? E9 ?? ?? ?? ??"); blueSpellBook = (uint *)(pluginInterface.TargetModuleScanner.GetStaticAddressFromSig("0F B7 0D ?? ?? ?? ?? 84 C0") + 0x2A); PluginLog.Verbose($"Blue Spell Book: {(ulong) blueSpellBook:X}"); ActionManager = new ActionManager(this, actionManagerStatic); pluginInterface.UiBuilder.OnOpenConfigUi += OnOpenConfigUi; PluginInterface.UiBuilder.OnBuildUi += this.BuildUI; pluginInterface.ClientState.TerritoryChanged += TerritoryChanged; TerritoryChanged(this, pluginInterface.ClientState.TerritoryType); updateRetainerListHook = new Hook <UpdateRetainerListDelegate>(pluginInterface.TargetModuleScanner.ScanText("40 53 48 83 EC 20 48 8B 01 48 8B D9 FF 50 20 84 C0 74 0F 48 8B 03 48 8B CB 48 83 C4 20 5B 48 FF 60 18 E8"), new UpdateRetainerListDelegate(UpdateRetainerListDetour)); updateRetainerListHook.Enable(); Client = new ClientInterface(pluginInterface.TargetModuleScanner, pluginInterface.Data); SetupCommands(); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); var Form = new ClientInterface(); SplashScreen.ShowSplashScreen(); Application.DoEvents(); SplashScreen.SetStatus("Loading Client Interface"); System.Threading.Thread.Sleep(1000); SplashScreen.SetStatus("Loading module 1"); System.Threading.Thread.Sleep(500); /* * SplashScreen.SetStatus("Loading module 2"); * System.Threading.Thread.Sleep(300); * SplashScreen.SetStatus("Loading module 3"); * System.Threading.Thread.Sleep(900); * SplashScreen.SetStatus("Loading module 4"); * System.Threading.Thread.Sleep(100); * */ SplashScreen.CloseForm(); Application.Run(Form); }
public TCPConnection(String ip, int port, ClientInterface host, ITCPDataListener listener) { GUI = host; this.listener = listener; client = new TcpClient(ip, port); reader = new Thread(new ThreadStart(new TCPReceiver(client, listener).Start)); reader.Start(); }
public void AskNeighbourForMeetings(String clientName, String clientURL) { ClientInterface chosenClient = (ClientInterface)Activator.GetObject(typeof(ClientInterface), clientURL); Dictionary <String, AbstractMeeting> meetings = chosenClient.getAllMeetings(); this.AllMeetings = meetings; this.UpdateMeetingsFromClient(); }
public FBackup(ClientInterface newInterface) { InitializeComponent(); _myInterface = newInterface; saveFileDialog1.InitialDirectory = Environment.GetFolderPath( Environment.SpecialFolder.MyDocuments); }
public void GivenICallOpenWeatherApiWithLatitudeAndLongitude(Decimal Latitude, Decimal Longitude) { this.Latitude = Latitude.ToString(); this.Longitude = Longitude.ToString(); // weatherApi = new ClientInterface(); WeatherResponseModel response = weatherApi.GetCurrentWeather(this.Latitude, this.Longitude); WeatherApiTemp = Convert.ToInt32(response.current.temp); }
public void Inject(string processName) { if (Injected) { return; } var process = Process.GetProcessesByName(processName) .FirstOrDefault() ?? throw new AppException($"无法找到正在运行的 {processName} 应用."); if (!RemoteHooking.IsAdministrator) { // Please run the program as an administrator throw new AppException("请以管理员身份运行程序."); } if (Parameter.DirectXVersion == DirectXVersion.Unkonwn) { Parameter.DirectXVersion = GetCurrentDirectXVerion(process); } logger.Info($"Current DirectX version is {Parameter.DirectXVersion}."); var injectionLibrary = typeof(InjectEntryPoint).Assembly.Location; var server = new ServerInterface(logger); string channelName = null; RemoteHooking.IpcCreateServer( ref channelName, System.Runtime.Remoting.WellKnownObjectMode.Singleton, server); Parameter.ChannelName = channelName; try { logger.Info($"Attemption to inject into process {process.ProcessName}({process.Id})"); RemoteHooking.Inject( process.Id, injectionLibrary, injectionLibrary, Parameter ); Injected = true; this.server = server; } catch (Exception ex) { logger.Error("There was an error while injecting into target:", ex); } // 锁头 Detect(process.MainWindowHandle); screenCapture.SetForegroundWindow(process.MainWindowHandle); }
public override void handleClientSide(ClientInterface clientInterface) { if (user != null) { clientInterface.GiveUserResponse(user); } else { clientInterface.GiveUserResponse(users); } }
public void GameOver() { lost = true; left = 8; top = 40; ClientInterface c = (ClientInterface)Activator.GetObject( typeof(ClientInterface), this.getUrl()); c.gameOver(); }
// ============================================================ // Constructor internal HttpServer(ref ClientInterface CommonCode, TimeSpan CacheTime, int ServerPort) { Trace.WriteLine("HttpServer: Creating in thread \"" + System.Threading.Thread.CurrentThread.Name + "\" " + " ( " + Thread.CurrentThread.ManagedThreadId.ToString() + " ) " + DateTime.Now.ToLongTimeString()); this.port = ServerPort; commonCode = CommonCode; cacheTime = CacheTime; }
public override void ClientConnect(string address) { if (useRelay) { Client = SteamNetworkingSockets.ConnectRelay <ClientInterface>(targetSteamId); } else { Client = SteamNetworkingSockets.ConnectNormal <ClientInterface>(NetAddress.From(address, port)); } }
/// <summary> /// Disconnects the Client from the remote host if connected. NOTE: Currently run asynchronously due to design flaws (to be fixed). /// Use this code after calling this method to wait for completion: /// while (client.Connected) { System.Threading.Thread.Sleep(100); } /// </summary> /// <param name="sendDisconnect">Indicates whether the remote host should be notified about the disconnect.</param> protected void Disconnect(bool sendDisconnect) { Connecting = false; Active = false; if (sendDisconnect && ClientInterface != null && ClientInterface.Connections.ContainsKey("Main") && ClientInterface.Connections["Main"] != null) { ClientInterface.Connections["Main"].Write(Password, new Command(null, ClientInterface.Information, CommandType.Close, CommandOption.Broadcast)); } Connected = false; Clients.Clear(); ClientInterface?.Dispose(); ClientInterface = null; }
private void sendUpdateGhosts() { for (int i = 0; i < players.Count; i++) { try { ClientInterface c = (ClientInterface)Activator.GetObject(typeof(ClientInterface), players[i].getUrl()); c.updateGhosts(ghostsRemote); } catch (Exception e) { Console.WriteLine("ERRO4" + i); failureDetector.getKnownProcessById(i.ToString()).addFail(new Fail()); players[i].setAlive(false); } } }
public void globalStatus() { for (int i = 0; i < clientsUrl.Count; i++) { ClientInterface c = (ClientInterface)Activator.GetObject( typeof(ClientInterface), clientsUrl[i]); c.globalStatus(); } for (int i = 0; i < serversUrl.Count; i++) { ServerInterface s = (ServerInterface)Activator.GetObject( typeof(ServerInterface), serversUrl[i]); s.globalStatus(); } }
//we don't check ties private void calculateWinner() { int maxCoins = 0; int playerId = 0; for (int i = 0; i < players.Count; i++) { Player p = players[i]; if (p.score > maxCoins) { maxCoins = p.score; playerId = p.getId(); } } try { ClientInterface c = (ClientInterface)Activator.GetObject(typeof(ClientInterface), players[playerId].getUrl()); c.gameWon(); } catch (Exception e) { Console.WriteLine("ERRO6"); failureDetector.getKnownProcessById(playerId.ToString()).addFail(new Fail()); players[playerId].setAlive(false); } for (int i = 0; i < players.Count && players[i].getId() != playerId; i++) { try { ClientInterface c = (ClientInterface)Activator.GetObject(typeof(ClientInterface), players[i].getUrl()); c.gameOver(); } catch (Exception e) { Console.WriteLine("ERRO7"); failureDetector.getKnownProcessById(i.ToString()).addFail(new Fail()); players[i].setAlive(false); } } }
private void Awake() { ProfileManager.Instance.SaveAll(); transform.parent = null; if (cBuild.GetSingleton().buildMode != enumBuildMode.inactive) { c = cBuild.GetSingleton().GetC(); } else { c = ClientInterface.GetInterface().Get_I_All_ConstructableSelector().Get_LookSC_LookC_CloseCRay_CloseC(); } visualizer = BuildingToolsPlugin.bundle.LoadAllAssets <ComputeShader>()[0]; camera = gameObject.AddComponent <Camera>(); camera.tag = "MainCamera"; camera.cullingMask = 0; camera.clearFlags = CameraClearFlags.Nothing; QualitySettings.vSyncCount = 1; Application.targetFrameRate = -1; InitializeShaderParameters(); //DisableAllScripts(); gameObject.AddComponent <FlyCamera>(); //transform.position = new Vector3(0, -50, 0); foreach (var i in SceneManager.GetActiveScene().GetRootGameObjects()) { if (i != gameObject) { Destroy(i); } } Cursor.visible = false; Cursor.lockState = CursorLockMode.Locked; }
public void Initialize(DalamudPluginInterface pluginInterface) { this.PluginInterface = pluginInterface; Client = new ClientInterface(pluginInterface.TargetModuleScanner, pluginInterface.Data); // UiHelper.Setup(pluginInterface.TargetModuleScanner); Common = new Common(pluginInterface); PluginInterface.UiBuilder.OnBuildUi += this.BuildUI; PluginInterface.Framework.OnUpdateEvent += FrameworkOnUpdate; var addr = Common.Scanner.ScanText("48 85 C9 74 24 8B 81 ?? ?? ?? ?? A8 01 75 15 F3 0F 10 41 ?? 0F 2E C1 7A 02 74 09 83 C8 01 89 81 ?? ?? ?? ?? F3 0F 11 49 48 C3 "); addr = IntPtr.Add(addr, 0x5); resetMemberPositionHook = Common.Hook <ResetMemberPositionDelegate>(addr, ResetMemberPositionDetour); changeMemberWidthHook = Common.Hook <ChangeMemberWidthDelegate>("48 89 5C 24 ?? 56 48 83 EC 30 48 89 7C 24 ?? 41 8B F0 48 63 FA 4C 8D 44 24 ?? ", ChangeMemberWidthDetour); resetChocotimeHook = Common.Hook <ResetChocoPositionDelegate>("0F BF C2 66 0F 6E C8 8B 81 ?? ?? ?? ?? 0F 5B C9 A8 01 75 15 F3 0F 10 41 ?? 0F 2E C1 7A 02 74 09 83 C8 01 89 81 ?? ?? ?? ?? F3 0F 11 49 48 C3", ResetChocoTimeDetour); SetupCommands(); }
static void Main(string[] args) { if (args.Length > 0) { runClient(args); } //(13-16) Runs the client if there are arguments else { try { ClientInterface Interface = new ClientInterface(); Interface.ShowDialog(); } catch { Console.WriteLine("Error reading details"); } } //(18-29) Runs the client and UI if there are no arguments }
static void Main(string[] args) { ClientInterface clientInterface = new ClientInterface(); clientInterface.start(); Console.ReadLine(); //tcpClient.ReceiveBufferSize = 256; //int BufferSize = tcpClient.ReceiveBufferSize; //NetworkStream nws = tcpClient.GetStream(); //FileStream fs; //fs = new FileStream(filename, FileMode.Open, // FileAccess.Read); //byte[] bytesToSend = new byte[fs.Length]; //int numBytesRead = fs.Read(bytesToSend, 0, // bytesToSend.Length); //int totalBytes = 0; ////byte[] protocolaa= Encoding.ASCII.GetBytes("abc"); ////nws.Write(protocol, 0, protocol.Length); //for (int i = 0; i <= fs.Length / BufferSize; i++) //{ // //---send the file--- // if (fs.Length - (i * BufferSize) > BufferSize) // { // nws.Write(bytesToSend, i * BufferSize, // BufferSize); // totalBytes += BufferSize; // } // else // { // nws.Write(bytesToSend, i * BufferSize, // (int)fs.Length - (i * BufferSize)); // totalBytes += (int)fs.Length - (i * BufferSize); // } //} //fs.Close(); //Console.ReadLine(); }
internal InstructDriver(PassportClient client) { LogHelper.CreateLog(null, string.Format("ID为{0}的Passport客户端启动", client.ClientID), "passport.log"); this.Client = client; this.InstructList = new Queue<Instruct>(this.QueueSize); watch = new Stopwatch(); ClientService = new ClientInterface(); ClientService.Url = UrlUtil.JoinUrl(Client.Url.Trim(), client.APIFilePath); ClientService.AllowAutoRedirect = true; LastSuccessTime = DateTime.Now; LoadDbInstruct();//载入数据库数据 if (this.InstructList.Count>0) { this.thread = new Thread(ThreadStart); thread.IsBackground = true; thread.Start(); } else this.IsOpenQueue = true; //没有数据库记录, 打开队列 }
public override void handleClientSide(ClientInterface clientInterface) { clientInterface.recievePacketBicycleCommand(this); }
public override void handleClientSide(ClientInterface clientInterface) { clientInterface.loginResponse(loginOk); }
public override void handleClientSide(ClientInterface clientInterface) { clientInterface.SaveDataResponse(succesfull); }
public override void handleClientSide(ClientInterface clientInterface) { clientInterface.recieveResponse(recieveOk); }
public override void handleClientSide(ClientInterface clientInterface) { clientInterface.LoginResponse(loginOk,isPhysician); }
public override void handleClientSide(ClientInterface clientInterface) { clientInterface.GetWerkbonnenResponse(werkbonnen); }
public override void handleClientSide(ClientInterface clientInterface) { clientInterface.LoginResponse(loginOk, accessRights); }
public override void handleClientSide(ClientInterface clientInterface) { clientInterface.ChatMessageResponse(sender, receiver, message); }
public override void handleClientSide(ClientInterface clientInterface) { clientInterface.GetUsersResponse(users); }
public virtual void handleClientSide(ClientInterface clientInterface) { }
public override void handleClientSide(ClientInterface clientInterface) { clientInterface.recievePacketSessions(this); }
public override void handleClientSide(ClientInterface clientInterface) { clientInterface.BikeValuesResponse(power, time, distance); }
public override void handleClientSide(ClientInterface clientInterface) { clientInterface.disconnectResponse(disconnectOk); }
public override void handleClientSide(ClientInterface clientInterface) { clientInterface.SaveWerkbonResponse(); }