Пример #1
0
 public void GetFileToFolder(IFileInfo fileInfo, string folder)
 {
     using (var client = new FileServiceProxy())
     {
         var stream = client.GetFileAnonimous(fileInfo.FileName);
         var pathFileSave = Path.Combine(Directory.CreateDirectory(folder).FullName, fileInfo.FileName);
         var writeFile = File.OpenWrite(pathFileSave);
         stream.CopyTo(writeFile);
         writeFile.Flush();
         writeFile.Close();
     }
 }
Пример #2
0
 public Stream GetFile(IFileInfo fileInfo)
 {
     using (var client = new FileServiceProxy())
     {
         return client.GetFileAnonimous(fileInfo.FileName);
     }
 }
Пример #3
0
        public string GetFileToTemp(IFileInfo fileInfo)
        {
            using (var client = new FileServiceProxy())
            {
                var stream = client.GetFileAnonimous(fileInfo.FileName);
                var pathFileSave = Path.Combine(Path.GetTempPath(), "UPPY" + Environment.TickCount + fileInfo.FileName);
                var writeFile = File.OpenWrite(pathFileSave);
                stream.CopyTo(writeFile);
                writeFile.Flush();
                writeFile.Close();

                return pathFileSave;
            }
        }