示例#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> GetChildren(IList <WebDAVdotNet.PropertyName> properties)
        {
            List <WebDAVdotNet.IHierarchyItem> returnItems = new List <WebDAVdotNet.IHierarchyItem>();

            string[] directories = Directory.GetDirectories(_path);
            foreach (string directory in directories)
            {
                MyFolder myFolder = (MyFolder)MyEngine.GetResource(directory, properties);
                returnItems.Add(myFolder);
            }

            string[] files = Directory.GetFiles(_path);
            foreach (string file in files)
            {
                MyFile myFile = (MyFile)MyEngine.GetResource(file, properties);
                returnItems.Add(myFile);
            }

            return(returnItems);
        }