Example #1
0
        public string[] ToCommandLineArgs()
        {
            var args = new List <string>();

            if (Command != null)
            {
                args.AddRange(new[] { "--command", Command });
            }
            if (Architecture.Cpu == Cpu.Source)
            {
                args.Add("--source");
            }
            else
            {
                if (Architecture.OS != OS.All)
                {
                    args.AddRange(new[] { "--os", Architecture.OS.ConvertToString() });
                }
                if (Architecture.Cpu != Cpu.All)
                {
                    args.AddRange(new[] { "--cpu", Architecture.Cpu.ConvertToString() });
                }
            }
            foreach (var language in Languages)
            {
                args.AddRange(new[] { "--language", language.ToString() });
            }
            foreach (var pair in ExtraRestrictions)
            {
                args.AddRange(new[] { "--version-for", pair.Key.ToStringRfc(), pair.Value.ToString() });
            }
            args.Add(InterfaceUri.ToStringRfc());

            return(args.ToArray());
        }
Example #2
0
 /// <inheritdoc/>
 public override int GetHashCode()
 {
     unchecked
     {
         int result = base.GetHashCode();
         if (InterfaceUri != null)
         {
             result = (result * 397) ^ InterfaceUri.GetHashCode();
         }
         if (Name != null)
         {
             result = (result * 397) ^ Name.GetHashCode();
         }
         result = (result * 397) ^ AutoUpdate.GetHashCode();
         if (Requirements != null)
         {
             result = (result * 397) ^ Requirements.GetHashCode();
         }
         result = (result * 397) ^ CapabilityLists.GetSequencedHashCode();
         if (AccessPoints != null)
         {
             result = (result * 397) ^ AccessPoints.GetHashCode();
         }
         return(result);
     }
 }
Example #3
0
 private async void buttonUpdate_Click(object sender, EventArgs e)
 {
     if (InterfaceUri.IsFake)
     {
         return;
     }
     await Program.RunCommandAsync(Commands.Basic.Update.Name, InterfaceUri.ToStringRfc());
 }
Example #4
0
 private void buttonUpdate_Click(object sender, EventArgs e)
 {
     if (InterfaceUri.IsFake)
     {
         return;
     }
     Program.RunCommand(Commands.CliCommands.Update.Name, InterfaceUri.ToStringRfc());
 }
Example #5
0
 private void buttonSelectVersion_Click(object sender, EventArgs e)
 {
     if (InterfaceUri.IsFake)
     {
         return;
     }
     Program.RunCommand(Run.Name, "--no-wait", "--customize", InterfaceUri.ToStringRfc());
 }
Example #6
0
        /// <summary>
        /// Returns the dependency in the form "Interface (Use)". Not safe for parsing!
        /// </summary>
        public override string ToString()
        {
            string result = (InterfaceUri == null) ? "-" : InterfaceUri.ToStringRfc();

            if (!string.IsNullOrEmpty(Use))
            {
                result += " (" + Use + ")";
            }
            return(result);
        }
Example #7
0
        /// <inheritdoc/>
        public int CompareTo(ImplementationSelection other)
        {
            #region Sanity checks
            if (other == null)
            {
                throw new ArgumentNullException(nameof(other));
            }
            #endregion

            return(StringComparer.Ordinal.Compare(InterfaceUri.ToStringRfc(), other.InterfaceUri.ToStringRfc()));
        }
Example #8
0
 /// <inheritdoc/>
 public override int GetHashCode()
 {
     unchecked
     {
         int result = base.GetHashCode();
         result = (result * 397) ^ InterfaceUri?.GetHashCode() ?? 0;
         result = (result * 397) ^ FromFeed?.GetHashCode() ?? 0;
         result = (result * 397) ^ QuickTestFile?.GetHashCode() ?? 0;
         return(result);
     }
 }
Example #9
0
 /// <inheritdoc/>
 public override int GetHashCode()
 {
     unchecked
     {
         int result = base.GetHashCode();
         result = (result * 397) ^ InterfaceUri?.GetHashCode() ?? 0;
         result = (result * 397) ^ Command?.GetHashCode() ?? 0;
         result = (result * 397) ^ Implementations.GetUnsequencedHashCode();
         return(result);
     }
 }
Example #10
0
        private void buttonIntegrate_Click(object sender, EventArgs e)
        {
            if (InterfaceUri.IsFake)
            {
                return;
            }

            // Disable buttons while operation is running
            buttonRemove.Enabled = buttonIntegrate.Enabled = false;

            Program.RunCommand(UpdateButtons, _machineWide, IntegrateApp.Name, InterfaceUri.ToStringRfc());
        }
Example #11
0
 /// <inheritdoc/>
 public override int GetHashCode()
 {
     unchecked
     {
         int result = base.GetHashCode();
         result = (result * 397) ^ InterfaceUri?.GetHashCode() ?? 0;
         result = (result * 397) ^ (int)OS;
         result = (result * 397) ^ Versions?.GetHashCode() ?? 0;
         result = (result * 397) ^ Constraints.GetUnsequencedHashCode();
         result = (result * 397) ^ Distributions.GetUnsequencedHashCode();
         return(result);
     }
 }
Example #12
0
 /// <inheritdoc/>
 public override int GetHashCode()
 {
     unchecked
     {
         int result = InterfaceUri?.GetHashCode() ?? 0;
         result = (result * 397) ^ (Command?.GetHashCode() ?? 0);
         result = (result * 397) ^ Architecture.GetHashCode();
         result = (result * 397) ^ Languages.GetSequencedHashCode();
         result = (result * 397) ^ ExtraRestrictions.GetUnsequencedHashCode();
         result = (result * 397) ^ Distributions.GetUnsequencedHashCode();
         return(result);
     }
 }
