Пример #1
0
        void InstallUpdates(UpdateOn CurrentlyUpdating)
        {
            switch (CurrentlyUpdating)
            {
                case UpdateOn.Extracting:

                    // set for auto-updates
                    currentlyExtracting = true;

                    SetStepStatus(1, clientLang.Extract);

                    installUpdate = new InstallUpdate
                    {
                        Filename = Path.Combine(tempDirectory, updateFilename),
                        OutputDirectory = tempDirectory,
                        TempDirectory = tempDirectory,
                        ProgramDirectory = baseDirectory,

                        // use the password passed in by commandline (take precedence)
                        // or use the password embedded in the client.wyc file.
                        //ExtractPassword = PasswordUpdateCmd ?? update.UpdatePassword
                    };

                    installUpdate.ProgressChanged += ShowProgress;
                    installUpdate.RunUnzipProcess();
                    break;
                case UpdateOn.ClosingProcesses:
                    SetStepStatus(1, clientLang.Processes);

                    installUpdate = new InstallUpdate
                    {
                        UpdtDetails = updtDetails,
                        TempDirectory = tempDirectory,
                        ProgramDirectory = baseDirectory,

                        // skip ui reporting when updating from a service
                        //SkipUIReporting = UpdatingFromService || updateHelper.IsAService,
                        //SkipStartService = updateHelper.IsAService ? updateHelper.FileOrServiceToExecuteAfterUpdate : null
                    };

                    installUpdate.Rollback += ChangeRollback;
                    installUpdate.ProgressChanged += CheckProcess;
                    installUpdate.RunProcessesCheck();
                    break;
                case UpdateOn.PreExecute:

                    // try to stop the user from forcefuly exiting
                    BlockLogOff(true);

                    SetStepStatus(1, clientLang.PreExec);

                    installUpdate = new InstallUpdate
                    {
                        UpdtDetails = updtDetails,
                        TempDirectory = tempDirectory,
                        ProgramDirectory = baseDirectory,
                        IsAdmin = IsAdmin,
                        MainWindowHandle = Handle
                    };

                    installUpdate.Rollback += ChangeRollback;
                    installUpdate.ProgressChanged += ShowProgress;
                    installUpdate.RunPreExecute();
                    break;
                case UpdateOn.BackUpInstalling:
                    SetStepStatus(1, clientLang.Files);

                    installUpdate = new InstallUpdate
                    {
                        UpdtDetails = updtDetails,
                        TempDirectory = tempDirectory,
                        ProgramDirectory = baseDirectory,

                        // skip ui reporting when updating from a service
                        //SkipUIReporting = UpdatingFromService || updateHelper.IsAService
                    };

                    installUpdate.Rollback += ChangeRollback;
                    installUpdate.ProgressChanged += ShowProgress;
                    installUpdate.RunUpdateFiles();
                    break;
                case UpdateOn.ModifyReg:
                    SetStepStatus(2, clientLang.Registry);

                    installUpdate = new InstallUpdate
                    {
                        UpdtDetails = updtDetails,
                        TempDirectory = tempDirectory,
                        ProgramDirectory = baseDirectory
                    };

                    installUpdate.Rollback += ChangeRollback;
                    installUpdate.ProgressChanged += ShowProgress;
                    installUpdate.RunUpdateRegistry();
                    break;
                case UpdateOn.DeletingTemp:
                    SetStepStatus(3, clientLang.TempFiles);

                    installUpdate = new InstallUpdate
                    {
                        TempDirectory = tempDirectory
                    };

                    installUpdate.ProgressChanged += ShowProgress;
                    installUpdate.RunDeleteTemporary();
                    break;
                case UpdateOn.Uninstalling:
                    // need to pass: client data file loc, delegate, this
                    installUpdate = new InstallUpdate
                    {
                        //Filename = clientFileLoc
                    };

                    installUpdate.ProgressChanged += UninstallProgress;
                    installUpdate.RunUninstall();
                    break;
            }
        }
