コード例 #1
0
        private bool Extract()
        {
            string embeddedGameVersion = Installer.GetEmbeddedGameVersion(m_gameTitle);

            if (!Installer.IsGameDownloaded(m_gameTitle, embeddedGameVersion))
            {
                Stage = GameUpdateStage.ExtractingUpdate;
                if (!Installer.ExtractEmbeddedGame(delegate(int progress) {
                    StageProgress = (double)progress / 100.0;
                }, this))
                {
                    return(false);
                }
                if (Cancelled)
                {
                    return(false);
                }
                StageProgress = 1.0;
            }
            return(true);
        }
コード例 #2
0
        private bool Download(string gameVersion, string downloadURL, string username = null, string password = null)
        {
            if (!Installer.IsGameDownloaded(m_gameTitle, gameVersion))
            {
                Stage = GameUpdateStage.DownloadingUpdate;

                string embeddedGameTitle, embeddedGameVersion, embeddedGameURL, embeddedUsername, embeddedPassword;
                if (Installer.GetEmbeddedGameInfo(out embeddedGameTitle, out embeddedGameVersion, out embeddedGameURL, out embeddedUsername, out embeddedPassword))
                {
                    if (username == null)
                    {
                        username = embeddedUsername;
                    }
                    if (password == null)
                    {
                        password = embeddedPassword;
                    }
                }

                bool authFailure;
                if (!Installer.DownloadGame(
                        m_gameTitle, gameVersion,
                        downloadURL,
                        username,
                        password,
                        delegate(int progress) {
                    StageProgress = (double)progress / 100.0;
                },
                        this,
                        out authFailure
                        ))
                {
                    if (Cancelled)
                    {
                        return(false);
                    }
                    if (authFailure)
                    {
                        if (embeddedUsername == null && embeddedPassword == null)
                        {
                            if (ShowUsernameAndPasswordPrompt(ref username, ref password))
                            {
                                return(Download(gameVersion, downloadURL, username, password));
                            }
                        }
                        else if (embeddedUsername == null)
                        {
                            if (ShowUsernamePrompt(ref username))
                            {
                                return(Download(gameVersion, downloadURL, username, embeddedPassword));
                            }
                        }
                        else if (embeddedPassword == null)
                        {
                            if (ShowPasswordPrompt(ref password))
                            {
                                return(Download(gameVersion, downloadURL, embeddedUsername, password));
                            }
                        }
                    }
                    return(false);
                }
                if (Cancelled)
                {
                    return(false);
                }
                StageProgress = 1.0;
            }
            return(true);
        }