Esempio n. 1
0
        internal static UniqueKey ReadUniqueKey(this IBinaryTokenStreamReader @this)
        {
            ulong  n0           = @this.ReadULong();
            ulong  n1           = @this.ReadULong();
            ulong  typeCodeData = @this.ReadULong();
            string keyExt       = @this.ReadString();

            return(UniqueKey.NewKey(n0, n1, typeCodeData, keyExt));
        }
Esempio n. 2
0
        internal static bool TryReadSimpleType(this IBinaryTokenStreamReader @this, out object result, out SerializationTokenType token)
        {
            token = @this.ReadToken();
            byte[] bytes;
            switch (token)
            {
            case SerializationTokenType.True:
                result = true;
                break;

            case SerializationTokenType.False:
                result = false;
                break;

            case SerializationTokenType.Null:
                result = null;
                break;

            case SerializationTokenType.Object:
                result = new object();
                break;

            case SerializationTokenType.Int:
                result = @this.ReadInt();
                break;

            case SerializationTokenType.Uint:
                result = @this.ReadUInt();
                break;

            case SerializationTokenType.Short:
                result = @this.ReadShort();
                break;

            case SerializationTokenType.Ushort:
                result = @this.ReadUShort();
                break;

            case SerializationTokenType.Long:
                result = @this.ReadLong();
                break;

            case SerializationTokenType.Ulong:
                result = @this.ReadULong();
                break;

            case SerializationTokenType.Byte:
                result = @this.ReadByte();
                break;

            case SerializationTokenType.Sbyte:
                result = @this.ReadSByte();
                break;

            case SerializationTokenType.Float:
                result = @this.ReadFloat();
                break;

            case SerializationTokenType.Double:
                result = @this.ReadDouble();
                break;

            case SerializationTokenType.Decimal:
                result = @this.ReadDecimal();
                break;

            case SerializationTokenType.String:
                result = @this.ReadString();
                break;

            case SerializationTokenType.Character:
                result = @this.ReadChar();
                break;

            case SerializationTokenType.Guid:
                bytes  = @this.ReadBytes(16);
                result = new Guid(bytes);
                break;

            case SerializationTokenType.Date:
                result = DateTime.FromBinary(@this.ReadLong());
                break;

            case SerializationTokenType.TimeSpan:
                result = new TimeSpan(@this.ReadLong());
                break;

            case SerializationTokenType.GrainId:
                result = @this.ReadGrainId();
                break;

            case SerializationTokenType.ActivationId:
                result = @this.ReadActivationId();
                break;

            case SerializationTokenType.SiloAddress:
                result = @this.ReadSiloAddress();
                break;

            case SerializationTokenType.ActivationAddress:
                result = @this.ReadActivationAddress();
                break;

            case SerializationTokenType.IpAddress:
                result = @this.ReadIPAddress();
                break;

            case SerializationTokenType.IpEndPoint:
                result = @this.ReadIPEndPoint();
                break;

            case SerializationTokenType.CorrelationId:
                result = new CorrelationId(@this.ReadBytes(CorrelationId.SIZE_BYTES));
                break;

            default:
                result = null;
                return(false);
            }
            return(true);
        }