Пример #1
0
 protected static void writeOptional(ByteStream source, Encodable type, int contextId)
 {
     if (type == null)
     {
         return;
     }
     write(source, type, contextId);
 }
Пример #2
0
        private static Encodable readWrapped(ByteStream source, Type type, int contextId)
        {
            popStart(source, contextId);
            Encodable result = read(source, type);

            popEnd(source, contextId);
            return(result);
        }
Пример #3
0
 // Read and write encodable
 protected static void writeEncodable(ByteStream source, Encodable type, int contextId)
 {
     if (type.GetType().IsSubclassOf(typeof(Primitive.Primitive)))
     {
         ((Primitive.Primitive)type).WriteEncodable(source, contextId);
     }
     else
     {
         type.write(source, contextId);
     }
 }
Пример #4
0
        protected static Encodable read(ByteStream source, Type type)
        {
            if (type.IsSubclassOf(typeof(Primitive.Primitive)))
            {
                return(Primitive.Primitive.CreatePrimitive(source));
            }

            var       constructor = type.GetConstructor(new Type[] { typeof(ByteStream) });
            Encodable obj         = (Encodable)constructor.Invoke(new object[] { source });

            return(obj);
        }
Пример #5
0
        protected static Encodable readSequenceType(ByteStream source, Type type, int contextId)
        {
            popStart(source, contextId);
            Encodable result = null;

            try
            {
                var constructor = type.GetConstructor(new Type[] { typeof(ByteStream), typeof(int) });
                result = (Encodable)constructor.Invoke(new object[] { source, contextId });
            }
            catch (System.Exception e)
            {
                throw new BACnetException(e);
            }
            popEnd(source, contextId);
            return(result);
        }
Пример #6
0
 protected static void write(ByteStream source, Encodable type, int contextId)
 {
     type.write(source, contextId);
 }
Пример #7
0
 //
 // Basic read and write. Pretty trivial.
 protected static void write(ByteStream source, Encodable type)
 {
     type.write(source);
 }