Пример #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);
        }
Пример #2
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;
        }