Beispiel #1
0
        public static bool GetFieldValue(MessageStructure ms, FieldType fieldType, ref string val)
        {
            bool result = false;
            switch (fieldType)
            {
                case FieldType.Int:
                    val = ms.ReadInt().ToString();
                    result = true;
                    break;
                case FieldType.Password:
                case FieldType.String:
                    val = ms.ReadString();
                    result = true;
                    break;
                case FieldType.Short:
                    val = ms.ReadShort().ToString();
                    result = true;
                    break;
                case FieldType.Byte:
                    val = ms.ReadByte().ToString();
                    result = true;
                    break;
                case FieldType.Long:
                    val = ms.ReadLong().ToString();
                    result = true;
                    break;
                case FieldType.Bool:
                    val = ms.ReadBool().ToString();
                    result = true;
                    break;
                case FieldType.Float:
                    val = ms.ReadFloat().ToString();
                    result = true;
                    break;
                case FieldType.Double:
                    val = ms.ReadDouble().ToString();
                    result = true;
                    break;
                case FieldType.DateTime:
                    val = ms.ReadDateTime().ToString();
                    result = true;
                    break;
                case FieldType.ULong:
                    val = ms.ReadUInt64().ToString();
                    result = true;
                    break;
                case FieldType.UInt:
                    val = ms.ReadUInt32().ToString();
                    result = true;
                    break;
                case FieldType.UShort:
                    val = ms.ReadUInt16().ToString();
                    result = true;
                    break;
                case FieldType.Record:
                    break;
                case FieldType.End:
                    break;
                case FieldType.Void:
                    break;
                default:
                    break;
            }

            return result;
        }