コード例 #1
0
ファイル: PropertyExecutor.cs プロジェクト: rpc-bindings/core
        public PropertyGetSetResult <TMarshal> Execute(PropertySetExecution <TMarshal> propertySetExecution)
        {
            GetPropertyDescriptor(propertySetExecution.ObjectId, propertySetExecution.PropertyId, out var propertyDescriptor, out var objectDescriptor);

            var result = new PropertyGetSetResult <TMarshal>
            {
                ExecutionId = propertySetExecution.ExecutionId
            };

            try
            {
                propertyDescriptor.Setter(objectDescriptor.Object, this.BindToNet(
                                              new Binding <TMarshal>
                {
                    Value      = propertySetExecution.Value,
                    TargetType = propertyDescriptor.Type
                }));
                result.Success = true;
            }
            catch (Exception e)
            {
                result.Error = e.Message;
            }

            return(result);
        }
コード例 #2
0
        private void OnPropertySetExecution(PropertySetExecution <TMarshal> propertySetExecution)
        {
            var result = propertyExecutor.Execute(propertySetExecution);

            connection.Send(new RpcRequest <TMarshal>()
            {
                PropertyResult = result
            });
        }