mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
RobloxActivity -> Integrations.ActivityWatcher
This commit is contained in:
parent
8065e5be98
commit
83856acaec
@ -236,7 +236,7 @@ namespace Bloxstrap
|
||||
}
|
||||
|
||||
List<Process> autocloseProcesses = new();
|
||||
RobloxActivity? activityWatcher = null;
|
||||
ActivityWatcher? activityWatcher = null;
|
||||
DiscordRichPresence? richPresence = null;
|
||||
|
||||
App.Logger.WriteLine(LOG_IDENT, $"Started Roblox (PID {gameClientPid})");
|
||||
|
@ -5,7 +5,7 @@ namespace Bloxstrap.Integrations
|
||||
public class DiscordRichPresence : IDisposable
|
||||
{
|
||||
private readonly DiscordRpcClient _rpcClient = new("1005469189907173486");
|
||||
private readonly RobloxActivity _activityWatcher;
|
||||
private readonly ActivityWatcher _activityWatcher;
|
||||
|
||||
private RichPresence? _currentPresence;
|
||||
private bool _visible = true;
|
||||
@ -13,7 +13,7 @@ namespace Bloxstrap.Integrations
|
||||
private long _currentUniverseId;
|
||||
private DateTime? _timeStartedUniverse;
|
||||
|
||||
public DiscordRichPresence(RobloxActivity activityWatcher)
|
||||
public DiscordRichPresence(ActivityWatcher activityWatcher)
|
||||
{
|
||||
const string LOG_IDENT = "DiscordRichPresence::<construct>";
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
namespace Bloxstrap
|
||||
namespace Bloxstrap.Integrations
|
||||
{
|
||||
public class RobloxActivity : IDisposable
|
||||
public class ActivityWatcher : IDisposable
|
||||
{
|
||||
// i'm thinking the functionality for parsing roblox logs could be broadened for more features than just rich presence,
|
||||
// like checking the ping and region of the current connected server. maybe that's something to add?
|
||||
@ -44,7 +44,7 @@
|
||||
|
||||
public async void StartWatcher()
|
||||
{
|
||||
const string LOG_IDENT = "RobloxActivity::StartWatcher";
|
||||
const string LOG_IDENT = "ActivityWatcher::StartWatcher";
|
||||
|
||||
// okay, here's the process:
|
||||
//
|
||||
@ -118,7 +118,7 @@
|
||||
|
||||
private void ExamineLogEntry(string entry)
|
||||
{
|
||||
const string LOG_IDENT = "RobloxActivity::ExamineLogEntry";
|
||||
const string LOG_IDENT = "ActivityWatcher::ExamineLogEntry";
|
||||
|
||||
OnLogEntry?.Invoke(this, entry);
|
||||
|
||||
@ -253,7 +253,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
if (String.IsNullOrEmpty(message.Command))
|
||||
if (string.IsNullOrEmpty(message.Command))
|
||||
{
|
||||
App.Logger.WriteLine(LOG_IDENT, "Failed to parse message! (Command is empty)");
|
||||
return;
|
||||
@ -266,7 +266,7 @@
|
||||
|
||||
public async Task<string> GetServerLocation()
|
||||
{
|
||||
const string LOG_IDENT = "RobloxActivity::GetServerLocation";
|
||||
const string LOG_IDENT = "ActivityWatcher::GetServerLocation";
|
||||
|
||||
if (GeolcationCache.ContainsKey(ActivityMachineAddress))
|
||||
return GeolcationCache[ActivityMachineAddress];
|
||||
@ -291,7 +291,7 @@
|
||||
locationRegion = locationRegion.ReplaceLineEndings("");
|
||||
locationCountry = locationCountry.ReplaceLineEndings("");
|
||||
|
||||
if (String.IsNullOrEmpty(locationCountry))
|
||||
if (string.IsNullOrEmpty(locationCountry))
|
||||
location = "N/A";
|
||||
else if (locationCity == locationRegion)
|
||||
location = $"{locationRegion}, {locationCountry}";
|
@ -1,6 +1,7 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
using Bloxstrap.Integrations;
|
||||
using Bloxstrap.UI.ViewModels.ContextMenu;
|
||||
|
||||
namespace Bloxstrap.UI.Elements.ContextMenu
|
||||
@ -12,7 +13,7 @@ namespace Bloxstrap.UI.Elements.ContextMenu
|
||||
{
|
||||
private bool _autoscroll = true;
|
||||
|
||||
public LogTracer(RobloxActivity activityWatcher)
|
||||
public LogTracer(ActivityWatcher activityWatcher)
|
||||
{
|
||||
DataContext = new LogTracerViewModel(this, activityWatcher);
|
||||
InitializeComponent();
|
||||
|
@ -24,13 +24,13 @@ namespace Bloxstrap.UI.Elements.ContextMenu
|
||||
{
|
||||
// i wouldve gladly done this as mvvm but turns out that data binding just does not work with menuitems for some reason so idk this sucks
|
||||
|
||||
private readonly RobloxActivity? _activityWatcher;
|
||||
private readonly ActivityWatcher? _activityWatcher;
|
||||
private readonly DiscordRichPresence? _richPresenceHandler;
|
||||
|
||||
private LogTracer? _logTracerWindow;
|
||||
private ServerInformation? _serverInformationWindow;
|
||||
|
||||
public MenuContainer(RobloxActivity? activityWatcher, DiscordRichPresence? richPresenceHandler)
|
||||
public MenuContainer(ActivityWatcher? activityWatcher, DiscordRichPresence? richPresenceHandler)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
|
@ -12,6 +12,7 @@ using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
using Bloxstrap.Integrations;
|
||||
using Bloxstrap.UI.ViewModels.ContextMenu;
|
||||
|
||||
namespace Bloxstrap.UI.Elements.ContextMenu
|
||||
@ -21,7 +22,7 @@ namespace Bloxstrap.UI.Elements.ContextMenu
|
||||
/// </summary>
|
||||
public partial class ServerInformation
|
||||
{
|
||||
public ServerInformation(RobloxActivity activityWatcher)
|
||||
public ServerInformation(ActivityWatcher activityWatcher)
|
||||
{
|
||||
DataContext = new ServerInformationViewModel(this, activityWatcher);
|
||||
InitializeComponent();
|
||||
|
@ -14,7 +14,7 @@ namespace Bloxstrap.UI
|
||||
private readonly System.Windows.Forms.NotifyIcon _notifyIcon;
|
||||
private MenuContainer? _menuContainer;
|
||||
|
||||
private RobloxActivity? _activityWatcher;
|
||||
private ActivityWatcher? _activityWatcher;
|
||||
private DiscordRichPresence? _richPresenceHandler;
|
||||
|
||||
EventHandler? _alertClickHandler;
|
||||
@ -42,7 +42,7 @@ namespace Bloxstrap.UI
|
||||
_richPresenceHandler = richPresenceHandler;
|
||||
}
|
||||
|
||||
public void SetActivityWatcher(RobloxActivity activityWatcher)
|
||||
public void SetActivityWatcher(ActivityWatcher activityWatcher)
|
||||
{
|
||||
if (_activityWatcher is not null)
|
||||
return;
|
||||
|
@ -3,12 +3,14 @@ using System.Windows.Input;
|
||||
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
|
||||
using Bloxstrap.Integrations;
|
||||
|
||||
namespace Bloxstrap.UI.ViewModels.ContextMenu
|
||||
{
|
||||
internal class LogTracerViewModel : NotifyPropertyChangedViewModel
|
||||
{
|
||||
private readonly Window _window;
|
||||
private readonly RobloxActivity _activityWatcher;
|
||||
private readonly ActivityWatcher _activityWatcher;
|
||||
private int _lineNumber = 1;
|
||||
|
||||
public ICommand CloseWindowCommand => new RelayCommand(_window.Close);
|
||||
@ -17,7 +19,7 @@ namespace Bloxstrap.UI.ViewModels.ContextMenu
|
||||
public string LogFilename => Path.GetFileName(_activityWatcher.LogLocation);
|
||||
public string LogContents { get; private set; } = "";
|
||||
|
||||
public LogTracerViewModel(Window window, RobloxActivity activityWatcher)
|
||||
public LogTracerViewModel(Window window, ActivityWatcher activityWatcher)
|
||||
{
|
||||
_window = window;
|
||||
_activityWatcher = activityWatcher;
|
||||
|
@ -1,6 +1,6 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
|
||||
using Bloxstrap.Integrations;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
|
||||
namespace Bloxstrap.UI.ViewModels.ContextMenu
|
||||
@ -8,7 +8,7 @@ namespace Bloxstrap.UI.ViewModels.ContextMenu
|
||||
internal class ServerInformationViewModel : NotifyPropertyChangedViewModel
|
||||
{
|
||||
private readonly Window _window;
|
||||
private readonly RobloxActivity _activityWatcher;
|
||||
private readonly ActivityWatcher _activityWatcher;
|
||||
|
||||
public string InstanceId => _activityWatcher.ActivityJobId;
|
||||
public string ServerType => $"{_activityWatcher.ActivityServerType} server";
|
||||
@ -18,7 +18,7 @@ namespace Bloxstrap.UI.ViewModels.ContextMenu
|
||||
public ICommand CopyInstanceIdCommand => new RelayCommand(CopyInstanceId);
|
||||
public ICommand CloseWindowCommand => new RelayCommand(_window.Close);
|
||||
|
||||
public ServerInformationViewModel(Window window, RobloxActivity activityWatcher)
|
||||
public ServerInformationViewModel(Window window, ActivityWatcher activityWatcher)
|
||||
{
|
||||
_window = window;
|
||||
_activityWatcher = activityWatcher;
|
||||
|
Loading…
Reference in New Issue
Block a user