mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-17 05:43:51 +02:00
Fix manage cache, OnPlayerLeft notification
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
// For a copy, see <https://opensource.org/licenses/MIT>.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Security.Cryptography;
|
||||
@@ -276,17 +277,19 @@ namespace VRCX
|
||||
/// <summary>
|
||||
/// Removes empty directories from the VRChat cache directory and deletes old versions of cached asset bundles.
|
||||
/// </summary>
|
||||
public void SweepCache()
|
||||
public List<string> SweepCache()
|
||||
{
|
||||
var output = new List<string>();
|
||||
var cachePath = GetVRChatCacheLocation();
|
||||
if (!Directory.Exists(cachePath))
|
||||
return;
|
||||
return output;
|
||||
var directories = new DirectoryInfo(cachePath);
|
||||
var cacheDirectories = directories.GetDirectories();
|
||||
foreach (var cacheDirectory in cacheDirectories)
|
||||
{
|
||||
// var versionDirectories = cacheDirectory.GetDirectories().OrderBy(d => ReverseHexToDecimal(d.Name)).ToArray();
|
||||
var versionDirectories =
|
||||
cacheDirectory.GetDirectories().OrderBy(d => ReverseHexToDecimal(d.Name)).ToArray();
|
||||
cacheDirectory.GetDirectories().OrderBy(d => d.LastWriteTime).ToArray();
|
||||
for (var index = 0; index < versionDirectories.Length; index++)
|
||||
{
|
||||
var versionDirectory = versionDirectories[index];
|
||||
@@ -303,11 +306,14 @@ namespace VRCX
|
||||
continue; // skip locked version
|
||||
|
||||
versionDirectory.Delete(true);
|
||||
output.Add($"{cacheDirectory.Name}\\{versionDirectory.Name}");
|
||||
}
|
||||
|
||||
if (cacheDirectory.GetDirectories().Length + cacheDirectory.GetFiles().Length == 0)
|
||||
cacheDirectory.Delete(); // delete empty directory
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -406,8 +406,9 @@ namespace VRCX
|
||||
// 2021.09.02 00:02:12 Log - [Behaviour] Destination set: wrld_4432ea9b-729c-46e3-8eaf-846aa0a37fdd:15609~private(usr_032383a7-748c-4fb2-94e4-bcb928e5de6b)~nonce(72CC87D420C1D49AEFFBEE8824C84B2DF0E38678E840661E)
|
||||
// 2021.09.02 00:49:15 Log - [Behaviour] Destination fetching: wrld_4432ea9b-729c-46e3-8eaf-846aa0a37fdd
|
||||
// 2022.08.13 18:57:00 Log - [Behaviour] OnLeftRoom
|
||||
// 2024.11.22 15:32:28 Log - [Behaviour] Successfully left room
|
||||
|
||||
if (line.Contains("[Behaviour] OnLeftRoom"))
|
||||
if (line.Contains("[Behaviour] Successfully left room"))
|
||||
{
|
||||
AppendLog(new[]
|
||||
{
|
||||
|
||||
@@ -4673,7 +4673,9 @@ speechSynthesis.getVoices();
|
||||
this.updateOnlineFriendCoutner();
|
||||
}
|
||||
ctx.state = newState;
|
||||
ctx.name = ref.displayName;
|
||||
if (ref?.displayName) {
|
||||
ctx.name = ref.displayName;
|
||||
}
|
||||
ctx.isVIP = isVIP;
|
||||
};
|
||||
|
||||
@@ -5525,6 +5527,9 @@ speechSynthesis.getVoices();
|
||||
`${ref.displayName} GPS ${previousLocation} -> ${newLocation}`
|
||||
);
|
||||
}
|
||||
if (previousLocation === 'offline') {
|
||||
previousLocation = '';
|
||||
}
|
||||
if (!previousLocation) {
|
||||
// no previous location
|
||||
if ($app.debugFriendState) {
|
||||
@@ -16726,7 +16731,8 @@ speechSynthesis.getVoices();
|
||||
};
|
||||
|
||||
$app.methods.sweepVRChatCache = async function () {
|
||||
await AssetBundleCacher.SweepCache();
|
||||
var output = await AssetBundleCacher.SweepCache();
|
||||
console.log('SweepCache', output);
|
||||
if (this.VRChatConfigDialog.visible) {
|
||||
this.getVRChatCacheSize();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user