コード例 #1
0
ファイル: MdpFileList.cs プロジェクト: binyamin555/gamecorev2
        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);
        }
コード例 #2
0
        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);
                }
            }
        }