public override int Fill(DataSet dataSet) { command = (RiaDbCommand)this.SelectCommand; connection = (RiaDbConnection)command.Connection; provider = connection.Provider; var parameters = this.GetFillParameters(); RemoteInvoke agent = new RemoteInvoke(new Uri(provider.DataSource)); string sql = command.CommandText; string code = $"var cmd=new tw.Common.SqlCmdDirect('{sql}');ds=cmd.FillDataSet();"; agent.Execute(code); var ds = agent.GetValue <DataSet>("ds"); if (ds != null) { foreach (DataTable dt in ds.Tables) { dataSet.Tables.Add(dt.Copy()); } } return(0); }
static RemoteInvoke() { if (_instance == null) { _instance = new RemoteInvoke(); } }
public RiaDbCommand(string cmdText, RiaDbConnection connection) { this.CommandText = cmdText; this.CommandType = CommandType.Text; this.DbConnection = connection; this.agent = new RemoteInvoke(new Uri(connection.Provider.DataSource)); }
/// <summary> /// 删除 /// </summary> /// <param name="url"></param> /// <param name="entityForm"></param> /// <param name="config"></param> /// <returns></returns> public static string DELETE(string url, string entityForm = null, WebapiConfig config = null, Dictionary <string, string> httpRequestHeaderMap = null) { config = config == null ? new WebapiConfig() { ParamsType = ParamType.FORM } : config; config.Method = HttpMethod.DELETE; return(RemoteInvoke.Call(url, entityForm, config, httpRequestHeaderMap)); }
void MatchFound(int networkId, IPAddress sender) { Debug.Log("Match found!! " + networkId + " " + sender); if (Network.Connected) { Session.StopAnnouncing(); Network.Disconnect(); } Network.Connect(sender); RemoteInvoke.SendMessage("Connected"); }
void OnGUI() { //GUILayout.Label("viewTesterOne " + viewTesterOne.TestString + " " + viewTesterOne.TestInt); //GUILayout.Label("viewTesterTwo " + viewTesterTwo.TestString + " " + viewTesterTwo.TestInt); if (GUILayout.Button("Send a message!")) { RemoteInvoke.SendMessage("RecieveMessage", "Yuppers!"); //viewTesterOne.TestInt++; //viewTesterTwo.TestInt++; //viewTesterOne.Sync(); //viewTesterTwo.Sync(); } }
/// <summary> /// Make a remote call to the server. /// </summary> /// <param name="methodName">Name of method to execute on the server.</param> /// <param name="arguments">Data to pass to the server method.</param> /// <returns>Result from server method.</returns> protected object RemoteCallName(string methodName, object[] arguments) { using (var client = new NamedPipeClientStream(@".", ConnectionName, PipeDirection.InOut)) { client.Connect(Timeout); client.ReadMode = PipeTransmissionMode.Message; var remoteInvoke = new RemoteInvoke { MethodName = methodName, Arguments = arguments }; var messageBytes = SerializeObject(remoteInvoke); client.Write(messageBytes, 0, messageBytes.Length); var response = (RemoteResponse)DeserializeObject(ReadAllBytes(client)); if (null != response.Exception) { throw new TargetInvocationException(response.Exception); } return(response.ReturnValue); } }
public override int Fill(DataSet dataSet) { command = (RiaDbCommand)this.SelectCommand; connection = (RiaDbConnection)command.Connection; provider = connection.Provider; var parameters = this.GetFillParameters(); RemoteInvoke agent = new RemoteInvoke(new Uri(provider.DataSource)); string sql = command.CommandText; string code = $"var cmd=new tw.Common.SqlCmdDirect('{sql}');ds=cmd.FillDataSet();"; agent.Execute(code); var ds = agent.GetValue<DataSet>("ds"); if (ds != null) { foreach (DataTable dt in ds.Tables) { dataSet.Tables.Add(dt.Copy()); } } return 0; }
void OnGUI() { //if (GUILayout.Button("TestAsync")) { // var newClient = new UdpClient(21044); // newClient.BeginReceive(result => Debug.Log("Recieved!"), null); // newClient.Close(); //} if (Network.Statistics.Log) { GUILayout.Label( "Host: " + Network.HostAddress + "\n" + "Connected: " + (Network.Connected ? Network.HostAddress.Address.ToString() : "Disconnected") + "\n" + "Connections Made: " + Network.Statistics.Connections + "\n" + "Disconnects: " + Network.Statistics.Disconnects + "\n" + "Messages\n" + "Total Recieved: " + Network.Statistics.TotalMessagesRecieved + "\n" + "Valid Recieved: " + Network.Statistics.ValidMessagesRecieved + "\n" + "Forign Recieved: " + Network.Statistics.ForignMessagesRecieved + "\n" + "Total Sent : " + Network.Statistics.MessagesSent ); } if (!Network.Connected) { var ip = "192.168.1.10"; if (GUILayout.Button("Connect (" + ip + ")")) { Network.Connect(IPAddress.Parse(ip)); } if (GUILayout.Button("Find")) { Session.Find(MatchFound); } if (GUILayout.Button("Listen For Broadcast")) { Network.BroadcastConnect(); } if (GUILayout.Button("Announce")) { Session.Announce(1); } if (GUILayout.Button("Stop Announcing")) { Session.StopAnnouncing(); } } else { if (GUILayout.Button("Send some other message!!")) { RemoteInvoke.SendMessage("RecievedMessage"); } if (GUILayout.Button("Disconnect")) { Network.Disconnect(); } } GUILayout.Label("Recieved message?? " + _recievedMessage); }