コード例 #1
0
ファイル: CallMethodEditor.cs プロジェクト: JCYTop/Project_X
        private void UpdateCache()
        {
            callMethod = target as CallMethod;
            if (callMethod != null)
            {
                if (callMethod.parameters == null)
                {
                    callMethod.parameters = new FsmVar[0];
                }

                if (callMethod.methodName == null)
                {
                    callMethod.methodName = new FsmString();
                }

                if (callMethod.behaviour != null)
                {
                    cachedType     = callMethod.behaviour.ObjectType;
                    cachedTypeName = cachedType != null ? cachedType.FullName : "";
                    //Debug.Log(cachedTypeName);
                }
                else
                {
                    //Debug.Log("callMethod.behaviour == null");
                }
            }
        }
コード例 #2
0
        public unsafe void installCompileMethod()
        {
            var hJitterDll = getJitterDllHandle();

            jitterTextFreeMem = getEndOfText(hJitterDll);

            var getJitPtr = GetProcAddress(hJitterDll, "getJit");
            var getJit    = (GetJit)Marshal.GetDelegateForFunctionPointer(getJitPtr, typeof(GetJit));

            jitterInstance    = getJit();
            jitterVtbl        = *(IntPtr *)jitterInstance;
            origCompileMethod = *(IntPtr *)jitterVtbl;

            prepareMethods();
            initializeDelegateFunctionPointers();
            installOurCode(createOurCode(origCompileMethod));
            callMethodDelegate = (CallMethod)Marshal.GetDelegateForFunctionPointer(callMethod, typeof(CallMethod));

            uint oldProtect;

            if (!VirtualProtect(jitterVtbl, IntPtr.Size, PAGE_EXECUTE_READWRITE, out oldProtect))
            {
                throw new ApplicationException("Could not enable write access to jitter vtbl");
            }
            *(IntPtr *)jitterVtbl = ourCompileMethodInfo.ptrInDll;
            VirtualProtect(jitterVtbl, IntPtr.Size, oldProtect, out oldProtect);
        }
コード例 #3
0
        protected override void VisitCallMethod(CallMethod node, object data)
        {
            ParameterValues paramVals =
                state.Stack.Perform_CallMethod(node.Method, node.IsVirtCall);

            if (node.IsVirtCall)
            {
                paramVals.ChooseVirtualMethod();
            }

            Exception exc    = null;
            Value     retVal = null;

            if (holder.ContainsMethodBody(paramVals.Method))
            {
                retVal = InterpretMethod(holder, holder[paramVals.Method], paramVals, out exc, indent + "    ");
            }
            else
            {
                retVal = paramVals.Invoke(out exc);
            }

            if (exc == null)
            {
                if (retVal != null)
                {
                    state.Stack.Push(retVal);
                }
                AddTask(node.Next);
            }
            else
            {
                HandleException(node, exc);
            }
        }
コード例 #4
0
        /// <summary>
        /// Starts an asynchronous invocation of a SOAP service method
        /// using SOAP.
        /// </summary>
        /// <param name="methodName">The name of the SOAP service method
        /// in the derived class that is invoking BeginInvoke. </param>
        /// <param name="parameters">An array of objects containing the
        /// parameters to pass to the SOAP service. The order of the
        /// values in the array correspond to the order of the parameters
        /// in the calling method of the derived class.</param>
        /// <param name="callback">The delegate to call when the asynchronous
        /// invoke is complete.</param>
        /// <param name="asyncState">Extra information supplied by the caller.
        /// </param>
        /// <returns>An IAsyncResult which is passed to EndInvoke to obtain
        /// the return values from the remote method call.</returns>
        protected new IAsyncResult BeginInvoke(string methodName, object[] parameters,
                                               AsyncCallback callback, object asyncState)
        {
            CallMethod apiFunction = new CallMethod(MakeApiCall);

            return(apiFunction.BeginInvoke(methodName, parameters, callback, apiFunction));
        }
