Prevent issues with extracting due to Environment.CurrentDirectory not being useable inside of Application Settings, Rookie will now check if a boolean is set to true or false (by default it is false), when it is false it will set the downloadDir to its currentDirectory, otherwise it will use a set custom one.

This commit is contained in:
Chax
2023-01-06 10:55:45 +01:00
committed by Fenopy
parent a9e11e3734
commit 3e69119df2
5 changed files with 28 additions and 4 deletions

View File

@@ -195,7 +195,10 @@
<value>False</value>
</setting>
<setting name="downloadDir" serializeAs="String">
<value>Environment.CurrentDirectory</value>
<value />
</setting>
<setting name="customDir" serializeAs="String">
<value>False</value>
</setting>
</AndroidSideloader.Properties.Settings>
<AndroidADB.Sideloader.Properties.Settings>

View File

@@ -2303,6 +2303,10 @@ Things you can try:
public async void downloadInstallGameButton_Click(object sender, EventArgs e)
{
{
if (!Properties.Settings.Default.customDir)
{
Properties.Settings.Default.downloadDir = Environment.CurrentDirectory.ToString();
}
bool obbsMismatch = false;
if (nodeviceonstart && !updatesnotified)
{

View File

@@ -756,7 +756,7 @@ namespace AndroidSideloader.Properties {
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("Environment.CurrentDirectory")]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string downloadDir {
get {
return ((string)(this["downloadDir"]));
@@ -765,5 +765,17 @@ namespace AndroidSideloader.Properties {
this["downloadDir"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("False")]
public bool customDir {
get {
return ((bool)(this["customDir"]));
}
set {
this["customDir"] = value;
}
}
}
}

View File

@@ -186,7 +186,10 @@
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="downloadDir" Type="System.String" Scope="User">
<Value Profile="(Default)">Environment.CurrentDirectory</Value>
<Value Profile="(Default)" />
</Setting>
<Setting Name="customDir" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
</Settings>
</SettingsFile>

View File

@@ -101,7 +101,8 @@ namespace AndroidSideloader
private void resetSettingsButton_Click(object sender, EventArgs e)
{
Properties.Settings.Default.Reset();
Properties.Settings.Default.downloadDir = Environment.CurrentDirectory;
Properties.Settings.Default.customDir = false;
Properties.Settings.Default.downloadDir = Environment.CurrentDirectory.ToString();
intSettings();
}
@@ -203,6 +204,7 @@ namespace AndroidSideloader
{
if (downloadDirectorySetter.ShowDialog() == DialogResult.OK)
{
Properties.Settings.Default.customDir = true;
Properties.Settings.Default.downloadDir = downloadDirectorySetter.SelectedPath;
Properties.Settings.Default.Save();
}