示例#1
0
        static void Main()
        {
            var f = new ChannelFactory<IHelloWorldService>("Client.HelloWorldService");

            int count = 0;

            var c = f.CreateChannel();

            while (true)
            {
                using (var t = new TransactionScope())
                {
                    Console.Write("Enter number of message to create:");
                    var nr = int.Parse(Console.ReadLine());
                    for (int i = 0; i < nr; i++)
                    {
                        var data = new CallData
                        {
                            At = DateTime.Now,
                            Nr = Interlocked.Increment(ref count),
                            Payload = new byte[1024],
                            Host = Dns.GetHostName(),
                        };

                        Console.WriteLine(data);
                        c.Call(data);
                    }

                    t.Complete();
                }
            }
        }
示例#2
0
        protected override void Load(CallData callData)
        {
            int num = callData.GetParamNum();

            if (num > 0)
            {
                m_TargetLayer = LayerMask.NameToLayer(callData.GetParamId(0));
            }
        }
        protected override void Load(CallData callData)
        {
            int num = callData.GetParamNum();

            if (num > 0)
            {
                m_Visible = bool.Parse(callData.GetParamId(0));
            }
        }
示例#4
0
 public ICallLine CreateCall(CallData callData) => CallSource.CreateCall(this, new OutgoingCall(
                                                                             callData.OriginalLine,
                                                                             callData.DateTime,
                                                                             callData.InternalNumber,
                                                                             this,
                                                                             callData.CoCode,
                                                                             callData.CdCode,
                                                                             callData.Duration,
                                                                             callData.Cost));
示例#5
0
        // POST api/call
        public DVP_Helper.@continue Post(CallData value)
        {
            DVP_Helper.@continue continuecmd = new DVP_Helper.@continue()
            {
                app = "CallRouting"
            };

            return(continuecmd);
        }
示例#6
0
文件: DslAction.cs 项目: xmshaka/DSL
 private AbstractSyntaxComponent simplifyStatement(CallData data)
 {
     if (!data.HaveParam())
     {
         //没有参数的调用退化为基本值数据
         if (data.IsHighOrder)
         {
             //这种情况应该不会出现
             return(data);
         }
         else
         {
             data.Name.CopyComments(data);
             return(data.Name);
         }
     }
     else if (data.GetId() == "-" && data.GetParamNum() == 1)
     {
         ISyntaxComponent val  = data.GetParam(0);
         ValueData        temp = val as ValueData;
         if (null != temp && temp.IsNumber())
         {
             ValueData ret = new ValueData("-" + temp.GetId(), ValueData.NUM_TOKEN);
             ret.CopyComments(temp);
             ret.CopyComments(data);
             return(ret);
         }
         else
         {
             simplifyCallData(data);
             return(data);
         }
     }
     else if (data.GetId() == "+" && data.GetParamNum() == 1)
     {
         ISyntaxComponent val  = data.GetParam(0);
         ValueData        temp = val as ValueData;
         if (null != temp && temp.IsNumber())
         {
             ValueData ret = new ValueData(temp.GetId(), ValueData.NUM_TOKEN);
             ret.CopyComments(temp);
             ret.CopyComments(data);
             return(ret);
         }
         else
         {
             simplifyCallData(data);
             return(data);
         }
     }
     else
     {
         //有参数不会退化,对各参数进行化简
         simplifyCallData(data);
         return(data);
     }
 }
        protected override void Load(CallData callData)
        {
            int num = callData.GetParamNum();

            if (num >= 1)
            {
                m_BuffId = int.Parse(callData.GetParamId(0));
            }
        }
        protected override void Load(FunctionData funcData)
        {
            CallData callData = funcData.Call;

            if (null != callData)
            {
                Load(callData);
            }
        }
示例#9
0
        protected override void Load(CallData callData)
        {
            int num = callData.GetParamNum();

            if (num > 0)
            {
                m_Offset = ScriptableDataUtility.CalcVector3(callData.GetParam(0) as ScriptableData.CallData);
            }
        }
