From 203169177ac54008805a37d5de52d76e31f57dbb Mon Sep 17 00:00:00 2001 From: Mag-nus Date: Mon, 31 Dec 2018 18:13:50 -0600 Subject: [PATCH] Fix bulk launch cancel, add icon, verison 1.1 --- 2207.ico | Bin 0 -> 4286 bytes Mag-ACClientLauncher.csproj | 7 ++++++- MainWindow.xaml.cs | 23 +++++++++++++++++++---- Properties/AssemblyInfo.cs | 2 +- 4 files changed, 26 insertions(+), 6 deletions(-) create mode 100644 2207.ico diff --git a/2207.ico b/2207.ico new file mode 100644 index 0000000000000000000000000000000000000000..dca213df77309bf9a972c627da08de4a0310a9b0 GIT binary patch literal 4286 zcmeH}TTGkx8OA+LiY9HTCbdnw=Afj6gg^`!W3chr#z%ZUU@+hqYzziM%%Q+CMb(a7 zyNgYcI<4B)%dPEhvhHTR>DHYqC25*2yXjg1N!m0?X&OqBYE6H8zYo%Nt;}}So6YFu zGvD{|f8OVL-{<}RHJZ=K&+gqC<+tXkFKaa0G#X8vgxu0NB$WH=N1pxuuJu^Iq0s>U zk97@1iqG`(N!>B(ng}@^*xFig8QXA6c#H;ordEOyA&IcLm6%0O+}uK>qXnlEEVrkZ5ZEnD>tH-H3Kxa!mK0`f$wgUtV zwRl?|#NAwjqood)zMf9~0laecw$|e}DBt(1YnXM7n3|h#w&`&hnycamOnNdN2PW+S zoK1Ui>-OLg41eo`1lwzb|6Zb&y(DaViCYhd76;}2K|K0Bgp3c09yLVF>+eL(HIjqm zsIQghvYuW`z|=y(SRFrP)-&L<3)cp^jP-;&>WEnCh}-H&I_v0mH<0x+EYLJ`-+t?&I>m|RYs{Et!d{EZ&7_`LgEu>wdhgWh6 znkYrxJk*__5|1*QPEw9~IFjySBo<;Q=;E9CA-+CPkmq40!X5@aCIla;VNfE`6o&@wRD6I&^~F!l9srnN*T*mr5Kv)W@vk@YSBQ%=TgWSr8sw(9&9eF|N6e1e~H>ge_9DR+4} zmdSCnKf_EWO68EBquCU{{KeCpJbjv)ni}@)+lS9$WjqyNq9@2qHpx^h#(Z~*LfAr& zPw;JxWJHIAqdNcC2EM;t_zV7kuZ<(Yu)5A6h~_a$ z;ZD9&9^pYNJE^U$Rk2&V z-5fuDoJy{b@tBXp;*sHqMS4)tze)TfdHfgr1ERlD|E%ag9u827xOn=>AG7rO>ntrV z@yH*;+b5RS$x*X_vWX#u(-_9;-X+*V|Dd9e?9j%UViy3_uY3NTU*O~#WsmvuO}_| zqobpYjg2vvmG4m(z20^FZmGYbL$&(TD|h*|V<*{tIgF-*eAB)Ya9Y%piqxrBY#}G(t?Y zpN*u2zgzl#WBzT@{|f$4mkpovf4|?tk$8-&SFUhl^)1#`*HEyPQ0C9eXV3Ed^S@#H zj_oS{hK2?#7K@5MF)_i&$OzF$MCzZQ81zW}75|G5HuJwt{3r9uZ`9J~voaA0apC0S zTs%?x5%$W;3X6+NDEt+C#rxZ~Z9~CV_@|`jCdS8A{X<={7f20@vKPf|%^UdD`(O3H z;0FYMz;EM;ijnhAeTnbS?!+W}*V?s<+_-U*ix)4-{8`@6f4hpW>_JwmRrPHnLzZi*jQ zc<$HFq168FyYE(YQ1Ii@b4ny-&o-Hi%!(gJLLL%Q|8@PV^G^!?NLc)5X=F5&;QY_F zsQBl9{sk_d`zhze_lo}SUc1hlZ(QQpXMcsu|X8K|d2INeW>j{z1Mj0GPGMMjSs5n4D@)<4{yvYehfPgFYs69>%jS%A)0H(kg3N==Yfz3R&s%wpYcsHrFv2c94@Z z-*D6}|LbHdBluZ2l>skPvi6MRFgF}z{^L;$Fk1*RJrrO{@|^4!e95~kT8@Yg!!fIR lj?4wD_+++L)Bnzc&*=Ke^Vk3C->Tfd)o4EdS;n0j{}Xpp9!~%O literal 0 HcmV?d00001 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