Ejemplo n.º 1
0
        private void Loading_Load(object sender, EventArgs e)
        {
            if (InstallPathExists() && !IsNewVersionAvailable())
            {
                ExecuteApplication();
            }
            else if (IsNewVersionAvailable())
            {
                NotifyNewVersionIsAvailable();
            }

            statusLabelMessage.Text    = "";
            fileDataReceivedLabel.Text = "";

            var fileProcess       = new FileProcess();
            var botDirectories    = new CreateBotDirectoriesCommand();
            var downloadFactory   = new DownloadFactory(_webClient, fileProcess);
            var downloadService   = new DownloadService(downloadFactory);
            var extractFactory    = new ExtractFactory();
            var extractService    = new ExtractService(extractFactory);
            var removeFactory     = new RemoveFactory();
            var removeService     = new RemoveService(removeFactory);
            var tesseractDownload = downloadService.Create(FileType.Tesseract, _binDirectory);
            var clientDownload    = downloadService.Create(FileType.Client, _installPath);
            var tesseractExtract  = extractService.Create(FileType.Tesseract, _binDirectory);
            var clientExtract     = extractService.Create(FileType.Client, _installPath);
            var tesseractRemove   = removeService.Create(FileType.Tesseract, _binDirectory);
            var clientRemove      = removeService.Create(FileType.Client, _installPath);

            _commandList.Add(botDirectories);
            _commandList.Add(tesseractDownload);
            _commandList.Add(clientDownload);
            _commandList.Add(tesseractExtract);
            _commandList.Add(clientExtract);
            _commandList.Add(tesseractRemove);
            _commandList.Add(clientRemove);

            Run();
        }
        private void Uninstaller_Load(object sender, EventArgs e)
        {
            fileLocationLabel.Text = "";

            try
            {
                _installPath = RegistryUtils.GetRegistryEntry();
                installLocationLabel.Text = _installPath;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            var removeFactory   = new RemoveFactory();
            var removeService   = new RemoveService(removeFactory);
            var clientRemove    = removeService.Create(FileType.Client, _installPath);
            var documentsRemove = removeService.Create(FileType.Documents, BotDirectories.baseDir);

            _commandList.Add(clientRemove);
            _commandList.Add(documentsRemove);
        }
 public RemoveService(RemoveFactory removeFactory)
 {
     _removeFactory = removeFactory;
 }