コード例 #5
0
 /// <summary>
 /// Ends an asynchronous invocation of a SOAP service method using
 /// SOAP.
 /// </summary>
 /// <param name="asyncResult">The IAsyncResult returned from BeginInvoke.
 /// </param>
 /// <returns>An array of objects containing the return value and any
 /// by-reference or out parameters of the derived class method.</returns>
 /// <exception cref="ArgumentNullException">Thrown if
 /// <paramref name="asyncResult"/> is null.</exception>
 protected new object[] EndInvoke(IAsyncResult asyncResult) {
   if (asyncResult == null) {
     throw new ArgumentNullException("asyncResult");
   }
   CallMethod apiFunction = (CallMethod) asyncResult.AsyncState;
   return apiFunction.EndInvoke(asyncResult);
 }
コード例 #6
0
ファイル: Interface.cs プロジェクト: qrakhen/sqript
 /// <summary>
 ///
 /// </summary>
 /// <param name="name">function name, as used in code</param>
 /// <param name="parameters">parameter names to later be able to identify them inside the callback</param>
 /// <param name="call">any function that implements the CallbackMethod delegate (Value(Dictionary<string, Value>))
 /// the actual function, provide any method that accepts a Dictionary as parameter and returns a Sqript.Value
 /// all provided parameters will be accessible using the dictionary (i.e. string key = parameters["key"];)
 /// </param>
 public Call(string[] parameters, CallMethod call, ValueType returnType = ValueType.Any, string name = null)
 {
     this.parameters = parameters;
     this.call       = call;
     this.returnType = returnType;
     this.name       = name ?? call.Method.Name;
 }
コード例 #7
0
ファイル: CallTest.cs プロジェクト: paisleypark3121/Call
        public void JsonPostTest()
        {
            #region arrange
            DateTime dateTime    = new DateTime(2020, 8, 31, 13, 23, 10);
            long     timestamp   = 1598873142327;
            DateTime dateTime_ts = DateTimeOffset.FromUnixTimeMilliseconds(timestamp).DateTime.ToLocalTime();

            string alpha = "12,34";
            string beta  = "56,78";
            string body  = "[{\"datetime\":\"" + dateTime.ToString("yyyy-MM-ddTHH:mm:ss.fffZ") + "\"," +
                           "\"datetime_ts\":\"" + dateTime_ts.ToString("yyyy-MM-ddTHH:mm:ss.fffZ") + "\"," +
                           "\"alpha\":" + alpha.Replace(",", ".") + "," +
                           "\"beta\":" + beta.Replace(",", ".") + "}]";

            string          endPoint        = @"https://postman-echo.com/post";
            object          id              = "1234";
            CallMethod      callMethod      = CallMethod.POST;
            CallContentType callContentType = CallContentType.json;
            #endregion

            #region act
            ICall                       call   = new HttpCall();
            IResponseParser             parser = new SimpleParser();
            Dictionary <string, object> actual = call.doCall(id, callMethod, callContentType, endPoint, parser, body);
            #endregion

            #region assert
            Assert.IsNotNull(actual);
            Assert.IsTrue(actual.Count == 1);
            Assert.IsTrue(actual.ContainsKey("Response"));
            #endregion
        }
コード例 #8
0
ファイル: Transforms.cs プロジェクト: mortend/uno
        public static bool TryTransformEnumHasFlagToIntOps(this CallMethod s, Log log, ref Expression result)
        {
            // Enum.HasFlag() -> (((int)a & (int)b) == (int)b)
            if (s.Method.DeclaringType is EnumType && s.Method.UnoName == "HasFlag" && s.Arguments.Length == 1)
            {
                var bt = s.Method.DeclaringType.Base;

                foreach (var o in bt.Operators)
                {
                    if (o.UnoName == "op_BitwiseAnd")
                    {
                        var a = new CastOp(s.Source, bt, s.Object.ActualValue);
                        var b = new CastOp(s.Source, bt, s.Arguments[0]);

                        foreach (var p in bt.Operators)
                        {
                            if (p.UnoName == "op_Equality")
                            {
                                result = new CallBinOp(s.Source, p, new CallBinOp(s.Source, o, a, b), b);
                                return(true);
                            }
                        }

                        log.Error(s.Source, ErrorCode.I0069, "'" + bt + ".op_Equality(" + bt + "," + bt + ")' was not found");
                        return(false);
                    }
                }

                log.Error(s.Source, ErrorCode.I0069, "'" + bt + ".op_BitwiseAnd(" + bt + "," + bt + ")' was not found");
            }

            return(false);
        }
