コード例 #1
0
        public override string ToString()
        {
            switch (DataType)
            {
            case 0x00:     // array
                return(array != null
                        ? '[' + string.Join(", ", array.Select(i => i.ToString())) + ']'
                        : null);

            case 0x01:     // bitarray, weird alignment requirements, hasn't been used yet
                throw new NotImplementedException();

            case 0x02:     // blob
                return('"' + blobText + '"');

            case 0x03:     // choice
                return("Choice: Flag: " + choiceFlag + ", Data: " + choiceData);

            case 0x04:     // optional
                return(optionalData != null
                        ? optionalData.ToString()
                        : null);

            case 0x05:     // struct
                return('{' + string.Join(", ", dictionary.Values.Select(i => i.ToString())) + '}');

            case 0x06:     // u8
            case 0x07:     // u32
            case 0x08:     // u64
                return(unsignedInt.HasValue
                        ? unsignedInt.Value.ToString()
                        : null);

            case 0x09:     // vint
                return(vInt.HasValue
                        ? vInt.Value.ToString()
                        : null);

            default:
                throw new NotImplementedException();
            }
        }
コード例 #2
0
 public override string ToString()
 {
     return(data != null?data.ToString() : null);
 }