Beispiel #1
0
 public static void SendStreamValue(string tag, System.ValueType value)
 {
     if (mtLoggingOn)
     {
         TelemetryTools.Telemetry.Instance.SendStreamValue(tag, value);
     }
 }
        /// <summary>  Initialization method - doesn't do much but do the object
        /// creation.  We only need to do it once.
        /// </summary>
        /// <param name="context">
        /// </param>
        /// <param name="data">
        /// </param>
        /// <returns> The data object.
        /// </returns>
        /// <throws>  TemplateInitException </throws>
        public override object Init(IInternalContextAdapter context, object data)
        {
            /*
             *  Init the tree correctly
             */

            base.Init(context, data);

            /**
             * Determine the size of the item and make it a Double or BigDecimal as appropriate.
             */
            string str = FirstToken.Image;

            try
            {
                value = double.Parse(str);
            }
            catch (System.FormatException)
            {
                // if there's still an Exception it will propogate out
                value = decimal.Parse(str, System.Globalization.NumberStyles.Any);
            }

            return(data);
        }
Beispiel #3
0
    public static int Main()
    {
        System.Enum      e = Foo.Bar;
        System.ValueType vt1 = Foo.Bar, vt2 = 1;

        if (((Foo)e) != Foo.Bar)
        {
            return(1);
        }

        if (((Foo)vt1) != Foo.Bar)
        {
            return(2);
        }

        if (((int)vt2) != 1)
        {
            return(3);
        }

        //
        // Test that we can assign null to a valueType
        //

        System.ValueType vt = null;

        return(0);
    }
Beispiel #4
0
        //This is the callback from a nested action
        void OnNestedActionEnd(System.ValueType didSucceed)
        {
            if (!(bool)didSucceed)
            {
                EndAction(false);
                return;
            }

            currentActionIndex++;

            if (runInParallel)
            {
                if (currentActionIndex == actions.Count)
                {
                    EndAction(true);
                    return;
                }
            }
            else
            {
                if (currentActionIndex < actions.Count)
                {
                    MoveNext();
                }
                else
                {
                    EndAction(true);
                }
            }
        }
Beispiel #5
0
        ///Ends the action either in success or failure. The callback function (passed on ExecuteAction) is called with the same parameter that this function was called.
        ///If not called, the action will run indefinetely.
        public void EndAction(System.ValueType param)
        {
            if (!isRunning && !isPaused)
            {
                return;
            }

            //do these if the action actually entered update after all
            if (elapsedTime > 0)
            {
                MonoManager.current.RemoveMethod(UpdateAction);
                estimatedLength = elapsedTime;
                elapsedTime     = 0;
            }

            isRunning = false;
            isPaused  = false;
            enabled   = false;
            OnStop();

            if (FinishCallback != null)
            {
                FinishCallback(param);
            }
            FinishCallback = null;
        }
Beispiel #6
0
        public static void ReqNoResponse(ref System.ValueType value)
        {
            //전송 부분
            byte[] plainBytes  = CryptoGraphyHelper.GetByteFromStruct(value);
            byte[] cipherBytes = CryptoGraphyHelper.GetCipherByte(plainBytes);

            socket.Send(cipherBytes);
        }
Beispiel #7
0
        private void OnActionEnd(System.ValueType success)
        {
            if ((bool)success)
            {
                Continue();
                return;
            }

            status = Status.Failure;
            DLGTree.StopGraph();
        }
Beispiel #8
0
 /// <summary>
 /// 構造体を Stream に書き込みます。動作確認済み。
 /// </summary>
 /// <param name="structure">書き込む構造体を指定します。</param>
 /// <param name="strlen">構造体の長さを指定します。</param>
 /// <param name="copylen">書き込む長さを指定します。</param>
 private void WriteStructure(System.ValueType structure, int strlen, int copylen)
 {
     System.IntPtr buff = Marshal.AllocHGlobal(strlen);
     try{
         byte[] data = new byte[copylen];
         Marshal.StructureToPtr(structure, buff, false);
         Marshal.Copy(buff, data, 0, strlen);
         str.Write(data, 0, copylen);
     }finally{
         Marshal.FreeHGlobal(buff);
     }
 }
Beispiel #9
0
    public static void ValueTypeArray()
    {
        var o = new System.ValueType[1];

        o.SetValue(1, 0);
        TestLog.Log(o[0]);
        o.SetValue(new A {
            V = 123
        }, 0);
        TestLog.Log(((A)o[0]).V);
        o.SetValue(null, 0);
        TestLog.Log(o[0]);
    }
Beispiel #10
0
    void UseAsWithNullable(System.ValueType val)
    {
        int?j = val as int?;

        if (j != null)
        {
            Console.WriteLine(j);
        }
        else
        {
            Console.WriteLine("Could not convert " + val.ToString());
        }
    }
