コード例 #1
0
 public void ToXml(ListBucketResponse list, String storage)
 {
     XmlTextWriter XWriter = this.GetOutputWriter();
     XWriter.WriteStartDocument();
     XWriter.Formatting = Formatting.Indented;
     XWriter.Indentation = 2;
     XWriter.WriteStartElement("bucket");
     XWriter.WriteAttributeString("name", storage);
     foreach (ListEntry entry in list.Entries)
     {
         Owner o = entry.Owner;
         if (o == null)
         {
             o = new Owner("", "");
         }
         XWriter.WriteStartElement("File");
         XWriter.WriteAttributeString("key", entry.Key);
         XWriter.WriteElementString("ETag", entry.ETag);
         XWriter.WriteElementString("LastModified", entry.LastModified.ToString());
         XWriter.WriteElementString("ID", o.Id);
         XWriter.WriteElementString("DisplayName", o.DisplayName);
         XWriter.WriteElementString("Size", entry.Size.ToString());
         XWriter.WriteElementString("StorageClass", entry.StorageClass);
         XWriter.WriteEndElement();
     }
     XWriter.WriteEndElement();
     XWriter.Flush();
     XWriter.Close();
 }
コード例 #2
0
        public ListAllMyBucketsResponse( WebRequest request ) :
            base(request)
        {
            buckets = new ArrayList();
            string rawBucketXML = Utils.slurpInputStreamAsString( response.GetResponseStream() );

            XmlDocument doc = new XmlDocument();
            doc.LoadXml( rawBucketXML );
            foreach (XmlNode node in doc.ChildNodes)
            {
                if (node.Name.Equals("ListAllMyBucketsResult"))
                {
                    foreach (XmlNode child in node.ChildNodes)
                    {
                        if (child.Name.Equals("Owner"))
                        {
                            owner = new Owner(child);
                        }
                        else if (child.Name.Equals("Buckets"))
                        {
                            foreach (XmlNode bucket in child.ChildNodes)
                            {
                                if (bucket.Name.Equals("Bucket"))
                                {
                                    buckets.Add(new Bucket(bucket));
                                }
                            }
                        }
                    }
                }
            }
        }
コード例 #3
0
ファイル: ListEntry.cs プロジェクト: xxjeng/nuxleus
 public ListEntry( string key,
                   DateTime lastModified,
                   string etag,
                   long size,
                   string storageClass,
                   Owner owner)
 {
     this.key = key;
     this.lastModified = lastModified;
     this.etag = etag;
     this.size = size;
     this.storageClass = storageClass;
     this.owner = owner;
 }
コード例 #4
0
        public void ToAtom(ListBucketResponse list, String storage)
        {
            XmlTextWriter XWriter = this.GetOutputWriter();
            XWriter.WriteStartDocument();
            XWriter.Formatting = Formatting.Indented;
            XWriter.Indentation = 2;
            XWriter.WriteStartElement("feed", "http://www.w3.org/2005/Atom");
            //XWriter.WriteAttributeString("name", storage);
            foreach (ListEntry entry in list.Entries)
            {
                Owner o = entry.Owner;
                if (o == null)
                {
                    o = new Owner("", "");
                }
                XWriter.WriteStartElement("entry");

                // 06/12/06 01:15AM MDT : This was (hopefully) obviously a cut/paste job 
                // from above. Not sure how I plan to implement this in the final assembly,
                // but I know it won't be a part of the this particular class.
                //
                // For now I am just commenting out the obvious stuff that is worthless.
                //

                //XWriter.WriteAttributeString("key", entry.Key);
                //XWriter.WriteElementString("ETag", entry.ETag);
                //XWriter.WriteElementString("LastModified", entry.LastModified.ToString());
                //XWriter.WriteElementString("ID", o.Id);
                //XWriter.WriteElementString("DisplayName", o.DisplayName);
                //XWriter.WriteElementString("Size", entry.Size.ToString());
                //XWriter.WriteElementString("StorageClass", entry.StorageClass);

                XWriter.WriteEndElement();
            }
            XWriter.WriteEndElement();
            XWriter.Flush();
            XWriter.Close();
        }
コード例 #5
0
ファイル: ListEntry.cs プロジェクト: xxjeng/nuxleus
 public ListEntry(XmlNode node)
 {
     foreach (XmlNode child in node.ChildNodes)
     {
         if (child.Name.Equals("Key"))
         {
             key = Utils.getXmlChildText(child);
         }
         else if (child.Name.Equals("LastModified"))
         {
             string value = Utils.getXmlChildText(child);
             lastModified = Utils.parseDate(value);
         }
         else if ( child.Name.Equals("ETag" ) ) {
             etag = Utils.getXmlChildText(child);
         }
         else if ( child.Name.Equals("Size" ) )
         {
             size = long.Parse( Utils.getXmlChildText( child ) );
         }
         else if ( child.Name.Equals( "Owner" ) )
         {
             owner = new Owner( child );
         }
         else if ( child.Name.Equals( "StorageClass" ) )
         {
             storageClass = Utils.getXmlChildText( child );
         }
     }
 }