示例#10
0
        public DVP_Helper.hangup Post(CallData value)
        {
            DVP_Helper.hangup hangup = new DVP_Helper.hangup()
            {
                cause = "test"
            };

            return(hangup);
        }
示例#11
0
    protected override void Load(CallData callData)
    {
        int num = callData.GetParamNum();

        if (num > 0)
        {
            m_oEnable.InitFromDsl(callData.GetParam(0));
        }
    }
        protected override void Load(CallData callData)
        {
            if (callData.GetParamNum() >= 3)
            {
                m_CharacterId = int.Parse(callData.GetParamId(0));

                m_LocalPosition = ScriptableDataUtility.CalcVector3(callData.GetParam(1) as ScriptableData.CallData);
                m_LocalRotation = ScriptableDataUtility.CalcVector3(callData.GetParam(2) as ScriptableData.CallData);
            }
        }
示例#13
0
            internal int[] getResults()
            {
                var results = CallData.Select(data => data.Read <int>(8))
                              .ToArray();

                CallData.ForEach(d => d.Dispose());
                Frame.Dispose();

                return(results);
            }
示例#14
0
        /// <summary>
        /// Executes a call to a library.
        /// </summary>
        /// <param name="callData"><see cref="CallData">CallData</see> object with information about invocation.</param>
        /// <returns>Result object returned by the library.</returns>
        /// <exception cref="Exception">This Method will rethrow all exceptions thrown by the wrapper.</exception>
        protected internal virtual object InvokeInternal(CallData callData)
        {
            _pipeConnector.SendCallRequest(callData);

            CallResult callResult = _pipeConnector.ReceiveCallResponse();

            CopyParameters(callResult, callData);

            return(callResult.Result);
        }
示例#15
0
        protected override void Load(CallData callData)
        {
            int num = callData.GetParamNum();

            if (num >= 2)
            {
                m_Target.InitFromDsl(callData.GetParam(0));
                m_SkillId = int.Parse(callData.GetParamId(1));
            }
        }
示例#16
0
        protected override void Load(CallData callData)
        {
            int num = callData.GetParamNum();

            if (num > 0)
            {
                m_EntityId.InitFromDsl(callData.GetParam(0));
                m_CampId.InitFromDsl(callData.GetParam(1));
            }
        }
示例#17
0
文件: DslAction.cs 项目: xmshaka/DSL
        internal void buildHighOrderFunction()
        {
            //高阶函数构造(当前函数返回一个函数)
            FunctionData func = getLastFunction();
            CallData     temp = new CallData();

            temp.Call = func.Call;
            func.Clear();
            func.Call = temp;
        }
示例#18
0
        public void CallData_should_be_serializable()
        {
            // Arrange
            var data = new CallData(this.DummyMethodInfo, Enumerable.Empty <object>(), new object());

            // Act

            // Assert
            Assert.That(data, Is.BinarySerializable);
        }
        protected override void Load(CallData callData)
        {
            int num = callData.GetParamNum();

            if (num >= 2)
            {
                m_Offset = ScriptableDataUtility.CalcVector3(callData.GetParam(0) as ScriptableData.CallData);
                m_Radius = float.Parse(callData.GetParamId(1));
            }
        }
示例#20
0
        public void CallDataHandlesEqualsNull()
        {
            var    st = new CallData(1, 0, 0, 0);
            object o  = null;

            Assert.IsFalse(st.Equals(null));
            Assert.IsTrue(st.Equals((object)st));
            Assert.IsFalse(st.Equals(33));
            Assert.IsFalse(st.Equals(o));
        }
示例#21
0
        protected override void Load(CallData callData)
        {
            int num = callData.GetParamNum();

            if (num >= 3)
            {
                m_LayerId    = LayerMask.NameToLayer(callData.GetParamId(0));
                m_RemainTime = long.Parse(callData.GetParamId(1));
                m_Interval   = long.Parse(callData.GetParamId(2));
            }
        }
