Exemplo n.º 1
0
        /// <summary>
        /// Creates a collection from a file
        /// </summary>
        /// <param name="filename">File containing bookstore data</param>
        /// <returns>BookstoreCollection</returns>
        public static ShopCollection FromFile(string filename)
        {
            ShopCollection _shoplist = new ShopCollection();

            if (File.Exists(filename))
            {
                using (ShopReader reader = ShopReader.Open(filename))
                {
                    while (reader.Read())
                    {
                        if (reader.HasInformation == true)
                        {
                            if (reader.Count > 0)
                            {
                                _shoplist.AddGoods(reader.Value, reader.Count);
                            }
                            else
                            {
                                _shoplist.AddGoods(reader.Value);
                            }
                        }
                    }
                }
            }

            return(_shoplist);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates a bookstore collection from a file
        /// </summary>
        /// <param name="filename">File containing bookstore data</param>
        /// <returns>BookstoreCollection</returns>
        public static BookstoreCollection FromFile(string filename)
        {
            BookstoreCollection _shoplist = new BookstoreCollection();

            if (File.Exists(filename))
            {
                using (ShopReader reader = ShopReader.Open(filename))
                {
                    while (reader.Read())
                    {
                        if (reader.HasInformation == true)
                        {
                            _shoplist.AddGoods(reader.Value);
                        }
                    }
                }
            }

            return(_shoplist);
        }