Skip to content

Commit

Permalink
persistent resolver/protocol/provider selection; remove NyaLabs POW P…
Browse files Browse the repository at this point in the history
…rovider
  • Loading branch information
Archeb committed Jun 8, 2024
1 parent 393507e commit d419b97
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
20 changes: 20 additions & 0 deletions MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,13 @@ public MainForm()
SelectedIndex = 0,
ToolTip = Resources.PROTOCOL_FOR_TRACEROUTING
};
protocolSelection.SelectedKey = UserSettings.selectedProtocol;
protocolSelection.SelectedKeyChanged += (sender, e) =>
{
UserSettings.selectedProtocol = protocolSelection.SelectedKey;
UserSettings.SaveSettings();
};

dataProviderSelection = new DropDown
{
Items = {
Expand All @@ -147,11 +154,24 @@ public MainForm()
if (UserSettings.enable_ip2region == true) dataProviderSelection.Items.Add(new ListItem { Text = "Ip2region", Key = "--data-provider Ip2region" });
if (UserSettings.enable_ipinfolocal == true) dataProviderSelection.Items.Add(new ListItem { Text = "IPInfoLocal", Key = "--data-provider IPInfoLocal" });

dataProviderSelection.SelectedKey = UserSettings.selectedDataProvider;
dataProviderSelection.SelectedKeyChanged += (sender, e) =>
{
UserSettings.selectedDataProvider = dataProviderSelection.SelectedKey;
UserSettings.SaveSettings();
};

if (UserSettings.localDBPath != "") IPDBLoader.Load();

dnsResolverSelection = new DropDown();
dnsResolverSelection.SelectedKeyChanged += resolveParamChanged;
LoadDNSResolvers();
dnsResolverSelection.SelectedKey = UserSettings.selectedDnsResolver;
dnsResolverSelection.SelectedKeyChanged += (sender, e) =>
{
UserSettings.selectedDnsResolver = dnsResolverSelection.SelectedKey;
UserSettings.SaveSettings();
};

tracerouteGridView = new GridView { DataStore = tracerouteResultCollection };
tracerouteGridView.MouseUp += Dragging_MouseUp;
Expand Down
1 change: 0 additions & 1 deletion PreferencesDialog.xeto
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@
<Label Text="{x:Static resource:Resources.POW_PROVIDER}"></Label>
<DropDown x:Name="POWProvider" SelectedIndex="0">
<ListItem Text="{x:Static resource:Resources.POW_PROVIDER_LEOMOE}" Key="api.leo.moe"></ListItem>
<ListItem Text="{x:Static resource:Resources.POW_PROVIDER_SAKURA}" Key="sakura"></ListItem>
</DropDown>
</TableRow>
<TableRow>
Expand Down
9 changes: 9 additions & 0 deletions UserSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,5 +126,14 @@ internal class UserSettings : Advexp.Settings<UserSettings>

[Setting(Name = "maskedHopsMode", Default = "ip_half")]
public static string maskedHopsMode { get; set; }

[Setting(Name = "selectedDnsResolver", Default = "system")]
public static string selectedDnsResolver { get; set; }

[Setting(Name = "selectedProtocol", Default = "")]
public static string selectedProtocol { get; set; }

[Setting(Name = "selectedDataProvider", Default = "")]
public static string selectedDataProvider { get; set; }
}
}

0 comments on commit d419b97

Please sign in to comment.