Пример #2
0
        void InstallUpdates(UpdateOn CurrentlyUpdating)
        {
            switch (CurrentlyUpdating)
            {
                case UpdateOn.FullSelfUpdate:
                    SetStepStatus(1, clientLang.SelfUpdate);

                    installUpdate = new InstallUpdate
                                        {
                                            //location of old "self" to replace
                                            OldSelfLoc = oldSelfLocation,
                                            Filename = Path.Combine(tempDirectory, updateFilename),
                                            OutputDirectory = tempDirectory,
                                            FromAutoUpdate = isAutoUpdateMode
                                        };

                    installUpdate.ProgressChanged += SelfUpdateProgress;
                    installUpdate.RunSelfUpdate();
                    break;
                case UpdateOn.ExtractSelfUpdate:

                    oldSelfLocation = VersionTools.SelfLocation;

                    installUpdate = new InstallUpdate
                                        {
                                            // old self is needed for patching
                                            OldSelfLoc = oldSelfLocation,
                                            Filename = Path.Combine(tempDirectory, updateFilename),
                                            OutputDirectory = Path.Combine(tempDirectory, "selfupdate")
                                        };

                    installUpdate.ProgressChanged += SelfUpdateProgress;
                    installUpdate.JustExtractSelfUpdate();
                    break;
                case UpdateOn.InstallSelfUpdate:

                    installUpdate = new InstallUpdate
                                        {
                                            //location of old "self" to replace
                                            OldSelfLoc = oldSelfLocation,
                                            NewSelfLoc = newSelfLocation,
                                            Filename = Path.Combine(tempDirectory, updateFilename),
                                            OutputDirectory = Path.Combine(tempDirectory, "selfupdate"),
                                            FromAutoUpdate = isAutoUpdateMode
                                        };

                    installUpdate.ProgressChanged += SelfUpdateProgress;
                    installUpdate.JustInstallSelfUpdate();
                    break;
                case UpdateOn.Extracting:

                    // set for auto-updates
                    currentlyExtracting = true;

                    SetStepStatus(1, clientLang.Extract);

                    installUpdate = new InstallUpdate
                                        {
                                            Filename = Path.Combine(tempDirectory, updateFilename),
                                            OutputDirectory = tempDirectory,
                                            TempDirectory = tempDirectory,
                                            ProgramDirectory = baseDirectory,

                                            // use the password passed in by commandline (take precedence)
                                            // or use the password embedded in the client.wyc file.
                                            ExtractPassword = PasswordUpdateCmd ?? update.UpdatePassword
                                        };

                    installUpdate.ProgressChanged += ShowProgress;
                    installUpdate.RunUnzipProcess();
                    break;
                case UpdateOn.ClosingProcesses:
                    SetStepStatus(1, clientLang.Processes);

                    installUpdate = new InstallUpdate
                                        {
                                            UpdtDetails = updtDetails,
                                            TempDirectory = tempDirectory,
                                            ProgramDirectory = baseDirectory,

                                            // skip ui reporting when updating from a service
                                            SkipUIReporting = UpdatingFromService || updateHelper.IsAService,
                                            SkipStartService = updateHelper.IsAService ? updateHelper.FileOrServiceToExecuteAfterUpdate : null
                                        };

                    installUpdate.Rollback += ChangeRollback;
                    installUpdate.ProgressChanged += CheckProcess;
                    installUpdate.RunProcessesCheck();
                    break;
                case UpdateOn.PreExecute:

                    // try to stop the user from forcefuly exiting
                    BlockLogOff(true);

                    SetStepStatus(1, clientLang.PreExec);

                    installUpdate = new InstallUpdate
                                        {
                                            UpdtDetails = updtDetails,
                                            TempDirectory = tempDirectory,
                                            ProgramDirectory = baseDirectory,
                                            IsAdmin = IsAdmin,
                                            MainWindowHandle = Handle
                                        };

                    installUpdate.Rollback += ChangeRollback;
                    installUpdate.ProgressChanged += ShowProgress;
                    installUpdate.RunPreExecute();
                    break;
                case UpdateOn.BackUpInstalling:
                    SetStepStatus(1, clientLang.Files);

                    installUpdate = new InstallUpdate
                                        {
                                            UpdtDetails = updtDetails,
                                            TempDirectory = tempDirectory,
                                            ProgramDirectory = baseDirectory,

                                            // skip ui reporting when updating from a service
                                            SkipUIReporting = UpdatingFromService || updateHelper.IsAService
                                        };

                    installUpdate.Rollback += ChangeRollback;
                    installUpdate.ProgressChanged += ShowProgress;
                    installUpdate.RunUpdateFiles();
                    break;
                case UpdateOn.ModifyReg:
                    SetStepStatus(2, clientLang.Registry);

                    installUpdate = new InstallUpdate
                                        {
                                            UpdtDetails = updtDetails,
                                            TempDirectory = tempDirectory,
                                            ProgramDirectory = baseDirectory
                                        };

                    installUpdate.Rollback += ChangeRollback;
                    installUpdate.ProgressChanged += ShowProgress;
                    installUpdate.RunUpdateRegistry();
                    break;
                case UpdateOn.OptimizeExecute:
                    SetStepStatus(3, clientLang.Optimize);

                    installUpdate = new InstallUpdate
                                        {
                                            UpdtDetails = updtDetails,
                                            TempDirectory = tempDirectory,
                                            ProgramDirectory = baseDirectory,
                                            SkipStartService = updateHelper.IsAService ? updateHelper.FileOrServiceToExecuteAfterUpdate : null,
                                            IsAdmin = IsAdmin,
                                            MainWindowHandle = Handle
                                        };

                    installUpdate.Rollback += ChangeRollback;
                    installUpdate.ProgressChanged += ShowProgress;
                    installUpdate.RunOptimizeExecute();
                    break;
                case UpdateOn.WriteClientFile:
                    // don't show any status, but begin the thread to being updating the client file

                    // Save the client file with the new version
                    update.InstalledVersion = ServerFile.NewVersion;

                    installUpdate = new InstallUpdate
                                        {
                                            Filename = clientFileLoc,
                                            UpdtDetails = updtDetails,
                                            ClientFileType = clientFileType,
                                            ClientFile = update,
                                            SkipProgressReporting = true,
                                            TempDirectory = tempDirectory,
                                            ProgramDirectory = baseDirectory
                                        };

                    installUpdate.Rollback += ChangeRollback;
                    installUpdate.ProgressChanged += ShowProgress;
                    installUpdate.RunUpdateClientDataFile();
                    break;
                case UpdateOn.DeletingTemp:
                    SetStepStatus(3, clientLang.TempFiles);

                    installUpdate = new InstallUpdate
                                        {
                                            TempDirectory = tempDirectory
                                        };

                    installUpdate.ProgressChanged += ShowProgress;
                    installUpdate.RunDeleteTemporary();
                    break;
                case UpdateOn.Uninstalling:
                    // need to pass: client data file loc, delegate, this
                    installUpdate = new InstallUpdate
                                        {
                                            Filename = clientFileLoc
                                        };

                    installUpdate.ProgressChanged += UninstallProgress;
                    installUpdate.RunUninstall();
                    break;
            }
        }
