Ejemplo n.º 1
0
 public void Serialize(IPofWriter writer)
 {
     writer.WriteS32(0, MobileId);
     writer.WriteS32(1, X);
     writer.WriteS32(2, Y);
     writer.WriteBoolean(3, IsStartOfGame);
 }
Ejemplo n.º 2
0
 public void Serialize(IPofWriter writer)
 {
     writer.WriteS64(0, accountId);
     writer.WriteString(1, accountName);
     writer.WriteString(2, email);
     writer.WriteS64(3, expirationTime.ToBinary());
 }
Ejemplo n.º 3
0
 public void Serialize(IPofWriter writer)
 {
     writer.WriteFloat(0, X);
     writer.WriteFloat(1, Y);
     writer.WriteFloat(2, Z);
     writer.WriteFloat(3, W);
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Serialize a user type instance to a POF stream by writing its
        /// state using the specified <see cref="IPofWriter"/> object.
        /// </summary>
        /// <remarks>
        /// An implementation of <b>IPofSerializer</b> is required to follow
        /// the following steps in sequence for writing out an object of a
        /// user type:
        /// <list type="number">
        /// <item>
        /// <description>
        /// If the object is evolvable, the implementation must set the
        /// version by calling <see cref="IPofWriter.VersionId"/>.
        /// </description>
        /// </item>
        /// <item>
        /// <description>
        /// The implementation may write any combination of the properties of
        /// the user type by using the "write" methods of the
        /// <b>IPofWriter</b>, but it must do so in the order of the property
        /// indexes.
        /// </description>
        /// </item>
        /// <item>
        /// <description>
        /// After all desired properties of the user type have been written,
        /// the implementation must terminate the writing of the user type by
        /// calling <see cref="IPofWriter.WriteRemainder"/>.
        /// </description>
        /// </item>
        /// </list>
        /// </remarks>
        /// <param name="writer">
        /// The <b>IPofWriter</b> with which to write the object's state.
        /// </param>
        /// <param name="o">
        /// The object to serialize.
        /// </param>
        /// <exception cref="IOException">
        /// If an I/O error occurs.
        /// </exception>
        public void Serialize(IPofWriter writer, object o)
        {
            IIdentity identity = (IIdentity)o;

            writer.WriteString(0, identity.Name);
            writer.WriteRemainder(null);
        }
Ejemplo n.º 5
0
 public void Serialize(IPofWriter writer)
 {
     writer.WriteU32(0, kVersion);
     writer.WriteString(1, SourceDirectory);
     writer.WriteString(2, DestinationDirectory);
     writer.WriteS32(3, ThumbnailsToGenerate);
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Save the contents of a POF user type instance by writing its
 /// state using the specified <see cref="IPofWriter"/> object.
 /// </summary>
 /// <param name="writer">
 /// The <b>IPofWriter</b> to which to write the object's state.
 /// </param>
 /// <exception cref="IOException">
 /// If an I/O error occurs.
 /// </exception>
 public virtual void WriteExternal(IPofWriter writer)
 {
     writer.WriteString(0, m_memberName);
     // slot #1 is not used since Coherence 3.5
     writer.WriteArray(2, m_parameters);
     writer.WriteInt32(3, m_target);
 }
Ejemplo n.º 7
0
 /// <see cref="IPortableObject"/>
 void IPortableObject.WriteExternal(IPofWriter writer)
 {
     writer.WriteInt16(0, m_accessCode);
     writer.WriteInt16(1, m_countryCode);
     writer.WriteInt16(2, m_areaCode);
     writer.WriteInt64(3, m_localNumber);
 }
 public void Serialize(IPofWriter writer)
 {
     writer.WriteGuid(0, Id);
     writer.WriteGuid(1, RecipientId);
     writer.WriteU32(2, (uint)MessageFlags);
     writer.AssignSlot(3, Payload, PayloadOffset, PayloadLength);
 }
        /// <summary>
        /// Save the contents of a POF user type instance by writing its
        /// state using the specified <see cref="IPofWriter"/> object.
        /// </summary>
        /// <param name="writer">
        /// The <b>IPofWriter</b> to which to write the object's state.
        /// </param>
        /// <exception cref="IOException">
        /// If an I/O error occurs.
        /// </exception>
        public override void WriteExternal(IPofWriter writer)
        {
            base.WriteExternal(writer);

            writer.WriteBoolean(2, m_ignoreCase);
            writer.WriteChar(3, m_escape);
        }
Ejemplo n.º 10
0
 public virtual void WriteExternal(IPofWriter writer)
 {
     if (writer.UserTypeId == 1)
     {
         writer.WriteString(0, Name);
     }
 }
Ejemplo n.º 11
0
 public virtual void WriteExternal(IPofWriter writer)
 {
     if (writer.UserTypeId == 3)
     {
         writer.WriteString(0, Species);
     }
 }
        /// <summary>
        /// Save the contents of a POF user type instance by writing its
        /// state using the specified <see cref="IPofWriter"/> object.
        /// </summary>
        /// <param name="writer">
        /// The <b>IPofWriter</b> to which to write the object's state.
        /// </param>
        /// <exception cref="IOException">
        /// If an I/O error occurs.
        /// </exception>
        public override void WriteExternal(IPofWriter writer)
        {
            base.WriteExternal(writer);

            writer.WriteInt64(0, RequestId);
            writer.WriteBoolean(1, IsFailure);

            ResultFormatType format = ResultFormat;

            writer.WriteInt32(2, (int)format);

            switch (format)
            {
            default:
            case ResultFormatType.Generic:
                writer.WriteObject(3, Result);
                break;

            case ResultFormatType.Collection:
                writer.WriteCollection(4, (ICollection)Result);
                break;

            case ResultFormatType.Map:
                writer.WriteDictionary(5, (IDictionary)Result);
                break;
            }
        }
        /// <summary>
        /// Serialize a user type instance to a POF stream by writing its
        /// state using the specified <see cref="IPofWriter"/> object.
        /// </summary>
        /// <param name="writer">
        /// The <b>IPofWriter</b> with which to write the object's state.
        /// </param>
        /// <param name="o">
        /// The object to serialize.
        /// </param>
        /// <exception cref="IOException">
        /// If an I/O error occurs.
        /// </exception>
        public void Serialize(IPofWriter writer, object o)
        {
            try
            {
                StringBuilder sb = new StringBuilder();
                using (TextWriter txtWriter = new StringWriter(sb))
                {
                    new System.Xml.Serialization.XmlSerializer(o.GetType()).Serialize(txtWriter, o);
                }
                writer.WriteString(0, sb.ToString());
                writer.WriteRemainder(null);
            }
            catch (InvalidOperationException e)
            {
                string typeName = null;
                try
                {
                    typeName = writer.PofContext.GetTypeName(m_typeId);
                }
                catch (Exception)
                {}

                string actual = o.GetType().FullName;
                throw new IOException(
                          "An exception occurred writing an object"
                          + " user type to a POF stream: type-id=" + m_typeId
                          + (typeName == null ? "" : ", class-name=" + typeName)
                          + (actual == null ? "" : ", actual class-name=" + actual)
                          + ", exception=\n" + e);
            }
        }
Ejemplo n.º 14
0
 public void Serialize(IPofWriter writer)
 {
     writer.WriteS32(0, MobileId);
      writer.WriteS32(1, X);
      writer.WriteS32(2, Y);
      writer.WriteBoolean(3, IsStartOfGame);
 }
        /// <summary>
        /// Serialize a user type instance to a POF stream by writing its
        /// state using the specified <see cref="IPofWriter"/> object.
        /// </summary>
        /// <remarks>
        /// An implementation of <b>IPofSerializer</b> is required to follow
        /// the following steps in sequence for writing out an object of a
        /// user type:
        /// <list type="number">
        /// <item>
        /// <description>
        /// The implementation may write any combination of the properties of
        /// the user type by using the "write" methods of the
        /// <b>IPofWriter</b>, but it must do so in the order of the property
        /// indexes.
        /// </description>
        /// </item>
        /// <item>
        /// <description>
        /// After all desired properties of the user type have been written,
        /// the implementation must terminate the writing of the user type by
        /// calling <see cref="IPofWriter.WriteRemainder"/>.
        /// </description>
        /// </item>
        /// </list>
        /// </remarks>
        /// <param name="writer">
        /// The <b>IPofWriter</b> with which to write the object's state.
        /// </param>
        /// <param name="o">
        /// The object to serialize.
        /// </param>
        /// <exception cref="IOException">
        /// If an I/O error occurs.
        /// </exception>
        public void Serialize(IPofWriter writer, object o)
        {
            MemoryStream stream = new MemoryStream();

            try
            {
                new BinaryFormatter().Serialize(stream, o);

                stream.Position = 0;
                writer.WriteObject(0, stream.GetBuffer());
                writer.WriteRemainder(null);
            }
            catch (SerializationException e)
            {
                string typeName = null;
                try
                {
                    typeName = writer.PofContext.GetTypeName(m_typeId);
                }
                catch (Exception)
                { }

                string actual = o.GetType().FullName;
                throw new IOException(
                          "An exception occurred writing an object"
                          + " user type to a POF stream: type-id=" + m_typeId
                          + (typeName == null ? "" : ", class-name=" + typeName)
                          + (actual == null ? "" : ", actual class-name=" + actual)
                          + ", exception=\n" + e);
            }
            finally
            {
                stream.Close();
            }
        }
Ejemplo n.º 16
0
        /// <summary>
        /// Save the contents of a POF user type instance by writing
        /// its state using the specified <see cref="IPofWriter"/>
        /// object.
        /// </summary>
        /// <param name="writer">
        /// The <b>IPofWriter</b> to which to write the object's
        /// state.
        /// </param>
        /// <exception cref="IOException">
        /// If an I/O error occurs.
        /// </exception>
        public override void WriteExternal(IPofWriter writer)
        {
            base.WriteExternal(writer);

            writer.WriteBoolean(10, IsRedirectSupported);
            writer.WriteBoolean(11, IsRedirect);
        }
Ejemplo n.º 17
0
        public void WriteExternal(IPofWriter writer)
        {
            writer.WriteInt32(0, INTEGER);

            IPofWriter nested1 = writer.CreateNestedPofWriter(1);

            IPofWriter nested2 = nested1.CreateNestedPofWriter(0);

            nested2.WriteString(0, STRING);
            nested2.WriteSingleArray(2, FLOAT_ARRAY);

            IPofWriter nested3 = nested2.CreateNestedPofWriter(3);

            nested3.WriteArray(0, STRING_ARRAY, typeof(String));

            nested2.WriteBoolean(4, false);
            nested2.WriteRemainder(null);

            IList list = (IList)set;

            nested1.WriteCollection(1, list);
            nested1.WriteDouble(2, 2.0);
            nested1.WriteInt32(3, 5);
            nested1.WriteCollection(4, set);
            nested1.WriteDouble(10, 2.222);

            writer.WriteDouble(2, 4.444);
            writer.WriteInt32(3, 15);
        }
Ejemplo n.º 18
0
 /// <summary>
 /// Save the contents of a POF user type instance by writing its
 /// state using the specified <see cref="IPofWriter"/> object.
 /// </summary>
 /// <param name="writer">
 /// The <b>IPofWriter</b> to which to write the object's state.
 /// </param>
 /// <exception cref="IOException">
 /// If an I/O error occurs.
 /// </exception>
 public virtual void WriteExternal(IPofWriter writer)
 {
     writer.WriteBoolean(0, IsParallel);
     writer.WriteObject(1, Extractor);
     writer.WriteObject(2, Comparer);
     writer.WriteInt32(3, Results);
 }
        /// <summary>
        /// Save the contents of a POF user type instance by writing its
        /// state using the specified <see cref="IPofWriter"/> object.
        /// </summary>
        /// <param name="writer">
        /// The <b>IPofWriter</b> to which to write the object's state.
        /// </param>
        /// <exception cref="IOException">
        /// If an I/O error occurs.
        /// </exception>
        /// <seealso cref="Request.WriteExternal"/>
        public override void WriteExternal(IPofWriter writer)
        {
            base.WriteExternal(writer);

            writer.WriteObject(2, Processor);
            writer.WriteBinary(3, Cookie);
        }
        /// <summary>
        /// Serialize a user type instance to a POF stream by writing its
        /// state using the specified <see cref="IPofWriter"/> object.
        /// </summary>
        /// <remarks>
        /// An implementation of <b>IPofSerializer</b> is required to follow
        /// the following steps in sequence for writing out an object of a
        /// user type:
        /// <list type="number">
        /// <item>
        /// <description>
        /// If the object is evolvable, the implementation must set the
        /// version by calling <see cref="IPofWriter.VersionId"/>.
        /// </description>
        /// </item>
        /// <item>
        /// <description>
        /// The implementation may write any combination of the properties of
        /// the user type by using the "write" methods of the
        /// <b>IPofWriter</b>, but it must do so in the order of the property
        /// indexes.
        /// </description>
        /// </item>
        /// <item>
        /// <description>
        /// After all desired properties of the user type have been written,
        /// the implementation must terminate the writing of the user type by
        /// calling <see cref="IPofWriter.WriteRemainder"/>.
        /// </description>
        /// </item>
        /// </list>
        /// </remarks>
        /// <param name="writer">
        /// The <b>IPofWriter</b> with which to write the object's state.
        /// </param>
        /// <param name="o">
        /// The object to serialize.
        /// </param>
        /// <exception cref="IOException">
        /// If an I/O error occurs.
        /// </exception>
        public virtual void Serialize(IPofWriter writer, object o)
        {
            // set the version identifier
            bool       isEvolvable = o is IEvolvable;
            IEvolvable evolvable   = null;

            if (isEvolvable)
            {
                evolvable        = (IEvolvable)o;
                writer.VersionId =
                    Math.Max(evolvable.DataVersion, evolvable.ImplVersion);
            }

            // POF Annotation processing
            for (IEnumerator enmr = m_tmd.GetAttributes(); enmr.MoveNext();)
            {
                IAttributeMetadata <object> attr = (IAttributeMetadata <object>)enmr.Current;
                attr.Codec.Encode(writer, attr.Index, attr.Get(o));
            }

            // write out any future properties
            Binary remainder = null;

            if (isEvolvable)
            {
                remainder = evolvable.FutureData;
            }
            writer.WriteRemainder(remainder);
        }
Ejemplo n.º 21
0
            public void Serialize(IPofWriter writer)
            {
                int i = 0;

                writer.WriteU64(i++, id);
                writer.WriteString(i++, name);
            }
Ejemplo n.º 22
0
 public void Serialize(IPofWriter writer)
 {
     writer.WriteString(0, type);
     writer.WriteString(1, message);
     writer.WriteObject(2, stackTrace);
     writer.WriteObject(3, innerException);
 }
        public void WriteExternal(IPofWriter writer)
        {
            writer.WriteInt32(0, INTEGER);

            IPofWriter nested1 = writer.CreateNestedPofWriter(1);

            IPofWriter nested2 = nested1.CreateNestedPofWriter(0);

            nested2.WriteString(0, STRING);
            nested2.WriteObject(1, PERSON);
            nested2.WriteDoubleArray(2, DOUBLE_ARRAY);

            IPofWriter nested3 = nested2.CreateNestedPofWriter(3);

            nested3.WriteArray(0, STRING_ARRAY, typeof(String));

            nested2.WriteBoolean(4, false);
            nested2.WriteRemainder(null);

            nested1.WriteCollection(1, (ICollection <String>)set);
            nested1.WriteDouble(2, 2.0);
            nested1.WriteInt32(3, 5);
            nested1.WriteCollection(4, set, typeof(String));
            nested1.WriteObject(5, PERSON);
            nested1.WriteDouble(10, 2.222);

            writer.WriteDouble(2, 4.444);
            writer.WriteInt32(3, 15);
            writer.WriteObject(4, PERSON);
        }
Ejemplo n.º 24
0
 /// <summary>
 /// Save the contents of a POF user type instance by writing its
 /// state using the specified <see cref="IPofWriter"/> object.
 /// </summary>
 /// <param name="writer">
 /// The <b>IPofWriter</b> to which to write the object's state.
 /// </param>
 /// <exception cref="IOException">
 /// If an I/O error occurs.
 /// </exception>
 public override void WriteExternal(IPofWriter writer)
 {
     writer.WriteBoolean(0, m_fetchExtractor);
     writer.WriteString(1, m_query);
     writer.WriteArray(2, m_env);
     writer.WriteDictionary(3, m_bindings);
 }
 /// <summary>
 /// Save the contents of a POF user type instance by writing its
 /// state using the specified <see cref="IPofWriter"/> object.
 /// </summary>
 /// <param name="writer">
 /// The <b>IPofWriter</b> to which to write the object's state.
 /// </param>
 /// <exception cref="IOException">
 /// If an I/O error occurs.
 /// </exception>
 public void WriteExternal(IPofWriter writer)
 {
     writer.WriteInt64(OID, m_oid);
     writer.WriteString(ORIGAIRPORT, m_origAirport);
     writer.WriteString(DESTAIRPORT, m_destAirport);
     writer.WriteDouble(DEALAPPEAL, m_dealAppeal);
 }
        /// <summary>
        /// Save the contents of a POF user type instance by writing its
        /// state using the specified <see cref="IPofWriter"/> object.
        /// </summary>
        /// <param name="writer">
        /// The <b>IPofWriter</b> to which to write the object's state.
        /// </param>
        /// <exception cref="IOException">
        /// If an I/O error occurs.
        /// </exception>
        public override void WriteExternal(IPofWriter writer)
        {
            base.WriteExternal(writer);

            writer.WriteObject(0, ChannelId);
            writer.WriteObject(1, Cause);
        }
        /// <summary>
        /// Save the contents of a POF user type instance by writing its
        /// state using the specified <see cref="IPofWriter"/> object.
        /// </summary>
        /// <param name="writer">
        /// The <b>IPofWriter</b> to which to write the object's state.
        /// </param>
        /// <exception cref="IOException">
        /// If an I/O error occurs.
        /// </exception>
        public override void WriteExternal(IPofWriter writer)
        {
            base.WriteExternal(writer);

            writer.WriteInt32(1, ChannelId);
            writer.WriteByteArray(2, IdentityToken);
        }
Ejemplo n.º 28
0
            public void Serialize(IPofWriter pofWriter, object o)
            {
                var p = (Product)o;

                pofWriter.WriteObject(0, p.getBalance());
                pofWriter.WriteRemainder(null);
            }
Ejemplo n.º 29
0
        /// <summary>
        /// Save the contents of a POF user type instance by writing its
        /// state using the specified <see cref="IPofWriter"/> object.
        /// </summary>
        /// <param name="writer">
        /// The <b>IPofWriter</b> to which to write the object's state.
        /// </param>
        /// <exception cref="IOException">
        /// If an I/O error occurs.
        /// </exception>
        /// <seealso cref="Request.WriteExternal"/>
        public override void WriteExternal(IPofWriter writer)
        {
            base.WriteExternal(writer);

            writer.WriteObject(2, KeysOnly);
            writer.WriteBinary(3, Cookie);
            writer.WriteObject(4, FilterCookie);
        }
Ejemplo n.º 30
0
 public void Serialize(IPofWriter writer)
 {
     writer.WriteU32(0, invocationId);
     writer.WriteGuid(1, serviceGuid);
     writer.WriteString(2, methodName);
     writer.WriteObject(3, genericArguments);
     writer.WriteObject(4, methodArguments);
 }
Ejemplo n.º 31
0
            public void Serialize(IPofWriter pofWriter, object o)
            {
                var bal = (Balance)o;

                pofWriter.WriteDouble(0, bal.getBalance());
                pofWriter.WriteObject(1, bal.getCustomer());
                pofWriter.WriteRemainder(null);
            }
Ejemplo n.º 32
0
 public void Serialize(IPofWriter writer)
 {
     writer.WriteU32(0, kVersion);
      writer.WriteGuid(1, id);
      writer.WriteString(2, name);
      writer.WriteCollection(3, authors);
      writer.WriteString(4, website);
      writer.WriteCollection(5, targets.Select(target => target.Value));
 }
 public void Serialize(IPofWriter writer) {
    writer.WriteS32(0, packetId);
    writer.WriteFloat(1, leftX);
    writer.WriteFloat(2, leftY);
    writer.WriteFloat(3, rightX);
    writer.WriteFloat(4, rightY);
    writer.WriteFloat(5, leftTrigger);
    writer.WriteFloat(6, rightTrigger);
    writer.WriteCollection(7, buttons);
 }
 public void Serialize(IPofWriter writer) {
    writer.WriteGuid(0, cacheId);
    Serialize(writer, 1);
 }
 public void Serialize(IPofWriter writer) {
    writer.WriteU32(0, StartBlockInclusive);
    writer.WriteU32(1, EndBlockExclusive);
 }
 protected abstract void Serialize(IPofWriter writer, int baseSlot);
 public void Serialize(IPofWriter writer) {
    writer.WriteCollection(0, internalList, true);
 }
 public void Serialize(IPofWriter writer) { }
 protected override void Serialize(IPofWriter writer, int baseSlot) {
    writer.WriteGuid(baseSlot + 0, EpochId);
    writer.WriteCollection(baseSlot + 1, OrderedParticipants);
 }
 public void Serialize(IPofWriter writer) {
    writer.WriteS32(0, InjectionAttempts);
    writer.WriteS32(1, InjectionAttemptDelay);
 }
 public void Serialize(IPofWriter writer) {
    writer.WriteMap(0, blocks);
 }
 public void Serialize(IPofWriter writer) {
    writer.WriteObject(0, commandList);
 }
Ejemplo n.º 43
0
 public void Serialize(IPofWriter writer) {
    Wait();
    writer.WriteObject(0, this.commandList);
 }
 public void Serialize(IPofWriter writer)
 {
     writer.WriteS32(0, kVersion);
      writer.WriteString(1, SelectedThumbnailPath);
 }
Ejemplo n.º 45
0
 public void Serialize(IPofWriter writer) {
    writer.WriteString(0, value);
 }
 public void Serialize(IPofWriter writer) {
    writer.WriteGuid(0, Id);
    writer.WriteObject(1, Name);
    writer.WriteObject(2, Version);
 }
 public void Serialize(IPofWriter writer)
 {
     writer.WriteCollection(0, processNames);
 }
 protected override void Serialize(IPofWriter writer, int baseSlot) {
    writer.WriteGuid(baseSlot + 0, Nominee);
    writer.WriteCollection(baseSlot + 1, Followers ?? new ItzWarty.Collections.HashSet<Guid>());
 }
 public void Serialize(IPofWriter writer) {
    writer.WriteString(0, name);
    writer.WriteU32(1, value);
 }
Ejemplo n.º 50
0
 public void Serialize(IPofWriter writer)
 {
     writer.WriteS32(0, kVersion);
      writer.WriteBoolean(1, IsEnabled);
 }
Ejemplo n.º 51
0
 public void Serialize(IPofWriter writer) {
    writer.WriteString(0, Type);
    writer.AssignSlot(1, Data);
 }
 public void Serialize(IPofWriter writer) {
    writer.WriteU32(0, kVersion);
    writer.WriteString(1, SourceDirectory);
    writer.WriteString(2, DestinationDirectory);
    writer.WriteS32(3, ThumbnailsToGenerate);
 }
 public void Serialize(IPofWriter writer)
 {
     writer.WriteS32(0, kVersion);
      writer.WriteU32(1, category.Value);
 }
 public void Serialize(IPofWriter writer) {
    writer.WriteBoolean(0, OverridingEnabled);
 }
 public void Serialize(IPofWriter writer) {
    writer.WriteS32(0, kVersion);
    writer.WriteS32(1, ServicePort);
 }
 protected override void Serialize(IPofWriter writer, int baseSlot) { }
Ejemplo n.º 57
0
 protected override void Serialize(IPofWriter writer, int baseSlot) {
    writer.WriteCollection(baseSlot + 0, Blocks);
 }