diff --git a/2207.ico b/2207.ico new file mode 100644 index 0000000..dca213d Binary files /dev/null and b/2207.ico differ diff --git a/Mag-ACClientLauncher.csproj b/Mag-ACClientLauncher.csproj index c1fa022..b281cf6 100644 --- a/Mag-ACClientLauncher.csproj +++ b/Mag-ACClientLauncher.csproj @@ -33,6 +33,9 @@ prompt 4 + + 2207.ico + @@ -112,6 +115,8 @@ - + + + \ No newline at end of file diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs index 68b8451..272b14a 100644 --- a/MainWindow.xaml.cs +++ b/MainWindow.xaml.cs @@ -3,6 +3,7 @@ using System.ComponentModel; using System.Diagnostics; using System.IO; +using System.Threading; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; @@ -21,6 +22,8 @@ public MainWindow() { InitializeComponent(); + Title += " 1.1"; // Update line 55 in AssemblyInfo.cs + if (Properties.Settings.Default.WindowPositionLeft != 0 && Properties.Settings.Default.WindowPositionTop != 0) { Left = Properties.Settings.Default.WindowPositionLeft; @@ -359,10 +362,18 @@ private void cboBulkLauncherServerList_SelectionChanged(object sender, Selection SelectServer(server.Id); } + CancellationTokenSource bulkLaunchCTS; + private async void cmdBulkLaunch_Click(object sender, RoutedEventArgs e) { if (cmdBulkLaunch.Content.ToString() == "Cancel") { + if (bulkLaunchCTS != null) + { + bulkLaunchCTS.Cancel(); + bulkLaunchCTS = null; + } + cmdBulkLaunch.Content = "Bulk Launch"; return; } @@ -372,7 +383,11 @@ private async void cmdBulkLaunch_Click(object sender, RoutedEventArgs e) try { if (cboBulkLauncherServerList.SelectedItem is Server server) - await DoBulkLaunch(Properties.Settings.Default.BulkLaunchQuantity, Properties.Settings.Default.BulkLaunchStartIndex, Properties.Settings.Default.BulkLaunchUserNamePrefix, TimeSpan.FromSeconds(Properties.Settings.Default.IntervalBetweenLaunches), server); + { + bulkLaunchCTS = new CancellationTokenSource(); + + await DoBulkLaunch(Properties.Settings.Default.BulkLaunchQuantity, Properties.Settings.Default.BulkLaunchStartIndex, Properties.Settings.Default.BulkLaunchUserNamePrefix, TimeSpan.FromSeconds(Properties.Settings.Default.IntervalBetweenLaunches), server, bulkLaunchCTS.Token); + } } finally { @@ -380,11 +395,11 @@ private async void cmdBulkLaunch_Click(object sender, RoutedEventArgs e) } } - private async Task DoBulkLaunch(int launchQuantity, int startIndex, string userNamePrefix, TimeSpan interval, Server server) + private async Task DoBulkLaunch(int launchQuantity, int startIndex, string userNamePrefix, TimeSpan interval, Server server, CancellationToken token) { for (int i = startIndex; i < (startIndex + launchQuantity); i++) { - if (cmdBulkLaunch.Content.ToString() == "Bulk Launch") + if (token.IsCancellationRequested) return; var userName = userNamePrefix + i.ToString("00000"); @@ -401,7 +416,7 @@ private async Task DoBulkLaunch(int launchQuantity, int startIndex, string userN break; } - if (cmdBulkLaunch.Content.ToString() == "Bulk Launch") + if (token.IsCancellationRequested) return; await Task.Delay(interval); diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index 17deaef..cb87973 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -52,4 +52,4 @@ // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.1")] // Update line 25 in MainWindow.xaml.cs