Exemple #1
0
        private void buttonNext_Click(object sender, EventArgs e)
        {
            using (var handler = new GuiTaskHandler(this))
            {
                if (FileUtils.IsBreakoutPath(comboBoxExtract.Text))
                {
                    Msg.Inform(this, Resources.ArchiveBreakoutPath, MsgSeverity.Error);
                    return;
                }

                _archive.Extract = comboBoxExtract.Text ?? "";
                _feedBuilder.ImplementationDirectory = Path.Combine(_feedBuilder.TemporaryDirectory, FileUtils.UnifySlashes(_archive.Extract));

                try
                {
                    // Candidate detection is handled differently when captuing an installer
                    if (_installerCapture == null)
                    {
                        _feedBuilder.DetectCandidates(handler);
                    }

                    _feedBuilder.CalculateDigest(handler);
                }
                #region Error handling
                catch (OperationCanceledException)
                {
                    return;
                }
                catch (ArgumentException ex)
                {
                    Msg.Inform(this, ex.Message, MsgSeverity.Warn);
                    return;
                }
                catch (IOException ex)
                {
                    Msg.Inform(this, ex.Message, MsgSeverity.Warn);
                    return;
                }
                catch (UnauthorizedAccessException ex)
                {
                    Msg.Inform(this, ex.Message, MsgSeverity.Error);
                    return;
                }
                #endregion
            }

            if (_feedBuilder.ManifestDigest.PartialEquals(ManifestDigest.Empty))
            {
                Msg.Inform(this, Resources.EmptyImplementation, MsgSeverity.Warn);
                return;
            }
            if (_feedBuilder.MainCandidate == null)
            {
                Msg.Inform(this, Resources.NoEntryPointsFound, MsgSeverity.Warn);
                return;
            }

            Next();
        }
Exemple #2
0
 private void OnSingleFile()
 {
     Retrieve(
         new SingleFile {
         Href = textBoxDownloadUrl.Uri
     },
         checkLocalCopy.Checked ? textBoxLocalPath.Text : null);
     _feedBuilder.ImplementationDirectory = _feedBuilder.TemporaryDirectory;
     using (var handler = new DialogTaskHandler(this))
     {
         _feedBuilder.DetectCandidates(handler);
         _feedBuilder.CalculateDigest(handler);
     }
     if (_feedBuilder.MainCandidate == null)
     {
         throw new NotSupportedException(Resources.NoEntryPointsFound);
     }
     else
     {
         _feedBuilder.GenerateCommands();
         pageDownload.NextPage = pageDetails;
     }
 }
        /// <summary>
        /// Collects data from the locations indicated by the differences between the <see cref="Start"/> state and the current system state.
        /// </summary>
        /// <param name="handler">A callback object used when the the user needs to be informed about IO tasks.</param>
        /// <exception cref="InvalidOperationException">No installation directory was detected.</exception>
        /// <exception cref="OperationCanceledException">The user canceled the operation.</exception>
        /// <exception cref="IOException">There was an error accessing the registry or file system.</exception>
        /// <exception cref="UnauthorizedAccessException">Access to the registry or file system was not permitted.</exception>
        public void Diff([NotNull] ITaskHandler handler)
        {
            #region Sanity checks
            if (handler == null)
            {
                throw new ArgumentNullException("handler");
            }
            #endregion

            _diff = new SnapshotDiff(before: _snapshot, after: Snapshot.Take());
            if (string.IsNullOrEmpty(InstallationDir))
            {
                InstallationDir = _diff.GetInstallationDir();
            }

            _feedBuilder.ImplementationDirectory = InstallationDir;
            _feedBuilder.DetectCandidates(handler);
        }
Exemple #4
0
 private void OnSingleFile()
 {
     Retrieve(new SingleFile {
         Href = textBoxUrl.Uri
     });
     _feedBuilder.ImplementationDirectory = _feedBuilder.TemporaryDirectory;
     using (var handler = new GuiTaskHandler(this))
     {
         _feedBuilder.DetectCandidates(handler);
         _feedBuilder.CalculateDigest(handler);
     }
     if (_feedBuilder.MainCandidate == null)
     {
         Msg.Inform(this, Resources.NoEntryPointsFound, MsgSeverity.Warn);
     }
     else
     {
         AsSingleFile();
     }
 }