Exemplo n.º 1
0
 IXMLStorageSection IStorageEntry.OpenXMLSection(string sectionKey, StorageSectionOpenFlag openFlags, ulong additionalNumericKey)
 {
     return(new XmlStorageSection(manager, this, sectionKey, additionalNumericKey, openFlags));
 }
Exemplo n.º 2
0
 IRawStreamStorageSection IStorageEntry.OpenRawStreamSection(string sectionKey, StorageSectionOpenFlag openFlags, ulong additionalNumericKey)
 {
     return(new BinaryStorageSection(manager, this, sectionKey, additionalNumericKey, openFlags));
 }
Exemplo n.º 3
0
 public XmlStorageSection(StorageManagerImplementation manager, StorageEntry entry, string key, ulong additionalNumericKey, StorageSectionOpenFlag openFlags) :
     base(manager, entry, key, additionalNumericKey, KeyPrefix, openFlags)
 {
     if ((openFlags & StorageSectionOpenFlag.ClearOnOpen) == 0)
     {
         using (var s = manager.FileSystem.OpenFile(Path, true))
         {
             try
             {
                 if (s != null)
                 {
                     data = XDocument.Load(s);
                 }
             }
             catch (XmlException)
             {
                 data = null;
             }
         }
     }
     if (data == null)
     {
         data = new XDocument();
     }
 }
Exemplo n.º 4
0
 public BinaryStorageSection(StorageManagerImplementation manager, StorageEntry entry, string key, ulong additionalNumericKey, StorageSectionOpenFlag openFlags) :
     base(manager, entry, key, additionalNumericKey, KeyPrefix, openFlags)
 {
     if ((openFlags & StorageSectionOpenFlag.ClearOnOpen) == 0)
     {
         using (var s = manager.FileSystem.OpenFile(Path, true))
             if (s != null)
             {
                 s.CopyTo(data);
                 data.Position = 0;
             }
     }
 }
Exemplo n.º 5
0
 public SaxXmlStorageSection(StorageManagerImplementation manager, StorageEntry entry, string key, ulong additionalNumericKey, StorageSectionOpenFlag openFlags) :
     base(manager, entry, key, additionalNumericKey, XmlStorageSection.KeyPrefix, openFlags)
 {
     if ((openFlags & StorageSectionOpenFlag.ReadWrite) == 0)
     {
         throw new NotSupportedException("Sax xml section can be open for writing");
     }
     if ((openFlags & StorageSectionOpenFlag.ClearOnOpen) == 0)
     {
         fileSystemStream = manager.FileSystem.OpenFile(Path, true);
         if (fileSystemStream != null)
         {
             reader    = XmlReader.Create(fileSystemStream);
             streamLen = fileSystemStream.Length != 0 ? fileSystemStream.Length : new double?();
         }
     }
 }
Exemplo n.º 6
0
 public StorageSectionBase(StorageManagerImplementation manager, StorageEntry entry, string key, ulong additionalNumericKey, string pathPrefix, StorageSectionOpenFlag openFlags)
 {
     if (string.IsNullOrWhiteSpace(key))
     {
         throw new ArgumentException("Wrong key");
     }
     this.manager         = manager;
     this.entry           = entry;
     this.key             = key;
     this.path            = entry.Path + System.IO.Path.DirectorySeparatorChar + StorageManagerImplementation.NormalizeKey(key, additionalNumericKey, pathPrefix);
     this.openFlags       = openFlags;
     this.commitOnDispose = (openFlags & StorageSectionOpenFlag.AccessMask) == StorageSectionOpenFlag.ReadWrite;
 }
Exemplo n.º 7
0
 IRawStreamStorageSection IStorageEntryInternal.OpenRawXMLSection(string sectionKey, StorageSectionOpenFlag openFlags, ulong additionalNumericKey)
 {
     return(new BinaryStorageSection(manager, this, sectionKey, additionalNumericKey, openFlags, XmlStorageSection.KeyPrefix));
 }