예제 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DealConnection"/> class.
        /// </summary>
        /// <param name="ClientIdentity">The ClientIdentity<see cref="MemberIdentity"/>.</param>
        /// <param name="OnCompleteEvent">The OnCompleteEvent<see cref="IDeputy"/>.</param>
        /// <param name="OnEchoEvent">The OnEchoEvent<see cref="IDeputy"/>.</param>
        public DealConnection(MemberIdentity ClientIdentity, IDeputy OnCompleteEvent = null, IDeputy OnEchoEvent = null)
        {
            MemberIdentity ci = ClientIdentity;

            ci.Site = ServiceSite.Client;
            DealClient client = new DealClient(ci);

            Transfer = new DealTransfer(ci);

            connected       = new DealEvent("Connected", this);
            headerSent      = new DealEvent("HeaderSent", this);
            messageSent     = new DealEvent("MessageSent", this);
            headerReceived  = new DealEvent("HeaderReceived", this);
            messageReceived = new DealEvent("MessageReceived", this);

            client.Connected       = connected;
            client.HeaderSent      = headerSent;
            client.MessageSent     = messageSent;
            client.HeaderReceived  = headerReceived;
            client.MessageReceived = messageReceived;

            CompleteEvent = OnCompleteEvent;
            EchoEvent     = OnEchoEvent;

            Client = client;

            WriteEcho("Client Connection Created");
        }
예제 #2
0
        /// <summary>
        /// The Reconnect.
        /// </summary>
        public void Reconnect()
        {
            MemberIdentity ci = new MemberIdentity()
            {
                AuthId    = Client.Identity.AuthId,
                Site      = ServiceSite.Client,
                Name      = Client.Identity.Name,
                Token     = Client.Identity.Token,
                UserId    = Client.Identity.UserId,
                DeptId    = Client.Identity.DeptId,
                DataPlace = Client.Identity.DataPlace,
                Id        = Client.Identity.Id,
                Ip        = Client.EndPoint.Address.ToString(),
                Port      = Client.EndPoint.Port,
                Key       = Client.Identity.Key
            };

            Transfer.Dispose();
            DealClient client = new DealClient(ci);

            Transfer               = new DealTransfer(ci);
            client.Connected       = connected;
            client.HeaderSent      = headerSent;
            client.MessageSent     = messageSent;
            client.HeaderReceived  = headerReceived;
            client.MessageReceived = messageReceived;
            Client = client;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="DealManager"/> class.
 /// </summary>
 /// <param name="dealTransfer">The dealTransfer<see cref="DealTransfer"/>.</param>
 public DealManager(DealTransfer dealTransfer)
 {
     transfer        = dealTransfer;
     transferContext = dealTransfer.Context;
     dealContext     = dealTransfer.MyHeader.Context;
     site            = dealContext.IdentitySite;
 }
        private DealManager treatment;// Important Field !!! - Dealer Treatment initiatie, filtering, sorting, saving, editing all treatment here.

        #endregion

        #region Constructors

        /// <summary>
        /// Initializes a new instance of the <see cref="TransferManager"/> class.
        /// </summary>
        /// <param name="_transaction">The _transaction<see cref="DealTransfer"/>.</param>
        public TransferManager(DealTransfer _transaction)
        {
            transaction     = _transaction;
            transferContext = transaction.Context;
            context         = transaction.MyHeader.Context;
            site            = context.IdentitySite;
            treatment       = new DealManager(_transaction);
        }
예제 #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DealHeader"/> class.
 /// </summary>
 /// <param name="_transaction">The _transaction<see cref="DealTransfer"/>.</param>
 /// <param name="identity">The identity<see cref="MemberIdentity"/>.</param>
 public DealHeader(DealTransfer _transaction, MemberIdentity identity)
 {
     Context              = new DealContext();
     Context.Identity     = identity;
     Context.IdentitySite = identity.Site;
     transaction          = _transaction;
     SerialCount          = 0; DeserialCount = 0;
 }
예제 #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DealHeader"/> class.
 /// </summary>
 /// <param name="_transaction">The _transaction<see cref="DealTransfer"/>.</param>
 /// <param name="context">The context<see cref="ITransferContext"/>.</param>
 public DealHeader(DealTransfer _transaction, ITransferContext context)
 {
     Context = new DealContext();
     Context.LocalEndPoint  = (IPEndPoint)context.Listener.LocalEndPoint;
     Context.RemoteEndPoint = (IPEndPoint)context.Listener.RemoteEndPoint;
     transaction            = _transaction;
     SerialCount            = 0; DeserialCount = 0;
 }
예제 #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DealHeader"/> class.
 /// </summary>
 /// <param name="_transaction">The _transaction<see cref="DealTransfer"/>.</param>
 /// <param name="context">The context<see cref="ITransferContext"/>.</param>
 /// <param name="identity">The identity<see cref="MemberIdentity"/>.</param>
 public DealHeader(DealTransfer _transaction, ITransferContext context, MemberIdentity identity)
 {
     Context = new DealContext();
     Context.LocalEndPoint  = (IPEndPoint)context.Listener.LocalEndPoint;
     Context.RemoteEndPoint = (IPEndPoint)context.Listener.RemoteEndPoint;
     Context.Identity       = identity;
     Context.IdentitySite   = identity.Site;
     transaction            = _transaction;
     SerialCount            = 0; DeserialCount = 0;
 }
예제 #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TransferOperation"/> class.
 /// </summary>
 /// <param name="_transaction">The _transaction<see cref="DealTransfer"/>.</param>
 /// <param name="_part">The _part<see cref="MessagePart"/>.</param>
 /// <param name="_direction">The _direction<see cref="DirectionType"/>.</param>
 public TransferOperation(DealTransfer _transaction, MessagePart _part, DirectionType _direction)
 {
     transaction      = _transaction;
     transferContext  = transaction.Context;
     transportContext = transaction.MyHeader.Context;
     site             = transportContext.IdentitySite;
     direction        = _direction;
     part             = _part;
     protocol         = transferContext.Protocol;
     method           = transferContext.Method;
 }
예제 #9
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DealMessage"/> class.
        /// </summary>
        /// <param name="_transaction">The _transaction<see cref="DealTransfer"/>.</param>
        /// <param name="_direction">The _direction<see cref="DirectionType"/>.</param>
        /// <param name="message">The message<see cref="object"/>.</param>
        public DealMessage(DealTransfer _transaction, DirectionType _direction, object message = null)
        {
            transaction = _transaction;
            direction   = _direction;

            if (message != null)
            {
                Content = message;
            }
            else
            {
                content = new object();
            }

            SerialCount   = 0;
            DeserialCount = 0;
        }
예제 #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DealHeader"/> class.
 /// </summary>
 /// <param name="_transaction">The _transaction<see cref="DealTransfer"/>.</param>
 public DealHeader(DealTransfer _transaction)
 {
     Context     = new DealContext();
     transaction = _transaction;
     SerialCount = 0; DeserialCount = 0;
 }