Esempio n. 1
0
        public void Write(PainlessBinaryWriter writer)
        {
            WriteUnderlyingTypeFunction writeFunction = _writeFunctions[_underlyingType];
            object underlyingValue = Convert.ChangeType(Value, _underlyingType);

            writeFunction(writer, underlyingValue);
        }
Esempio n. 2
0
        public void Write(PainlessBinaryWriter writer)
        {
            writer.Write(_listLength);

            for (int index = 0; index < _listLength; ++index)
            {
                writer.WritePainlessBinaryObject(_contentType, _list[index]);
            }
        }
Esempio n. 3
0
        public void Write(PainlessBinaryWriter writer)
        {
            writer.Write(_arrayLength);

            for (int rank = 0; rank < _rank; ++rank)
            {
                for (int index = 0; index < _arrayLength; ++index)
                {
                    writer.WritePainlessBinaryObject(_elementType, _array[index]);
                }
            }
        }
Esempio n. 4
0
        public void Write(PainlessBinaryWriter writer, Type fullType)
        {
            writer.Write(_id);

            Type elementType = fullType.GetElementType();

            writer.WriteType(elementType);

            int rank = fullType.GetArrayRank();

            writer.Write(rank);
        }
        public void Write(PainlessBinaryWriter writer)
        {
            writer.PushCompoundingHash();

            foreach (SerializedMember member in _members)
            {
                object rawValue = member.GetValue(Value);
                writer.WritePainlessBinaryObject(member.Type, rawValue);
            }

            int computedHash = writer.PopCompoundingHash();

            writer.Write(computedHash);
        }
Esempio n. 6
0
        public void SerializeFile <T>(Stream dataStream, SerializationFile <T> file)
        {
            if (file == null)
            {
                throw new ArgumentNullException(nameof(file));
            }

            using (StreamWrapper streamWrapper = new StreamWrapper(dataStream))
            {
                using (PainlessBinaryWriter writer = new PainlessBinaryWriter(streamWrapper, _typeManager, HashBaseValue, HashMultiplicationConstant))
                {
                    SerializeFilePayload(writer, file.Payload);
                }
            }
        }
        public void Write(PainlessBinaryWriter writer, Type fullType)
        {
            writer.Write(_id);

            int numGenericParameters = CountNumberGenericParameters(_baseType);

            if (numGenericParameters == 0)
            {
                return;
            }

            Type[] genericArguments = fullType.GetGenericArguments();
            for (int index = 0; index < numGenericParameters; ++index)
            {
                writer.WriteType(genericArguments[index]);
            }
        }
Esempio n. 8
0
        void SerializeFilePayload <T>(PainlessBinaryWriter writer, T payload)
        {
            writer.WriteType(typeof(T));

            writer.WritePainlessBinaryObject(typeof(T), payload);
        }
Esempio n. 9
0
        public void Write(PainlessBinaryWriter writer)
        {
            object containedValue = _valuePropertyInfo.GetValue(Value);

            writer.WritePainlessBinaryObject(_contentType, containedValue);
        }
Esempio n. 10
0
 public void Write(PainlessBinaryWriter writer)
 {
     _readWriteOperations.WriteFunction(writer, _value);
 }