Beispiel #11
0
        public static long SpanToIntPtr(System.ValueType span)
        {
            // CodeSpan::ExplicitCast inserts a call to this method
            // when processing a call to
            //      System.IntPtr System.IntPtr::op_Explicit(System.Void*)
            //
            // note that a void* pointer should always handled as a Span<T>
            // in CodeSpan, so we make sure the input is really a span.

            if (span == null)
            {
                return(0);
            }

            if ((object)span is system.Span <object> span_)
            {
                object array;
                var    copy = span_.CloneIntoCache(out array);

                if (array != null)
                {
                    var trackedObject =
                        IdentifierWeakTable.Global.GetTrackedObject(array);

                    int id = (trackedObject != null) ? trackedObject.id
                           : IdentifierWeakTable.Global.Generate(array,
                                                                 (id, obj, @ref) =>
                                                                 new TrackedSpan(id, obj, @ref)
                    {
                        span = copy
                    });

                    // left-shift the 'address' by 32-bits, so we can detect
                    // if an offset was added to the returned 'pointer'
                    return(((long)id) << 32);
                }
            }

            // this helper class only manages Span<T>
            throw new System.PlatformNotSupportedException("SpanToIntPtr");
        }
        static int _m_ToString(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


            System.ValueType __cl_gen_to_be_invoked = (System.ValueType)translator.FastGetCSObj(L, 1);


            try {
                {
                    string __cl_gen_ret = __cl_gen_to_be_invoked.ToString(  );
                    LuaAPI.lua_pushstring(L, __cl_gen_ret);



                    return(1);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
        }
        static int _m_GetHashCode(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                System.ValueType __cl_gen_to_be_invoked = (System.ValueType)translator.FastGetCSObj(L, 1);



                {
                    int __cl_gen_ret = __cl_gen_to_be_invoked.GetHashCode(  );
                    LuaAPI.xlua_pushinteger(L, __cl_gen_ret);



                    return(1);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
        }
        static int _m_Equals(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


            System.ValueType __cl_gen_to_be_invoked = (System.ValueType)translator.FastGetCSObj(L, 1);


            try {
                {
                    object obj = translator.GetObject(L, 2, typeof(object));

                    bool __cl_gen_ret = __cl_gen_to_be_invoked.Equals(obj);
                    LuaAPI.lua_pushboolean(L, __cl_gen_ret);



                    return(1);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
        }
Beispiel #15
0
 ///Declares that the state has finished
 protected void Finish(System.ValueType inSuccess)
 {
     enabled = false;
     status  = (bool)inSuccess? Status.Success : Status.Failure;
 }
        public void NullableIsStruct()
        {
            int?x = 10;

            System.ValueType y = x;
        }
Beispiel #17
0
 private void OnActionListFinished(System.ValueType didSucceed)
 {
     Finish();
     hasBeenExecuted = true;
 }
Beispiel #18
0
        public static bool eq(object v1, object v2)
        {
            if (System.Object.ReferenceEquals(v1, v2))
            {
                return(true);
            }
            if (v1 == null || v2 == null)
            {
                return(false);
            }

            System.IConvertible v1c = v1 as System.IConvertible;

            if (v1c != null)
            {
                System.IConvertible v2c = v2 as System.IConvertible;

                if (v2c == null)
                {
                    return(false);
                }

                System.TypeCode t1 = v1c.GetTypeCode();
                System.TypeCode t2 = v2c.GetTypeCode();
                if (t1 == t2)
                {
                    return(v1c.Equals(v2c));
                }

                switch (t1)
                {
                case System.TypeCode.Int64:
                case System.TypeCode.UInt64:
                    return(v1c.ToUInt64(null) == v2c.ToUInt64(null));

                default:
                    return(v1c.ToDouble(null) == v2c.ToDouble(null));
                }
            }

            System.ValueType v1v = v1 as System.ValueType;
            if (v1v != null)
            {
                return(v1.Equals(v2));
            }
            else
            {
                System.Type v1t = v1 as System.Type;
                if (v1t != null)
                {
                    System.Type v2t = v2 as System.Type;
                    if (v2t != null)
                    {
                        return(typeEq(v1t, v2t));
                    }
                    return(false);
                }
            }

            return(false);
        }
Beispiel #19
0
 public static void FileGet(int FileNumber, System.ValueType& Value, long RecordNumber)
 {
 }
Beispiel #20
0
        /// <summary>
        /// 構造体を Stream に書き込みます。
        /// </summary>
        /// <param name="structure">書き込む構造体を指定します。</param>
        /// <param name="length">
        /// 書き込む長さを指定します。構造体の初めから途中までの情報を書き込む事が出来ます。
        /// 構造体自体の長さよりも大きな値を指定した場合にはエラーになります。
        /// </param>
        public void WriteStructure(System.ValueType structure, int length)
        {
            int len = Marshal.SizeOf(structure);

            this.WriteStructure(structure, len, length);
        }
Beispiel #21
0
 //Callback from the "ActionTask".
 private void OnActionEnd(System.ValueType didSucceed)
 {
     status = (bool)didSucceed? Status.Success : Status.Failure;
 }