private NetworkEntity ReadEntity(ISerializationContext context, IValueReader reader)
        {
            var entity = new NetworkEntity (reader.ReadString (), EntityType.Client);

            entity.NetworkID = reader.ReadUInt16 ();
            UInt16 fieldCount = reader.ReadUInt16 ();

            for (int f = 0; f < fieldCount; f++)
            {
                string name = reader.ReadString ();
                ushort typeID = reader.ReadUInt16 ();

                Type type;
                context.TypeMap.TryGetType (typeID, out type);

                object value;

                if (type == typeof (Vector2))
                    value = reader.Read (context, Vector2Serializer.Instance);
                else if (type == typeof (Vector3))
                    value = reader.Read (context, Vector3Serializer.Instance);
                else
                    value = reader.Read (context, type);

                entity.Fields.Add (name, new PropertyGroup (value, type));
            }

            return entity;
        }
Beispiel #2
0
        public void PushBottom(T obj)
        {
            long b = reader.Read(ref bottom);
            var  a = array;

            // Take care of growing
            if (b - upperBound >= a.Size - 1)
            {
                upperBound = reader.Read(ref top);
                a          = a.Grow(b, upperBound);
                Interlocked.Exchange(ref array, a);
            }

            // Register the new value
            a[b] = obj;
            Interlocked.Increment(ref bottom);
        }
Beispiel #3
0
        public static IValueReader Read(this IValueReader reader, out TvrData1 d)
        {
            d = new TvrData1();
            char paren;

            return(reader
                   .Read(out paren)
                   .Read(out d.A).Read(out d.B).Read(out d.C).Read(out d.D)
                   .Read(out paren));
        }
Beispiel #4
0
 protected void ApplyMapping(IValueReader reader, IValueWriter writer, MappingContext context, IMapping mapping)
 {
     var context2 = new DataAccessContext();
     var result = reader.Read(context.Source, context2);
     if (!result.WasValueRead)
     {
         context.RunFail.Add(mapping);
         return;
     }
     ApplyMapping(result.ReadValue, writer, context, mapping);
 }
Beispiel #5
0
        public static IValueReader Read(this IValueReader reader, out TvrOp o)
        {
            o = new TvrOp();
            char paren;

            reader.Read(out paren)
            .Read(out o.op)
            .Read(out o.left)
            .Read(out o.right)
            .Read(out paren);
            return(reader);
        }
        private object ReadValue(object source, IValueReader reader, DataAccessContext context)
        {
            if (reader == null)
            {
                return((object)null);
            }
            if (!reader.CanRead(source, context).CanReadValue)
            {
                return((object)null);
            }
            ReadResult readResult = reader.Read(source, context);

            if (!readResult.WasValueRead)
            {
                return((object)null);
            }
            return(readResult.ReadValue);
        }
        private string Read(IValueReader valueReader, object identifierObject, PipelineStep pipelineStep, PipelineContext pipelineContext)
        {
            string result = null;
            var    logger = pipelineContext.PipelineBatchContext.Logger;

            if (!valueReader.CanRead(identifierObject, new DataAccessContext()).CanReadValue)
            {
                logger.Error("Cannot read value from identifier object. (pipeline step: {0})", pipelineStep.Name);
            }
            else
            {
                var readResult = valueReader.Read(identifierObject, new DataAccessContext());
                if (!readResult.WasValueRead)
                {
                    logger.Error("No value was read from identifier object. (pipeline step: {0})", pipelineStep.Name);
                }
                else
                {
                    result = readResult.ReadValue.ToString();
                }
            }
            return(result);
        }
		public override void ReadPayload (ISerializationContext context, IValueReader reader)
		{
			Inviter = reader.ReadString();
			Group = reader.Read (context, GroupSerializer.Instance);
		}
 public override void ReadPayload(ISerializationContext context, IValueReader reader)
 {
     Group = reader.Read(context, GroupSerializer.Instance);
 }
        public override void ReadPayload(ISerializationContext context, IValueReader reader)
        {
            SignatureHashAlgorithm = reader.ReadString();

            Protocol[] protocols = new Protocol[reader.ReadInt32()];
            for (int i = 0; i < protocols.Length; ++i)
                protocols[i] = new Protocol (context, reader);

            EnabledProtocols = protocols;

            ConnectionId = reader.ReadInt64();

            PublicEncryptionKey = reader.Read<IAsymmetricKey> (context);
            PublicAuthenticationKey = reader.Read<IAsymmetricKey> (context);
        }
Beispiel #11
0
		public override void ReadPayload (ISerializationContext context, IValueReader reader)
		{
			Person = reader.Read<Person> (context);
		}
Beispiel #12
0
 public override void ReadPayload(ISerializationContext context, IValueReader reader)
 {
     Direction = reader.Read<Vector2> (context);
 }
Beispiel #13
0
 public override void ReadPayload(ISerializationContext context, IValueReader reader)
 {
     Person = reader.Read <Person> (context);
 }
Beispiel #14
0
 public override void ReadPayload(ISerializationContext context, IValueReader reader)
 {
     Element = reader.Read <T>(context);
 }
Beispiel #15
0
 public override void ReadPayload(ISerializationContext context, IValueReader reader)
 {
     Object = reader.Read (context);
 }