diff --git a/.vs/rcloneExplorer/v14/.suo b/.vs/rcloneExplorer/v14/.suo index 2247538..674de4e 100644 Binary files a/.vs/rcloneExplorer/v14/.suo and b/.vs/rcloneExplorer/v14/.suo differ diff --git a/rcloneExplorer/rcloneExplorer.Auxiliary.SetupWiz.cs b/rcloneExplorer/rcloneExplorer.Auxiliary.SetupWiz.cs index 2185e22..84b9c49 100644 --- a/rcloneExplorer/rcloneExplorer.Auxiliary.SetupWiz.cs +++ b/rcloneExplorer/rcloneExplorer.Auxiliary.SetupWiz.cs @@ -6,6 +6,7 @@ using System.IO; using System.Linq; using System.Text; +using System.Text.RegularExpressions; using System.Threading.Tasks; using System.Windows.Forms; @@ -14,7 +15,7 @@ namespace rcloneExplorer public partial class rcloneExplorerSetupWiz : Form { rcloneExplorerInternalExec internalExecHandler; - rcloneExplorerExploreHandler exploreHandler; + rcloneExplorerExploreHandler exploreHandler; IniFile iniSettings; string[] providers = { "crypt", "amazon cloud drive", "s3", "b2", "dropbox", "google cloud storage", "drive", "hubic", "onedrive", "swift", "yandex" }; @@ -69,19 +70,19 @@ private void loadConfigs() private void openSelectedRemote() { - if (lstConfigs.SelectedItems.Count>0) - { - if (!String.IsNullOrEmpty(lstConfigs.SelectedItems[0].Text)) - { - //write newly selected config to ini - iniSettings.Write("rcloneRemote", lstConfigs.SelectedItems[0].Text.ToString()); + if (lstConfigs.SelectedItems.Count > 0 && !String.IsNullOrEmpty(lstConfigs.SelectedItems[0].Text)) + { + //write newly selected config to ini + iniSettings.Write("rcloneRemote", lstConfigs.SelectedItems[0].Text.ToString()); + //not doing first time setup so clear the CD and refresh view + if (!rcloneExplorer.initialSetup) { //set current path to root rcloneExplorer.remoteCD = ""; //refresh the explorer lst exploreHandler.refreshlstExplorer(); - //close config screen - this.Close(); - } + } + //close config screen + this.Close(); } } @@ -143,9 +144,9 @@ private void cmbProviderList_TextChanged(object sender, EventArgs e) cmbProviderList.Visible = false; //if user doesnt enter a valid remote name, keep asking - while (String.IsNullOrEmpty(nRemoteName.Trim())) + while (String.IsNullOrEmpty(nRemoteName.Trim()) || !Regex.IsMatch("^[a-zA-Z][a-zA-Z0-9]*$", nRemoteName.Trim())) { - nRemoteName = PromptGenerator.ShowDialog("Remote Name:", ""); + nRemoteName = PromptGenerator.ShowDialog("Remote Name:", "Please enter an alphanumeric name for the remote").Replace(@"\", @""); } //build command list diff --git a/rcloneExplorer/rcloneExplorer.Core.Initialization.cs b/rcloneExplorer/rcloneExplorer.Core.Initialization.cs index 212104b..3a57871 100644 --- a/rcloneExplorer/rcloneExplorer.Core.Initialization.cs +++ b/rcloneExplorer/rcloneExplorer.Core.Initialization.cs @@ -32,10 +32,8 @@ public void initRcloneSettings() //config found, checking for settings if (string.IsNullOrEmpty(iniSettings.Read("rcloneRemote"))) { - MessageBox.Show("ERR: Incorrect config\r\n\r\nPlease add an rclone remote Name to the config ini"); - Process.Start("cmd.exe", "/c rclone config"); - Process.Start("notepad.exe", "rcloneExplorer.ini"); - Environment.Exit(0); + MessageBox.Show("ERR: Incorrect config\r\n\r\nLoading config, this may take a minute..."); + rcloneExplorer.initialSetup = true; } else { @@ -57,10 +55,8 @@ public void initRcloneSettings() iniSettings.Write("rcloneSyncBandwidthLimit", "0"); iniSettings.Write("rcloneSyncMinFileSize", "0"); iniSettings.Write("rcloneSyncMaxFileSize", "0"); - MessageBox.Show("No ini file found!\r\n\r\nPlease add an rclone remote Name to the config ini"); - Process.Start("cmd.exe", "/c rclone config"); - Process.Start("notepad.exe", "rcloneExplorer.ini"); - Environment.Exit(0); + MessageBox.Show("ERR: No ini file found!\r\n\r\nLoading config, this may take a minute..."); + rcloneExplorer.initialSetup = true; } if (System.IO.File.Exists(AppDomain.CurrentDomain.BaseDirectory + "\\ffplay.exe")) { diff --git a/rcloneExplorer/rcloneExplorer.cs b/rcloneExplorer/rcloneExplorer.cs index e90624f..50f4069 100644 --- a/rcloneExplorer/rcloneExplorer.cs +++ b/rcloneExplorer/rcloneExplorer.cs @@ -29,6 +29,7 @@ public partial class rcloneExplorer : Form public static string remoteCD = ""; public static long totalFilesize = 0; public static bool loaded = false; + public static bool initialSetup = false; public static bool streamingEnabled = false; public static System.Windows.Forms.Timer transferTimer = new System.Windows.Forms.Timer(); @@ -45,6 +46,12 @@ public rcloneExplorer() tickHandler.init(); //init rclone settings InitializationHandler.initRcloneSettings(); + //wait for initial setup to complete if need be + if (initialSetup) { + var SetupWiz = new rcloneExplorerSetupWiz(); + var waitforcomplete = SetupWiz.ShowDialog(); + initialSetup = false; + } //start the splashscreen in a background thread so the main form can work away new Thread(() => {