Exemplo n.º 1
0
        public static Client Deserialise(Stream stream)
        {
            Client result = new Client();

            result.ClientID = IPCHelper.ReadGuid(stream);
            result.Name     = IPCHelper.ReadString(stream);
            DateTime?dateTime = IPCHelper.ReadDateTime(stream);

            if (dateTime.HasValue)
            {
                result.Lifetime = dateTime.Value;
            }
            string version = IPCHelper.ReadString(stream);

            result.Version = Version.Parse(version);
            string       bindingModeText = IPCHelper.ReadString(stream);
            TBindingMode bindingMode;

            if (Enum.TryParse <TBindingMode>(bindingModeText, true, out bindingMode))
            {
                result.BindingMode = bindingMode;
            }
            result.SMSNumber      = IPCHelper.ReadString(stream);
            result.SupportedTypes = ObjectTypes.Deserialise(stream);
            return(result);
        }
Exemplo n.º 2
0
        public static Property Deserialise(System.IO.Stream stream)
        {
            Property property = new Property();

            property.PropertyDefinitionID = IPCHelper.ReadGuid(stream);
            property.PropertyID           = IPCHelper.ReadString(stream);
            byte nullItem = IPCHelper.ReadByte(stream);

            if (nullItem == 1)
            {
                property.Value = new PropertyValue()
                {
                    Value = IPCHelper.ReadString(stream)
                };
            }
            int valueCount = IPCHelper.ReadInt32(stream);

            for (int valueIndex = 0; valueIndex < valueCount; valueIndex++)
            {
                PropertyValue value = new PropertyValue();
                value.PropertyValueID = IPCHelper.ReadString(stream);
                value.Value           = IPCHelper.ReadString(stream);
                if (property.Values == null)
                {
                    property.Values = new List <PropertyValue>();
                }
                property.Values.Add(value);
            }
            return(property);
        }
Exemplo n.º 3
0
        public static ObjectType Deserialise(Stream stream)
        {
            ObjectType result = new ObjectType();

            result.Path         = IPCHelper.ReadString(stream);
            result.ObjectTypeID = IPCHelper.ReadInt32(stream);
            int count = IPCHelper.ReadInt32(stream);

            if (count > 0)
            {
                for (int index = 0; index < count; index++)
                {
                    int item = IPCHelper.ReadInt32(stream);
                    result.Instances.Add(item);
                }
            }
            return(result);
        }
Exemplo n.º 4
0
        public static Object Deserialise(Stream stream)
        {
            Object result = new Object();

            result.ObjectDefinitionID = IPCHelper.ReadGuid(stream);
            result.ObjectID           = IPCHelper.ReadString(stream);
            result.InstanceID         = IPCHelper.ReadString(stream);
            int count = IPCHelper.ReadInt32(stream);

            if (count > 0)
            {
                for (int index = 0; index < count; index++)
                {
                    Property property = Property.Deserialise(stream);
                    result.Properties.Add(property);
                }
            }
            return(result);
        }
Exemplo n.º 5
0
 private void CheckError()
 {
     if (_ErrorResponse)
     {
         using (MemoryStream stream = new MemoryStream(_ResponseBytes))
         {
             string    typeName = IPCHelper.ReadString(stream);
             string    message  = IPCHelper.ReadString(stream);
             Exception exception;
             try
             {
                 Type type = Type.GetType(typeName);
                 exception = (Exception)Activator.CreateInstance(type, message);
             }
             catch
             {
                 exception = new Exception(message);
             }
             throw exception;
         }
     }
 }
Exemplo n.º 6
0
 public string ReadString()
 {
     return(IPCHelper.ReadString(_Payload));
 }