Пример #3
0
        void InstallUpdates(UpdateOn CurrentlyUpdating)
        {
            switch (CurrentlyUpdating)
            {
            case UpdateOn.FullSelfUpdate:
                SetStepStatus(1, clientLang.SelfUpdate);

                installUpdate = new InstallUpdate
                {
                    //location of old "self" to replace
                    OldSelfLoc      = oldSelfLocation,
                    Filename        = Path.Combine(tempDirectory, updateFilename),
                    OutputDirectory = tempDirectory,
                    FromAutoUpdate  = isAutoUpdateMode
                };

                installUpdate.ProgressChanged += SelfUpdateProgress;
                installUpdate.RunSelfUpdate();
                break;

            case UpdateOn.ExtractSelfUpdate:

                oldSelfLocation = VersionTools.SelfLocation;

                installUpdate = new InstallUpdate
                {
                    // old self is needed for patching
                    OldSelfLoc      = oldSelfLocation,
                    Filename        = Path.Combine(tempDirectory, updateFilename),
                    OutputDirectory = Path.Combine(tempDirectory, "selfupdate")
                };

                installUpdate.ProgressChanged += SelfUpdateProgress;
                installUpdate.JustExtractSelfUpdate();
                break;

            case UpdateOn.InstallSelfUpdate:

                installUpdate = new InstallUpdate
                {
                    //location of old "self" to replace
                    OldSelfLoc      = oldSelfLocation,
                    NewSelfLoc      = newSelfLocation,
                    Filename        = Path.Combine(tempDirectory, updateFilename),
                    OutputDirectory = Path.Combine(tempDirectory, "selfupdate"),
                    FromAutoUpdate  = isAutoUpdateMode
                };

                installUpdate.ProgressChanged += SelfUpdateProgress;
                installUpdate.JustInstallSelfUpdate();
                break;

            case UpdateOn.Extracting:

                // set for auto-updates
                currentlyExtracting = true;

                SetStepStatus(1, clientLang.Extract);

                installUpdate = new InstallUpdate
                {
                    Filename         = Path.Combine(tempDirectory, updateFilename),
                    OutputDirectory  = tempDirectory,
                    TempDirectory    = tempDirectory,
                    ProgramDirectory = baseDirectory,

                    // use the password passed in by commandline (take precedence)
                    // or use the password embedded in the client.wyc file.
                    ExtractPassword = PasswordUpdateCmd ?? update.UpdatePassword
                };

                installUpdate.ProgressChanged += ShowProgress;
                installUpdate.RunUnzipProcess();
                break;

            case UpdateOn.ClosingProcesses:
                SetStepStatus(1, clientLang.Processes);

                installUpdate = new InstallUpdate
                {
                    UpdtDetails      = updtDetails,
                    TempDirectory    = tempDirectory,
                    ProgramDirectory = baseDirectory,

                    // skip ui reporting when updating from a service
                    SkipUIReporting  = UpdatingFromService || updateHelper.IsAService,
                    SkipStartService = updateHelper.IsAService ? updateHelper.FileOrServiceToExecuteAfterUpdate : null
                };

                installUpdate.Rollback        += ChangeRollback;
                installUpdate.ProgressChanged += CheckProcess;
                installUpdate.RunProcessesCheck();
                break;

            case UpdateOn.PreExecute:

                // try to stop the user from forcefuly exiting
                BlockLogOff(true);

                SetStepStatus(1, clientLang.PreExec);

                installUpdate = new InstallUpdate
                {
                    UpdtDetails      = updtDetails,
                    TempDirectory    = tempDirectory,
                    ProgramDirectory = baseDirectory,
                    IsAdmin          = IsAdmin,
                    MainWindowHandle = Handle
                };

                installUpdate.Rollback        += ChangeRollback;
                installUpdate.ProgressChanged += ShowProgress;
                installUpdate.RunPreExecute();
                break;

            case UpdateOn.BackUpInstalling:
                SetStepStatus(1, clientLang.Files);

                installUpdate = new InstallUpdate
                {
                    UpdtDetails      = updtDetails,
                    TempDirectory    = tempDirectory,
                    ProgramDirectory = baseDirectory,

                    // skip ui reporting when updating from a service
                    SkipUIReporting = UpdatingFromService || updateHelper.IsAService
                };

                installUpdate.Rollback        += ChangeRollback;
                installUpdate.ProgressChanged += ShowProgress;
                installUpdate.RunUpdateFiles();
                break;

            case UpdateOn.ModifyReg:
                SetStepStatus(2, clientLang.Registry);

                installUpdate = new InstallUpdate
                {
                    UpdtDetails      = updtDetails,
                    TempDirectory    = tempDirectory,
                    ProgramDirectory = baseDirectory
                };

                installUpdate.Rollback        += ChangeRollback;
                installUpdate.ProgressChanged += ShowProgress;
                installUpdate.RunUpdateRegistry();
                break;

            case UpdateOn.OptimizeExecute:
                SetStepStatus(3, clientLang.Optimize);

                installUpdate = new InstallUpdate
                {
                    UpdtDetails      = updtDetails,
                    TempDirectory    = tempDirectory,
                    ProgramDirectory = baseDirectory,
                    SkipStartService = updateHelper.IsAService ? updateHelper.FileOrServiceToExecuteAfterUpdate : null,
                    IsAdmin          = IsAdmin,
                    MainWindowHandle = Handle
                };

                installUpdate.Rollback        += ChangeRollback;
                installUpdate.ProgressChanged += ShowProgress;
                installUpdate.RunOptimizeExecute();
                break;

            case UpdateOn.WriteClientFile:
                // don't show any status, but begin the thread to being updating the client file

                // Save the client file with the new version
                update.InstalledVersion = ServerFile.NewVersion;

                installUpdate = new InstallUpdate
                {
                    Filename              = clientFileLoc,
                    UpdtDetails           = updtDetails,
                    ClientFileType        = clientFileType,
                    ClientFile            = update,
                    SkipProgressReporting = true,
                    TempDirectory         = tempDirectory,
                    ProgramDirectory      = baseDirectory
                };

                installUpdate.Rollback        += ChangeRollback;
                installUpdate.ProgressChanged += ShowProgress;
                installUpdate.RunUpdateClientDataFile();
                break;

            case UpdateOn.DeletingTemp:
                SetStepStatus(3, clientLang.TempFiles);

                installUpdate = new InstallUpdate
                {
                    TempDirectory = tempDirectory
                };

                installUpdate.ProgressChanged += ShowProgress;
                installUpdate.RunDeleteTemporary();
                break;

            case UpdateOn.Uninstalling:
                // need to pass: client data file loc, delegate, this
                installUpdate = new InstallUpdate
                {
                    Filename = clientFileLoc
                };

                installUpdate.ProgressChanged += UninstallProgress;
                installUpdate.RunUninstall();
                break;
            }
        }
