/// <summary> /// Create a response for Depth 0 request - just a root info /// </summary> /// <param name="xmlDocument"></param> /// <returns></returns> private XmlElement CreateDepth0Response(HTTPHeader header, XmlDocument xmlDocument, PropfindProperties propfindProperties, HashSet<String> destinationObjectStreamTypes) { var XMLElemResponse = xmlDocument.CreateElement(S_DAV_PREFIX, "response", S_DAV_NAMESPACE_URI); if(header.IsSVNClient) XMLElemResponse.SetAttribute("xmlns:"+S_SVN_PREFIX, S_SVN_NAMESPACE_URI); #region response elements var XMLElemHref = xmlDocument.CreateElement(S_DAV_PREFIX, "href", S_DAV_NAMESPACE_URI); if (header.IsSVNClient) XMLElemHref.InnerText = header.RawUrl; else XMLElemHref.InnerText = header.FullHTTPDestinationPath(); var Props = new Dictionary<String, String>(); // Should return ALL props var DisplayName = DirectoryHelper.GetObjectName(header.Destination); if (DisplayName == String.Empty) DisplayName = FSPathConstants.PathDelimiter; if (!header.IsSVNClient) { if (!destinationObjectStreamTypes.Contains(FSConstants.INLINEDATA)) { //var ObjectLocator = _AGraphDSSharp.ExportObjectLocator(ObjectLocation.ParseString((Header.Destination)); if (destinationObjectStreamTypes.Contains(FSConstants.DIRECTORYSTREAM)) { Props.Add(PropfindProperties.Getcontenttype.ToString(), System.Net.Mime.MediaTypeNames.Application.Octet); Props.Add(PropfindProperties.Getcontentlength.ToString(), "0"); Props.Add(PropfindProperties.Resourcetype.ToString(), "collection"); // Do we want to add some MS specific data? if (header.ClientType == ClientTypes.MicrosoftWebDAVMiniRedir) { //Props.Add("isFolder", "f"); //If the element contains the 'collection' child element plus additional unrecognized elements, it should generally be treated as a collection. If the element contains no recognized child elements, it should be treated as a non-collection resource //Props.Add("isCollection", "1"); //Props.Add("ishidden", "0"); } } else if (destinationObjectStreamTypes.Contains(FSConstants.FILESTREAM)) { Props.Add(PropfindProperties.Getcontentlength.ToString(), _AGraphDSSharp.GetFSObject<FileObject>(ObjectLocation.ParseString(header.Destination), FSConstants.FILESTREAM, null, null, 0, false).Value.ObjectData.Length.ToString()); } //if ((myPropfindProperties == PropfindProperties.NONE) || ((myPropfindProperties & PropfindProperties.Getlastmodified) == PropfindProperties.Getlastmodified)) //{ //if (ObjectLocator.INodeReference != null) // Props.Add(PropfindProperties.Getlastmodified.ToString(), GetConvertedDateTime(ObjectLocator.INodeReference.LastModificationTime).ToString(S_DATETIME_FORMAT)); //else // Props.Add(PropfindProperties.Getlastmodified.ToString(), GetConvertedDateTime(ObjectLocator.ModificationTime.Ticks).ToString(S_DATETIME_FORMAT)); //} //if ((myPropfindProperties == PropfindProperties.NONE) || ((myPropfindProperties & PropfindProperties.Creationdate) == PropfindProperties.Creationdate)) //{ // Props.Add(PropfindProperties.Creationdate.ToString(), GetConvertedDateTime(ObjectLocator.INodeReference.CreationTime).ToString(S_DATETIME_FORMAT)); //} } if ((propfindProperties == PropfindProperties.NONE) || ((propfindProperties & PropfindProperties.Displayname) == PropfindProperties.Displayname)) Props.Add(PropfindProperties.Displayname.ToString(), DisplayName); //Props.Add(PropfindProperties.Getcontentlanguage.ToString(), ""); // If no Content-Language is specified, the default is that the content is intended for all language audiences. //Props.Add(PropfindProperties.Getetag.ToString(), CacheUUID.NewGuid().ToString()); // to identify a single ressource for update purposes (see If-Match) if ((propfindProperties == PropfindProperties.NONE) || ((propfindProperties & PropfindProperties.Lockdiscovery) == PropfindProperties.Lockdiscovery)) Props.Add(PropfindProperties.Lockdiscovery.ToString(), ""); if ((propfindProperties == PropfindProperties.NONE) || ((propfindProperties & PropfindProperties.Supportedlock) == PropfindProperties.Supportedlock)) Props.Add(PropfindProperties.Supportedlock.ToString(), ""); } else // if (Header.IsSVNClient) { Boolean AllProps = ((propfindProperties & PropfindProperties.AllProp) == PropfindProperties.AllProp); if (destinationObjectStreamTypes.Contains(FSConstants.DIRECTORYSTREAM)) { if (AllProps || (propfindProperties & PropfindProperties.Resourcetype) == PropfindProperties.Resourcetype) Props.Add(PropfindProperties.Resourcetype.ToString(), "collection"); if (AllProps) Props.Add(PropfindProperties.Getcontenttype.ToString(), System.Net.Mime.MediaTypeNames.Application.Octet); } if (AllProps) { if (destinationObjectStreamTypes.Contains(FSConstants.INLINEDATA)) { //ObjectLocator ObjectLocator = _AGraphDSSharp.ExportObjectLocator(ObjectLocation.ParseString((Header.Destination)); //Props.Add(PropfindProperties.Creationdate.ToString(), GetConvertedDateTime(ObjectLocator.INodeReference.CreationTime).ToString(S_DATETIME_FORMAT)); //Props.Add(PropfindProperties.Getlastmodified.ToString(), GetConvertedDateTime(ObjectLocator.INodeReference.LastModificationTime).ToString(S_DATETIME_FORMAT)); } Props.Add(PropfindProperties.CheckedIn.ToString(), "ver"); // handled in special way Props.Add(PropfindProperties.VersionControlledConfiguration.ToString(), ""); // handled in special way Props.Add(PropfindProperties.Getetag.ToString(), Guid.NewGuid().ToString()); // to identify a single ressource for update purposes (see If-Match) Props.Add(PropfindProperties.VersionName.ToString(), "37491"); Props.Add(PropfindProperties.CreatorDisplayname.ToString(), "Stefan"); Props.Add(PropfindProperties.BaselineRelativePath.ToString(), ""); Props.Add(PropfindProperties.RepositoryUuid.ToString(), "612f8ebc-c883-4be0-9ee0-a4e9ef946e3a");//CacheUUID.NewGuid().ToString()); Props.Add(PropfindProperties.DeadpropCount.ToString(), "1"); Props.Add(PropfindProperties.Lockdiscovery.ToString(), ""); } if ((propfindProperties & PropfindProperties.CheckedIn) == PropfindProperties.CheckedIn) Props.Add(PropfindProperties.CheckedIn.ToString(), ""); // handled in special way if ((propfindProperties & PropfindProperties.VersionControlledConfiguration) == PropfindProperties.VersionControlledConfiguration) Props.Add(PropfindProperties.VersionControlledConfiguration.ToString(), ""); // handled in special way if ((propfindProperties & PropfindProperties.BaselineRelativePath) == PropfindProperties.BaselineRelativePath) Props.Add(PropfindProperties.BaselineRelativePath.ToString(), ""); if ((propfindProperties & PropfindProperties.RepositoryUuid) == PropfindProperties.RepositoryUuid) Props.Add(PropfindProperties.RepositoryUuid.ToString(), "612f8ebc-c883-4be0-9ee0-a4e9ef946e3a");//CacheUUID.NewGuid().ToString()); if ((propfindProperties & PropfindProperties.BaselineCollection) == PropfindProperties.BaselineCollection) Props.Add(PropfindProperties.BaselineCollection.ToString(), ""); if ((propfindProperties & PropfindProperties.VersionName) == PropfindProperties.VersionName) Props.Add(PropfindProperties.VersionName.ToString(), ""); } XmlElement ElemPropstat = CreatePropstatElement(header, xmlDocument, Props, header.Destination); #endregion XMLElemResponse.AppendChild(XMLElemHref); XMLElemResponse.AppendChild(ElemPropstat); return XMLElemResponse; }
/// <summary> /// Create a usual Response Element for a File or InlineData /// </summary> /// <param name="xmlDocument"></param> /// <param name="hRef"></param> /// <param name="displayname"></param> /// <returns></returns> private XmlElement CreateResponseElement_File(HTTPHeader header, XmlDocument xmlDocument, String hRef, String displayname, String mediaTypeName, UInt64 contentLength, DateTime creationDate, DateTime lastModificationDate, PropfindProperties propfindProperties) { // need to convert the DateTime because WebDAV needs this as Zulu converted Timestamp //LastModificationDate = TimeZoneInfo.ConvertTime(LastModificationDate, TimeZoneInfo.Utc); //CreationDate = TimeZoneInfo.ConvertTime(CreationDate, TimeZoneInfo.Utc); XmlElement ElemResponse = xmlDocument.CreateElement(S_DAV_PREFIX, "response", S_DAV_NAMESPACE_URI); #region Add response elements XmlElement ElemHref = xmlDocument.CreateElement(S_DAV_PREFIX, "href", S_DAV_NAMESPACE_URI); ElemHref.InnerText = hRef; Dictionary<String, String> Props = new Dictionary<String, String>(); //Props.Add("displayname", Displayname); /* if (myPropfindProperties == PropfindProperties.NONE) { Props.Add(PropfindProperties.Creationdate.ToString(), CreationDate.ToString(S_DATETIME_FORMAT));//, "2008-12-29T15:28:29Z"); Props.Add(PropfindProperties.Displayname.ToString(), Displayname); //Props.Add(PropfindProperties.Getcontentlanguage.ToString(), ""); // If no Content-Language is specified, the default is that the content is intended for all language audiences. Props.Add(PropfindProperties.Getcontentlength.ToString(), ContentLength.ToString()); //Props.Add(PropfindProperties.Getcontenttype.ToString(), MediaTypeName); //Props.Add(PropfindProperties.Getetag.ToString(), CacheUUID.NewGuid().ToString()); // to identify a single ressource for update purposes (see If-Match) Props.Add(PropfindProperties.Getlastmodified.ToString(), LastModificationDate.ToString(S_DATETIME_FORMAT));//"2009-02-09T08:11:12Z"); Props.Add(PropfindProperties.Lockdiscovery.ToString(), ""); //Props.Add(PropfindProperties.Resourcetype.ToString(), ""); // is empty for files! Props.Add(PropfindProperties.Supportedlock.ToString(), ""); } else { * */ if ((propfindProperties == PropfindProperties.NONE) || ((propfindProperties & PropfindProperties.Creationdate) == PropfindProperties.Creationdate)) Props.Add(PropfindProperties.Creationdate.ToString(), creationDate.ToString(S_DATETIME_FORMAT)); if ((propfindProperties == PropfindProperties.NONE) || ((propfindProperties & PropfindProperties.Displayname) == PropfindProperties.Displayname)) Props.Add(PropfindProperties.Displayname.ToString(), displayname); if ((propfindProperties == PropfindProperties.NONE) || ((propfindProperties & PropfindProperties.Getcontentlanguage) == PropfindProperties.Getcontentlanguage)) Props.Add(PropfindProperties.Getcontentlanguage.ToString(), ""); if ((propfindProperties == PropfindProperties.NONE) || ((propfindProperties & PropfindProperties.Getcontentlength) == PropfindProperties.Getcontentlength)) Props.Add(PropfindProperties.Getcontentlength.ToString(), contentLength.ToString()); if ((propfindProperties == PropfindProperties.NONE) || ((propfindProperties & PropfindProperties.Getcontenttype) == PropfindProperties.Getcontenttype)) Props.Add(PropfindProperties.Getcontenttype.ToString(), mediaTypeName); if ((propfindProperties == PropfindProperties.NONE) || ((propfindProperties & PropfindProperties.Getetag) == PropfindProperties.Getetag)) Props.Add(PropfindProperties.Getetag.ToString(), Guid.NewGuid().ToString()); if ((propfindProperties == PropfindProperties.NONE) || ((propfindProperties & PropfindProperties.Getlastmodified) == PropfindProperties.Getlastmodified)) Props.Add(PropfindProperties.Getlastmodified.ToString(), lastModificationDate.ToString(S_DATETIME_FORMAT)); if ((propfindProperties == PropfindProperties.NONE) || ((propfindProperties & PropfindProperties.Lockdiscovery) == PropfindProperties.Lockdiscovery)) Props.Add(PropfindProperties.Lockdiscovery.ToString(), ""); //if ((myPropfindProperties == PropfindProperties.NONE) || ((myPropfindProperties & PropfindProperties.Resourcetype) == PropfindProperties.Resourcetype)) // Props.Add(PropfindProperties.Resourcetype.ToString(), ""); if ((propfindProperties == PropfindProperties.NONE) || ((propfindProperties & PropfindProperties.Supportedlock) == PropfindProperties.Supportedlock)) Props.Add(PropfindProperties.Supportedlock.ToString(), ""); // Do we want to add some MS specific data? if (header.ClientType == ClientTypes.MicrosoftWebDAVMiniRedir) { //Props.Add("isFolder", "f"); //If the element contains the 'collection' child element plus additional unrecognized elements, it should generally be treated as a collection. If the element contains no recognized child elements, it should be treated as a non-collection resource //Props.Add("isCollection", "1"); //Props.Add("ishidden", "0"); } //} XmlElement ElemPropstat = CreatePropstatElement(header, xmlDocument, Props, hRef); #endregion ElemResponse.AppendChild(ElemHref); ElemResponse.AppendChild(ElemPropstat); return ElemResponse; }
/// <summary> /// Create a usual Response Element for an directory /// </summary> /// <param name="xmlDocument"></param> /// <param name="hRef"></param> /// <param name="displayname"></param> /// <returns></returns> private XmlElement CreateResponseElement_Dir(HTTPHeader header, XmlDocument xmlDocument, String hRef, String displayname, IDirectoryObject directoryObject, PropfindProperties propfindProperties) { String CreationDate = ""; String LastModificationDate = ""; //if (DirectoryObject != null && DirectoryObject.INodeReference != null) //{ // CreationDate = GetConvertedDateTime(DirectoryObject.INodeReference.CreationTime).ToString(S_DATETIME_FORMAT); // LastModificationDate = GetConvertedDateTime(DirectoryObject.INodeReference.LastModificationTime).ToString(S_DATETIME_FORMAT); //} XmlElement ElemResponse = xmlDocument.CreateElement(S_DAV_PREFIX, "response", S_DAV_NAMESPACE_URI); #region response elements XmlElement ElemHref = xmlDocument.CreateElement(S_DAV_PREFIX, "href", S_DAV_NAMESPACE_URI); ElemHref.InnerText = hRef; Dictionary<String, String> Props = new Dictionary<String, String>(); /* if (myPropfindProperties == PropfindProperties.NONE) { // Should return ALL props Props.Add(PropfindProperties.Creationdate.ToString(), CreationDate);//, "2008-12-29T15:28:29Z"); Props.Add(PropfindProperties.Displayname.ToString(), Displayname); Props.Add(PropfindProperties.Getcontentlanguage.ToString(), ""); // If no Content-Language is specified, the default is that the content is intended for all language audiences. Props.Add(PropfindProperties.Getcontentlength.ToString(), "0"); Props.Add(PropfindProperties.Getcontenttype.ToString(), System.Net.Mime.MediaTypeNames.Application.Octet); Props.Add(PropfindProperties.Getetag.ToString(), CacheUUID.NewGuid().ToString()); // to identify a single ressource for update purposes (see If-Match) Props.Add(PropfindProperties.Getlastmodified.ToString(), LastModificationDate);//"2009-02-09T08:11:12Z"); Props.Add(PropfindProperties.Lockdiscovery.ToString(), ""); Props.Add(PropfindProperties.Resourcetype.ToString(), "collection"); Props.Add(PropfindProperties.Supportedlock.ToString(), ""); // Do we want to add some MS specific data? if (Header.ClientType == ClientTypes.MicrosoftWebDAVMiniRedir) { //Props.Add("isFolder", "f"); //If the element contains the 'collection' child element plus additional unrecognized elements, it should generally be treated as a collection. If the element contains no recognized child elements, it should be treated as a non-collection resource //Props.Add("isCollection", "1"); //Props.Add("ishidden", "0"); } }else{ */ if ((propfindProperties == PropfindProperties.NONE) || ((propfindProperties & PropfindProperties.Creationdate) == PropfindProperties.Creationdate)) Props.Add(PropfindProperties.Creationdate.ToString(), CreationDate); if ((propfindProperties == PropfindProperties.NONE) || ((propfindProperties & PropfindProperties.Displayname) == PropfindProperties.Displayname)) Props.Add(PropfindProperties.Displayname.ToString(), displayname); if ((propfindProperties == PropfindProperties.NONE) || ((propfindProperties & PropfindProperties.Getcontentlanguage) == PropfindProperties.Getcontentlanguage)) Props.Add(PropfindProperties.Getcontentlanguage.ToString(), ""); if ((propfindProperties == PropfindProperties.NONE) || ((propfindProperties & PropfindProperties.Getcontentlength) == PropfindProperties.Getcontentlength)) Props.Add(PropfindProperties.Getcontentlength.ToString(), "0"); if ((propfindProperties == PropfindProperties.NONE) || ((propfindProperties & PropfindProperties.Getcontenttype) == PropfindProperties.Getcontenttype)) Props.Add(PropfindProperties.Getcontenttype.ToString(), System.Net.Mime.MediaTypeNames.Application.Octet); if ((propfindProperties == PropfindProperties.NONE) || ((propfindProperties & PropfindProperties.Getetag) == PropfindProperties.Getetag)) Props.Add(PropfindProperties.Getetag.ToString(), Guid.NewGuid().ToString()); if ((propfindProperties == PropfindProperties.NONE) || ((propfindProperties & PropfindProperties.Getlastmodified) == PropfindProperties.Getlastmodified)) Props.Add(PropfindProperties.Getlastmodified.ToString(), LastModificationDate); if ((propfindProperties == PropfindProperties.NONE) || ((propfindProperties & PropfindProperties.Lockdiscovery) == PropfindProperties.Lockdiscovery)) Props.Add(PropfindProperties.Lockdiscovery.ToString(), ""); if ((propfindProperties == PropfindProperties.NONE) || ((propfindProperties & PropfindProperties.Resourcetype) == PropfindProperties.Resourcetype)) Props.Add(PropfindProperties.Resourcetype.ToString(), "collection"); if ((propfindProperties == PropfindProperties.NONE) || ((propfindProperties & PropfindProperties.Supportedlock) == PropfindProperties.Supportedlock)) Props.Add(PropfindProperties.Supportedlock.ToString(), ""); //} XmlElement ElemPropstat = CreatePropstatElement(header, xmlDocument, Props, hRef.Replace(header.GetFullHTTPHost(), "")); #endregion ElemResponse.AppendChild(ElemHref); ElemResponse.AppendChild(ElemPropstat); return ElemResponse; }
/// <summary> /// Create a usual Response Element for a File /// </summary> /// <param name="xmlDocument">The Parent XmlDocument</param> /// <param name="hRef">The Full HTTP reference to the File</param> /// <param name="displayname">The display Name (currently not use in WebDAV MS Explorer Client)</param> /// <param name="mediaTypeName">The MIMEType</param> /// <param name="FilestreamObject">A File Object</param> /// <returns></returns> private XmlElement CreateResponseElement_File(HTTPHeader header, XmlDocument xmlDocument, String hRef, String displayname, String mediaTypeName, UInt64 size, PropfindProperties propfindProperties) { //DateTime CreationDate = GetConvertedDateTime(INode.CreationTime); //DateTime LastModificationDate = GetConvertedDateTime(INode.LastModificationTime); DateTime CreationDate = DateTime.Now; DateTime LastModificationDate = DateTime.Now; return CreateResponseElement_File(header, xmlDocument, hRef, displayname, mediaTypeName, size, CreationDate, LastModificationDate, propfindProperties); }
/// <summary> /// Create a repsonse for a PROPFIND request (Directory(File)-Listing /// </summary> /// <param name="properties"></param> /// <returns></returns> private Byte[] CreatePropfindResponse(HTTPHeader header, PropfindProperties propfindProperties, HashSet<String> _DestinationObjectStreamTypes, params string[] properties) { #region Create XmlDocument XmlDocument XmlDocument = new XmlDocument(); //XmlDeclaration xmlDeclaration = XmlDocument.CreateXmlDeclaration("1.0", "utf-8", ""); //XmlDocument.AppendChild(xmlDeclaration); XmlElement Root = XmlDocument.CreateElement(S_DAV_PREFIX, "multistatus", S_DAV_NAMESPACE_URI); //Root.SetAttribute("xmlns:" + S_SVN_PREFIX, S_SVN_NAMESPACE_URI); if (header.GetDepth() == WebDAVDepth.Depth0) { Root.AppendChild(CreateDepth0Response(header, XmlDocument, propfindProperties, _DestinationObjectStreamTypes)); } Boolean IsLegalDir = true; if (S_INVALID_DIRECTORIES.Contains(String.Concat("|", DirectoryHelper.GetObjectName(header.Destination), "|"))) IsLegalDir = false; var directoryObjectR = _AGraphDSSharp.GetFSObject<DirectoryObject>(ObjectLocation.ParseString(header.Destination), FSConstants.DIRECTORYSTREAM, null, null, 0, false); // uncommented because _AGraphDSSharp.isIDirectoryObject is odd //if (IsLegalDir && _AGraphDSSharp.isIDirectoryObject(ObjectLocation.ParseString((header.Destination)) == Trinary.TRUE) if (IsLegalDir && directoryObjectR.Success()) { #region root elements if (header.GetDepth() != WebDAVDepth.Depth0) { // Get Content of the Current Directory var DirectoryObject = directoryObjectR.Value; foreach (DirectoryEntryInformation actualDirectoryEntry in DirectoryObject.GetExtendedDirectoryListing()) { //if (((String)DirectoryEntries["ObjectName"]).Contains(".forest") || ((String)DirectoryEntries["ObjectName"]).Contains(".fs") || ((String)DirectoryEntries["ObjectName"]).Contains(".metadata") || ((String)DirectoryEntries["ObjectName"]).Contains(".revisions") || ((String)DirectoryEntries["ObjectName"]).Contains(".vfs")) if (S_INVALID_DIRECTORIES.Contains(String.Concat("|", actualDirectoryEntry.Name))) continue; String ObjectDestination = header.Destination + (header.Destination.EndsWith("/") ? "" : FSPathConstants.PathDelimiter) + actualDirectoryEntry.Name; if (actualDirectoryEntry.Streams.Contains(FSConstants.DIRECTORYSTREAM)) { try { IDirectoryObject CurDirectoryObject = _AGraphDSSharp.GetFSObject<DirectoryObject>(ObjectLocation.ParseString(ObjectDestination), FSConstants.DIRECTORYSTREAM, null, null, 0, false).Value; String HRef = header.FullHTTPDestinationPath() + (header.FullHTTPDestinationPath().EndsWith("/") ? "" : FSPathConstants.PathDelimiter) + actualDirectoryEntry.Name; XmlElement XmlElement = CreateResponseElement_Dir(header, XmlDocument, HRef, actualDirectoryEntry.Name, CurDirectoryObject, propfindProperties); Root.AppendChild(XmlElement); } catch { } } else if (actualDirectoryEntry.Streams.Contains(FSConstants.FILESTREAM)) { String HRef = header.FullHTTPDestinationPath() + (header.FullHTTPDestinationPath().EndsWith("/") ? "" : FSPathConstants.PathDelimiter) + actualDirectoryEntry.Name; //INode INode = _AGraphDSSharp.ExportINode(ObjectLocation.ParseString((ObjectDestination)); UInt64 Size = (UInt64)_AGraphDSSharp.GetFSObject<FileObject>(ObjectLocation.ParseString(ObjectDestination), FSConstants.FILESTREAM, null, null, 0, false).Value.ObjectData.Length; XmlElement ResponseElement_File = CreateResponseElement_File(header, XmlDocument, HRef, actualDirectoryEntry.Name, System.Net.Mime.MediaTypeNames.Text.Plain, Size, propfindProperties); Root.AppendChild(ResponseElement_File); } else if (actualDirectoryEntry.Streams.Contains(FSConstants.SYMLINK)) { String HRef = header.FullHTTPDestinationPath() + (header.FullHTTPDestinationPath().EndsWith("/") ? "" : FSPathConstants.PathDelimiter) + actualDirectoryEntry.Name; Root.AppendChild(CreateResponseElement_Dir(header, XmlDocument, HRef, actualDirectoryEntry.Name, null, propfindProperties)); } else if (actualDirectoryEntry.Streams.Contains(FSConstants.INLINEDATA)) { String HRef = header.FullHTTPDestinationPath() + (header.FullHTTPDestinationPath().EndsWith("/") ? "" : FSPathConstants.PathDelimiter) + actualDirectoryEntry.Name; Byte[] Inlinedata = DirectoryObject.GetInlineData(actualDirectoryEntry.Name); // Return CreationTime and LastModificationTime of the DirectoryObject! var _CreationTime = DateTime.Now; var _LastModificationTime = DateTime.Now; var _AGraphObject = DirectoryObject as AFSObject; if (_AGraphObject != null) if (_AGraphObject.INodeReference != null) { _CreationTime = new DateTime((Int64)_AGraphObject.INodeReference.CreationTime); _LastModificationTime = new DateTime((Int64)_AGraphObject.INodeReference.LastModificationTime); } Root.AppendChild( CreateResponseElement_File( header, XmlDocument, HRef, actualDirectoryEntry.Name, System.Net.Mime.MediaTypeNames.Text.Plain, (UInt64)Inlinedata.Length, _LastModificationTime, _CreationTime, propfindProperties ) ); } //else // Root.AppendChild(CreateResponseElement_Dir(XmlDocument, actualDirectoryEntry.StreamTypes + ":" + actualDirectoryEntry.myLogin, actualDirectoryEntry.StreamTypes + actualDirectoryEntry.myLogin, null, myPropfindProperties)); } } #endregion } XmlDocument.AppendChild(Root); #endregion #region Stream XmlDocument to ByteArray XmlWriterSettings settings; settings = new XmlWriterSettings(); settings.Encoding = Encoding.UTF8; using (MemoryStream stream = new MemoryStream()) { using (XmlWriter writer = XmlWriter.Create(stream, settings)) { XmlDocument.WriteContentTo(writer); writer.Flush(); return CleanContent(stream.ToArray()); } } #endregion }