Exemple #1
0
        /// <summary>
        /// Append a resource to the xml text writer
        /// </summary>
        /// <param name="davResource"></param>
        /// <param name="requestedProperties"></param>
        /// <param name="xmlWriter"></param>
        private static void AppendResourceNode(DavResourceBase davResource, DavPropertyCollection requestedProperties, XmlTextWriter xmlWriter)
        {
            DavPropertyCollection _validProperties   = new DavPropertyCollection();
            DavPropertyCollection _invalidProperties = new DavPropertyCollection();

            davResource.GetPropertyValues(requestedProperties, _validProperties, _invalidProperties);

            //Open the response element
            xmlWriter.WriteStartElement("response", "DAV:");

            //Load the valid items HTTP/1.1 200 OK
            xmlWriter.WriteElementString("href", "DAV:", davResource.ResourcePath);

            //Open the propstat element section
            xmlWriter.WriteStartElement("propstat", "DAV:");

            //Open the prop element section
            xmlWriter.WriteStartElement("prop", "DAV:");

            //Load the valid properties
            foreach (DavProperty _davProperty in _validProperties)
            {
                _davProperty.ToXML(xmlWriter);
            }

            //Close the prop element section
            xmlWriter.WriteEndElement();

            //Write the status record
            xmlWriter.WriteElementString("status", "DAV:", InternalFunctions.GetEnumHttpResponse(ServerResponseCode.Ok));

            //Close the propstat element section
            xmlWriter.WriteEndElement();
            //END Load the valid items HTTP/1.1 200 OK

            //Load the invalid items HTTP/1.1 404 Not Found
            if (_invalidProperties.Count > 0)
            {
                xmlWriter.WriteStartElement("propstat", "DAV:");
                xmlWriter.WriteElementString("status", "DAV:", InternalFunctions.GetEnumHttpResponse(ServerResponseCode.NotFound));

                //Open the prop element section
                xmlWriter.WriteStartElement("prop", "DAV:");

                //Load all the invalid properties
                foreach (DavProperty _davProperty in _invalidProperties)
                {
                    _davProperty.ToXML(xmlWriter);
                }

                //Close the prop element section
                xmlWriter.WriteEndElement();
                //Close the propstat element section
                xmlWriter.WriteEndElement();
            }
            //END Load the invalid items HTTP/1.1 404 Not Found

            //Close the response element
            xmlWriter.WriteEndElement();
        }
Exemple #2
0
        /// <summary>
        /// Append a resource's properties to the xml text writer
        /// </summary>
        /// <param name="davResource"></param>
        /// <param name="xmlWriter"></param>
        private static void AppendResourceNodeProperties(DavResourceBase davResource, XmlTextWriter xmlWriter)
        {
            //Open the response element
            xmlWriter.WriteStartElement("response", "DAV:");

            //Load the valid items HTTP/1.1 200 OK
            xmlWriter.WriteElementString("href", "DAV:", davResource.ResourcePath);

            //Open the propstat element section
            xmlWriter.WriteStartElement("propstat", "DAV:");

            //Open the prop element section
            xmlWriter.WriteStartElement("prop", "DAV:");

            //Load the valid properties
            foreach (DavProperty _davProperty in davResource.ResourceProperties)
            {
                _davProperty.ToXML(xmlWriter);
            }

            //Close the prop element section
            xmlWriter.WriteEndElement();

            //Write the status record
            xmlWriter.WriteElementString("status", "DAV:", InternalFunctions.GetEnumHttpResponse(ServerResponseCode.Ok));

            //Close the propstat element section
            xmlWriter.WriteEndElement();
            //END Load the valid items HTTP/1.1 200 OK

            //Close the response element
            xmlWriter.WriteEndElement();
        }
		/// <summary>
		/// Add a resource
		/// </summary>
		/// <param name="resource"></param>
		protected void AddResource(DavResourceBase resource)
		{
			if (resource is DavFile)
				this.FileResources.Add(resource);
			else if (resource is DavFolder)
				this.CollectionResources.Add(resource);
		}
        /// <summary>
        /// Add a resource
        /// </summary>
        /// <param name="resource"></param>
        /// <param name="errorCode"></param>
        /// <exception cref="WebDavException">Throw exception if the errorCode value is not a valid Int32</exception>
        internal void Add(DavResourceBase resource, Enum errorCode)
        {
            if (InternalFunctions.ValidateEnumType(errorCode))
            {
                if (base.Dictionary[errorCode] == null)
                    base.Dictionary[errorCode] = new ArrayList();

                ((ArrayList)base.Dictionary[errorCode]).Add(resource);
            }
        }