コード例 #9
0
        public static void Initialize(string[] args, Libraries libraryNames)
        {
            DllLoadUtils = Platform.IsLinux()
            ? (IDllLoadUtils) new DllLoadUtilsLinux()
            : new DllLoadUtilsWindows();

            string platformMain;

            if (Platform.IsLinux())
            {
                platformMain = "unixmain";
                LibraryName  = IntPtr.Size == 8 ? libraryNames.Linux64bit : libraryNames.Linux32bit;
            }
            else if (Platform.IsOSX())
            {
                platformMain = "osxmain";
                LibraryName  = IntPtr.Size == 8 ? libraryNames.OSX64bit : libraryNames.OSX32bit;
            }
            else
            {
                platformMain = "winmain";
                LibraryName  = IntPtr.Size == 8 ? libraryNames.Windows64bit : libraryNames.Windows32bit;
            }

            Torque6LibHandle = DllLoadUtils.LoadLibrary(LibraryName);
            if (Torque6LibHandle == IntPtr.Zero)
            {
                throw new Exception("Unable to load " + (IntPtr.Size == 8 ? "64" : "32") + " bit dll: " + LibraryName);
            }
            var mainHandle         = DllLoadUtils.GetProcAddress(Torque6LibHandle, platformMain);
            var setCallbacksHandle = DllLoadUtils.GetProcAddress(Torque6LibHandle, "SetCallbacks");

            var setCallbacks = (T6SetCallFunction)Marshal.GetDelegateForFunctionPointer(
                setCallbacksHandle, typeof(T6SetCallFunction));

            var main = (T6Main)Marshal.GetDelegateForFunctionPointer(
                mainHandle, typeof(T6Main));

            CallFunction callDelegate      = CallFunctionDelegate;
            CallMethod   methodDelegate    = CallMethodDelegate;
            IsMethod     isMethodDelegate  = IsMethodDelegate;
            IntPtr       mainEntryPointPtr = IntPtr.Zero;

            if (Initializer.GetScriptEntry() != null)
            {
                mainEntryPointPtr =
                    Marshal.GetFunctionPointerForDelegate(
                        (MainEntryPoint)Initializer.GetScriptEntry().CreateDelegate(typeof(MainEntryPoint)));
            }

            setCallbacks(Marshal.GetFunctionPointerForDelegate(callDelegate)
                         , Marshal.GetFunctionPointerForDelegate(methodDelegate)
                         , Marshal.GetFunctionPointerForDelegate(isMethodDelegate)
                         , mainEntryPointPtr);

            main(args.Length, args, IntPtr.Zero);

            DllLoadUtils.FreeLibrary(Torque6LibHandle);
        }
コード例 #10
0
            public void Callback(Node node)
            {
                if (node is ITypedNode)
                {
                    ITypedNode theNode = node as ITypedNode;
                    theNode.Type = mapper.Map(theNode.Type);
                }
                if (node is ManageField)
                {
                    ManageField theNode = node as ManageField;
                    theNode.Field = mapper.Map(theNode.Field);
                }
                if (node is MethodBodyBlock)
                {
                    MethodBodyBlock body = node as MethodBodyBlock;
                    foreach (Variable var in body.Variables)
                    {
                        var.Type = mapper.Map(var.Type);
                    }
                    body.ReturnType = mapper.Map(body.ReturnType);
                }
                if (node is CallMethod)
                {
                    CallMethod     call = node as CallMethod;
                    ResidualMethod id   = Specialization.GetResidualMethod(call);
                    if (id != null)
                    {
                        MethodBodyBlock mbb = mapper.Holder[id];
                        node.Options["HasPseudoParameter"] = mapper.HasPseudoParameter(mbb);
                        call.MethodWithParams = new MethodInfoExtention(mapper.Map(mbb), call.IsVirtCall, mapper.Map(GetParamTypes(mbb, id.IsConstructor)));
                    }
                    else
                    {
                        call.MethodWithParams = mapper.Map(call.MethodWithParams);
                    }
                }
                if (node is NewObject)
                {
                    NewObject      newObj = node as NewObject;
                    ResidualMethod id     = Specialization.GetResidualMethod(node);
                    if (id != null)
                    {
                        MethodBodyBlock mbb = mapper.Holder[id];
                        newObj.CtorWithParams = new MethodInfoExtention(mapper.Map(mbb), false, mapper.Map(GetParamTypes(mbb, id.IsConstructor)));
                        node.Options["HasPseudoParameter"] = mapper.HasPseudoParameter(mbb);
                    }
                    else
                    {
                        newObj.CtorWithParams = mapper.Map(newObj.CtorWithParams);
                    }
                }
                if (node is CreateDelegate)
                {
                    CreateDelegate crDel = node as CreateDelegate;
                    //Andrew TODO: Map this node...
                }

                // Graph should be verified AFTER the metadata is resolved
            }
