public ConnectionTradingOnServer(TcpClient client, TradingRequestHandler handler)
 {
     this.client            = client;
     this.connection_reader = new ConnectionReader(new BinaryReader(client.GetStream()), this);
     this.connection_writer = new ConnectionWriter(new BinaryWriter(client.GetStream()));
     this.handler           = handler;
 }
        public async Task <Report> GenerateAsync(int userId, int portfolioId)
        {
            var connections        = ConnectionReader.ReadByUserIdAsync(userId);
            var allocations        = AllocationReader.ReadByPortfolioIdAsync(portfolioId);
            var cashAssetClass     = AssetClassReader.ReadCashByPortfolioIdAsync(portfolioId);
            var equityAssetClasses = AssetClassReader.ReadEquityByPortfolioIdAsync(portfolioId);
            var currencies         = CurrencyReader.ReadAllAsync();
            var exclude            = await ExcludeReader.ReadByPortfolioIdAsync(portfolioId);

            var accounts = new List <AccountReport>();

            foreach (var connection in await connections)
            {
                accounts.AddRange(
                    (await AccountReader.ReadByConnectionIdAsync(connection.Id))
                    .Select(a => new AccountReport(
                                exclude.Accounts.Any(e => e.Id == a.Id),
                                a.Id,
                                a.Number,
                                a.Name,
                                a.Balances.Select(b => new BalanceReport(false, b)), // TODO: In the future, get exclude value from database
                                a.Positions.Select(p => new PositionReport(
                                                       exclude.Symbols.Any(s => s.AccountId == a.Id && s.SymbolId == p.Symbol.Id), p)))));
            }

            return(new Report(
                       accounts.OrderBy(a => a.Name).ToList(),
                       await allocations,
                       await cashAssetClass,
                       await equityAssetClasses,
                       await currencies,
                       (await currencies).First(c => c.Code == "CAD")));
        }
    public void Run()
    {
        Debug.Log("Server started");
        do
        {
            TcpClient client = server.AcceptTcpClient();

            if (connections.Count >= maxPlayers)
            {
                Debug.Log("Disconected!");
                client.Close();
                continue;
            }

            ConnectionReader reader = new ConnectionReader(client, nextID);

            /*
             * string type = reader.DirectRead();
             *
             * if (Converter.toCommand(type[0]) == Command.SERVERCHECKER)
             * {
             *  reader.CloseConnection();
             *  continue;
             * }
             */
            connections.Add(reader);
            hasNewConnection = true;
            nextID++;
            Debug.Log("Connected");
        } while (acceptConnection);
    }
        public void CheckConnectionReaderReadsRelevantConnectionString()
        {
            var reader = new ConnectionReader();
            var result = reader.Read("test");

            Assert.IsNotNull(result);
            Assert.AreEqual("testResultTwo", result);
        }
    public void InstantiatePlayer(ConnectionReader reader)
    {
        GameObject newPlayer = GameObject.Instantiate(playerPrefab, Vector3.zero, Quaternion.identity) as GameObject;
        Player     player    = newPlayer.GetComponent <Player>();

        player.onConnectionClose = OnConnectionClose;
        player.SetConnectionReader(reader);
        reader.initialized = true;
        players.Add(player);
    }
