public List<IFileInfo> GetListFiels() { var listFiles = new List<IFileInfo>(); using (var client = new FileServiceProxy()) { var files = client.ListFilesAnonimous(null); listFiles.AddRange(files.Select(storageFileInfo => new UppyFileInfo() { FileName = storageFileInfo.VirtualPath })); } return listFiles; }
private UppyFileInfo PutFile(Stream stream, string fileName) { using (FileServiceProxy proxy = new FileServiceProxy()) { //var file = proxy.List().FirstOrDefault(x => x.VirtualPath == fileName); proxy.PutFileAnonimous(new FileUploadMessage() { DataStream = stream, VirtualPath = fileName }); } UppyFileInfo uppyFileInfo = new UppyFileInfo(); uppyFileInfo.FileName = fileName; return uppyFileInfo; }
private Task<IFileInfo> PutFileAsync(Stream stream, string fileName) { var task = new Task<IFileInfo>(() => { using (var client = new FileServiceProxy()) { var taskServer = client.PutFileAsyncAnonimous(new FileUploadMessage() { DataStream = stream, VirtualPath = fileName }); taskServer.Wait(); stream.Close(); } UppyFileInfo uppyFileInfo = new UppyFileInfo(); uppyFileInfo.FileName = fileName; return uppyFileInfo; }); task.Start(); return task; }
public Stream GetFile(IFileInfo fileInfo) { using (var client = new FileServiceProxy()) { return client.GetFileAnonimous(fileInfo.FileName); } }
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(); } }
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; } }
public Stream GetFile(IFileInfo fileInfo) { using (var client = new FileServiceProxy()) { return client.GetFile(_ticketAut, fileInfo.FileName); } }