コード例 #11
0
ファイル: Program.cs プロジェクト: EdiCarlos/MyPractices
 static void Main(string[] args)
 {
     Program prog = new Program();
     CallMethod call = new CallMethod(prog.ShowFullName);
    IAsyncResult result =  call.BeginInvoke("Aarif", "Khan", null, null);
    result.AsyncWaitHandle.WaitOne();
    string fullName = call.EndInvoke(result);
    Console.WriteLine(fullName);
 }
コード例 #12
0
        private static double MeasureExecutionTime(CallMethod methodToExecute)
        {
            var executionStart = DateTime.Now;

            methodToExecute();
            var executionEnd = DateTime.Now;

            return((executionEnd - executionStart).TotalMilliseconds);
        }
コード例 #13
0
        private static double MeasureExecutionTime(CallMethod methodToExecute)
        {
            var dateStart = DateTime.Now;

            methodToExecute();
            var dateEnd = DateTime.Now;

            return((dateEnd - dateStart).Milliseconds);
        }
コード例 #14
0
ファイル: StructCopyTransform.cs プロジェクト: kusma/uno
        Expression Assign(Expression obj, Expression value)
        {
            var result = new CallMethod(obj.Source, obj.Address, GetAssignMethod(obj.ReturnType), value);
            var pseq   = ParentExpression as SequenceOp;

            return(ParentExpression == null ||
                   pseq != null && pseq.Left == CurrentExpression
                ? (Expression)result
                :              new SequenceOp(result, obj));
        }
コード例 #15
0
        /// <summary>
        /// Assert that a particular method raises the expected exception.
        /// </summary>
        /// <param name="expectedException">The exception that is expected.</param>
        /// <param name="method">Method to call (use anonymous delegate).</param>
        public static Exception Raises <TExpected>(CallMethod method)
            where TExpected : Exception
        {
            try { method(); }
            catch (TExpected ex) { return(ex); }

            // Throw Assert exception if the expected exception was not thrown
            throw new AssertFailedException(string.Format(
                                                "Expected exception <{0}> was not thrown", typeof(TExpected).ToString()));
        }
コード例 #16
0
 public void FixObjects()
 {
     if (m_ChangeObjectProperty == null)
     {
         m_ChangeObjectProperty = new ChangeObjectProperty(LChangeObjectProperty);
     }
     if (m_CallMethod == null)
     {
         m_CallMethod = new CallMethod(LCallMethod);
     }
 }
コード例 #17
0
            protected internal override void VisitCallMethod(CallMethod node, object data)
            {
                StackTypes stack = data as StackTypes;

                Verifier.ProcessCallOrNewobj(node.MethodWithParams, stack, false);
                AddTask(node.Next, stack);
                if (node.IsTailCall && !IsRet(node.Next))
                {
                    throw new VerifierException();
                }
            }
コード例 #18
0
 public RemoteFuncManager(TcpClient client)
 {
     this.client = client;
     foreach (var field in typeof(Contracts).GetFields(BindingFlags.Static | BindingFlags.Public))
     {
         Contract   contract = (Contract)field.GetValue(null);
         MethodInfo method   = typeof(GameAPI).GetMethod(contract.FuncName, BindingFlags.Public | BindingFlags.Static);
         CallMethod del      = (CallMethod)Delegate.CreateDelegate(typeof(CallMethod), method);
         funcDict.Add("c_callfunc_" + contract.FuncName, new TargetInfo(del, contract));
     }
 }
