mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-19 14:53:50 +02:00
Add systems for local world persistence (#553)
* chore: Change vscode workspace settings to work with omnisharp * refactor(.NET): Use connection string builder to init sqlite database * docs(.NET): Add method documentation to most things that matter * docs(.NET): Add more docs I forgot to commit apparently * feat: Add PoC world database structure ^& http listener * fix: Send a response if VRCX isn't initialized rather than hanging * feat: Initialize world db schema on startup * feat: Allow worlds to store data in db through logfile * use existing current location for worldDB * Add tooltips * chore: Make it so vscode can format C# files without prettier * refactor: Add sqlite-net to (eventually) replace sqlite impl * refactor: Make use of sqlite-net for world database * docs: Add todo for fixing some random exception * refactor: Remove now-unused SQLiteWorld * refactor: Fix DB init query and change table structure again * refactor: Add WorldDataRequest, add attributes for camelcase json keys * Support current user location from API in addition to gameLog * Change current location check for worldDB * feat: Take store requests in JSON, identify worlds by GUID on store. * refactor: Remove unused worldId param from connection key generator * docs: Add more documentation to the methods for the world database * fix: Hey wait that's not a primary key * feat: Add a 10MB data cap for worlds shared across all of their rows. * fix: Don't calculate size of world date twice when inserting * refactor: Discard the guid variable since we only check for validity * docs: Add docs/comments for new data cap functionality * feat: Implement /getbulk API endpoint * fix: Correct WorldDB init query typo * fix: Update data entries properly instead of using 'OR REPLACE' * refactor: Move endpoint processing to separate methods * refactor: Add another check for error 503, remove old code * feat: Add debug capability to /vrcx/getbulk * fix: Correct the usage of getUser in actuallyGetCurrentLocation * feat: Add store errors, implement external reading, stop 404ing * docs: Add docs for new world db funcs * refactor: Change world db server listen port to 22500 * fix: Use getUser correctly, dumb dumb * fix: This error set shouldn't be here * feat: Future-proof api endpoints. Add /status endpoint --------- Co-authored-by: Natsumi <cmcooper123@hotmail.com>
This commit is contained in:
@@ -14,6 +14,9 @@ using CefSharp;
|
||||
|
||||
namespace VRCX
|
||||
{
|
||||
/// <summary>
|
||||
/// Monitors the VRChat log files for changes and provides access to the log data.
|
||||
/// </summary>
|
||||
public class LogWatcher
|
||||
{
|
||||
public static readonly LogWatcher Instance;
|
||||
@@ -88,6 +91,9 @@ namespace VRCX
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the log watcher by checking for new log files and updating the log list.
|
||||
/// </summary>
|
||||
private void Update()
|
||||
{
|
||||
if (m_ResetLog)
|
||||
@@ -157,6 +163,11 @@ namespace VRCX
|
||||
m_FirstRun = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parses the log file starting from the current position and updates the log context.
|
||||
/// </summary>
|
||||
/// <param name="fileInfo">The file information of the log file to parse.</param>
|
||||
/// <param name="logContext">The log context to update.</param>
|
||||
private void ParseLog(FileInfo fileInfo, LogContext logContext)
|
||||
{
|
||||
try
|
||||
@@ -224,6 +235,7 @@ namespace VRCX
|
||||
ParseLogUsharpVideoPlay(fileInfo, logContext, line, offset) ||
|
||||
ParseLogUsharpVideoSync(fileInfo, logContext, line, offset) ||
|
||||
ParseLogWorldVRCX(fileInfo, logContext, line, offset) ||
|
||||
ParseLogWorldDataVRCX(fileInfo, logContext, line, offset) ||
|
||||
ParseLogOnAudioConfigurationChanged(fileInfo, logContext, line, offset) ||
|
||||
ParseLogScreenshot(fileInfo, logContext, line, offset) ||
|
||||
ParseLogStringDownload(fileInfo, logContext, line, offset) ||
|
||||
@@ -593,6 +605,19 @@ namespace VRCX
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool ParseLogWorldDataVRCX(FileInfo fileInfo, LogContext logContext, string line, int offset)
|
||||
{
|
||||
// [VRCX-World] store:test:testvalue
|
||||
|
||||
if (string.Compare(line, offset, "[VRCX-World] ", 0, 13, StringComparison.Ordinal) != 0)
|
||||
return false;
|
||||
|
||||
var data = line.Substring(offset + 13);
|
||||
|
||||
WorldDBManager.Instance.ProcessLogWorldDataRequest(data);
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool ParseLogVideoChange(FileInfo fileInfo, LogContext logContext, string line, int offset)
|
||||
{
|
||||
// 2021.04.20 13:37:69 Log - [Video Playback] Attempting to resolve URL 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
|
||||
@@ -927,7 +952,7 @@ namespace VRCX
|
||||
private bool ParseOpenVRInit(FileInfo fileInfo, LogContext logContext, string line, int offset)
|
||||
{
|
||||
// 2022.07.29 02:52:14 Log - OpenVR initialized!
|
||||
|
||||
|
||||
// 2023.04.22 16:52:28 Log - Initializing VRSDK.
|
||||
// 2023.04.22 16:52:29 Log - StartVRSDK: Open VR Loader
|
||||
|
||||
@@ -944,7 +969,7 @@ namespace VRCX
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
private bool ParseDesktopMode(FileInfo fileInfo, LogContext logContext, string line, int offset)
|
||||
{
|
||||
// 2023.04.22 16:54:18 Log - VR Disabled
|
||||
|
||||
Reference in New Issue
Block a user