Example #1
0
        public void WriteBool(string name, bool value)
        {
            var node = PrepareBaseType(NodeValueType.Boolean, typeof(bool), name);

            byte[] bytes = FrameworkBitConverter.GetBytes(value);
            node.WriteBaseValue(bytes);
        }
Example #2
0
        public void WriteDecimal(string name, decimal value)
        {
            var node = PrepareBaseType(NodeValueType.Decimal, typeof(decimal), name);

            byte[] bytes = FrameworkBitConverter.GetBytes(value);
            node.WriteBaseValue(bytes);
        }
Example #3
0
        public void WriteGuid(string name, Guid value)
        {
            var node = PrepareBaseType(NodeValueType.Guid, typeof(Guid), name);

            byte[] bytes = FrameworkBitConverter.GetBytes(value);
            node.WriteBaseValue(bytes);
        }
Example #4
0
        public void WriteDouble(string name, double value)
        {
            var node = PrepareBaseType(NodeValueType.Double, typeof(double), name);

            byte[] bytes = FrameworkBitConverter.GetBytes(value);
            node.WriteBaseValue(bytes);
        }
Example #5
0
        public void WriteFloat(string name, float value)
        {
            var node = PrepareBaseType(NodeValueType.Float, typeof(float), name);

            byte[] bytes = FrameworkBitConverter.GetBytes(value);
            node.WriteBaseValue(bytes);
        }
Example #6
0
        public void WriteUInt64(string name, ulong value)
        {
            var node = PrepareBaseType(NodeValueType.UInt64, typeof(ulong), name);

            byte[] bytes = FrameworkBitConverter.GetBytes(value);
            node.WriteBaseValue(bytes);
        }
Example #7
0
        public void WriteInt32(string name, int value)
        {
            var node = PrepareBaseType(NodeValueType.Int32, typeof(int), name);

            byte[] bytes = FrameworkBitConverter.GetBytes(value);
            node.WriteBaseValue(bytes);
        }
Example #8
0
        public void WriteChar(string name, char value)
        {
            var node = PrepareBaseType(NodeValueType.Char, typeof(char), name);

            byte[] bytes = FrameworkBitConverter.GetBytes(value);
            node.WriteBaseValue(bytes);
        }
Example #9
0
        public ulong ReadUInt64(string name)
        {
            var child = FindChildNode(_cur, name, typeof(ulong), NodeValueType.UInt64);

            if (child == null)
            {
                throw new Exception(string.Format("The Node Can't Find  Name : {0} ,Type : {1}", name, typeof(ulong)));
            }
            if (child.nodeType != NodeType.Node)
            {
                throw new Exception("The Child is Not  Node");
            }
            return(FrameworkBitConverter.ToUInt64(child.valuePacket.message, 0));
        }
Example #10
0
        public bool ReadBool(string name)
        {
            var child = FindChildNode(_cur, name, typeof(bool), NodeValueType.Boolean);

            if (child == null)
            {
                throw new Exception(string.Format("The Node Can't Find  Name : {0} ,Type : {1}", name, typeof(bool)));
            }
            if (child.nodeType != NodeType.Node)
            {
                throw new Exception("The Child is Not  Node");
            }
            return(FrameworkBitConverter.ToBoolean(child.valuePacket.message, 0));
        }
Example #11
0
        protected Packet CreateGUIDPacket()
        {
            Packet pkg = new Packet(0, (ushort)NodeValueType.Guid, (byte)PacketType.Guid, FrameworkBitConverter.GetBytes(context.guid));

            return(pkg);
        }
Example #12
0
 protected void ReadGUID(Packet pkg)
 {
     context.guid = FrameworkBitConverter.ToGuid(pkg.message, 0);
 }