Exemple #6
0
    public static bool readPair(ConnectionReader connection, Portable head, Portable body)
    {
        bool ret = yarpPINVOKE.PortablePairBase_readPair(ConnectionReader.getCPtr(connection), Portable.getCPtr(head), Portable.getCPtr(body));

        if (yarpPINVOKE.SWIGPendingException.Pending)
        {
            throw yarpPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
Exemple #7
0
    public new bool read(ConnectionReader connection)
    {
        bool ret = yarpPINVOKE.VectorBase_read(swigCPtr, ConnectionReader.getCPtr(connection));

        if (yarpPINVOKE.SWIGPendingException.Pending)
        {
            throw yarpPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
Exemple #8
0
    public new bool read(ConnectionReader reader)
    {
        bool ret = yarpPINVOKE.Property_read(swigCPtr, ConnectionReader.getCPtr(reader));

        if (yarpPINVOKE.SWIGPendingException.Pending)
        {
            throw yarpPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
Exemple #9
0
    public bool setConnectionReader(ConnectionReader reader)
    {
        bool ret = yarpPINVOKE.Things_setConnectionReader(swigCPtr, ConnectionReader.getCPtr(reader));

        if (yarpPINVOKE.SWIGPendingException.Pending)
        {
            throw yarpPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
Exemple #10
0
    public static ConnectionReader createConnectionReader(SWIGTYPE_p_yarp__os__InputStream arg0)
    {
        global::System.IntPtr cPtr = yarpPINVOKE.ConnectionReader_createConnectionReader(SWIGTYPE_p_yarp__os__InputStream.getCPtr(arg0));
        ConnectionReader      ret  = (cPtr == global::System.IntPtr.Zero) ? null : new ConnectionReader(cPtr, false);

        if (yarpPINVOKE.SWIGPendingException.Pending)
        {
            throw yarpPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
 public static void Start(string configurationFile)
 {
     lock (Padlock)
     {
         if (_ormManager == null)
         {
             _ormManager = new OrmManager(Assembly.GetCallingAssembly());
             ConnectionReader.SetConnection(AssemblyToScan, configurationFile);
             _ormManager.CreateSchema();
         }
     }
 }
Exemple #12
0
        public Connection(Socket socket, ConnectionSettings settings)
        {
            this.settings = settings;

            var ns = new NetworkStream(socket);
            writer = new BinaryWriter(ns);
            reader = new BinaryReader(ns);

            startdtactSignal = new CountDownLatch(1);

            var connectionReader = new ConnectionReader(this);
            connectionReader.Start();
        }
        public void Connections()
        {
            ConnectionNoW connectionNoW = new ConnectionNoW();

            connectionNoW.Start();
            ConnectionReader connectionReader = new ConnectionReader();

            connectionReader.Start();
            ConnectionRefresh connectionRefresh = new ConnectionRefresh();

            connectionRefresh.Start();
            LoadBOpenConnection loadBOpenConnection = new LoadBOpenConnection();

            loadBOpenConnection.Start();
        }
Exemple #14
0
        public Connection(Socket socket, ConnectionSettings settings)
        {
            this.settings = settings;

            var ns = new NetworkStream(socket);

            writer = new BinaryWriter(ns);
            reader = new BinaryReader(ns);

            startdtactSignal = new CountDownLatch(1);

            var connectionReader = new ConnectionReader(this);

            connectionReader.Start();
        }
Exemple #15
0
        public void Teest()
        {
            ConnectionReader connectionNoW = new ConnectionReader();

            connectionNoW.Start();


            ConnectionNoW connectionNoW2 = new ConnectionNoW();

            connectionNoW2.Start();

            NumberWorkers numberWorkers = new NumberWorkers();

            numberWorkers.Number();

            ValuesFromInterval valuesFromInterval = new ValuesFromInterval();
            Refreshing         refreshing         = new Refreshing();
            LastValue          lastValue          = new LastValue();
        }
Exemple #16
0
        private static void ConnectStream(Stream stream)
        {
            ConnectionStream = stream;

            if (ConnectionReader != null)
            {
                ConnectionReader.Dispose();
            }
            ConnectionReader = new StreamReader(ConnectionStream, Encoding.ASCII);

            if (ConnectionWriter != null)
            {
                ConnectionWriter.Dispose();
            }
            ConnectionWriter = new StreamWriter(ConnectionStream, Encoding.ASCII)
            {
                AutoFlush = true, NewLine = "\n"
            };

            IsConnected = true;
        }
Exemple #17
0
        public async Task <IActionResult> Sync()
        {
            try
            {
                var user = await AuthenticationClient.AuthenticateAsync(HttpContext.Request);

                foreach (var connection in await ConnectionReader.ReadByUserIdAsync(user.Id))
                {
                    await ConnectionSynchronizer.SyncAsync(connection);
                }

                await CurrencySynchronizer.SyncAsync();

                return(NoContent());
            }
            catch (ErrorException ex)
            {
                return(BadRequest(new
                {
                    message = ex.Message
                }));
            }
        }
Exemple #18
0
 public new bool read(ConnectionReader connection)
 {
     bool ret = yarpPINVOKE.Portable_read(swigCPtr, ConnectionReader.getCPtr(connection));
     if (yarpPINVOKE.SWIGPendingException.Pending) throw yarpPINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }
 public new bool read(ConnectionReader reader)
 {
     bool ret = yarpPINVOKE.Bottle_read__SWIG_0(swigCPtr, ConnectionReader.getCPtr(reader));
     if (yarpPINVOKE.SWIGPendingException.Pending) throw yarpPINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }
 public ConnectionReader getReader()
 {
     ConnectionReader ret = new ConnectionReader(yarpPINVOKE.DummyConnector_getReader(swigCPtr), false);
     return ret;
 }
Exemple #21
0
    public ConnectionReader getReader()
    {
        ConnectionReader ret = new ConnectionReader(yarpPINVOKE.DummyConnector_getReader(swigCPtr), false);

        return(ret);
    }
Exemple #22
0
 public new bool read(ConnectionReader connection) {
   bool ret = yarpPINVOKE.Image_read(swigCPtr, ConnectionReader.getCPtr(connection));
   if (yarpPINVOKE.SWIGPendingException.Pending) throw yarpPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
Exemple #23
0
 public void SetConnectionReader(ConnectionReader reader)
 {
     this.reader = reader;
     reader.SetJoystickListener(this);
     DontDestroyOnLoad(gameObject);
 }
Exemple #24
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ConnectionReader obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }
 public static bool readPair(ConnectionReader connection, Portable head, Portable body)
 {
     bool ret = yarpPINVOKE.PortablePairBase_readPair(ConnectionReader.getCPtr(connection), Portable.getCPtr(head), Portable.getCPtr(body));
     if (yarpPINVOKE.SWIGPendingException.Pending) throw yarpPINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }
Exemple #26
0
 public virtual void setParentConnectionReader(ConnectionReader parentConnectionReader)
 {
     yarpPINVOKE.ConnectionReader_setParentConnectionReader(swigCPtr, ConnectionReader.getCPtr(parentConnectionReader));
 }
Exemple #27
0
 internal static HandleRef getCPtr(ConnectionReader obj)
 {
     return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
 }
 public void RemoveConnection(ConnectionReader con)
 {
     connections.Remove(con);
 }
 public bool setConnectionReader(ConnectionReader reader)
 {
     bool ret = yarpPINVOKE.Things_setConnectionReader(swigCPtr, ConnectionReader.getCPtr(reader));
     if (yarpPINVOKE.SWIGPendingException.Pending) throw yarpPINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }