Skip to content

Commit

Permalink
Sync setup wizard: Show equivalent command-line
Browse files Browse the repository at this point in the history
  • Loading branch information
bastianeicher committed Jul 10, 2023
1 parent f3c7bcf commit 3172bcd
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 2 deletions.
22 changes: 22 additions & 0 deletions src/Central.WinForms/SyncWizard.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions src/Central.WinForms/SyncWizard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Licensed under the GNU Lesser Public License

using System.Diagnostics;
using System.Text;
using AeroWizard;
using ICSharpCode.SharpZipLib.Zip;
using NanoByte.Common.Net;
Expand Down Expand Up @@ -412,6 +413,14 @@ private void pageNewCryptoKey_Commit(object sender, WizardPageConfirmEventArgs e
#endregion

#region pageSetupFinished
private void pageSetupFinished_Initialize(object sender, WizardPageInitEventArgs e)
{
var commandLine = new StringBuilder();
foreach (var (key, value) in _config.Where(x => x.Key.StartsWith("sync_") && !string.IsNullOrEmpty(x.Value)))
commandLine.AppendLine(new[] {"0install", "config", key, value}.JoinEscapeArguments());
textBoxCommandLine.Text = commandLine.ToString().TrimEnd('\n');
}

private void pageSetupFinished_Commit(object sender, WizardPageConfirmEventArgs e)
{
if (!SaveConfig())
Expand Down
4 changes: 4 additions & 0 deletions src/Central.WinForms/SyncWizard.de.resx
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,10 @@
<value>Sync einrichten</value>
<comment>Manually overriden.</comment>
</data>
<data name="groupBoxCommandLine.Text" xml:space="preserve">
<value>Entsprechende Befehlszeile</value>
<comment>Manually overriden.</comment>
</data>
<data name="textBoxCustomServer.HintText" xml:space="preserve">
<value>Server URI</value>
<comment>Manually overriden.</comment>
Expand Down
61 changes: 59 additions & 2 deletions src/Central.WinForms/SyncWizard.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1251,6 +1251,63 @@
<data name="&gt;&gt;labelNewCryptoKey.ZOrder" xml:space="preserve">
<value>3</value>
</data>
<data name="groupBoxCommandLine.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Bottom, Left, Right</value>
</data>
<data name="textBoxCommandLine.AccessibleName" xml:space="preserve">
<value>Equivalent command-line</value>
</data>
<data name="textBoxCommandLine.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top, Bottom, Left, Right</value>
</data>
<data name="textBoxCommandLine.Location" type="System.Drawing.Point, System.Drawing">
<value>6, 19</value>
</data>
<data name="textBoxCommandLine.Multiline" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="textBoxCommandLine.Size" type="System.Drawing.Size, System.Drawing">
<value>465, 70</value>
</data>
<data name="textBoxCommandLine.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
</data>
<data name="&gt;&gt;textBoxCommandLine.Name" xml:space="preserve">
<value>textBoxCommandLine</value>
</data>
<data name="&gt;&gt;textBoxCommandLine.Type" xml:space="preserve">
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;textBoxCommandLine.Parent" xml:space="preserve">
<value>groupBoxCommandLine</value>
</data>
<data name="&gt;&gt;textBoxCommandLine.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="groupBoxCommandLine.Location" type="System.Drawing.Point, System.Drawing">
<value>3, 81</value>
</data>
<data name="groupBoxCommandLine.Size" type="System.Drawing.Size, System.Drawing">
<value>477, 99</value>
</data>
<data name="groupBoxCommandLine.TabIndex" type="System.Int32, mscorlib">
<value>1</value>
</data>
<data name="groupBoxCommandLine.Text" xml:space="preserve">
<value>Equivalent command-line</value>
</data>
<data name="&gt;&gt;groupBoxCommandLine.Name" xml:space="preserve">
<value>groupBoxCommandLine</value>
</data>
<data name="&gt;&gt;groupBoxCommandLine.Type" xml:space="preserve">
<value>System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;groupBoxCommandLine.Parent" xml:space="preserve">
<value>pageSetupFinished</value>
</data>
<data name="&gt;&gt;groupBoxCommandLine.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="labelSetupFinished.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top, Left, Right</value>
</data>
Expand All @@ -1261,7 +1318,7 @@
<value>3, 9</value>
</data>
<data name="labelSetupFinished.Size" type="System.Drawing.Size, System.Drawing">
<value>477, 81</value>
<value>477, 69</value>
</data>
<data name="labelSetupFinished.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
Expand All @@ -1279,7 +1336,7 @@
<value>pageSetupFinished</value>
</data>
<data name="&gt;&gt;labelSetupFinished.ZOrder" xml:space="preserve">
<value>0</value>
<value>1</value>
</data>
<data name="pageSetupFinished.Size" type="System.Drawing.Size, System.Drawing">
<value>527, 261</value>
Expand Down

0 comments on commit 3172bcd

Please sign in to comment.