Exemple of Agileload C# Externalizable class: ClockExt.cs

using System;
using System.Text;

using FlexParser.AMF3;

namespace ConversionFlex
{
    public class ClockExt : IExternalizable
    {
        private int m_annee;
        private int m_mois;
        private int m_jour;
        private int m_heure;
        private int m_minute;
        private int m_second;

        public ClockExt()
        {
            now();
        }

        public void now()
        {
            DateTime now = System.DateTime.Now.ToLocalTime();
            m_annee = now.Year;
            m_mois = now.Month;
            m_jour = now.Day;
            m_heure = now.Hour;
            m_minute = now.Minute;
            m_second = now.Second;
        }

        public String getString()
        {
            return m_annee + "/" + m_mois + "/" + m_jour + " " + m_heure + ":" + m_minute + ":" + m_second;
        }

        public ClockExt getThis()
        {
            return this;
        }

        public int annee
        {
            get { return m_annee; }
            set { m_annee = value; }
        }
        public int mois
        {
            get { return m_mois; }
            set { m_mois = value; }
        }
        public int jour
        {
            get { return m_jour; }
            set { m_jour = value; }
        }
        public int heure
        {
            get { return m_heure; }
            set { m_heure = value; }
        }
        public int minute
        {
            get { return m_minute; }
            set { m_minute = value; }
        }
        public int second
        {
            get { return m_second; }
            set { m_second = value; }
        }

        #region IExternalizable Members

        void IExternalizable.ReadExternal(IDataInput input)
        {
            m_annee = input.ReadInt();
            m_mois = input.ReadInt();
            m_jour = input.ReadInt();
            m_heure = input.ReadInt();
            m_minute = input.ReadInt();
            m_second = input.ReadInt();
        }

        void IExternalizable.WriteExternal(IDataOutput output)
        {
            output.WriteInt(m_annee);
            output.WriteInt(m_mois);
            output.WriteInt(m_jour);
            output.WriteInt(m_heure);
            output.WriteInt(m_minute);
            output.WriteInt(m_second);
        }

        #endregion

    }
}




Go back to the Learning center:


Copyright © AgileLoad. All rights reserved.
Agile Load testing tool| Contact AgileLoad | Terms of Use | Sitemap