Пример #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();
        }