Esempio n. 1
0
 public System.Object Load(Version fv, WsgFileStream fs, System.Object obj)
 {
     try
     {
         if (fv.Major > 0)
         {
             Id = fs.ReadString();
             Name = fs.ReadString();
             int c = fs.ReadInt();
             if (c > 0)
             {
                 StockIndexes stockindexes = (StockIndexes) obj;
                 for (int i = 0; i < c; i++)
                 {
                     string id = fs.ReadString();
                     StockIndex stockindex = null;
                     if (stockindexes.TryGetValue(id, out stockindex))
                     {
                         stockindex.Stocks.Add(Id, this);
                         StockIndexes.Add(stockindex.Id, stockindex);
                     }
                 }
             }
             PriceHistory.Load(fv, fs, obj);
             if (fv.Major > 0 && fv.Minor >= 1)
             {
                 MinPrice = fs.ReadDouble();
                 MaxPrice = fs.ReadDouble();
             }
             else
             {
                 MinPrice = MIN_PRICE;
                 MaxPrice = MAX_PRICE;
             }
             Price = fs.ReadDouble();
             if (PriceHistory.Count > 0)
                 PriceHistory.RemoveAt(PriceHistory.Count - 1);
             Available = fs.ReadInt();
             OwnedByPlayers = fs.ReadInt();
         }
         return this;
     }
     catch (System.Exception ex)
     {
         throw ex;
     }
 }