Exemple #5
0
 /// <summary>
 /// Add a resource
 /// </summary>
 /// <param name="resource"></param>
 protected void AddResource(DavResourceBase resource)
 {
     if (resource is DavFile)
     {
         this.FileResources.Add(resource);
     }
     else if (resource is DavFolder)
     {
         this.CollectionResources.Add(resource);
     }
 }
		/// <summary>
		/// Add a resource to the error list
		/// </summary>
		/// <param name="resource"></param>
		/// <param name="errorCode"></param>
		public void AddProcessErrorResource(DavResourceBase resource, Enum errorCode)
		{
			this.ProcessErrors.Add(resource, errorCode);
		}
Exemple #7
0
 /// <summary>
 /// Add a resource to the error list
 /// </summary>
 /// <param name="resource"></param>
 /// <param name="errorCode"></param>
 public void AddProcessErrorResource(DavResourceBase resource, Enum errorCode)
 {
     this.ProcessErrors.Add(resource, errorCode);
 }
		/// <summary>
		/// Append a resource to the xml text writer
		/// </summary>
		/// <param name="davResource"></param>
		/// <param name="requestedProperties"></param>
		/// <param name="xmlWriter"></param>
		private static void AppendInvalidResourceNode(DavResourceBase davResource, DavPropertyCollection requestedProperties, XmlTextWriter xmlWriter)
		{
			DavPropertyCollection _validProperties = new DavPropertyCollection();
			DavPropertyCollection _invalidProperties = new DavPropertyCollection();

			davResource.GetPropertyValues(requestedProperties, _validProperties, _invalidProperties);

			//Open the response element
			xmlWriter.WriteStartElement("response", "DAV:");

			//Load the valid items HTTP/1.1 200 OK
			xmlWriter.WriteElementString("href", "DAV:", davResource.ResourcePath);

			//Open the propstat element section
			xmlWriter.WriteStartElement("propstat", "DAV:");

			//Open the prop element section
			xmlWriter.WriteStartElement("prop", "DAV:");

			//Load the valid properties
			foreach (DavProperty _davProperty in _validProperties)
				_davProperty.ToXML(xmlWriter);

			//Close the prop element section
			xmlWriter.WriteEndElement();

			//Write the status record
			xmlWriter.WriteElementString("status", "DAV:", InternalFunctions.GetEnumHttpResponse(ServerResponseCode.Ok));

			//Close the propstat element section
			xmlWriter.WriteEndElement();
			//END Load the valid items HTTP/1.1 200 OK

			//Load the invalid items HTTP/1.1 404 Not Found
			if (_invalidProperties.Count > 0)
			{
				xmlWriter.WriteStartElement("propstat", "DAV:");

				//Open the prop element section
				xmlWriter.WriteStartElement("prop", "DAV:");

				//Load all the invalid properties
				foreach (DavProperty _davProperty in _invalidProperties)
					_davProperty.ToXML(xmlWriter);

				//Close the prop element section
				xmlWriter.WriteEndElement();

				//Write the status record
				xmlWriter.WriteElementString("status", "DAV:", InternalFunctions.GetEnumHttpResponse(ServerResponseCode.NotFound));

				//Close the propstat element section
				xmlWriter.WriteEndElement();
			}
			//END Load the invalid items HTTP/1.1 404 Not Found

			//Close the response element
			xmlWriter.WriteEndElement();
		}
		/// <summary>
		/// Append a resource's properties to the xml text writer
		/// </summary>
		/// <param name="davResource"></param>
		/// <param name="xmlWriter"></param>
		private static void AppendResourceNodeProperties(DavResourceBase davResource, XmlTextWriter xmlWriter)
		{
			//Open the response element
			xmlWriter.WriteStartElement("response", "DAV:");

			//Load the valid items HTTP/1.1 200 OK
			xmlWriter.WriteElementString("href", "DAV:", davResource.ResourcePath);

			//Open the propstat element section
			xmlWriter.WriteStartElement("propstat", "DAV:");

			//Open the prop element section
			xmlWriter.WriteStartElement("prop", "DAV:");

			//Load the valid properties
			foreach (DavProperty _davProperty in davResource.ResourceProperties)
				_davProperty.ToXML(xmlWriter);

			//Close the prop element section
			xmlWriter.WriteEndElement();

			//Write the status record
			xmlWriter.WriteElementString("status", "DAV:", InternalFunctions.GetEnumHttpResponse(ServerResponseCode.Ok));

			//Close the propstat element section
			xmlWriter.WriteEndElement();
			//END Load the valid items HTTP/1.1 200 OK

			//Close the response element
			xmlWriter.WriteEndElement();
		}