Example #13
0
 /// <inheritdoc/>
 public override int GetHashCode()
 {
     unchecked
     {
         int result = base.GetHashCode();
         result = (result * 397) ^ InterfaceUri?.GetHashCode() ?? 0;
         result = (result * 397) ^ Name?.GetHashCode() ?? 0;
         result = (result * 397) ^ AutoUpdate.GetHashCode();
         result = (result * 397) ^ Requirements?.GetHashCode() ?? 0;
         result = (result * 397) ^ CapabilityLists.GetUnsequencedHashCode();
         result = (result * 397) ^ AccessPoints?.GetHashCode() ?? 0;
         return(result);
     }
 }
Example #14
0
        private async void buttonAdd_Click(object sender, EventArgs e)
        {
            if (InterfaceUri.IsFake)
            {
                return;
            }

            // Disable button while operation is running
            buttonAdd.Enabled = false;

            await Program.RunCommandAsync(_machineWide, AddApp.Name, InterfaceUri.ToStringRfc());

            UpdateButtons();
        }
Example #15
0
 private async void buttonRun_Click(object sender, EventArgs e)
 {
     if (InterfaceUri.IsFake)
     {
         return;
     }
     if (Feed != null && Feed.NeedsTerminal)
     {
         new SelectCommandDialog(new FeedTarget(InterfaceUri, Feed)).Show(this);
     }
     else
     {
         await Program.RunCommandAsync(Run.Name, "--no-wait", InterfaceUri.ToStringRfc());
     }
 }
Example #16
0
        private void buttonRemove_Click(object sender, EventArgs e)
        {
            if (InterfaceUri.IsFake)
            {
                return;
            }

            if (!Msg.YesNo(this, string.Format(SharedResources.AppRemoveConfirm, AppName), MsgSeverity.Warn))
            {
                return;
            }

            // Disable buttons while operation is running
            buttonRemove.Enabled = buttonIntegrate.Enabled = false;

            Program.RunCommand(UpdateButtons, _machineWide, RemoveApp.Name, InterfaceUri.ToStringRfc());
        }
Example #17
0
 /// <inheritdoc/>
 public override int GetHashCode()
 {
     unchecked
     {
         int result = base.GetHashCode();
         if (InterfaceUri != null)
         {
             result = (result * 397) ^ InterfaceUri.GetHashCode();
         }
         if (Command != null)
         {
             result = (result * 397) ^ Command.GetHashCode();
         }
         result = (result * 397) ^ Implementations.GetSequencedHashCode();
         return(result);
     }
 }
    /// <summary>
    /// Verifies that calling <see cref="CliCommand.Parse"/> and <see cref="CliCommand.Execute"/> causes a specific result.
    /// </summary>
    /// <param name="expectedOutput">The expected string for a <see cref="ITaskHandler.Output"/> call; <c>null</c> if none.</param>
    /// <param name="expectedExitCode">The expected exit status code returned by <see cref="CliCommand.Execute"/>.</param>
    /// <param name="expectedSelections">The expected value passed to <see cref="ICommandHandler.ShowSelections"/>.</param>
    /// <param name="args">The arguments to pass to <see cref="CliCommand.Parse"/>.</param>
    protected void RunAndAssert(string?expectedOutput, ExitCode expectedExitCode, Selections?expectedSelections, params string[] args)
    {
        RunAndAssert(expectedOutput, expectedExitCode, args);

        var selections = Handler.LastSelections;

        if (expectedSelections == null)
        {
            selections.Should().BeNull();
        }
        else
        {
            selections !.InterfaceUri.Should().Be(expectedSelections.InterfaceUri);
            selections.Command.Should().Be(expectedSelections.Command);
            selections.Implementations.Should().Equal(expectedSelections.Implementations);
        }
    }
Example #19
0
 /// <inheritdoc/>
 public override int GetHashCode()
 {
     unchecked
     {
         int result = base.GetHashCode();
         if (InterfaceUri != null)
         {
             result = (result * 397) ^ InterfaceUri.GetHashCode();
         }
         result = (result * 397) ^ (int)OS;
         if (Versions != null)
         {
             result = (result * 397) ^ Versions.GetHashCode();
         }
         result = (result * 397) ^ Constraints.GetUnsequencedHashCode();
         result = (result * 397) ^ Distributions.GetUnsequencedHashCode();
         return(result);
     }
 }
 /// <inheritdoc/>
 public override int GetHashCode()
 {
     unchecked
     {
         int result = base.GetHashCode();
         if (InterfaceUri != null)
         {
             result = (result * 397) ^ InterfaceUri.GetHashCode();
         }
         if (FromFeed != null)
         {
             result = (result * 397) ^ FromFeed.GetHashCode();
         }
         if (QuickTestFile != null)
         {
             result = (result * 397) ^ QuickTestFile.GetHashCode();
         }
         return(result);
     }
 }
Example #21
0
 /// <summary>
 /// Returns the dependency in the form "Interface". Not safe for parsing!
 /// </summary>
 public override string ToString() => (InterfaceUri == null) ? "-" : InterfaceUri.ToStringRfc();
Example #22
0
 /// <summary>
 /// Returns the requirements in the form "InterfaceUri (Command)". Not safe for parsing!
 /// </summary>
 public override string ToString() => string.IsNullOrEmpty(Command)
     ? InterfaceUri.ToStringRfc()
     : InterfaceUri.ToStringRfc() + " (" + Command + ")";
Example #23
0
        //--------------------//

        #region Conversion
        /// <summary>
        /// Returns the dependency in the form "Interface". Not safe for parsing!
        /// </summary>
        public override string ToString()
        {
            return((InterfaceUri == null) ? "-" : InterfaceUri.ToStringRfc());
        }