Пример #4
0
        void InstallUpdates(UpdateOn CurrentlyUpdating)
        {
            switch (CurrentlyUpdating)
            {
            case UpdateOn.Extracting:

                // set for auto-updates
                currentlyExtracting = true;

                SetStepStatus(1, clientLang.Extract);

                installUpdate = new InstallUpdate
                {
                    Filename         = Path.Combine(tempDirectory, updateFilename),
                    OutputDirectory  = tempDirectory,
                    TempDirectory    = tempDirectory,
                    ProgramDirectory = baseDirectory,

                    // use the password passed in by commandline (take precedence)
                    // or use the password embedded in the client.wyc file.
                    //ExtractPassword = PasswordUpdateCmd ?? update.UpdatePassword
                };

                installUpdate.ProgressChanged += ShowProgress;
                installUpdate.RunUnzipProcess();
                break;

            case UpdateOn.ClosingProcesses:
                SetStepStatus(1, clientLang.Processes);

                installUpdate = new InstallUpdate
                {
                    UpdtDetails      = updtDetails,
                    TempDirectory    = tempDirectory,
                    ProgramDirectory = baseDirectory,

                    // skip ui reporting when updating from a service
                    //SkipUIReporting = UpdatingFromService || updateHelper.IsAService,
                    //SkipStartService = updateHelper.IsAService ? updateHelper.FileOrServiceToExecuteAfterUpdate : null
                };

                installUpdate.Rollback        += ChangeRollback;
                installUpdate.ProgressChanged += CheckProcess;
                installUpdate.RunProcessesCheck();
                break;

            case UpdateOn.PreExecute:

                // try to stop the user from forcefuly exiting
                BlockLogOff(true);

                SetStepStatus(1, clientLang.PreExec);

                installUpdate = new InstallUpdate
                {
                    UpdtDetails      = updtDetails,
                    TempDirectory    = tempDirectory,
                    ProgramDirectory = baseDirectory,
                    IsAdmin          = IsAdmin,
                    MainWindowHandle = Handle
                };

                installUpdate.Rollback        += ChangeRollback;
                installUpdate.ProgressChanged += ShowProgress;
                installUpdate.RunPreExecute();
                break;

            case UpdateOn.BackUpInstalling:
                SetStepStatus(1, clientLang.Files);

                installUpdate = new InstallUpdate
                {
                    UpdtDetails      = updtDetails,
                    TempDirectory    = tempDirectory,
                    ProgramDirectory = baseDirectory,

                    // skip ui reporting when updating from a service
                    //SkipUIReporting = UpdatingFromService || updateHelper.IsAService
                };

                installUpdate.Rollback        += ChangeRollback;
                installUpdate.ProgressChanged += ShowProgress;
                installUpdate.RunUpdateFiles();
                break;

            case UpdateOn.ModifyReg:
                SetStepStatus(2, clientLang.Registry);

                installUpdate = new InstallUpdate
                {
                    UpdtDetails      = updtDetails,
                    TempDirectory    = tempDirectory,
                    ProgramDirectory = baseDirectory
                };

                installUpdate.Rollback        += ChangeRollback;
                installUpdate.ProgressChanged += ShowProgress;
                installUpdate.RunUpdateRegistry();
                break;

            case UpdateOn.DeletingTemp:
                SetStepStatus(3, clientLang.TempFiles);

                installUpdate = new InstallUpdate
                {
                    TempDirectory = tempDirectory
                };

                installUpdate.ProgressChanged += ShowProgress;
                installUpdate.RunDeleteTemporary();
                break;

            case UpdateOn.Uninstalling:
                // need to pass: client data file loc, delegate, this
                installUpdate = new InstallUpdate
                {
                    //Filename = clientFileLoc
                };

                installUpdate.ProgressChanged += UninstallProgress;
                installUpdate.RunUninstall();
                break;
            }
        }