Ejemplo n.º 1
0
        ///// <summary>
        ///// Helper method allows to retrieve application entry assembly as well as its referenced (static and runtime) assemblies.
        ///// </summary>
        //static public List<Assembly> GetApplicationEntryAssemblyAndReferencedAssemblies()
        //{
        //}

        /// <summary>
        /// Helper method allows to retrieve initial assembly and it referenced (static and runtime) assemblies.
        /// </summary>
        static public ListUnique <Assembly> GetReferencedAndInitialAssembly(Assembly initialAssembly)
        {
            ListUnique <Assembly> assemblies = GetReferencedAssemblies(initialAssembly);

            assemblies.Add(initialAssembly);
            return(assemblies);
        }
Ejemplo n.º 2
0
        void _server_ClientDisconnectedEvent(SocketMessageServer server, SocketCommunicatorEx client)
        {
            // Clear all clients hooked on this connection.
            ListUnique <ClientId> clientsIds = null;

            lock (_syncRoot)
            {
                if (_remoteClientsNetIds.TryGetByKey(client.Id, ref clientsIds) == false)
                {
                    return;
                }

                _clientsAccessControl.Remove(client.Id);

                _remoteClientsNetIds.RemoveByKey(client.Id);
                foreach (ClientId id in clientsIds)
                {
                    _remoteClientNetId.Remove(id);
                    _remoteClientsTypes.Remove(id);
                    _remoteClientsSourcesTypesNames.Remove(id);
                }
            }

            // Raise event to notify of the disconnection of all these Ids.
            foreach (ClientId id in clientsIds)
            {
                // Notify of clients removal, with non permanent remove, since they may later be restored.
                RaiseClientRemovedEvent(id, false);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        ///
        /// </summary>
        public DataSubscriptionInfo(bool quoteSubscription, bool tickSubsription, TimeSpan[] dataBarSubscriptions)
        {
            _quoteSubscription = quoteSubscription;

            _tickSubscription = tickSubsription;

            _dataBarSubscriptions = new ListUnique <TimeSpan>();

            if (dataBarSubscriptions != null)
            {
                _dataBarSubscriptions.AddRange(dataBarSubscriptions);
            }
        }
        /// <summary>
        /// 
        /// </summary>
        public DataSubscriptionInfo(bool quoteSubscription, bool tickSubsription, TimeSpan[] dataBarSubscriptions)
        {
            _quoteSubscription = quoteSubscription;

            _tickSubscription = tickSubsription;

            _dataBarSubscriptions = new ListUnique<TimeSpan>();

            if (dataBarSubscriptions != null)
            {
                _dataBarSubscriptions.AddRange(dataBarSubscriptions);
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="orderInfo"></param>
        public void RestoreState(SerializationInfoEx info)
        {
            ListUnique <DynamicCustomObject> dynamicObjects = info.GetValue <ListUnique <DynamicCustomObject> >("CustomObjectManager::_dynamicCustomObjects");
            ListUnique <CustomObject>        staticObjects  = info.GetValue <ListUnique <CustomObject> >("CustomObjectManager::_staticCustomObjects");

            foreach (DynamicCustomObject dynamicObject in dynamicObjects)
            {
                this.Add(dynamicObject);
            }

            foreach (CustomObject customObject in staticObjects)
            {
                this.Add(customObject);
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Helper method allows to retrieve initial assembly referenced (static and runtime) assemblies.
        /// </summary>
        static public ListUnique <Assembly> GetReferencedAssemblies(Assembly initialAssembly)
        {
            ListUnique <Assembly> result = new ListUnique <Assembly>();

            AssemblyName[] names = initialAssembly.GetReferencedAssemblies();
            for (int i = 0; i < names.Length; i++)
            {
                result.Add(Assembly.Load(names[i]));
            }

            lock (_dynamicReferencedAssemblies)
            {
                if (_dynamicReferencedAssemblies.ContainsKey(initialAssembly))
                {
                    result.AddRange(_dynamicReferencedAssemblies[initialAssembly]);
                }
            }

            return(result);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Main initialization point.
        /// </summary>
        /// <returns></returns>
        public bool Initialize()
        {
            if (_manager == null)
            {
                return(false);
            }

            lock (this)
            {
                foreach (OrderStateEnum state in Enum.GetValues(typeof(OrderStateEnum)))
                {
                    _ordersByState[state] = new ListUnique <Order>();
                }
            }

            _provider.OrdersUpdatedEvent   += new OrdersUpdateDelegate(_executor_OrderUpdatedEvent);
            _provider.PositionsUpdateEvent += new PositionUpdateDelegate(_provider_PositionsUpdateEvent);

            ChangeOperationalState(OperationalStateEnum.Operational);

            return(true);
        }
        /// <summary>
        /// Main initialization point.
        /// </summary>
        /// <returns></returns>
        public bool Initialize()
        {
            if (_manager == null)
            {
                return false;
            }

            lock (this)
            {
                foreach (OrderStateEnum state in Enum.GetValues(typeof(OrderStateEnum)))
                {
                    _ordersByState[state] = new ListUnique<Order>();
                }
            }

            _provider.OrdersUpdatedEvent += new OrdersUpdateDelegate(_executor_OrderUpdatedEvent);
            _provider.PositionsUpdateEvent += new PositionUpdateDelegate(_provider_PositionsUpdateEvent);

            ChangeOperationalState(OperationalStateEnum.Operational);

            return true;
        }