Skip to content

Commit

Permalink
Clean up sloppiness in notification area icon
Browse files Browse the repository at this point in the history
  • Loading branch information
pizzaboxer committed Aug 13, 2024
1 parent ab2f5f5 commit de82349
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 16 deletions.
10 changes: 10 additions & 0 deletions Bloxstrap/Bootstrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,16 @@ private async Task StartRoblox()

App.NotifyIcon?.SetActivityWatcher(activityWatcher);

if (App.Settings.Prop.UseDisableAppPatch)
{
activityWatcher.OnAppClose += (_, _) =>
{
App.Logger.WriteLine(LOG_IDENT, "Received desktop app exit, closing Roblox");
using var process = Process.GetProcessById(gameClientPid);
process.CloseMainWindow();
};
}

if (App.Settings.Prop.UseDiscordRichPresence)
{
App.Logger.WriteLine(LOG_IDENT, "Using Discord Rich Presence");
Expand Down
10 changes: 3 additions & 7 deletions Bloxstrap/Integrations/ActivityWatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public class ActivityWatcher : IDisposable
public event EventHandler<string>? OnLogEntry;
public event EventHandler? OnGameJoin;
public event EventHandler? OnGameLeave;
public event EventHandler? OnAppClose;
public event EventHandler<Message>? OnRPCMessage;

private readonly Dictionary<string, string> GeolocationCache = new();
Expand Down Expand Up @@ -135,13 +136,8 @@ private void ExamineLogEntry(string entry)
else if (_logEntriesRead % 100 == 0)
App.Logger.WriteLine(LOG_IDENT, $"Read {_logEntriesRead} log entries");


if (App.Settings.Prop.UseDisableAppPatch && entry.Contains(GameLeavingEntry))
{
App.Logger.WriteLine(LOG_IDENT, "Received desktop app exit, closing Roblox");
using var process = Process.GetProcessById(_gameClientPid);
process.CloseMainWindow();
}
if (entry.Contains(GameLeavingEntry))
OnAppClose?.Invoke(this, new EventArgs());

if (!ActivityInGame && ActivityPlaceId == 0)
{
Expand Down
26 changes: 22 additions & 4 deletions Bloxstrap/Resources/Strings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 9 additions & 4 deletions Bloxstrap/Resources/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -287,12 +287,11 @@ Your ReShade configuration files will still be saved, and you can locate them by
<value>Location</value>
</data>
<data name="ContextMenu.ServerInformation.Notification.Text" xml:space="preserve">
<value>Located at {0}
<value>Location: {0}
Click for more information</value>
</data>
<data name="ContextMenu.ServerInformation.Notification.Title" xml:space="preserve">
<value>Connected to {0} server</value>
<comment>Enums.ServerType fills in {0} and is dynamically converted to lowercase when inserted here</comment>
<data name="ContextMenu.ServerInformation.Notification.Title.Public" xml:space="preserve">
<value>Connected to public server</value>
</data>
<data name="ContextMenu.ServerInformation.Title" xml:space="preserve">
<value>Server information</value>
Expand Down Expand Up @@ -1114,4 +1113,10 @@ If not, then please report this exception to the maintainers of this fork. Do NO
<data name="Menu.Shortcuts.Function.Description" xml:space="preserve">
<value>Create shortcuts for quick access to specific functions. These will all be placed on the Desktop.</value>
</data>
<data name="ContextMenu.ServerInformation.Notification.Title.Private" xml:space="preserve">
<value>Connected to private server</value>
</data>
<data name="ContextMenu.ServerInformation.Notification.Title.Reserved" xml:space="preserve">
<value>Connected to reserved server</value>
</data>
</root>
8 changes: 7 additions & 1 deletion Bloxstrap/UI/NotifyIconWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,15 @@ public void MouseClickEventHandler(object? sender, System.Windows.Forms.MouseEve
public async void OnGameJoin()
{
string serverLocation = await _activityWatcher!.GetServerLocation();
string title = _activityWatcher.ActivityServerType switch

Check warning on line 90 in Bloxstrap/UI/NotifyIconWrapper.cs

View workflow job for this annotation

GitHub Actions / build (Debug)

The switch expression does not handle some values of its input type (it is not exhaustive) involving an unnamed enum value. For example, the pattern '(Bloxstrap.Enums.ServerType)3' is not covered.

Check warning on line 90 in Bloxstrap/UI/NotifyIconWrapper.cs

View workflow job for this annotation

GitHub Actions / build (Debug)

The switch expression does not handle some values of its input type (it is not exhaustive) involving an unnamed enum value. For example, the pattern '(Bloxstrap.Enums.ServerType)3' is not covered.

Check warning on line 90 in Bloxstrap/UI/NotifyIconWrapper.cs

View workflow job for this annotation

GitHub Actions / build (Debug)

The switch expression does not handle some values of its input type (it is not exhaustive) involving an unnamed enum value. For example, the pattern '(Bloxstrap.Enums.ServerType)3' is not covered.

Check warning on line 90 in Bloxstrap/UI/NotifyIconWrapper.cs

View workflow job for this annotation

GitHub Actions / build (Debug)

The switch expression does not handle some values of its input type (it is not exhaustive) involving an unnamed enum value. For example, the pattern '(Bloxstrap.Enums.ServerType)3' is not covered.

Check warning on line 90 in Bloxstrap/UI/NotifyIconWrapper.cs

View workflow job for this annotation

GitHub Actions / build (Debug)

The switch expression does not handle some values of its input type (it is not exhaustive) involving an unnamed enum value. For example, the pattern '(Bloxstrap.Enums.ServerType)3' is not covered.

Check warning on line 90 in Bloxstrap/UI/NotifyIconWrapper.cs

View workflow job for this annotation

GitHub Actions / build (Debug)

The switch expression does not handle some values of its input type (it is not exhaustive) involving an unnamed enum value. For example, the pattern '(Bloxstrap.Enums.ServerType)3' is not covered.

Check warning on line 90 in Bloxstrap/UI/NotifyIconWrapper.cs

View workflow job for this annotation

GitHub Actions / build (Release)

The switch expression does not handle some values of its input type (it is not exhaustive) involving an unnamed enum value. For example, the pattern '(Bloxstrap.Enums.ServerType)3' is not covered.

Check warning on line 90 in Bloxstrap/UI/NotifyIconWrapper.cs

View workflow job for this annotation

GitHub Actions / build (Release)

The switch expression does not handle some values of its input type (it is not exhaustive) involving an unnamed enum value. For example, the pattern '(Bloxstrap.Enums.ServerType)3' is not covered.

Check warning on line 90 in Bloxstrap/UI/NotifyIconWrapper.cs

View workflow job for this annotation

GitHub Actions / build (Release)

The switch expression does not handle some values of its input type (it is not exhaustive) involving an unnamed enum value. For example, the pattern '(Bloxstrap.Enums.ServerType)3' is not covered.

Check warning on line 90 in Bloxstrap/UI/NotifyIconWrapper.cs

View workflow job for this annotation

GitHub Actions / build (Release)

The switch expression does not handle some values of its input type (it is not exhaustive) involving an unnamed enum value. For example, the pattern '(Bloxstrap.Enums.ServerType)3' is not covered.

Check warning on line 90 in Bloxstrap/UI/NotifyIconWrapper.cs

View workflow job for this annotation

GitHub Actions / build (Release)

The switch expression does not handle some values of its input type (it is not exhaustive) involving an unnamed enum value. For example, the pattern '(Bloxstrap.Enums.ServerType)3' is not covered.

Check warning on line 90 in Bloxstrap/UI/NotifyIconWrapper.cs

View workflow job for this annotation

GitHub Actions / build (Release)

The switch expression does not handle some values of its input type (it is not exhaustive) involving an unnamed enum value. For example, the pattern '(Bloxstrap.Enums.ServerType)3' is not covered.
{
ServerType.Public => Resources.Strings.ContextMenu_ServerInformation_Notification_Title_Public,
ServerType.Private => Resources.Strings.ContextMenu_ServerInformation_Notification_Title_Private,
ServerType.Reserved => Resources.Strings.ContextMenu_ServerInformation_Notification_Title_Reserved
};

ShowAlert(
String.Format(Resources.Strings.ContextMenu_ServerInformation_Notification_Title, _activityWatcher.ActivityServerType.ToTranslatedString().ToLower()),
title,
String.Format(Resources.Strings.ContextMenu_ServerInformation_Notification_Text, serverLocation),
10,
(_, _) => _menuContainer?.ShowServerInformationWindow()
Expand Down

0 comments on commit de82349

Please sign in to comment.