Beispiel #1
0
 public void pack(bool val, ITransport transport)
 {
     if (val)
     {
         Int8.pack((byte)1, transport);
     }
     else
     {
         Int8.pack((byte)0, transport);
     }
 }
Beispiel #2
0
        public static Int8 deserializeSingleInt8(JsonObject jint8)
        {
            //evtl ändern in String -> sbyte, da floatingpointfehler
            double doublesbyte = jint8["data"].GetNumber();
            sbyte  integer8    = (sbyte)doublesbyte;

            // Baue den Integer8 zusammen
            Int8 int8Object = new Int8();

            int8Object.data = integer8;
            return(int8Object);
        }
Beispiel #3
0
 public static Void WriteLine(Int8 value)
 {
     Internal.Console_WriteInt8Line(value);
 }
Beispiel #4
0
 public static string serializeSingleInt8(Int8 integer8)
 {
     return("{\"int8\": {\"data\": " + integer8.data + "}");
 }
Beispiel #5
0
 private static bool CheckInt8(Int8 v)
 {
     return(v == -9);
 }
Beispiel #6
0
    ////////// ////////// ////////// ////////// //////////
    // Sign

    public static Int32 Sign(Int8 val)
    {
        return(val > 0? 1 : val < 0? -1 : 0);
    }
Beispiel #7
0
 public override object unpack(ITransport transport)
 {
     return(((byte)Int8.unpack(transport)) != 0);
 }
Beispiel #8
0
 public static extern Void Console_WriteInt8Line(Int8 value);
 private static UInt64 TestInt8ToUInt64Func([ParamFullRange] Int8 v)
 {
     return((UInt64)v);
 }
 private static UInt32 TestInt8ToUInt32Func([ParamFullRange] Int8 v)
 {
     return((UInt32)v);
 }
 private static UInt16 TestInt8ToUInt16Func([ParamFullRange] Int8 v)
 {
     return((UInt16)v);
 }
 private static Double TestInt8ToDoubleFunc([ParamFullRange] Int8 v)
 {
     return((Double)v);
 }
 private static Single TestInt8ToSingleFunc([ParamFullRange] Int8 v)
 {
     return((Single)v);
 }
Beispiel #14
0
    ////////// ////////// ////////// ////////// //////////
    // Max

    public static Int8 Max(Int8 val1, Int8 val2)
    {
        return(val1 > val2? val1 : val2);
    }
Beispiel #15
0
    ////////// ////////// ////////// ////////// //////////
    // Min

    public static Int8 Min(Int8 val1, Int8 val2)
    {
        return(val1 < val2? val1 : val2);
    }
 /// <summary>
 /// Tries to convert the specified string to a <see cref="sbyte"/> value.
 /// The return value indicates whether the conversion succeeded or failed.
 /// </summary>
 /// <param name="s">A string containing the value to convert.</param>
 /// <param name="value">When this method returns, if the conversion succeeded, contains the converted value; otherwise <c>0</c> (zero).</param>
 /// <returns><see langword="true"/> if value was converted successfully; otherwise, <see langword="false"/>.</returns>
 /// <seealso cref="NumberStringConverter{T}.TryParse(string, out T)"/>
 public bool TryParse(string s, out sbyte value) => Int8.TryParse(s, out value);
 /// <summary>
 /// Converts the specified value to its equivalent string representation.
 /// </summary>
 /// <param name="value">The value to convert.</param>
 /// <returns>
 /// The string representation of <paramref name="value"/>.
 /// </returns>
 /// <remarks>
 /// The <see cref="IFormatProvider"/> specified in the <see cref="NumberStringConverter{T}(NumberStylesParseFunc{T}, NumberStylesTryParseFunc{T}, IFormatProvider)"/>
 /// constructor is passed to the <see cref="IFormattable.ToString(string, IFormatProvider)"/> method to represent <paramref name="value"/>.
 /// </remarks>
 public string ToString(sbyte value) => Int8.ToString(value);
