Esempio n. 1
0
 public System.Object ClientCommunication(Version serverversion, ICommunicateable communicator, bool full, System.Object obj)
 {
     try
     {
         if (serverversion.Major > 0)
         {
             if (full)
             {
                 Id = communicator.ReceiveString();
                 Name = communicator.ReceiveString();
                 int c = communicator.ReceiveInt();
                 if (c > 0)
                 {
                     StockIndexes stockindexes = (StockIndexes) obj;
                     for (int i = 0; i < c; i++)
                     {
                         string id = communicator.ReceiveString();
                         StockIndex stockindex = null;
                         if (stockindexes.TryGetValue(id, out stockindex))
                         {
                             stockindex.Stocks.Add(Id, this);
                             StockIndexes.Add(stockindex.Id, stockindex);
                         }
                     }
                 }
                 PriceHistory.ClientCommunication(serverversion, communicator, full, obj);
             }
             if (serverversion.Major > 0 && serverversion.Minor >= 1)
             {
                 MinPrice = communicator.ReceiveDouble();
                 MaxPrice = communicator.ReceiveDouble();
             }
             else
             {
                 MinPrice = MIN_PRICE;
                 MaxPrice = MAX_PRICE;
             }
             Price = communicator.ReceiveDouble();
             if (full && PriceHistory.Count > 0)
                 PriceHistory.RemoveAt(PriceHistory.Count - 1);
             Available = communicator.ReceiveInt();
             OwnedByPlayers = communicator.ReceiveInt();
         }
         return this;
     }
     catch (System.Exception ex)
     {
         throw ex;
     }
 }