コード例 #19
0
        private void DiscoverParameters()
        {
            var parms = CallMethod.GetParameters();


            foreach (var p in parms)
            {
                if (p.ParameterType.Namespace == "System.Net.Http")
                {
                    continue;
                }

                ApiServiceCallParameter callParam = new ApiServiceCallParameter(this, p);
                Parameters.Add(callParam);
            }
        }
コード例 #20
0
                /// <summary>
                /// 添加方法索引信息
                /// </summary>
                /// <param name="method">方法索引信息</param>
                public void Add(CallMethod method)
                {
                    MethodParameter[]        parameters                = method.MethodParameters;
                    MethodParameterTypeNames parameterTypeNames        = new MethodParameterTypeNames(parameters, false, false);
                    MethodParameterTypeNames historyJsonParameterIndex = default(MethodParameterTypeNames);

                    if (parameterTypeNames.IsParameter)
                    {
                        if (!ParameterIndexs.TryGetValue(ref parameterTypeNames, out historyJsonParameterIndex))
                        {
                            parameterTypeNames.Copy(++ParameterIndex);
                            ParameterIndexs.Set(ref parameterTypeNames, historyJsonParameterIndex = parameterTypeNames);
                        }
                        method.ParameterIndex = historyJsonParameterIndex.Index;
                    }
                    //method.Parameters = MethodParameterPair.Get(parameters, historyJsonParameterIndex);
                }
コード例 #21
0
 // Set the Method to be used to make the request.
 public Waiter Method(CallMethod method)
 {
     try
     {
         // Lets set the Method.
         callMethod = method;
         AddStatus("Method Set");
     }
     catch (Exception e)
     {
         // There was an Error.
         AddStatus("Method Not Set");
     }
     // Lets update our status with the manager.
     WaiterManager.Update(this);
     return(this);
 }
コード例 #22
0
ファイル: auto_pause.cs プロジェクト: natis1/combomod
            public gm_fsm_pause_data(string scene, string go, string fsm, string fsmState, int restartType = 0,
                                     float timeToRestart = 0f)
            {
                sceneName       = scene;
                gameObjectName  = go;
                fsmName         = fsm;
                fsmStateName    = fsmState;
                timeToRestartCD = new FsmVar(typeof(float))
                {
                    floatValue = timeToRestart
                };


                if (restartType == 1)
                {
                    outputCallMethod = new CallMethod
                    {
                        behaviour  = GameManager.instance.gameObject.GetComponent <combos>(),
                        methodName = "pauseCombosForTime",
                        parameters = new FsmVar[1] {
                            new FsmVar(timeToRestartCD)
                        },
                        everyFrame = false
                    };
                }
                else if (restartType == 0)
                {
                    outputCallMethod = new CallMethod
                    {
                        behaviour  = GameManager.instance.gameObject.GetComponent <combos>(),
                        methodName = "pauseCombos",
                        parameters = new FsmVar[0],
                        everyFrame = false
                    };
                }
                else
                {
                    outputCallMethod = new CallMethod
                    {
                        behaviour  = GameManager.instance.gameObject.GetComponent <combos>(),
                        methodName = "pauseCombosUntilNextScene",
                        parameters = new FsmVar[0],
                        everyFrame = false
                    };
                }
            }
コード例 #23
0
        Method CreateInvoker(Method method)
        {
            var invokeMethod = new Method(_source,
                                          _mainClass,
                                          null,
                                          Modifiers.Generated | Modifiers.Public | Modifiers.Static,
                                          InvokeName(method),
                                          DataType.Void,
                                          ParameterList.Empty);

            var testInstance = InstantiateTestFixture(method);
            var runTest      = new CallMethod(_source, testInstance, method);

            invokeMethod.SetBody(new Scope(_source, runTest));

            _mainClass.Methods.Add(invokeMethod);
            return(invokeMethod);
        }
