Exemple #1
0
		public IData Deserialize(byte[] bytes, int offset, int count)
		{
			int pos = offset;
			DClass result = new DClass();
			int fNum = OOD.Utility.Bytes.Unpack2(bytes, pos);
			pos += 2;;

			Debug.Assert(fNum > 0);

			result.m_fieldValues = new string[fNum];
			for (int i=0; i<fNum; i++)
			{
				int len = OOD.Utility.Bytes.Unpack2(bytes, pos);
				pos += 2;
				result.m_fieldValues[i] = System.Text.ASCIIEncoding.ASCII.GetString(bytes, pos, len);
				pos += len;
			}

			Debug.Assert(pos - offset == count);

			return result;
		}
Exemple #2
0
        public IData Deserialize(byte[] bytes, int offset, int count)
        {
            int    pos    = offset;
            DClass result = new DClass();
            int    fNum   = OOD.Utility.Bytes.Unpack2(bytes, pos);

            pos += 2;;

            Debug.Assert(fNum > 0);

            result.m_fieldValues = new string[fNum];
            for (int i = 0; i < fNum; i++)
            {
                int len = OOD.Utility.Bytes.Unpack2(bytes, pos);
                pos += 2;
                result.m_fieldValues[i] = System.Text.ASCIIEncoding.ASCII.GetString(bytes, pos, len);
                pos += len;
            }

            Debug.Assert(pos - offset == count);

            return(result);
        }
Exemple #3
0
		public IKey Deserialize(byte[] bytes, int offset, int count)
		{
			KClass result = new KClass();
			int pos = offset;

			result.m_type = (Types.InternalType)bytes[pos++];

			int len = OOD.Utility.Bytes.Unpack2(bytes, pos);
			pos += 2;
			string strValue = System.Text.ASCIIEncoding.ASCII.GetString(bytes, pos, len);
			pos +=len;

			switch (result.m_type)
			{
				case Types.InternalType.t_Byte:
					result.m_value = Convert.ToByte(strValue);
					break;
				case Types.InternalType.t_SByte:
					result.m_value = Convert.ToSByte(strValue);
					break;
				case Types.InternalType.t_Short:
					result.m_value = Convert.ToInt16(strValue);
					break;
				case Types.InternalType.t_UShort:
					result.m_value = Convert.ToUInt16(strValue);
					break;
				case Types.InternalType.t_Char:
					result.m_value = Convert.ToChar(strValue);
					break;
				case Types.InternalType.t_Int:
					result.m_value = Convert.ToInt32(strValue);
					break;
				case Types.InternalType.t_UInt:
					result.m_value = Convert.ToUInt32(strValue);
					break;
				case Types.InternalType.t_Long:
					result.m_value = Convert.ToInt64(strValue);
					break;
				case Types.InternalType.t_ULong:
					result.m_value = Convert.ToUInt64(strValue);
					break;
				case Types.InternalType.t_Float:
					result.m_value = Convert.ToSingle(strValue);
					break;
				case Types.InternalType.t_Double:
					result.m_value = Convert.ToDouble(strValue);
					break;
				case Types.InternalType.t_String:
					result.m_value = strValue;
					break;
			}

			if (count > pos - offset)
			{
				//IDATA is there too
				m_object_data = new DClass();
				result.m_object_data = (DClass)m_object_data.Deserialize(bytes, pos, count - (pos - offset));
			}


			return result;
		}
Exemple #4
0
        public IKey Deserialize(byte[] bytes, int offset, int count)
        {
            KClass result = new KClass();
            int    pos    = offset;

            result.m_type = (Types.InternalType)bytes[pos++];

            int len = OOD.Utility.Bytes.Unpack2(bytes, pos);

            pos += 2;
            string strValue = System.Text.ASCIIEncoding.ASCII.GetString(bytes, pos, len);

            pos += len;

            switch (result.m_type)
            {
            case Types.InternalType.t_Byte:
                result.m_value = Convert.ToByte(strValue);
                break;

            case Types.InternalType.t_SByte:
                result.m_value = Convert.ToSByte(strValue);
                break;

            case Types.InternalType.t_Short:
                result.m_value = Convert.ToInt16(strValue);
                break;

            case Types.InternalType.t_UShort:
                result.m_value = Convert.ToUInt16(strValue);
                break;

            case Types.InternalType.t_Char:
                result.m_value = Convert.ToChar(strValue);
                break;

            case Types.InternalType.t_Int:
                result.m_value = Convert.ToInt32(strValue);
                break;

            case Types.InternalType.t_UInt:
                result.m_value = Convert.ToUInt32(strValue);
                break;

            case Types.InternalType.t_Long:
                result.m_value = Convert.ToInt64(strValue);
                break;

            case Types.InternalType.t_ULong:
                result.m_value = Convert.ToUInt64(strValue);
                break;

            case Types.InternalType.t_Float:
                result.m_value = Convert.ToSingle(strValue);
                break;

            case Types.InternalType.t_Double:
                result.m_value = Convert.ToDouble(strValue);
                break;

            case Types.InternalType.t_String:
                result.m_value = strValue;
                break;
            }

            if (count > pos - offset)
            {
                //IDATA is there too
                m_object_data        = new DClass();
                result.m_object_data = (DClass)m_object_data.Deserialize(bytes, pos, count - (pos - offset));
            }


            return(result);
        }