Exemplo n.º 1
0
 public Stream GetFile(UppyFileInfo fileInfo)
 {
     using (var client = new FileRepositoryServiceClient())
     {
         return client.GetFile(fileInfo.FileName);
     }
 }
Exemplo n.º 2
0
        public string GetFileToTemp(UppyFileInfo fileInfo)
        {
            using (var client = new FileRepositoryServiceClient())
            {
                var stream = client.GetFile(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;
            }
        }
Exemplo n.º 3
0
        private UppyFileInfo PutFile(Stream stream, string fileName)
        {
            using (FileRepositoryServiceClient client = new FileRepositoryServiceClient())
            {
                var file = client.List().FirstOrDefault(x => x.VirtualPath == fileName);
                if (file == null)
                    client.PutFile(new FileUploadMessage() { DataStream = stream, VirtualPath = fileName });
            }

            UppyFileInfo uppyFileInfo = new UppyFileInfo();
            uppyFileInfo.FileName = fileName;

            return uppyFileInfo;
        }