コード例 #24
0
ファイル: Spec.cs プロジェクト: PlumpMath/cilpe-1
        protected override void VisitNewObject(NewObject downNode, object o)
        {
            PointerToNode   ptrUpNode = (o as Data).PointerToNode;
            AnnotatedMethod method    = Annotation.GetAnnotatedMethod(downNode);

            Node      upNode;
            ArrayList list = new ArrayList();

            for (int i = method.ParamVals.Count - 1; i > 0; i--)
            {
                if (Annotation.GetValueBTType(method.ParamVals[i].Val) == BTType.Static)
                {
                    list.Add(this.state.Stack.Pop());
                }
            }
            if (Annotation.GetValueBTType(method.ParamVals[0].Val) == BTType.Static)
            {
                Type objtype                  = downNode.Constructor.DeclaringType;
                ObjectReferenceValue obj      = new ObjectReferenceValue(FormatterServices.GetUninitializedObject(objtype));
                FieldInfo[]          fldInfos = ReflectionUtils.GetAllFields(objtype);
                BTType[]             btTypes  = Annotation.GetObjectFieldBTTypes(downNode);
                for (int i = 0; i < fldInfos.Length; i++)
                {
                    if (btTypes[i] == BTType.Dynamic)
                    {
                        Variable varUp = this.mbbUp.Variables.CreateVar(fldInfos[i].FieldType, VariableKind.Local);
                        this.varsHash[new PointerToObjectFieldValue(obj.Obj, fldInfos[i])] = varUp;
                        ptrUpNode = SpecializingVisitor.initVariable(varUp, ptrUpNode);
                    }
                }
                list.Add(obj);
                this.state.Stack.Push(obj);
                upNode = new CallMethod(downNode.Constructor, false, false);
            }
            else
            {
                upNode = new NewObject(downNode.Constructor);
            }
            list.Reverse();
            Value[] args = list.ToArray(typeof(Value)) as Value[];

            this.callMethod(downNode, method, ptrUpNode, upNode, args);
        }
コード例 #25
0
        public void CallMethodSerialization()
        {
            var fmt1 = new OELibProtobufFormatter.OELibProtobufFormatter();
            var assemblyQualifiedName = typeof(Echo).AssemblyQualifiedName;

            // ReSharper disable once AssignNullToNotNullAttribute
            fmt1.SerializationHelper.ManualSerilaizationActions.Add(assemblyQualifiedName,
                                                                    new Tuple <Action <System.IO.Stream, object>, Func <System.IO.Stream, string, object> >(
                                                                        (s, o) => {  }, (s, g) => new Echo()));
            var go     = new AutoResetEvent(false);
            var server =
                new CommunicationServer <ServerSideConnection>(new IPEndPoint(IPAddress.Any, 1029))
            {
                Formatter = fmt1
            };

            server.Start();
            server.ClientConnected += (s, e) => go.Set();
            var client = new ClientSideConnection(fmt1);

            client.Start("127.0.0.1", 1029);
            var ok = go.WaitOne(500);

            Assert.IsTrue(ok);
            var        go2 = new AutoResetEvent(false);
            CallMethod ee  = null;

            client.MessageReceived += (s, e) =>
            {
                ee = e as CallMethod;
                if (ee != null)
                {
                    go2.Set();
                }
            };
            server.Connections.First().SendMessage(new CallMethod("SomeMethodName", new object[] { 1, 2.2, "hello call method", new Echo(), new Echo2(), new Echo3() }, null));
            var ok2 = go2.WaitOne(500);

            Assert.IsTrue(ok2);
            Assert.AreEqual("SomeMethodName", ee.MethodName);
            Assert.AreEqual("hello call method", (string)ee.Arguments[2]);
        }
