mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-07 14:56:06 +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>.
|
// For a copy, see <https://opensource.org/licenses/MIT>.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
@@ -276,17 +277,19 @@ namespace VRCX
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Removes empty directories from the VRChat cache directory and deletes old versions of cached asset bundles.
|
/// Removes empty directories from the VRChat cache directory and deletes old versions of cached asset bundles.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void SweepCache()
|
public List<string> SweepCache()
|
||||||
{
|
{
|
||||||
|
var output = new List<string>();
|
||||||
var cachePath = GetVRChatCacheLocation();
|
var cachePath = GetVRChatCacheLocation();
|
||||||
if (!Directory.Exists(cachePath))
|
if (!Directory.Exists(cachePath))
|
||||||
return;
|
return output;
|
||||||
var directories = new DirectoryInfo(cachePath);
|
var directories = new DirectoryInfo(cachePath);
|
||||||
var cacheDirectories = directories.GetDirectories();
|
var cacheDirectories = directories.GetDirectories();
|
||||||
foreach (var cacheDirectory in cacheDirectories)
|
foreach (var cacheDirectory in cacheDirectories)
|
||||||
{
|
{
|
||||||
|
// var versionDirectories = cacheDirectory.GetDirectories().OrderBy(d => ReverseHexToDecimal(d.Name)).ToArray();
|
||||||
var versionDirectories =
|
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++)
|
for (var index = 0; index < versionDirectories.Length; index++)
|
||||||
{
|
{
|
||||||
var versionDirectory = versionDirectories[index];
|
var versionDirectory = versionDirectories[index];
|
||||||
@@ -303,11 +306,14 @@ namespace VRCX
|
|||||||
continue; // skip locked version
|
continue; // skip locked version
|
||||||
|
|
||||||
versionDirectory.Delete(true);
|
versionDirectory.Delete(true);
|
||||||
|
output.Add($"{cacheDirectory.Name}\\{versionDirectory.Name}");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cacheDirectory.GetDirectories().Length + cacheDirectory.GetFiles().Length == 0)
|
if (cacheDirectory.GetDirectories().Length + cacheDirectory.GetFiles().Length == 0)
|
||||||
cacheDirectory.Delete(); // delete empty directory
|
cacheDirectory.Delete(); // delete empty directory
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <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: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
|
// 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
|
// 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[]
|
AppendLog(new[]
|
||||||
{
|
{
|
||||||
|
|||||||
+7
-1
@@ -4673,7 +4673,9 @@ speechSynthesis.getVoices();
|
|||||||
this.updateOnlineFriendCoutner();
|
this.updateOnlineFriendCoutner();
|
||||||
}
|
}
|
||||||
ctx.state = newState;
|
ctx.state = newState;
|
||||||
|
if (ref?.displayName) {
|
||||||
ctx.name = ref.displayName;
|
ctx.name = ref.displayName;
|
||||||
|
}
|
||||||
ctx.isVIP = isVIP;
|
ctx.isVIP = isVIP;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -5525,6 +5527,9 @@ speechSynthesis.getVoices();
|
|||||||
`${ref.displayName} GPS ${previousLocation} -> ${newLocation}`
|
`${ref.displayName} GPS ${previousLocation} -> ${newLocation}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
if (previousLocation === 'offline') {
|
||||||
|
previousLocation = '';
|
||||||
|
}
|
||||||
if (!previousLocation) {
|
if (!previousLocation) {
|
||||||
// no previous location
|
// no previous location
|
||||||
if ($app.debugFriendState) {
|
if ($app.debugFriendState) {
|
||||||
@@ -16726,7 +16731,8 @@ speechSynthesis.getVoices();
|
|||||||
};
|
};
|
||||||
|
|
||||||
$app.methods.sweepVRChatCache = async function () {
|
$app.methods.sweepVRChatCache = async function () {
|
||||||
await AssetBundleCacher.SweepCache();
|
var output = await AssetBundleCacher.SweepCache();
|
||||||
|
console.log('SweepCache', output);
|
||||||
if (this.VRChatConfigDialog.visible) {
|
if (this.VRChatConfigDialog.visible) {
|
||||||
this.getVRChatCacheSize();
|
this.getVRChatCacheSize();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user