Пример #1
0
        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);
            }
        }
Пример #2
0
        static public GameWebDownloader GetInstance()
        {
            if (_instance == null)
            {
                _instance = new GameWebDownloader();
            }

            return(_instance);
        }
Пример #3
0
        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);
            }
        }
Пример #4
0
        void DownloadGame()
        {
            string downloadPath = string.Format("Games/{0}/server.version", _gameInfo.Downloadfolder);

            GameWebDownloader.GetInstance().DownloadFile(downloadPath, DownloadVersionCompleted, this);
        }