public void DownloadFileCompleted(string filePath) { DownloadFileInfo foundInfo = null; foreach (DownloadFileInfo localInfo in _LocalVersions) { if (localInfo.FilePath == _ServerVersions[0].FilePath) { foundInfo = localInfo; break; } } if (foundInfo == null) { foundInfo = new DownloadFileInfo(); foundInfo.FilePath = _ServerVersions[0].FilePath; _LocalVersions.Add(foundInfo); } foundInfo.FileVersion = _ServerVersions[0].FileVersion; _ServerVersions.RemoveAt(0); gameDownloadWnd.progressUpdate.Value++; if (NeedDownload()) { GameWebDownloader.GetInstance().DownloadFile(_ServerVersions[0].FilePath, DownloadFileCompleted, this); } }
public void DownloadVersionCompleted(string filePath) { string localRoot = AppDomain.CurrentDomain.BaseDirectory + "Games\\" + _gameInfo.Downloadfolder; _ServerVersions = VersionInfo.ReadInfoFile(localRoot, false); _LocalVersions = VersionInfo.ReadInfoFile(localRoot, true); if (NeedDownload()) { gameDownloadWnd = new GameDownload(); gameDownloadWnd.progressUpdate.Maximum = GetDownloadCount(); gameDownloadWnd.progressUpdate.Value = 0; gameDownloadWnd.Show(); GameWebDownloader.gameDownloadWnd = gameDownloadWnd; GameWebDownloader.GetInstance().DownloadFile(_ServerVersions[0].FilePath, DownloadFileCompleted, this); } }
void DownloadGame() { string downloadPath = string.Format("Games/{0}/server.version", _gameInfo.Downloadfolder); GameWebDownloader.GetInstance().DownloadFile(downloadPath, DownloadVersionCompleted, this); }