Esempio n. 1
0
        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);
        }
Esempio n. 2
0
 static RemoteInvoke()
 {
     if (_instance == null)
     {
         _instance = new RemoteInvoke();
     }
 }
Esempio n. 3
0
        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));
        }
Esempio n. 4
0
        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));
        }
Esempio n. 5
0
 /// <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));
 }
Esempio n. 6
0
    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");
    }
Esempio n. 7
0
    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();
        }
    }
Esempio n. 8
0
        /// <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);
            }
        }
Esempio n. 9
0
        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;
        }
Esempio n. 10
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);
    }