示例#22
0
        public void CallDataHoldsHashCode()
        {
            var st  = new CallData(1, 0, 0, 0);
            var st2 = new CallData(1, 0, 0, 0);

            Assert.AreNotSame(st2, st);
            Assert.AreEqual(st.GetHashCode(), st2.GetHashCode());
            var st3 = new CallData(2, 0, 0, 0);

            Assert.AreNotEqual(st.GetHashCode(), st3.GetHashCode());
        }
示例#23
0
        public void TestEquals()
        {
            var cd1 = new CallData(1, 1, 1, 1);
            var cd2 = new CallData(2, 2, 2, 2);
            var cd3 = new CallData(1, 1, 1, 1);

            Assert.AreEqual(cd1, cd3);
            Assert.AreNotSame(cd3, cd1);
            Assert.AreSame(cd1, cd1);
            Assert.AreNotEqual(cd1, cd2);
        }
示例#24
0
文件: DslAction.cs 项目: xmshaka/DSL
        private StatementData newStatement()
        {
            StatementData data = new StatementData();
            FunctionData  func = new FunctionData();
            CallData      call = new CallData();
            ValueData     name = new ValueData();

            call.Name = name;
            func.Call = call;
            data.Functions.Add(func);
            return(data);
        }
        protected override void Load(CallData callData)
        {
            int num = callData.GetParamNum();

            if (num >= 4)
            {
                m_StartPos   = ScriptableDataUtility.CalcVector3(callData.GetParam(0) as CallData);
                m_EndPos     = ScriptableDataUtility.CalcVector3(callData.GetParam(1) as CallData);
                m_Width      = float.Parse(callData.GetParamId(2));
                m_RemianTime = long.Parse(callData.GetParamId(3));
            }
        }
示例#26
0
        public void TestWrap()
        {
            var      cd1 = new CallData(1, 10, 40, 0);
            CallData cd2 = cd1.Wrap(10);

            Assert.AreNotEqual(cd1, cd2);

            Assert.AreEqual(cd1.Speed, cd2.Speed);
            Assert.AreEqual((uint)0, cd2.StartPosition);
            Assert.AreEqual((uint)10, cd2.StartTime);
            Assert.AreEqual(cd1.Duration - 10, cd2.Duration);
        }
示例#27
0
    // // 一定時間(duration)ごとにfilterによる呼び出し受け付けを繰り返す
    // // 引数 filterの記述例: () => OnResultBool()。 (引数なし、戻り値 bool)
    // // または、() => (PlayData.gameMode == GameMode.Play)など。
    // // 引数 actionの記述例:  () => OnDoRepeat()。 (引数なし、戻り値なし)
    // protected void SetRepeatCall(Func<bool> filter,
    //     float duration, float? changeDuration, float? limit,
    //     Action action)
    // {
    //     CallData callData = new CallData();
    //     callData.filter = filter;
    //     callData.action = action;

    //     repeatCallList.Add(callData);
    //     repeatSpanList.Add(duration);
    //     changeDurationList.Add(changeDuration);
    //     limitList.Add(limit);
    //     repeatDeltaList.Add(duration);  // 初回はすぐに実行可能とするため、duration経過扱いとする

    //     repeatCount++;
    // }

    // 一度のみ処理を受け付ける (例: タイトル画面でクリックされたら実行など)
    // 引数 filter: () => OnResultBool()。 (引数なし、戻り値 bool)
    // または、() => (Input.GetKeyDown(KeyCode.R))など。 ← Rボタンを押されたらリセットなど
    // 引数 actionの記述例:  () => OnDoOnce()。 (引数なし、戻り値なし)
    protected void SetOnceCall(Func <bool> filter, Action action)
    {
        CallData callData = new CallData();

        callData.filter = filter;
        callData.action = action;

        onceCallList.Add(callData);
        onceDoneList.Add(false);

        onceCount++;
    }
    // -----
    // boolのフラグ変更時に、行う処理を登録
    // 引数 trigger: true、false どちらがセットされた時に処理を行うか。どちらもであればnullセット
    // 引数 filterの記述例: () => OnResultBool()。 (引数なし、戻り値 bool)
    // または、() => (PlayData.gameMode == GameMode.Play)など。
    // 引数 actionの記述例:  x => OnDoAction(x)。 (引数bool、戻り値なし)
    public void SetOnChange(
        bool?trigger, Func <bool> filter, Action <bool> action)
    {
        CallData callData = new CallData();

        callData.trigger = trigger;
        callData.filter  = filter;
        callData.action  = action;

        callList.Add(callData);
        listCount++;
    }
        protected override void Load(CallData callData)
        {
            int num = callData.GetParamNum();

            if (num > 2)
            {
                m_BreakType = int.Parse(callData.GetParamId(0));

                m_StartTime = long.Parse(callData.GetParamId(1));
                m_EndTime   = long.Parse(callData.GetParamId(2));
            }
        }
