Esempio n. 1
0
        internal static BlobItemInternal DeserializeBlobItemInternal(XElement element)
        {
            string name                                   = default;
            bool   deleted                                = default;
            string snapshot                               = default;
            string versionId                              = default;
            bool?  isCurrentVersion                       = default;
            BlobPropertiesInternal properties             = default;
            IReadOnlyDictionary <string, string> metadata = default;
            BlobTags blobTags                             = default;
            IReadOnlyDictionary <string, string> objectReplicationMetadata = default;

            if (element.Element("Name") is XElement nameElement)
            {
                name = (string)nameElement;
            }
            if (element.Element("Deleted") is XElement deletedElement)
            {
                deleted = (bool)deletedElement;
            }
            if (element.Element("Snapshot") is XElement snapshotElement)
            {
                snapshot = (string)snapshotElement;
            }
            if (element.Element("VersionId") is XElement versionIdElement)
            {
                versionId = (string)versionIdElement;
            }
            if (element.Element("IsCurrentVersion") is XElement isCurrentVersionElement)
            {
                isCurrentVersion = (bool?)isCurrentVersionElement;
            }
            if (element.Element("Properties") is XElement propertiesElement)
            {
                properties = BlobPropertiesInternal.DeserializeBlobPropertiesInternal(propertiesElement);
            }
            if (element.Element("Metadata") is XElement metadataElement)
            {
                var dictionary = new Dictionary <string, string>();
                foreach (var e in metadataElement.Elements())
                {
                    dictionary.Add(e.Name.LocalName, (string)e);
                }
                metadata = dictionary;
            }
            if (element.Element("Tags") is XElement tagsElement)
            {
                blobTags = BlobTags.DeserializeBlobTags(tagsElement);
            }
            if (element.Element("ObjectReplicationMetadata") is XElement objectReplicationMetadataElement)
            {
                var dictionary = new Dictionary <string, string>();
                foreach (var e in objectReplicationMetadataElement.Elements())
                {
                    dictionary.Add(e.Name.LocalName, (string)e);
                }
                objectReplicationMetadata = dictionary;
            }
            return(new BlobItemInternal(name, deleted, snapshot, versionId, isCurrentVersion, properties, metadata, blobTags, objectReplicationMetadata));
        }
Esempio n. 2
0
 internal BlobItemInternal(string name, bool deleted, string snapshot, string versionId, bool?isCurrentVersion, BlobPropertiesInternal properties, IReadOnlyDictionary <string, string> metadata, BlobTags blobTags, IReadOnlyDictionary <string, string> objectReplicationMetadata)
 {
     Name                      = name;
     Deleted                   = deleted;
     Snapshot                  = snapshot;
     VersionId                 = versionId;
     IsCurrentVersion          = isCurrentVersion;
     Properties                = properties;
     Metadata                  = metadata;
     BlobTags                  = blobTags;
     ObjectReplicationMetadata = objectReplicationMetadata;
 }
 internal BlobItemInternal(BlobName name, bool deleted, string snapshot, string versionId, bool?isCurrentVersion, BlobPropertiesInternal properties, IReadOnlyDictionary <string, string> metadata, BlobTags blobTags, bool?hasVersionsOnly, IReadOnlyDictionary <string, string> orMetadata)
 {
     Name             = name;
     Deleted          = deleted;
     Snapshot         = snapshot;
     VersionId        = versionId;
     IsCurrentVersion = isCurrentVersion;
     Properties       = properties;
     Metadata         = metadata;
     BlobTags         = blobTags;
     HasVersionsOnly  = hasVersionsOnly;
     OrMetadata       = orMetadata;
 }
Esempio n. 4
0
        internal BlobItemInternal(string name, bool deleted, string snapshot, BlobPropertiesInternal properties)
        {
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }
            if (snapshot == null)
            {
                throw new ArgumentNullException(nameof(snapshot));
            }
            if (properties == null)
            {
                throw new ArgumentNullException(nameof(properties));
            }

            Name       = name;
            Deleted    = deleted;
            Snapshot   = snapshot;
            Properties = properties;
            Metadata   = new ChangeTrackingDictionary <string, string>();
            ObjectReplicationMetadata = new ChangeTrackingDictionary <string, string>();
        }