mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-06 06:46:04 +02:00
Small fixes
This commit is contained in:
@@ -4,6 +4,7 @@ using System.Diagnostics;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using System.Timers;
|
using System.Timers;
|
||||||
using NLog;
|
using NLog;
|
||||||
|
|
||||||
@@ -142,16 +143,16 @@ namespace VRCX
|
|||||||
{
|
{
|
||||||
UpdateChildProcesses(); // Ensure the list contains all current child processes.
|
UpdateChildProcesses(); // Ensure the list contains all current child processes.
|
||||||
|
|
||||||
foreach (var pair in startedProcesses)
|
Parallel.ForEach(startedProcesses.ToArray(), pair =>
|
||||||
{
|
{
|
||||||
var processes = pair.Value;
|
var processes = pair.Value;
|
||||||
|
var pids = processes.ToArray();
|
||||||
foreach (var pid in processes)
|
foreach (var pid in pids)
|
||||||
{
|
{
|
||||||
if (!WinApi.HasProcessExited(pid))
|
if (!WinApi.HasProcessExited(pid))
|
||||||
KillProcessTree(pid);
|
KillProcessTree(pid);
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
startedProcesses.Clear();
|
startedProcesses.Clear();
|
||||||
}
|
}
|
||||||
@@ -176,9 +177,7 @@ namespace VRCX
|
|||||||
{
|
{
|
||||||
return pids;
|
return pids;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Gonna be honest, not gonna spin up a 32bit windows VM to make sure this works. but it should.
|
|
||||||
// Does VRCX even run on 32bit windows?
|
|
||||||
PROCESSENTRY32 procEntry = new PROCESSENTRY32();
|
PROCESSENTRY32 procEntry = new PROCESSENTRY32();
|
||||||
procEntry.dwSize = (uint)Marshal.SizeOf(typeof(PROCESSENTRY32));
|
procEntry.dwSize = (uint)Marshal.SizeOf(typeof(PROCESSENTRY32));
|
||||||
|
|
||||||
@@ -190,7 +189,7 @@ namespace VRCX
|
|||||||
{
|
{
|
||||||
pids.Add((int)procEntry.th32ProcessID);
|
pids.Add((int)procEntry.th32ProcessID);
|
||||||
|
|
||||||
if(recursive) // Recursively find child processes
|
if (recursive) // Recursively find child processes
|
||||||
pids.AddRange(FindChildProcesses((int)procEntry.th32ProcessID));
|
pids.AddRange(FindChildProcesses((int)procEntry.th32ProcessID));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -209,12 +208,21 @@ namespace VRCX
|
|||||||
var pids = FindChildProcesses(pid);
|
var pids = FindChildProcesses(pid);
|
||||||
pids.Add(pid); // Kill parent
|
pids.Add(pid); // Kill parent
|
||||||
|
|
||||||
foreach (int p in pids)
|
foreach (var p in pids)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (Process proc = Process.GetProcessById(p))
|
using var proc = Process.GetProcessById(p);
|
||||||
proc.Kill();
|
if (proc.HasExited)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (proc.CloseMainWindow())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (proc.WaitForExit(1000))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
proc.Kill();
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
@@ -361,14 +369,11 @@ namespace VRCX
|
|||||||
/// <returns><c>true</c> if the given file path is a shortcut, otherwise <c>false</c></returns>
|
/// <returns><c>true</c> if the given file path is a shortcut, otherwise <c>false</c></returns>
|
||||||
private static bool IsShortcutFile(string filePath)
|
private static bool IsShortcutFile(string filePath)
|
||||||
{
|
{
|
||||||
byte[] headerBytes = new byte[4];
|
var headerBytes = new byte[4];
|
||||||
using (FileStream fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
|
using var fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
|
||||||
{
|
if (fileStream.Length < 4)
|
||||||
if (fileStream.Length >= 4)
|
return false;
|
||||||
{
|
fileStream.ReadExactly(headerBytes, 0, 4);
|
||||||
fileStream.Read(headerBytes, 0, 4);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return headerBytes.SequenceEqual(shortcutSignatureBytes);
|
return headerBytes.SequenceEqual(shortcutSignatureBytes);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -700,7 +700,7 @@ async function createDesktopFile() {
|
|||||||
|
|
||||||
// Download the icon and save it to the target directory
|
// Download the icon and save it to the target directory
|
||||||
const iconPath = path.join(homePath, '.local/share/icons/VRCX.png');
|
const iconPath = path.join(homePath, '.local/share/icons/VRCX.png');
|
||||||
if (!fs.existsSync(iconPath)) {
|
if (!fs.existsSync(iconPath) || fs.statSync(iconPath).size === 0) {
|
||||||
const iconDir = path.dirname(iconPath);
|
const iconDir = path.dirname(iconPath);
|
||||||
if (!fs.existsSync(iconDir)) {
|
if (!fs.existsSync(iconDir)) {
|
||||||
fs.mkdirSync(iconDir, { recursive: true });
|
fs.mkdirSync(iconDir, { recursive: true });
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
const { canOpenInstanceInGame } = useInviteStore();
|
const { canOpenInstanceInGame } = storeToRefs(useInviteStore());
|
||||||
const { tryOpenInstanceInVrc } = useLaunchStore();
|
const { tryOpenInstanceInVrc } = useLaunchStore();
|
||||||
|
|
||||||
const { isOpeningInstance } = storeToRefs(useLaunchStore());
|
const { isOpeningInstance } = storeToRefs(useLaunchStore());
|
||||||
|
|||||||
@@ -40,9 +40,19 @@ export function useDateNavigation(allDateOfActivity, reloadData) {
|
|||||||
const idx = allDateOfActivityArray.value.findIndex((date) =>
|
const idx = allDateOfActivityArray.value.findIndex((date) =>
|
||||||
date.isSame(selectedDate.value, 'day')
|
date.isSame(selectedDate.value, 'day')
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// when invalid date is selected, find the next closest date
|
||||||
|
if (idx === -1 && !isNext) {
|
||||||
|
const newIdx = allDateOfActivityArray.value.findIndex((date) =>
|
||||||
|
date.isBefore(selectedDate.value, 'day')
|
||||||
|
);
|
||||||
|
selectedDate.value = allDateOfActivityArray.value[newIdx].toDate();
|
||||||
|
reloadData();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (idx !== -1) {
|
if (idx !== -1) {
|
||||||
const newIdx = isNext ? idx - 1 : idx + 1;
|
const newIdx = isNext ? idx - 1 : idx + 1;
|
||||||
|
|
||||||
if (newIdx >= 0 && newIdx < allDateOfActivityArray.value.length) {
|
if (newIdx >= 0 && newIdx < allDateOfActivityArray.value.length) {
|
||||||
selectedDate.value =
|
selectedDate.value =
|
||||||
allDateOfActivityArray.value[newIdx].toDate();
|
allDateOfActivityArray.value[newIdx].toDate();
|
||||||
@@ -50,6 +60,8 @@ export function useDateNavigation(allDateOfActivity, reloadData) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fallback to the first/last date
|
||||||
selectedDate.value = isNext
|
selectedDate.value = isNext
|
||||||
? allDateOfActivityArray.value[0].toDate()
|
? allDateOfActivityArray.value[0].toDate()
|
||||||
: allDateOfActivityArray.value[
|
: allDateOfActivityArray.value[
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
<div style="margin-top: 10px">
|
<div style="margin-top: 10px">
|
||||||
<div style="display: flex; align-items: center; justify-content: space-between; font-size: 12px">
|
<div style="display: flex; align-items: center; justify-content: space-between; font-size: 12px">
|
||||||
<span class="name" style="margin-right: 24px">{{ t('dialog.registry_backup.auto_backup') }}</span>
|
<span class="name" style="margin-right: 24px">{{ t('dialog.registry_backup.auto_backup') }}</span>
|
||||||
<el-switch v-model="vrcRegistryAutoBackup" @change="setVrcRegistryAutoBackup"></el-switch>
|
<el-switch :model-value="vrcRegistryAutoBackup" @change="setVrcRegistryAutoBackup"></el-switch>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
style="
|
style="
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
">
|
">
|
||||||
<span class="name" style="margin-right: 24px">{{ t('dialog.registry_backup.ask_to_restore') }}</span>
|
<span class="name" style="margin-right: 24px">{{ t('dialog.registry_backup.ask_to_restore') }}</span>
|
||||||
<el-switch v-model="vrcRegistryAskRestore" @change="setVrcRegistryAskRestore"></el-switch>
|
<el-switch :model-value="vrcRegistryAskRestore" @change="setVrcRegistryAskRestore"></el-switch>
|
||||||
</div>
|
</div>
|
||||||
<DataTable v-bind="registryBackupTable" style="margin-top: 10px">
|
<DataTable v-bind="registryBackupTable" style="margin-top: 10px">
|
||||||
<el-table-column :label="t('dialog.registry_backup.name')" prop="name"></el-table-column>
|
<el-table-column :label="t('dialog.registry_backup.name')" prop="name"></el-table-column>
|
||||||
|
|||||||
Reference in New Issue
Block a user