コード例 #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());
        }
コード例 #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);
     }
 }
コード例 #3
0
 private async void buttonUpdate_Click(object sender, EventArgs e)
 {
     if (InterfaceUri.IsFake)
     {
         return;
     }
     await Program.RunCommandAsync(Commands.Basic.Update.Name, InterfaceUri.ToStringRfc());
 }
コード例 #4
0
ファイル: AppTile.cs プロジェクト: isabella232/0install-win
 private void buttonUpdate_Click(object sender, EventArgs e)
 {
     if (InterfaceUri.IsFake)
     {
         return;
     }
     Program.RunCommand(Commands.CliCommands.Update.Name, InterfaceUri.ToStringRfc());
 }
コード例 #5
0
ファイル: AppTile.cs プロジェクト: isabella232/0install-win
 private void buttonSelectVersion_Click(object sender, EventArgs e)
 {
     if (InterfaceUri.IsFake)
     {
         return;
     }
     Program.RunCommand(Run.Name, "--no-wait", "--customize", InterfaceUri.ToStringRfc());
 }
コード例 #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);
        }
コード例 #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()));
        }
コード例 #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);
     }
 }
コード例 #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);
     }
 }
コード例 #10
0
ファイル: AppTile.cs プロジェクト: isabella232/0install-win
        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());
        }
コード例 #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);
     }
 }
コード例 #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);
     }
 }
コード例 #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);
     }
 }
コード例 #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();
        }
コード例 #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());
     }
 }
コード例 #16
0
ファイル: AppTile.cs プロジェクト: isabella232/0install-win
        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());
        }
コード例 #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);
     }
 }
コード例 #18
0
    /// <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);
        }
    }
コード例 #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);
     }
 }
コード例 #20
0
 /// <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);
     }
 }
コード例 #21
0
 /// <summary>
 /// Returns the dependency in the form "Interface". Not safe for parsing!
 /// </summary>
 public override string ToString() => (InterfaceUri == null) ? "-" : InterfaceUri.ToStringRfc();
コード例 #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 + ")";
コード例 #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());
        }