示例#30
0
        public object Invoke(Guid clsid, string function, Execute execute, ParameterInfoTO[] args)
        {
            if (_disposed)
            {
                throw new ObjectDisposedException(nameof(IpcClient));
            }

            var info = new CallData
            {
                CLSID        = clsid,
                MethodToCall = function,
                Parameters   = args,
                ExecuteType  = execute.ToString(),
                Execute      = execute
            };

            // Write request to server
            var serializer = new JsonSerializer();
            var sw         = new StreamWriter(_pipeWrapper.GetInternalStream());

            serializer.Serialize(sw, JsonConvert.SerializeObject(info));
            sw.Flush();

            var sr             = new StreamReader(_pipeWrapper.GetInternalStream());
            var jsonTextReader = new JsonTextReader(sr);

            switch (info.Execute)
            {
            case Execute.GetType:
            {
                return(GetType(serializer, jsonTextReader));
            }

            case Execute.GetMethods:
            {
                return(GetMethodInfo(serializer, jsonTextReader));
            }

            case Execute.GetNamespaces:
            {
                return(GetNamespaces(serializer, jsonTextReader));
            }

            case Execute.ExecuteSpecifiedMethod:
            {
                return(ExecuteSpecifiedMethod(serializer, jsonTextReader));
            }

            default:
                return(null);
            }
        }
        public void AsyncProcessResponse(IClientResponseChannelSinkStack sinkStack,
                                         object state,
                                         ITransportHeaders headers,
                                         Stream stream)
        {
            CallData             data             = (CallData)state;
            SoapMessageFormatter soapMsgFormatter = data.Formatter;
            IMessage             replyMessage     = (IMessage)DeserializeMessage(
                stream, headers, (IMethodCallMessage)data.Msg,
                soapMsgFormatter);

            sinkStack.DispatchReplyMessage(replyMessage);
        }
        public void Call(CallData data)
        {
            Interlocked.Increment(ref _total);
            Interlocked.Increment(ref _active);
            Interlocked.Increment(ref _calls);

            Console.WriteLine(
                "#{6} I:{1} C:{5} T:{2} E:{3} A:{4} S:{7}| '{0}'",
                data,
                _instance,
                Thread.CurrentThread.ManagedThreadId,
                Start.Elapsed,
                _active,
                _calls,
                _total,
                DateTime.Now - data.At
                );

            Thread.Sleep(500);
            Interlocked.Decrement(ref _active);
        }