Beispiel #18
0
        public void Decode(XLua.LuaTable luaTable, BinaryReader stream)
        {
            var dictionary = new Dictionary <String, object>();

            foreach (var v in _attrs)
            {
                try
                {
                    if (v.type.Equals(s_sString))
                    {
                        String value = "";
                        doDeserialize(stream, ref value);
                        dictionary.Add(v.name, value);
                    }
                    else if (v.type.Equals(s_sInt32))
                    {
                        Int32 value = 0;
                        doDeserialize(stream, ref value);
                        dictionary.Add(v.name, value);
                    }
                    else if (v.type.Equals(s_sUint32))
                    {
                        UInt32 value = 0;
                        doDeserialize(stream, ref value);
                        dictionary.Add(v.name, value);
                    }
                    else if (v.type.Equals(s_sEnum))
                    {
                        Int32 value = 0;
                        doDeserialize(stream, ref value);
                        dictionary.Add(v.name, value);
                    }
                    else if (v.type.Equals(s_sUint8))
                    {
                        UInt8 value = 0;
                        doDeserialize(stream, ref value);
                        dictionary.Add(v.name, value);
                    }
                    else if (v.type.Equals(s_sUint16))
                    {
                        UInt16 value = 0;
                        doDeserialize(stream, ref value);
                        dictionary.Add(v.name, value);
                    }

                    else if (v.type.Equals(s_sUint64))
                    {
                        UInt64 value = 0;
                        doDeserialize(stream, ref value);
                        dictionary.Add(v.name, value);
                    }
                    else if (v.type.Equals(s_sInt8))
                    {
                        Int8 value = 0;
                        doDeserialize(stream, ref value);
                        dictionary.Add(v.name, value);
                    }
                    else if (v.type.Equals(s_sInt16))
                    {
                        Int16 value = 0;
                        doDeserialize(stream, ref value);
                        dictionary.Add(v.name, value);
                    }

                    else if (v.type.Equals(s_sInt64))
                    {
                        Int64 value = 0;
                        doDeserialize(stream, ref value);
                        dictionary.Add(v.name, value);
                    }
                    else if (v.type.Equals(s_sDouble))
                    {
                        Double value = 0.0f;
                        doDeserialize(stream, ref value);
                        dictionary.Add(v.name, value);
                    }
                    else if (v.type.Equals(s_sFloat))
                    {
                        Float value = 0.0f;
                        doDeserialize(stream, ref value);
                        dictionary.Add(v.name, value);
                    }
                    else if (v.type.Equals(s_sBool))
                    {
                        Bool value = false;
                        doDeserialize(stream, ref value);
                        dictionary.Add(v.name, value);
                    }
                    else
                    {
                        var table = _luaEnv.Global.Get <XLua.LuaTable>(v.name);
                        var ml    = table.Get <String, MessageLua>(s_sSelf);
                        ml.Decode(table, stream);
                    }
                }
                catch (Exception e)
                {
                    UnityEngine.Debug.LogException(e);
                }
            }

            luaTable.Set(dictionary);
        }
Beispiel #19
0
        private static object ReadValue(BinaryReader stream, String t)
        {
            if (t.Equals(_sString))
            {
                String value = "";
                doDeserialize(stream, ref value);
                return(value);
            }
            else if (t.Equals(_sInt32))
            {
                Int32 value = 0;
                doDeserialize(stream, ref value);
                return(value);
            }
            else if (t.Equals(_sUint32))
            {
                UInt32 value = 0;
                doDeserialize(stream, ref value);
                return(value);
            }
            else if (t.Equals(_sEnum))
            {
                Int32 value = 0;
                doDeserialize(stream, ref value);
                return(value);
            }
            else if (t.Equals(_sUint8))
            {
                UInt8 value = 0;
                doDeserialize(stream, ref value);
                return(value);
            }
            else if (t.Equals(_sUint16))
            {
                UInt16 value = 0;
                doDeserialize(stream, ref value);
                return(value);
            }
            else if (t.Equals(_sUint64))
            {
                UInt64 value = 0;
                doDeserialize(stream, ref value);
                return(value);
            }
            else if (t.Equals(_sInt8))
            {
                Int8 value = 0;
                doDeserialize(stream, ref value);
                return(value);
            }
            else if (t.Equals(_sInt16))
            {
                Int16 value = 0;
                doDeserialize(stream, ref value);
                return(value);
            }

            else if (t.Equals(_sInt64))
            {
                Int64 value = 0;
                doDeserialize(stream, ref value);
                return(value);
            }
            else if (t.Equals(_sDouble))
            {
                Double value = 0.0f;
                doDeserialize(stream, ref value);
                return(value);
            }
            else if (t.Equals(_sFloat))
            {
                Float value = 0.0f;
                doDeserialize(stream, ref value);
                return(value);
            }
            else if (t.Equals(_sBool))
            {
                Bool value = false;
                doDeserialize(stream, ref value);
                return(value);
            }
            else
            {
                return(null);
            }
        }