コード例 #26
0
        private IEnumerator AddHeroHooks()
        {
            while (NailArtControl == null)
            {
                yield return(null);
            }

            try
            {
                CallMethod firePillarOnRecover = new CallMethod
                {
                    behaviour  = this,
                    methodName = "FirePillar",
                    parameters = new FsmVar[0],
                    everyFrame = false
                };
                AddActionFirst(SpellControl, "Focus Cancel", firePillarOnRecover);

                CallMethod firePillarOnDamage = new CallMethod
                {
                    behaviour  = this,
                    methodName = "FirePillarDamage",
                    parameters = new FsmVar[0],
                    everyFrame = false
                };
                AddActionFirst(SpellControl, "Cancel All", firePillarOnDamage);

                CallMethod firePillarOnCompleted = new CallMethod
                {
                    behaviour  = this,
                    methodName = "FirePillarCompleted",
                    parameters = new FsmVar[0],
                    everyFrame = false
                };
                AddActionFirst(SpellControl, "Focus Get Finish", firePillarOnCompleted);

                Log("Added all hero hooks.");
            } catch (Exception e)
            {
                Log("Unable to add method: error " + e);
            }
        }
コード例 #27
0
        public unsafe void installCompileMethod()
        {
            var hJitterDll = getJitterDllHandle();

            jitterTextFreeMem = getEndOfText(hJitterDll);

            var getJitPtr = GetProcAddress(hJitterDll, "getJit");
            var getJit    = (GetJit)Marshal.GetDelegateForFunctionPointer(getJitPtr, typeof(GetJit));

            jitterInstance    = getJit();
            jitterVtbl        = *(IntPtr *)jitterInstance;
            origCompileMethod = *(IntPtr *)jitterVtbl;

            prepareMethods();
            initializeDelegateFunctionPointers();
            createOurCode();
            callMethodDelegate = (CallMethod)Marshal.GetDelegateForFunctionPointer(callMethod, typeof(CallMethod));

            writeCompileMethod(ourCompileMethodInfo.ptrInDll);
        }
コード例 #28
0
        public void AddActorRemoteMethodCall(int actorRemoteId, string methodName, bool reliable, object[] parameters)
        {
            var hashedMethodName = CompatibilityManager.GetHashCode(methodName);

            var methodCall = new CallMethod(actorRemoteId, hashedMethodName, reliable, parameters);

            if (!_methodCalls.ContainsKey(actorRemoteId))
            {
                _methodCalls.Add(actorRemoteId, new Dictionary <int, CallMethod>(1));
            }

            if (_methodCalls[actorRemoteId].ContainsKey(hashedMethodName))
            {
                _methodCalls[actorRemoteId][hashedMethodName] = methodCall;
            }
            else
            {
                _methodCalls[actorRemoteId].Add(hashedMethodName, methodCall);
            }
        }
コード例 #29
0
ファイル: Spec.cs プロジェクト: PlumpMath/cilpe-1
        protected override void VisitCallMethod(CallMethod downNode, object o)
        {
            PointerToNode ptrUpNode  = (o as Data).PointerToNode;
            bool          isVirtCall = downNode.IsVirtCall && downNode.Method.IsVirtual;

            AnnotatedMethod aMethod;

            if (isVirtCall)
            {
                aMethod = Annotation.GetAnyAnnotatedMethod(downNode);
            }
            else
            {
                aMethod = Annotation.GetAnnotatedMethod(downNode);
            }

            ArrayList list = new ArrayList();

            for (int i = aMethod.ParamVals.Count - 1; i >= 0; i--)
            {
                if (Annotation.GetValueBTType(aMethod.ParamVals[i].Val) == BTType.Static)
                {
                    list.Add(this.state.Stack.Pop());
                }
            }
            list.Reverse();
            Value[] args = list.ToArray(typeof(Value)) as Value[];

            MethodBase sMethod;

            if (isVirtCall)
            {
                sMethod = (aMethod = Annotation.GetAnnotatedMethod(downNode, args[0].Type)).SourceMethod;
            }
            else
            {
                sMethod = aMethod.SourceMethod;
            }

            this.callMethod(downNode, aMethod, ptrUpNode, new CallMethod(sMethod, false, downNode.IsTailCall), args);
        }