示例#33
0
 private void simplifyCallData(CallData data)
 {
     int ct = data.GetParamNum();
     for (int i = 0; i < ct; ++i) {
         ISyntaxComponent param = data.GetParam(i);
         StatementData statement = param as StatementData;
         if (null != statement) {
             data.SetParam(i, simplifyStatement(statement));
         } else {
             FunctionData func = param as FunctionData;
             if (null != func) {
                 data.SetParam(i, simplifyStatement(func));
             } else {
                 CallData call = param as CallData;
                 if (null != call) {
                     data.SetParam(i, simplifyStatement(call));
                 }
             }
         }
     }
 }
示例#34
0
        internal void beginFunction()
        {
            StatementData statement = getCurStatement();
            FunctionData func = getLastFunction();
            if (func.IsValid()) {
                //语句的多元函数的其它元函数名
                FunctionData newFunc = new FunctionData();
                CallData call = new CallData();
                ValueData name = new ValueData();
                call.Name = name;
                newFunc.Call = call;

                statement.Functions.Add(newFunc);
            }
        }
示例#35
0
 private StatementData newStatement()
 {
     StatementData data = new StatementData();
     FunctionData func = new FunctionData();
     CallData call = new CallData();
     ValueData name = new ValueData();
     call.Name = name;
     func.Call = call;
     data.Functions.Add(func);
     return data;
 }
 private string Format(CallData[] calls)
 {
     return string.Join(_delimiter, 
         Array.ConvertAll(calls, x => x.Format(_hasMultipleInstances, _requiresInstanceNumbers)));
 }
示例#37
0
        internal void buildSecondTernaryOperator()
        {
            int type;
            string name = pop(out type);

            StatementData statement = getCurStatement();
            FunctionData newFunc = new FunctionData();
            CallData call = new CallData();
            ValueData nname = new ValueData();
            call.Name = nname;
            newFunc.Call = call;
            statement.Functions.Add(newFunc);

            FunctionData func = getLastFunction();
            if (!func.IsValid()) {
                func.Call.SetParamClass((int)CallData.ParamClassEnum.PARAM_CLASS_TERNARY_OPERATOR);
                func.SetExtentClass((int)FunctionData.ExtentClassEnum.EXTENT_CLASS_STATEMENT);

                func.Call.Name.SetId(name);
                func.Call.Name.SetType(type);
                func.Call.Name.SetLine(getLastLineNumber());
            }
        }
示例#38
0
 private AbstractSyntaxComponent simplifyStatement(CallData data)
 {
     if (!data.HaveParam()) {
         //没有参数的调用退化为基本值数据
         if (data.IsHighOrder) {
             //这种情况应该不会出现
             return data;
         } else {
             data.Name.CopyComments(data);
             return data.Name;
         }
     } else if (data.GetId() == "-" && data.GetParamNum() == 1) {
         ISyntaxComponent val = data.GetParam(0);
         ValueData temp = val as ValueData;
         if (null != temp && temp.IsNumber()) {
             ValueData ret = new ValueData("-" + temp.GetId(), ValueData.NUM_TOKEN);
             ret.CopyComments(temp);
             ret.CopyComments(data);
             return ret;
         } else {
             simplifyCallData(data);
             return data;
         }
     } else if (data.GetId() == "+" && data.GetParamNum() == 1) {
         ISyntaxComponent val = data.GetParam(0);
         ValueData temp = val as ValueData;
         if (null != temp && temp.IsNumber()) {
             ValueData ret = new ValueData(temp.GetId(), ValueData.NUM_TOKEN);
             ret.CopyComments(temp);
             ret.CopyComments(data);
             return ret;
         } else {
             simplifyCallData(data);
             return data;
         }
     } else {
         //有参数不会退化,对各参数进行化简
         simplifyCallData(data);
         return data;
     }
 }
示例#39
0
 internal void buildHighOrderFunction()
 {
     //高阶函数构造(当前函数返回一个函数)
     FunctionData func = getLastFunction();
     CallData temp = new CallData();
     temp.Call = func.Call;
     func.Clear();
     func.Call = temp;
 }