示例#1
0
 public override void WriteFileToStream(WebDAVdotNet.IFile file, Stream outputStream)
 {
     //throw new NotImplementedException();
     using (Stream inStream = File.Open(MyEngine.RewriteURLToLocalPath(this._rootPath, file.Path), FileMode.Open, FileAccess.Read))
     {
         byte[] buffer = new byte[16 * 1024];
         int bytesRead = 0;
         while ((bytesRead = inStream.Read(buffer, 0, 16 * 1024)) > 0)
             outputStream.Write(buffer, 0, bytesRead);
     }
     //return new BufferedStream(System.IO.File.Open(MyEngine.RewriteURLToLocalPath(this._rootPath, file.Path), FileMode.Open, FileAccess.Read), 1024 * 32);
 }
示例#2
0
        public override IEnumerable<WebDAVdotNet.IHierarchyItem> GetResources(IList<string> items, IList<WebDAVdotNet.PropertyName> properties, WebDAVdotNet.Headers.Depth depth)
        {
            List<WebDAVdotNet.IHierarchyItem> returnItems = new List<WebDAVdotNet.IHierarchyItem>();

            foreach (string path in items)
            {

                string mappedPath = RewriteURLToLocalPath(_rootPath, path);

                WebDAVdotNet.IHierarchyItem item = GetResource(mappedPath, properties);
                if (item is MyFolder && depth == WebDAVdotNet.Headers.Depth.One)
                {
                    returnItems.AddRange(((MyFolder)item).GetChildren(properties));
                }

                returnItems.Add(item);
            }

            foreach (WebDAVdotNet.IHierarchyItem item in returnItems)
            {
                item.Path = RewriteLocalPathToURL(_rootPath, item.Path, (item is WebDAVdotNet.IFolder));
            }
            return returnItems;
        }