public void AddFilesFromRemote(string host, ListFormatType format = ListFormatType.Json, ListWriteMode mode = ListWriteMode.Append) { MdpRemoteServer mdpRemote = new MdpRemoteServer(); string result = mdpRemote.GetFilesList(host, ""); AddFilesFromText(result, format, mode); }
private void DownloadCorruptedFiles(string path, MdpFileInfo[] infos, string remoteDirUrl = "") { WebClient client = new WebClient(); string baseDlUrl = MdpApi.Resources.GetFilesDownloadUrl(Configuration.RemoteFileServer, remoteDirUrl); foreach (MdpFileInfo fileInfo in infos) { string fullPath = Path.GetFullPath(Path.Combine(path, fileInfo.Name)); Directory.GetParent(fullPath).Create(); if (fileInfo is MdpDirectoryInfo dirInfo) { MdpRemoteServer remote = new MdpRemoteServer(); string json = remote.GetFilesList(Configuration.RemoteFileServer, remoteDirUrl + "/" + dirInfo.Name); MdpFileList list = new MdpFileList(); list.AddFilesFromJson(json); DownloadCorruptedFiles(fullPath, list.Files, remoteDirUrl + "/" + dirInfo.Name); } else { client.DownloadFile(baseDlUrl + fileInfo.Name, fullPath); } } }