Exemple #1
0
        private void LoadData()
        {
            var streamInfo = _source.GetStream(ContentFileName);

            if (streamInfo != null)
            {
                using (streamInfo.Stream)
                {
                    using (var reader = XmlReader.Create(streamInfo.Stream))
                    {
                        while (reader.Read())
                        {
                            if (reader.NodeType == XmlNodeType.Element && reader.LocalName == "package")
                            {
                                _package = new Package();
                                _package.ReadXml(reader);
                                break;
                            }
                        }
                    }
                }
            }

            streamInfo = _source.GetStream(TextsStorageName, AuthorsFileName);
            if (streamInfo != null)
            {
                using (streamInfo.Stream)
                {
                    using (var reader = XmlReader.Create(streamInfo.Stream))
                    {
                        _authors = new AuthorInfoList();
                        _authors.ReadXml(reader);
                    }
                }
            }

            streamInfo = _source.GetStream(TextsStorageName, SourcesFileName);
            if (streamInfo != null)
            {
                using (streamInfo.Stream)
                {
                    using (var reader = XmlReader.Create(streamInfo.Stream))
                    {
                        _sources = new SourceInfoList();
                        _sources.ReadXml(reader);
                    }
                }
            }
        }
Exemple #2
0
        private void CreateCore(string name, string author)
        {
            _source.CreateStream(ContentFileName, "si/xml");
            _source.CreateStream(TextsStorageName, AuthorsFileName, "si/xml");
            _source.CreateStream(TextsStorageName, SourcesFileName, "si/xml");

            InitializeStorages();

            _package = new Package {
                Name = name
            };
            _package.Info.Authors.Add(author);

            _authors = new AuthorInfoList();
            _sources = new SourceInfoList();
        }