private void LoadInternal(string folder, bool read) { _source = SIPackageFactory.Instance.GetPackage(folder, read); LoadData(); InitializeStorages(); }
private void SaveCore(ISIPackage package) { using (var stream = package.GetStream(ContentFileName, false).Stream) { using (var writer = XmlWriter.Create(stream)) { _package.WriteXml(writer); } } using (var stream = package.GetStream(TextsStorageName, AuthorsFileName, false).Stream) { using (var writer = XmlWriter.Create(stream)) { _authors.WriteXml(writer); } } using (var stream = package.GetStream(TextsStorageName, SourcesFileName, false).Stream) { using (var writer = XmlWriter.Create(stream)) { _sources.WriteXml(writer); } } package.Flush(); }
private void LoadInternal(Stream stream, bool read) { _source = SIPackageFactory.Instance.GetPackage(stream, read); LoadData(); InitializeStorages(); }
public void ResetTo(Stream stream, bool read = true) { _source = SIPackageFactory.Instance.GetPackage(stream, read); _images.UpdateSource(_source); _audio.UpdateSource(_source); _video.UpdateSource(_source); }
public void Dispose() { if (_source != null) { _source.Dispose(); _source = null; } }
/// <summary> /// Создание категории /// </summary> /// <param name="package">Документ-владелец</param> /// <param name="name">Имя категории</param> internal DataCollection(ISIPackage package, string name, string mediaType) { Name = name; _mediaType = mediaType; _package = package; _files = new List <string>(_package.GetEntries(Name)); }
public static SIDocument Create(string name, string author, ISIPackage source) { var document = new SIDocument(); document.CreateInternal(source, name, author); Init(document); return(document); }
public SIDocument SaveAs(Stream stream, bool switchTo) { var newSource = _source.CopyTo(stream, switchTo, out bool isNew); if (isNew) { newSource.CreateStream(ContentFileName, "si/xml"); newSource.CreateStream(TextsStorageName, AuthorsFileName, "si/xml"); newSource.CreateStream(TextsStorageName, SourcesFileName, "si/xml"); } if (switchTo) { _source.Dispose(); _source = newSource; _images.UpdateSource(_source); _audio.UpdateSource(_source); _video.UpdateSource(_source); } SaveCore(newSource); if (switchTo) { return(this); } var doc = new SIDocument { _source = newSource }; doc.InitializeStorages(); return(doc); }
private void CreateInternal(string folder, string name, string author) { _source = SIPackageFactory.Instance.CreatePackage(folder); CreateCore(name, author); }
private void CreateInternal(Stream stream, string name, string author) { _source = SIPackageFactory.Instance.CreatePackage(stream); CreateCore(name, author); }
private void CreateInternal(ISIPackage source, string name, string author) { _source = source; CreateCore(name, author); }
internal void UpdateSource(ISIPackage package) { _package = package; }