コード例 #30
0
ファイル: redwing_hooks.cs プロジェクト: emodeca/redwing
        private void setupFlamePillar()
        {
            // lul... grimm enemy range.
            flamePillarDetect = new GameObject("redwingFlamePillarDetect",
                                               typeof(redwing_pillar_detect_behavior), typeof(Rigidbody2D), typeof(CircleCollider2D));
            flamePillarDetect.transform.parent        = voidKnight.transform;
            flamePillarDetect.transform.localPosition = Vector3.zero;


            var fpRangeCollide = flamePillarDetect.GetComponent <CircleCollider2D>();
            var bounds         = fpRangeCollide.bounds;

            bounds.center            = flamePillarDetect.transform.position;
            fpRangeCollide.isTrigger = true;
            fpRangeCollide.radius    = FP_RANGE;

            var fpFakePhysics = flamePillarDetect.GetComponent <Rigidbody2D>();

            fpFakePhysics.isKinematic = true;

            try
            {
                var firePillarOnRecover = new CallMethod
                {
                    behaviour  = flamePillarDetect.GetComponent <redwing_pillar_detect_behavior>(),
                    methodName = "spawnFirePillar",
                    parameters = new FsmVar[0],
                    everyFrame = false
                };

                addAction(voidKnightSpellControl, "Focus Completed", firePillarOnRecover);
            }
            catch (Exception e)
            {
                log("Unable to add method: error " + e);
            }

            log("got to end of FP method");
        }
コード例 #31
0
ファイル: State.cs プロジェクト: PlumpMath/cilpe-1
 protected override void VisitCallMethod(CallMethod node, object data)
 {
     result = false;
 }
コード例 #32
0
ファイル: Start.cs プロジェクト: tdochev/TelerikAcademy
 public static void Main()
 {
     var td = new CallMethod(TimerDelegate.CallMethodAtTSeconds);
     td(1);
 }
コード例 #33
0
ファイル: MyLock.cs.cs プロジェクト: wybq68/DIH_LUMBARROBAT
        public virtual void DoAction(CallMethod callMethod, bool isCreateNewThread = false)
        {
            lock (_lock)
            {
                if (IsLock)
                {
                    return;
                }
                else isLock = true;
            }

            try
            {
                if (isCreateNewThread)
                {
                    ThreadPool.QueueUserWorkItem((args) =>
                    {
                        try
                        {
                            callMethod();
                        }
                        catch (Exception e)
                        {
                            throw e;
                        }
                        finally
                        {
                            lock (_lock)
                            {
                                isLock = false;
                                if (parentLock != null)
                                {
                                    parentLock.childLock = null;
                                }
                            }
                        }
                    });
                }
                else
                {
                    callMethod();
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                if (!isCreateNewThread)
                {
                    lock (_lock)
                    {
                        isLock = false;
                        if (parentLock != null)
                        {
                            parentLock.childLock = null;
                        }
                    }
                }
            }
        }
コード例 #34
0
ファイル: MyLock.cs.cs プロジェクト: wybq68/DIH_LUMBARROBAT
 public override void DoAction(CallMethod callMethod, bool isCreateNewThread = false)
 {
     return;
 }
コード例 #35
0
 /// <summary>
 /// Starts an asynchronous invocation of a SOAP service method
 /// using SOAP.
 /// </summary>
 /// <param name="methodName">The name of the SOAP service method
 /// in the derived class that is invoking BeginInvoke. </param>
 /// <param name="parameters">An array of objects containing the
 /// parameters to pass to the SOAP service. The order of the
 /// values in the array correspond to the order of the parameters
 /// in the calling method of the derived class.</param>
 /// <param name="callback">The delegate to call when the asynchronous
 /// invoke is complete.</param>
 /// <param name="asyncState">Extra information supplied by the caller.
 /// </param>
 /// <returns>An IAsyncResult which is passed to EndInvoke to obtain
 /// the return values from the remote method call.</returns>
 protected new IAsyncResult BeginInvoke(string methodName, object[] parameters,
     AsyncCallback callback, object asyncState) {
   CallMethod apiFunction = new CallMethod(MakeApiCall);
   return apiFunction.BeginInvoke(methodName, parameters, callback, apiFunction);
 }
コード例 #36
0
ファイル: Lab11.cs プロジェクト: ravikamath/CPI311
 public Scene(CallMethod update, CallMethod draw)
 {
     Update = update; Draw = draw;
 }