public Blob(Container container, string name) { this.Container = container; this.Name = name; if (!string.IsNullOrEmpty(this.Name)) { Url = new Uri(Container.Url.ToString() + "/" + Name); } }
public static Container ParseFromXMLNode(AzureBlobService abs, XmlNode node) { Container cont = new Container() { Name = node.SelectSingleNode("Name").InnerText, Url = new Uri(node.SelectSingleNode("Url").InnerText), LastModified = DateTime.Parse(node.SelectSingleNode("Properties/Last-Modified").InnerText), Etag = node.SelectSingleNode("Properties/Etag").InnerText, LeaseState = (Enumerations.LeaseState)Enum.Parse(typeof(Enumerations.LeaseState), node.SelectSingleNode("Properties/LeaseState").InnerText, true), LeaseStatus = (Enumerations.LeaseStatus)Enum.Parse(typeof(Enumerations.LeaseStatus), node.SelectSingleNode("Properties/LeaseStatus").InnerText, true), AzureBlobService = abs }; XmlNode n = node.SelectSingleNode("Properties/LeaseDuration"); if (n != null) cont.LeaseDuration = (Enumerations.LeaseDuration)Enum.Parse(typeof(Enumerations.LeaseDuration), n.InnerText, true); return cont; }
public BlockBlob(Container container) : base(container) { BlobType = Enumerations.BlobType.BlockBlob; }
public BlockBlob(Container container, string name) : base(container, name) { BlobType = Enumerations.BlobType.BlockBlob; }
public Blob(Container container) : this(container, null) { }
public static Blob ParseFromXMLNode(Container container, XmlNode node) { Enumerations.BlobType blobType = (Enumerations.BlobType)Enum.Parse( typeof(Enumerations.BlobType), node.SelectSingleNode("Properties/BlobType").InnerText, true); Blob blob = null; switch (blobType) { case Enumerations.BlobType.BlockBlob: blob = new BlockBlob(container); break; case Enumerations.BlobType.PageBlob: blob = new PageBlob(container); break; default: throw new ArgumentException("BlobType of type " + blobType.ToString() + " is not supported."); } blob.Name = node.SelectSingleNode("Name").InnerText; blob.Url = new Uri(node.SelectSingleNode("Url").InnerText); blob.LeaseState = (Enumerations.LeaseState)Enum.Parse(typeof(Enumerations.LeaseState), node.SelectSingleNode("Properties/LeaseState").InnerText, true); blob.LeaseStatus = (Enumerations.LeaseStatus)Enum.Parse(typeof(Enumerations.LeaseStatus), node.SelectSingleNode("Properties/LeaseStatus").InnerText, true); blob.ContentLength = long.Parse(node.SelectSingleNode("Properties/Content-Length").InnerText); blob.BlobType = blobType; System.Xml.XmlNode nMeta = node.SelectSingleNode("Metadata"); if (nMeta != null) { foreach (System.Xml.XmlNode nMetaElem in nMeta.ChildNodes) { blob.Metadata[nMetaElem.Name] = nMetaElem.InnerText; } } XmlNode n = node.SelectSingleNode("Properties/LeaseDuration"); if (n != null) blob.LeaseDuration = (Enumerations.LeaseDuration)Enum.Parse(typeof(Enumerations.LeaseDuration), n.InnerText, true); n = node.SelectSingleNode("Properties/Last-Modified"); if (n != null) blob.LastModified = DateTime.Parse(n.InnerText); n = node.SelectSingleNode("Properties/Etag"); if (n != null) blob.Etag = n.InnerText; n = node.SelectSingleNode("Properties/Content-Type"); if (n != null) blob.ContentType = n.InnerText; n = node.SelectSingleNode("Properties/Content-Encoding"); if (n != null) blob.ContentEncoding = n.InnerText; n = node.SelectSingleNode("Properties/Content-Language"); if (n != null) blob.ContentLanguage = n.InnerText; n = node.SelectSingleNode("Properties/Content-MD5"); if (n != null) blob.ContentMD5 = n.InnerText; n = node.SelectSingleNode("Properties/CopyId"); if (n != null) { blob.CopyAttributes = new CopyAttributes() { CopyId = Guid.Parse(node.SelectSingleNode("Properties/CopyId").InnerText), CopySource = new Uri(node.SelectSingleNode("Properties/CopySource").InnerText), CopyStatus = node.SelectSingleNode("Properties/CopyStatus").InnerText }; n = node.SelectSingleNode("Properties/CopyCompletionTime"); if (n != null) blob.CopyAttributes.CopyCompletionTime = DateTime.Parse(n.InnerText); n = node.SelectSingleNode("Properties/CopyProgress"); if (n != null) { string[] tokens = n.InnerText.Split(new char[] { '/' }); blob.CopyAttributes.CopyCurrentPosition = long.Parse(tokens[0]); blob.CopyAttributes.CopyTotalLength = long.Parse(tokens[1]); } } return blob; }
public static IEnumerable<Blob> ParseFromXMLEnumerationResults(Container container, XmlDocument doc) { foreach (XmlNode n in doc.SelectNodes("EnumerationResults/Blobs/Blob")) { yield return ParseFromXMLNode(container, n); } }
public PageBlob(Container container) : base(container) { BlobType = Enumerations.BlobType.PageBlob; }