diff --git a/AUCapture-WPF/AUCapture-WPF.csproj b/AUCapture-WPF/AUCapture-WPF.csproj
index d47876bf..deac73b6 100644
--- a/AUCapture-WPF/AUCapture-WPF.csproj
+++ b/AUCapture-WPF/AUCapture-WPF.csproj
@@ -8,8 +8,8 @@
false
AUCapture_WPF.App
AnyCPU;x86;x64
- 2.7.0.0
- 2.7.0.0
+ 2.7.0.2
+ 2.7.0.2
true
true
true
diff --git a/AUCapture-WPF/AppSettings.cs b/AUCapture-WPF/AppSettings.cs
index dccf46a3..5af02414 100644
--- a/AUCapture-WPF/AppSettings.cs
+++ b/AUCapture-WPF/AppSettings.cs
@@ -17,6 +17,9 @@ public interface IAppSettings : INotifyPropertyChanged
[Option(DefaultValue = false)]
bool DarkMode { get; set; }
+ [Option(DefaultValue = true)]
+ bool FocusOnToken { get; set; }
+
[Option(DefaultValue = 18d)]
double fontSize { get; set; }
diff --git a/AUCapture-WPF/MainWindow.xaml b/AUCapture-WPF/MainWindow.xaml
index 6d450c21..10443dfe 100644
--- a/AUCapture-WPF/MainWindow.xaml
+++ b/AUCapture-WPF/MainWindow.xaml
@@ -8,12 +8,13 @@
xmlns:dialogs="http://metro.mahapps.com/winfx/xaml/controls"
mc:Ignorable="d"
Style="{DynamicResource MahApps.Styles.MetroWindow.Clean}"
- ResizeMode="CanResizeWithGrip"
- Title="Among Us Capture" TitleAlignment="Center" Height="450" Width="800"
+ ResizeMode="CanResize"
+ Title="AUCapture" TitleAlignment="Center" Height="450" Width="800"
ShowInTaskbar="True"
TitleCharacterCasing="Normal"
ShowSystemMenu="False"
ShowSystemMenuOnRightClick="False"
+ WindowStartupLocation="CenterScreen"
dialogs:DialogParticipation.Register="{Binding }"
ContentRendered="MainWindow_OnContentRendered" Loaded="MetroWindow_Loaded" TryToBeFlickerFree="True" MinWidth="300" MinHeight="200" >
@@ -64,7 +65,7 @@
-
@@ -72,19 +73,21 @@
-
+
-
-
-
-
+
+
+
+
+
@@ -93,33 +96,32 @@
-
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
+
-
-
-
+
+
-
+
@@ -127,7 +129,7 @@
-
@@ -171,7 +173,7 @@
-
+
@@ -180,6 +182,7 @@
IsReadOnly="True" DockPanel.Dock="Top"
mah:ScrollViewerHelper.IsHorizontalScrollWheelEnabled="True"
VerticalScrollBarVisibility="Auto"
+ DataObject.Copying="ConsoleTextBox_OnCopying"
MaxHeight="{Binding ActualHeight, ElementName=consoleDockPanel}"
Height="{Binding ActualHeight, ElementName=consoleDockPanel}" UseLayoutRounding="True"/>
@@ -188,27 +191,36 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/AUCapture-WPF/MainWindow.xaml.cs b/AUCapture-WPF/MainWindow.xaml.cs
index df4766ba..162bac28 100644
--- a/AUCapture-WPF/MainWindow.xaml.cs
+++ b/AUCapture-WPF/MainWindow.xaml.cs
@@ -74,8 +74,9 @@ public MainWindow()
GameMemReader.getInstance().ChatMessageAdded += OnChatMessageAdded;
GameMemReader.getInstance().JoinedLobby += OnJoinedLobby;
IPCAdapter.getInstance().OnToken += (sender, token) => {
- this.BeginInvoke((w) =>
+ this.BeginInvoke((w) =>
{
+ if (!w.context.Settings.FocusOnToken) return;
if (!w.IsVisible)
{
w.Show();
@@ -87,11 +88,7 @@ public MainWindow()
}
w.Activate();
- w.Topmost = true; // important
- w.Topmost = false; // important
w.Focus(); // important
-
- w.Activate();
}); };
@@ -196,7 +193,7 @@ private void ConfigOnPropertyChanged(object sender, PropertyChangedEventArgs e)
//{
// block.FontSize = config.fontSize;
//}
- });
+ }, DispatcherPriority.Input);
}
private void SetDefaultThemeColor()
@@ -425,7 +422,6 @@ private void MemeFlyout_OnIsOpenChanged(object sender, RoutedEventArgs e)
GC.Collect();
}
}
-
private void SubmitDiscordButton_OnClick(object sender, RoutedEventArgs e)
{
if (context.Settings.discordToken != "")
@@ -455,5 +451,11 @@ private void HelpDiscordButton_OnClick(object sender, RoutedEventArgs e)
{
OpenBrowser("https://www.youtube.com/watch?v=jKcEW5qpk8E");
}
+
+
+ private void ConsoleTextBox_OnCopying(object sender, DataObjectCopyingEventArgs e)
+ {
+ e.CancelCommand();
+ }
}
}
\ No newline at end of file
diff --git a/AmongUsCapture/Memory/GameMemReader.cs b/AmongUsCapture/Memory/GameMemReader.cs
index ae17a808..7fdb77ed 100644
--- a/AmongUsCapture/Memory/GameMemReader.cs
+++ b/AmongUsCapture/Memory/GameMemReader.cs
@@ -8,6 +8,7 @@
using AmongUsCapture.Memory.Structs;
using AmongUsCapture.TextColorLibrary;
using AUOffsetManager;
+using Newtonsoft.Json;
namespace AmongUsCapture
{
@@ -300,12 +301,19 @@ public void RunLoop()
GameOverReason gameOverReason = (GameOverReason) rawGameOverReason;
bool humansWon = rawGameOverReason <= 1 || rawGameOverReason == 5;
-
- if (humansWon) // we will be reading humans data, so set all to imps
+ if (humansWon) // we will be reading humans data, so set all to simps
{
foreach (string playerName in CachedPlayerInfos.Keys)
{
- CachedPlayerInfos[playerName].IsImpostor = true;
+ try
+ {
+ CachedPlayerInfos[playerName].IsImpostor = true;
+ }
+ catch (KeyNotFoundException e)
+ {
+ Console.WriteLine($"Could not find User: \"{playerName}\" in CachedPlayerinfos");
+ }
+
}
}
@@ -321,7 +329,15 @@ public void RunLoop()
WinningPlayerData wpi = ProcessMemory.getInstance()
.Read(winnerAddrPtr, 0, 0);
winnerAddrPtr += 4;
- CachedPlayerInfos[wpi.GetPlayerName()].IsImpostor = wpi.IsImpostor;
+ try
+ {
+ CachedPlayerInfos[wpi.GetPlayerName()].IsImpostor = wpi.IsImpostor;
+ }
+ catch (KeyNotFoundException e)
+ {
+ Console.WriteLine($"Could not find player with name \"{wpi.GetPlayerName()}\" in CachedPlayerInfos. JSON: {JsonConvert.SerializeObject(CachedPlayerInfos, Formatting.Indented)}");
+ }
+
}
ImmutablePlayer[] endingPlayerInfos = new ImmutablePlayer[CachedPlayerInfos.Count];