Beispiel #20
0
        public void Decode(XLua.LuaTable luaTable, BinaryReader stream)
        {
            var dictionary = new Dictionary <String, object>();

            foreach (var v in _attrs)
            {
                try
                {
                    if (v.type.Equals(_sString))
                    {
                        String value = "";
                        doDeserialize(stream, ref value);
                        dictionary.Add(v.name, value);
                    }
                    else if (v.type.Equals(_sInt32))
                    {
                        Int32 value = 0;
                        doDeserialize(stream, ref value);
                        dictionary.Add(v.name, value);
                    }
                    else if (v.type.Equals(_sUint32))
                    {
                        UInt32 value = 0;
                        doDeserialize(stream, ref value);
                        dictionary.Add(v.name, value);
                    }
                    else if (v.type.Equals(_sEnum))
                    {
                        Int32 value = 0;
                        doDeserialize(stream, ref value);
                        dictionary.Add(v.name, value);
                    }
                    else if (v.type.Equals(_sUint8))
                    {
                        UInt8 value = 0;
                        doDeserialize(stream, ref value);
                        dictionary.Add(v.name, value);
                    }
                    else if (v.type.Equals(_sUint16))
                    {
                        UInt16 value = 0;
                        doDeserialize(stream, ref value);
                        dictionary.Add(v.name, value);
                    }

                    else if (v.type.Equals(_sUint64))
                    {
                        UInt64 value = 0;
                        doDeserialize(stream, ref value);
                        dictionary.Add(v.name, value);
                    }
                    else if (v.type.Equals(_sInt8))
                    {
                        Int8 value = 0;
                        doDeserialize(stream, ref value);
                        dictionary.Add(v.name, value);
                    }
                    else if (v.type.Equals(_sInt16))
                    {
                        Int16 value = 0;
                        doDeserialize(stream, ref value);
                        dictionary.Add(v.name, value);
                    }

                    else if (v.type.Equals(_sInt64))
                    {
                        Int64 value = 0;
                        doDeserialize(stream, ref value);
                        dictionary.Add(v.name, value);
                    }
                    else if (v.type.Equals(_sDouble))
                    {
                        Double value = 0.0f;
                        doDeserialize(stream, ref value);
                        dictionary.Add(v.name, value);
                    }
                    else if (v.type.Equals(_sFloat))
                    {
                        Float value = 0.0f;
                        doDeserialize(stream, ref value);
                        dictionary.Add(v.name, value);
                    }
                    else if (v.type.Equals(_sBool))
                    {
                        Bool value = false;
                        doDeserialize(stream, ref value);
                        dictionary.Add(v.name, value);
                    }
                    else
                    {
                        //var table = _luaEnv.Global.GetInPath<CfgLua>(v.type);
                        //var ml = table.Get<String, CfgLua>(_sSelf);
                        var cl = _luaEnv.Global.GetInPath <CfgLua>(v.type);

                        cl.LoadCfg();

                        var indexValue = ReadValue(stream, cl.IndexType);
                        dictionary.Add(v.name, cl.GetItem(indexValue));
                    }
                }
                catch (Exception e)
                {
                    UnityEngine.Debug.LogException(e);
                }
            }

            luaTable.Set(dictionary);
        }
Beispiel #21
0
 public NSNumber(Int8 @char)
 {
 }
Beispiel #22
0
    ////////// ////////// ////////// ////////// //////////
    // Abs

    public static Int8 Abs(Int8 val)
    {
        return(val < 0? (Int8)(-val) : val);
    }