Пример #1
0
        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;
        }
Пример #2
0
        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;
        }
Пример #3
0
        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;

        }
Пример #4
0
 public Stream GetFile(IFileInfo fileInfo)
 {
     using (var client = new FileServiceProxy())
     {
         return client.GetFileAnonimous(fileInfo.FileName);
     }
 }
Пример #5
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();
     }
 }
Пример #6
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;
            }
        }
Пример #7
0
 public Stream GetFile(IFileInfo fileInfo)
 {
     using (var client = new FileServiceProxy())
     {
         return client.GetFile(_ticketAut, fileInfo.FileName);
     }
 }