NET 8 Upgrade (#687)

* Initial .NET8 Upgrade

* Initial GitHub Actions Cleanup

* Fix Desktop Notifications

* Fix throw warning

* Upgrade vunerable transative nuget packages

* Fix warnings with registry overflow

* Adjust async/await usage for configRepository

* Fix TTS voice name and app auto start

* Install .NET 8 with setup

I regret NSIS

* Remove no longer needed System/MS references (included in dotnet sdk)

* Surpress stackalloc in loop warning, that code scares me.

* Removed unused SharpDX packages

* Ignore WebClient warning, hopefully this project doesn't move past NET 8

* Fixed terrifying code

* GenerateAssemblyInfo

* Trimmed editor config to only silence warning.

* Fix open webpage

* Fix updater

---------

Co-authored-by: DubyaDude <ushafiq141@gmail.com>
Co-authored-by: Natsumi <cmcooper123@hotmail.com>
This commit is contained in:
Ethan Cordray
2023-11-21 07:41:57 -05:00
committed by GitHub
parent 7bb5c8ea45
commit 2e9db3153d
26 changed files with 796 additions and 736 deletions
+4
View File
@@ -0,0 +1,4 @@
[*.cs]
# SYSLIB0014: Type or member is obsolete
dotnet_diagnostic.SYSLIB0014.severity = suggestion
+50 -40
View File
@@ -1,51 +1,61 @@
name: VRCX name: VRCX
on: on:
- workflow_dispatch - push
- pull_request
jobs: jobs:
build_dotnet: build_vrcx_win:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Setup Nuget.exe
uses: nuget/setup-nuget@v1
- name: Restore packages
run: nuget restore VRCX.sln
- name: Setup MSBuild.exe
uses: microsoft/setup-msbuild@v1.1
- name: Build with MSBuild
run: msbuild VRCX.sln -p:Configuration=Release -p:Platform=x64
- uses: actions/upload-artifact@v3
with:
name: vrcx
path: bin/x64/Release
build_node:
runs-on: ubuntu-latest runs-on: ubuntu-latest
defaults:
run:
working-directory: html
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3 - name: Setup .NET 8
uses: actions/setup-dotnet@v3
with: with:
node-version: ${{ matrix.node-version }} dotnet-version: '8.0.x'
- name: Restore dependencies
run: npm ci - name: Setup NodeJS 18
- name: Lint uses: actions/setup-node@v4
run: npm run lint
- name: Build
run: npm run production
- name: Fix folder structure
id: fix-folders
run: |
mkdir upload
mv dist upload/html
- uses: actions/upload-artifact@v3
with: with:
name: vrcx node-version: 18
path: html/upload
- name: Setup NSIS
run: sudo apt update && sudo apt install -y nsis nsis-pluginapi
- name: Restore Node Dependencies
run: cd ${{ github.workspace }}/html && npm ci && cd ${{ github.workspace }}
#- name: JS Lint
# run: cd html && npm run lint && cd ..
- name: Build Web UI
run: cd ${{ github.workspace }}/html && npm run production && cd ${{ github.workspace }}
- name: Build .NET Application
run: dotnet build -p:Configuration=Release -p:Platform=x64 -p:EnableWindowsTargeting=true
- name: Copy Web UI
run: cp -r ${{ github.workspace }}/html/dist ${{ github.workspace }}/bin/x64/Release/html
- name: Fix NSIS Permissions
run: sudo chown -R $(whoami) /usr/share/nsis/Plugins/
- name: Build Installer
uses: joncloud/makensis-action@v4
with:
script-file: ${{ github.workspace }}/Installer/installer.nsi
additional-plugin-paths: ${{ github.workspace }}/Installer/Plugins
- name: Upload Zip
uses: actions/upload-artifact@v3
with:
name: "VRCX"
path: ${{ github.workspace }}/bin/x64/Release/*
- name: Upload Installer
uses: actions/upload-artifact@v3
with:
name: "VRCX_Setup"
path: ${{ github.workspace }}/Installer/VRCX_Setup.exe
+18 -16
View File
@@ -14,9 +14,9 @@ using System.Security.Cryptography;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using System.Windows.Forms; using System.Windows.Forms;
using Windows.UI.Notifications;
using CefSharp; using CefSharp;
using librsync.net; using librsync.net;
using Microsoft.Toolkit.Uwp.Notifications;
using Microsoft.Win32; using Microsoft.Win32;
using NLog; using NLog;
@@ -106,7 +106,10 @@ namespace VRCX
if (url.StartsWith("http://") || if (url.StartsWith("http://") ||
url.StartsWith("https://")) url.StartsWith("https://"))
{ {
Process.Start(url).Close(); Process.Start(new ProcessStartInfo(url)
{
UseShellExecute = true
});
} }
} }
@@ -182,20 +185,18 @@ namespace VRCX
/// <param name="Image">The optional image to display in the notification.</param> /// <param name="Image">The optional image to display in the notification.</param>
public void DesktopNotification(string BoldText, string Text = "", string Image = "") public void DesktopNotification(string BoldText, string Text = "", string Image = "")
{ {
var toastXml = ToastNotificationManager.GetTemplateContent(ToastTemplateType.ToastImageAndText02); ToastContentBuilder builder = new ToastContentBuilder();
var stringElements = toastXml.GetElementsByTagName("text");
var imagePath = Path.Combine(Program.BaseDirectory, "VRCX.ico");
if (!string.IsNullOrEmpty(Image))
{
imagePath = Image;
}
stringElements[0].AppendChild(toastXml.CreateTextNode(BoldText)); if (Uri.TryCreate(Image, UriKind.Absolute, out Uri uri))
stringElements[1].AppendChild(toastXml.CreateTextNode(Text)); builder.AddAppLogoOverride(uri);
var imageElements = toastXml.GetElementsByTagName("image");
imageElements[0].Attributes.GetNamedItem("src").NodeValue = imagePath; if (!string.IsNullOrEmpty(BoldText))
var toast = new ToastNotification(toastXml); builder.AddText(BoldText);
ToastNotificationManager.CreateToastNotifier("VRCX").Show(toast);
if (!string.IsNullOrEmpty(Text))
builder.AddText(Text);
builder.Show();
} }
/// <summary> /// <summary>
@@ -229,7 +230,8 @@ namespace VRCX
{ {
IPCServer.Send(new IPCPacket IPCServer.Send(new IPCPacket
{ {
Type = "VRCXLaunch" Type = "VRCXLaunch",
MsgType = "VRCXLaunch"
}); });
} }
+19 -17
View File
@@ -14,26 +14,24 @@ namespace VRCX
public partial class AppApi public partial class AppApi
{ {
[DllImport("advapi32.dll", CharSet = CharSet.Ansi, SetLastError = true)] [DllImport("advapi32.dll", CharSet = CharSet.Ansi, SetLastError = true)]
public static extern int RegSetValueExA( public static extern uint RegSetValueEx(
IntPtr hKey, UIntPtr hKey,
string lpValueName, [MarshalAs(UnmanagedType.LPStr)] string lpValueName,
int reserved, int Reserved,
RegistryValueKind dwType, RegistryValueKind dwType,
byte[] lpData, byte[] lpData,
int cbData int cbData);
);
[DllImport("advapi32.dll", CharSet = CharSet.Ansi, SetLastError = true)] [DllImport("advapi32.dll", CharSet = CharSet.Ansi, SetLastError = true)]
public static extern int RegOpenKeyExA( public static extern int RegOpenKeyEx(
IntPtr hKey, UIntPtr hKey,
string lpSubKey, string subKey,
int ulOptions, int ulOptions,
int samDesired, int samDesired,
out IntPtr phkResult out UIntPtr hkResult);
);
[DllImport("advapi32.dll")] [DllImport("advapi32.dll")]
public static extern int RegCloseKey(IntPtr hKey); public static extern int RegCloseKey(UIntPtr hKey);
public string AddHashToKeyName(string key) public string AddHashToKeyName(string key)
{ {
@@ -124,14 +122,14 @@ namespace VRCX
public void SetVRChatRegistryKey(string key, byte[] value) public void SetVRChatRegistryKey(string key, byte[] value)
{ {
var keyName = AddHashToKeyName(key); var keyName = AddHashToKeyName(key);
var hKey = (IntPtr)0x80000001; // HKEY_LOCAL_MACHINE var hKey = (UIntPtr)0x80000001; // HKEY_LOCAL_MACHINE
const int keyWrite = 0x20006; const int keyWrite = 0x20006;
const string keyFolder = @"SOFTWARE\VRChat\VRChat"; const string keyFolder = @"SOFTWARE\VRChat\VRChat";
var openKeyResult = RegOpenKeyExA(hKey, keyFolder, 0, keyWrite, out var folderPointer); var openKeyResult = RegOpenKeyEx(hKey, keyFolder, 0, keyWrite, out var folderPointer);
if (openKeyResult != 0) if (openKeyResult != 0)
throw new Exception("Error opening registry key. Error code: " + openKeyResult); throw new Exception("Error opening registry key. Error code: " + openKeyResult);
var setKeyResult = RegSetValueExA(folderPointer, keyName, 0, RegistryValueKind.DWord, value, value.Length); var setKeyResult = RegSetValueEx(folderPointer, keyName, 0, RegistryValueKind.DWord, value, value.Length);
if (setKeyResult != 0) if (setKeyResult != 0)
throw new Exception("Error setting registry value. Error code: " + setKeyResult); throw new Exception("Error setting registry value. Error code: " + setKeyResult);
@@ -147,6 +145,10 @@ namespace VRCX
throw new Exception("Nothing to backup."); throw new Exception("Nothing to backup.");
var keys = regKey.GetValueNames(); var keys = regKey.GetValueNames();
Span<long> spanLong = stackalloc long[1];
Span<double> doubleSpan = MemoryMarshal.Cast<long, double>(spanLong);
foreach (var key in keys) foreach (var key in keys)
{ {
var data = regKey.GetValue(key); var data = regKey.GetValue(key);
@@ -182,8 +184,8 @@ namespace VRCX
break; break;
} }
Span<long> spanLong = stackalloc long[] { (long)data }; spanLong[0] = (long)data;
var doubleValue = MemoryMarshal.Cast<long, double>(spanLong)[0]; var doubleValue = doubleSpan[0];
var floatDict = new Dictionary<string, object> var floatDict = new Dictionary<string, object>
{ {
{ "data", doubleValue }, { "data", doubleValue },
+15 -4
View File
@@ -5,6 +5,7 @@ using System.IO;
using System.Linq; using System.Linq;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Timers; using System.Timers;
using NLog;
namespace VRCX namespace VRCX
{ {
@@ -14,6 +15,7 @@ namespace VRCX
public class AutoAppLaunchManager public class AutoAppLaunchManager
{ {
public static AutoAppLaunchManager Instance { get; private set; } public static AutoAppLaunchManager Instance { get; private set; }
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
public static readonly string VRChatProcessName = "VRChat"; public static readonly string VRChatProcessName = "VRChat";
public bool Enabled = false; public bool Enabled = false;
@@ -215,14 +217,23 @@ namespace VRCX
/// Starts a new child process. /// Starts a new child process.
/// </summary> /// </summary>
/// <param name="path">The path.</param> /// <param name="path">The path.</param>
internal void StartChildProcess(string path) private void StartChildProcess(string path)
{ {
try try
{ {
using (var process = Process.Start(path)) var process = new Process();
if (process != null) process.StartInfo = new ProcessStartInfo(path)
{
UseShellExecute = true
};
process.Start();
if (process.Id != 0)
startedProcesses.Add(path, new HashSet<int>() { process.Id }); startedProcesses.Add(path, new HashSet<int>() { process.Id });
} catch { } }
catch (Exception ex)
{
logger.Error(ex);
}
} }
/// <summary> /// <summary>
+1 -1
View File
@@ -56,7 +56,7 @@ namespace VRCX
cefSettings.CefCommandLineArgs["remote-allow-origins"] = "*"; cefSettings.CefCommandLineArgs["remote-allow-origins"] = "*";
} }
CefSharpSettings.WcfEnabled = true; // TOOD: REMOVE THIS LINE YO (needed for synchronous configRepository) //CefSharpSettings.WcfEnabled = true; // TOOD: REMOVE THIS LINE YO (needed for synchronous configRepository)
CefSharpSettings.ShutdownOnExit = false; CefSharpSettings.ShutdownOnExit = false;
if (Cef.Initialize(cefSettings) == false) if (Cef.Initialize(cefSettings) == false)
+1 -1
View File
@@ -110,7 +110,7 @@ namespace VRCX
if ("true".Equals(VRCXStorage.Instance.Get("VRCX_StartAsMinimizedState")) && if ("true".Equals(VRCXStorage.Instance.Get("VRCX_StartAsMinimizedState")) &&
"true".Equals(VRCXStorage.Instance.Get("VRCX_CloseToTray"))) "true".Equals(VRCXStorage.Instance.Get("VRCX_CloseToTray")))
{ {
BeginInvoke(new MethodInvoker(Hide)); BeginInvoke(Hide);
} }
else else
{ {
+4 -3
View File
@@ -12,6 +12,7 @@ using SharpDX.Direct3D11;
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Threading; using System.Threading;
using Range = CefSharp.Structs.Range;
namespace VRCX namespace VRCX
{ {
@@ -87,7 +88,7 @@ namespace VRCX
var rowPitch = dataBox.RowPitch; var rowPitch = dataBox.RowPitch;
if (pitch == rowPitch) if (pitch == rowPitch)
{ {
WinApi.CopyMemory( WinApi.RtlCopyMemory(
destinationPtr, destinationPtr,
sourcePtr, sourcePtr,
(uint)(_width * _height * 4) (uint)(_width * _height * 4)
@@ -97,7 +98,7 @@ namespace VRCX
{ {
for (var y = _height; y > 0; --y) for (var y = _height; y > 0; --y)
{ {
WinApi.CopyMemory( WinApi.RtlCopyMemory(
destinationPtr, destinationPtr,
sourcePtr, sourcePtr,
(uint)pitch (uint)pitch
@@ -168,7 +169,7 @@ namespace VRCX
); );
} }
WinApi.CopyMemory( WinApi.RtlCopyMemory(
_paintBuffer.AddrOfPinnedObject(), _paintBuffer.AddrOfPinnedObject(),
buffer, buffer,
(uint)(width * height * 4) (uint)(width * height * 4)
+5 -5
View File
@@ -263,11 +263,11 @@ namespace VRCX
} }
} }
_browser2.Dispose(); _browser2?.Dispose();
_browser1.Dispose(); _browser1?.Dispose();
_texture2.Dispose(); _texture2?.Dispose();
_texture1.Dispose(); _texture1?.Dispose();
_device.Dispose(); _device?.Dispose();
} }
public void SetActive(bool active, bool hmdOverlay, bool wristOverlay, bool menuButton, int overlayHand) public void SetActive(bool active, bool hmdOverlay, bool wristOverlay, bool menuButton, int overlayHand)
+1 -1
View File
@@ -2003,7 +2003,7 @@ namespace SQLite
throw NotNullConstraintViolationException.New (ex, map, obj); throw NotNullConstraintViolationException.New (ex, map, obj);
} }
throw ex; throw;
} }
if (rowsAffected > 0) if (rowsAffected > 0)
+4 -2
View File
@@ -32,7 +32,7 @@ namespace VRCX
Install(); Install();
} }
public static void Install() private static void Install()
{ {
try try
{ {
@@ -42,7 +42,9 @@ namespace VRCX
StartInfo = new ProcessStartInfo StartInfo = new ProcessStartInfo
{ {
FileName = VRCX_Setup_Executable, FileName = VRCX_Setup_Executable,
Arguments = "/S" Arguments = "/S",
UseShellExecute = true,
WorkingDirectory = Program.AppDataDirectory
} }
}; };
VRCXProcess.Start(); VRCXProcess.Start();
+8 -8
View File
@@ -8,14 +8,14 @@ namespace VRCX
public static void ApplyJavascriptBindings(IJavascriptObjectRepository repository) public static void ApplyJavascriptBindings(IJavascriptObjectRepository repository)
{ {
repository.NameConverter = null; repository.NameConverter = null;
repository.Register("AppApi", AppApi.Instance, true); repository.Register("AppApi", AppApi.Instance);
repository.Register("SharedVariable", SharedVariable.Instance, false); repository.Register("SharedVariable", SharedVariable.Instance);
repository.Register("WebApi", WebApi.Instance, true); repository.Register("WebApi", WebApi.Instance);
repository.Register("VRCXStorage", VRCXStorage.Instance, true); repository.Register("VRCXStorage", VRCXStorage.Instance);
repository.Register("SQLite", SQLiteLegacy.Instance, true); repository.Register("SQLite", SQLiteLegacy.Instance);
repository.Register("LogWatcher", LogWatcher.Instance, true); repository.Register("LogWatcher", LogWatcher.Instance);
repository.Register("Discord", Discord.Instance, true); repository.Register("Discord", Discord.Instance);
repository.Register("AssetBundleCacher", AssetBundleCacher.Instance, true); repository.Register("AssetBundleCacher", AssetBundleCacher.Instance);
} }
} }
} }
+10 -4
View File
@@ -70,7 +70,9 @@ namespace VRCX
{ {
using (var stream = new MemoryStream(Convert.FromBase64String((string)values[0]))) using (var stream = new MemoryStream(Convert.FromBase64String((string)values[0])))
{ {
_cookieContainer = (CookieContainer)new BinaryFormatter().Deserialize(stream); _cookieContainer = new CookieContainer();
_cookieContainer.Add(System.Text.Json.JsonSerializer.Deserialize<CookieCollection>(stream));
//_cookieContainer = (CookieContainer)new BinaryFormatter().Deserialize(stream);
} }
} }
catch catch
@@ -94,7 +96,8 @@ namespace VRCX
{ {
using (var memoryStream = new MemoryStream()) using (var memoryStream = new MemoryStream())
{ {
new BinaryFormatter().Serialize(memoryStream, _cookieContainer); System.Text.Json.JsonSerializer.Serialize(memoryStream, _cookieContainer.GetAllCookies());
//new BinaryFormatter().Serialize(memoryStream, _cookieContainer);
SQLiteLegacy.Instance.ExecuteNonQuery( SQLiteLegacy.Instance.ExecuteNonQuery(
"INSERT OR REPLACE INTO `cookies` (`key`, `value`) VALUES (@key, @value)", "INSERT OR REPLACE INTO `cookies` (`key`, `value`) VALUES (@key, @value)",
new Dictionary<string, object>() { new Dictionary<string, object>() {
@@ -116,7 +119,8 @@ namespace VRCX
using (var memoryStream = new MemoryStream()) using (var memoryStream = new MemoryStream())
{ {
new BinaryFormatter().Serialize(memoryStream, _cookieContainer); System.Text.Json.JsonSerializer.Serialize(memoryStream, _cookieContainer.GetAllCookies());
//new BinaryFormatter().Serialize(memoryStream, _cookieContainer);
return Convert.ToBase64String(memoryStream.ToArray()); return Convert.ToBase64String(memoryStream.ToArray());
} }
} }
@@ -125,7 +129,9 @@ namespace VRCX
{ {
using (var stream = new MemoryStream(Convert.FromBase64String(cookies))) using (var stream = new MemoryStream(Convert.FromBase64String(cookies)))
{ {
_cookieContainer = (CookieContainer)new BinaryFormatter().Deserialize(stream); //_cookieContainer = (CookieContainer)new BinaryFormatter().Deserialize(stream);
_cookieContainer = new CookieContainer();
_cookieContainer.Add(System.Text.Json.JsonSerializer.Deserialize<CookieCollection>(stream));
} }
_cookieDirty = true; // force cookies to be saved for lastUserLoggedIn _cookieDirty = true; // force cookies to be saved for lastUserLoggedIn
+1 -1
View File
@@ -12,7 +12,7 @@ namespace VRCX
public static class WinApi public static class WinApi
{ {
[DllImport("kernel32.dll", SetLastError = false)] [DllImport("kernel32.dll", SetLastError = false)]
public static extern void CopyMemory(IntPtr destination, IntPtr source, uint length); public static extern void RtlCopyMemory(IntPtr destination, IntPtr source, uint length);
[DllImport("user32.dll", SetLastError = true)] [DllImport("user32.dll", SetLastError = true)]
public static extern IntPtr FindWindow(string lpClassName, string lpWindowName); public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
+22 -1
View File
@@ -46,6 +46,12 @@
!define MUI_ABORTWARNING !define MUI_ABORTWARNING
;--------------------------------
;Icons
!define MUI_ICON "../VRCX.ico"
!define MUI_UNICON "../VRCX.ico"
;-------------------------------- ;--------------------------------
;Pages ;Pages
@@ -112,6 +118,20 @@ Function .onInit
done: done:
FunctionEnd FunctionEnd
Function CheckAndInstallDotNet
nsExec::ExecToStack /OEM 'cmd /c dir "%windir%\system32" | dotnet --list-runtimes | find /c /i "Microsoft.NETCore.App 8"'
Pop $0
Pop $1
StrCpy $2 $1 1
StrCmp $2 "1" 0 version_not_found
goto version_found
version_not_found:
inetc::get "https://aka.ms/dotnet/8.0/windowsdesktop-runtime-win-x64.exe" $TEMP\dotnet-runtime-win-x64.exe
ExecWait "$TEMP\dotnet-runtime-win-x64.exe /install /quiet /norestart"
Delete "$TEMP\dotnet-runtime-win-x64.exe"
version_found:
FunctionEnd
Function createDesktopShortcut Function createDesktopShortcut
CreateShortcut "$DESKTOP\VRCX.lnk" "$INSTDIR\VRCX.exe" CreateShortcut "$DESKTOP\VRCX.lnk" "$INSTDIR\VRCX.exe"
FunctionEnd FunctionEnd
@@ -142,9 +162,10 @@ Section "Install" SecInstall
inetc::get "https://aka.ms/vs/17/release/vc_redist.x64.exe" $TEMP\vcredist_x64.exe inetc::get "https://aka.ms/vs/17/release/vc_redist.x64.exe" $TEMP\vcredist_x64.exe
ExecWait "$TEMP\vcredist_x64.exe /install /quiet /norestart" ExecWait "$TEMP\vcredist_x64.exe /install /quiet /norestart"
Delete "$TEMP\vcredist_x64.exe" Delete "$TEMP\vcredist_x64.exe"
VSRedistInstalled: VSRedistInstalled:
Call CheckAndInstallDotNet
SetOutPath "$INSTDIR" SetOutPath "$INSTDIR"
File /r /x *.log /x *.pdb "..\bin\x64\Release\*.*" File /r /x *.log /x *.pdb "..\bin\x64\Release\*.*"
+2 -25
View File
@@ -1,18 +1,7 @@
using System.Reflection; using System.Reflection;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Runtime.Versioning;
// 어셈블리에 대한 일반 정보는 다음 특성 집합을 통해
// 제어됩니다. 어셈블리와 관련된 정보를 수정하려면
// 이러한 특성 값을 변경하세요.
[assembly: AssemblyTitle("VRCX")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("VRCX")]
[assembly: AssemblyCopyright("vrcx-team, pypy, natsumi")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// ComVisible을 false로 설정하면 이 어셈블리의 형식이 COM 구성 요소에 // ComVisible을 false로 설정하면 이 어셈블리의 형식이 COM 구성 요소에
// 표시되지 않습니다. COM에서 이 어셈블리의 형식에 액세스하려면 // 표시되지 않습니다. COM에서 이 어셈블리의 형식에 액세스하려면
@@ -21,16 +10,4 @@ using System.Runtime.InteropServices;
// 이 프로젝트가 COM에 노출되는 경우 다음 GUID는 typelib의 ID를 나타냅니다. // 이 프로젝트가 COM에 노출되는 경우 다음 GUID는 typelib의 ID를 나타냅니다.
[assembly: Guid("d9f66f2e-3ed9-4d53-a6ac-adcc1513562a")] [assembly: Guid("d9f66f2e-3ed9-4d53-a6ac-adcc1513562a")]
[assembly: SupportedOSPlatform("windows")]
// 어셈블리의 버전 정보는 다음 네 가지 값으로 구성됩니다.
//
// 주 버전
// 부 버전
// 빌드 번호
// 수정 버전
//
// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호가 자동으로
// 지정되도록 할 수 있습니다.
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
+55 -174
View File
@@ -1,65 +1,51 @@
<?xml version="1.0" encoding="utf-8"?> <Project Sdk="Microsoft.NET.Sdk">
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{D9F66F2E-3ED9-4D53-A6AC-ADCC1513562A}</ProjectGuid>
<OutputType>WinExe</OutputType> <OutputType>WinExe</OutputType>
<RootNamespace>VRCX</RootNamespace> <TargetFrameworks>net8-windows10.0.19041.0</TargetFrameworks>
<AssemblyName>VRCX</AssemblyName> <Platforms>x64</Platforms>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion> <UseWindowsForms>true</UseWindowsForms>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<IsWebBootstrapper>false</IsWebBootstrapper>
<TargetFrameworkProfile />
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision> <ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion> <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust> <AssemblyTitle>VRCX</AssemblyTitle>
<BootstrapperEnabled>true</BootstrapperEnabled> <Product>VRCX</Product>
<Copyright>vrcx-team, pypy, natsumi</Copyright>
<OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
<Title>VRCX</Title>
<Description>VRCX</Description>
<PackageIcon>VRCX.png</PackageIcon>
<RepositoryUrl>https://github.com/vrcx-team/VRCX</RepositoryUrl>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<ApplicationIcon>VRCX.ico</ApplicationIcon> <ApplicationIcon>VRCX.ico</ApplicationIcon>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<StartupObject /> <StartupObject />
<CefSharpExcludeSubProcessExe>true</CefSharpExcludeSubProcessExe>
</PropertyGroup>
<PropertyGroup Condition="'$(PlatformTarget)' == 'x64'">
<RuntimeIdentifier Condition="'$(RuntimeIdentifier)' == ''">win-x64</RuntimeIdentifier>
<SelfContained Condition="'$(SelfContained)' == ''">false</SelfContained>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<ApplicationManifest>app.manifest</ApplicationManifest> <ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup> </PropertyGroup>
<PropertyGroup>
<ContentSQLiteInteropFiles>true</ContentSQLiteInteropFiles>
<CopySQLiteInteropFiles>false</CopySQLiteInteropFiles>
<CleanSQLiteInteropFiles>false</CleanSQLiteInteropFiles>
<CollectSQLiteInteropFiles>false</CollectSQLiteInteropFiles>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Blake2Sharp"> <Reference Include="Blake2Sharp">
<HintPath>librsync.net\Blake2Sharp.dll</HintPath> <HintPath>librsync.net\Blake2Sharp.dll</HintPath>
@@ -67,95 +53,37 @@
<Reference Include="librsync.net"> <Reference Include="librsync.net">
<HintPath>librsync.net\librsync.net.dll</HintPath> <HintPath>librsync.net\librsync.net.dll</HintPath>
</Reference> </Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.IO.Compression.FileSystem" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Dotnet\AppApi\AppApi.cs" /> <Compile Update="Dotnet\MainForm.cs">
<Compile Include="Dotnet\AppApi\Folders.cs" />
<Compile Include="Dotnet\AppApi\GameHandler.cs" />
<Compile Include="Dotnet\AppApi\LocalPlayerModerations.cs" />
<Compile Include="Dotnet\AppApi\RegistryPlayerPrefs.cs" />
<Compile Include="Dotnet\AppApi\Screenshot.cs" />
<Compile Include="Dotnet\AppApi\VrcConfigFile.cs" />
<Compile Include="Dotnet\AppApi\XSOverlay.cs" />
<Compile Include="Dotnet\AssetBundleCacher.cs" />
<Compile Include="Dotnet\AutoAppLaunchManager.cs" />
<Compile Include="Dotnet\Cef\CefCustomDownloadHandler.cs" />
<Compile Include="Dotnet\Cef\CefCustomDragHandler.cs" />
<Compile Include="Dotnet\Cef\CefCustomMenuHandler.cs" />
<Compile Include="Dotnet\Cef\CefService.cs" />
<Compile Include="Dotnet\Cef\CefNoopDragHandler.cs" />
<Compile Include="Dotnet\CpuMonitor.cs" />
<Compile Include="Dotnet\Discord.cs" />
<Compile Include="Dotnet\ImageCache.cs" />
<Compile Include="Dotnet\IPC\IPCClient.cs" />
<Compile Include="Dotnet\IPC\IPCPacket.cs" />
<Compile Include="Dotnet\IPC\IPCServer.cs" />
<Compile Include="Dotnet\JsonSerializer.cs" />
<Compile Include="Dotnet\LogWatcher.cs" />
<Compile Include="Dotnet\MainForm.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
<Compile Include="Dotnet\MainForm.Designer.cs"> <Compile Update="Dotnet\MainForm.Designer.cs">
<DependentUpon>MainForm.cs</DependentUpon> <DependentUpon>MainForm.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="Dotnet\OpenVR\openvr_api.cs" /> <Compile Update="Dotnet\Overlay\VRForm.cs">
<Compile Include="Dotnet\Overlay\OffScreenBrowser.cs" />
<Compile Include="Dotnet\Overlay\VRCXVR.cs" />
<Compile Include="Dotnet\Overlay\VRForm.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
<Compile Include="Dotnet\Overlay\VRForm.Designer.cs"> <Compile Update="Dotnet\Overlay\VRForm.Designer.cs">
<DependentUpon>VRForm.cs</DependentUpon> <DependentUpon>VRForm.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="Dotnet\ProcessMonitor.cs" /> <Compile Update="Dotnet\WinformBase.cs">
<Compile Include="Dotnet\Program.cs" />
<Compile Include="Dotnet\PWI\WorldDatabase.cs" />
<Compile Include="Dotnet\PWI\WorldDataRequestResponse.cs" />
<Compile Include="Dotnet\PWI\WorldDBManager.cs" />
<Compile Include="Dotnet\ScreenshotMetadata\ScreenshotHelper.cs" />
<Compile Include="Dotnet\ScreenshotMetadata\ScreenshotMetadata.cs" />
<Compile Include="Dotnet\ScreenshotMetadata\ScreenshotMetadataDatabase.cs" />
<Compile Include="Dotnet\SharedVariable.cs" />
<Compile Include="Dotnet\SQLite.cs" />
<Compile Include="Dotnet\SQLiteLegacy.cs" />
<Compile Include="Dotnet\StartupArgs.cs" />
<Compile Include="Dotnet\Update.cs" />
<Compile Include="Dotnet\Util.cs" />
<Compile Include="Dotnet\VRCXStorage.cs" />
<Compile Include="Dotnet\WebApi.cs" />
<Compile Include="Dotnet\WinApi.cs" />
<Compile Include="Dotnet\WinformBase.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
<Compile Include="Dotnet\WinformThemer.cs" /> <EmbeddedResource Update="Dotnet\MainForm.resx">
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Dotnet\MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon> <DependentUpon>MainForm.cs</DependentUpon>
<SubType>Designer</SubType> <SubType>Designer</SubType>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="Dotnet\Overlay\VRForm.resx"> <EmbeddedResource Update="Dotnet\Overlay\VRForm.resx">
<DependentUpon>VRForm.cs</DependentUpon> <DependentUpon>VRForm.cs</DependentUpon>
<SubType>Designer</SubType> <SubType>Designer</SubType>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx"> <EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator> <Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput> <LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType> <SubType>Designer</SubType>
</EmbeddedResource> </EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs"> <Compile Update="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen> <AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon> <DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime> <DesignTime>True</DesignTime>
@@ -165,7 +93,7 @@
<Generator>SettingsSingleFileGenerator</Generator> <Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput> <LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None> </None>
<Compile Include="Properties\Settings.Designer.cs"> <Compile Update="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen> <AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon> <DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput> <DesignTimeSharedInput>True</DesignTimeSharedInput>
@@ -174,9 +102,6 @@
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None> </None>
</ItemGroup> </ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="openvr_api.dll"> <Content Include="openvr_api.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
@@ -192,66 +117,22 @@
</Content> </Content>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.5.2"> <PackageReference Include="CefSharp.OffScreen.NETCore" Version="119.1.20" />
<Visible>False</Visible> <PackageReference Include="CefSharp.WinForms.NETCore" Version="119.1.20" />
<ProductName>Microsoft .NET Framework 4.5.2 %28x86 and x64%29</ProductName> <PackageReference Include="DiscordRichPresence" Version="1.2.1.24" />
<Install>true</Install> <PackageReference Include="Microsoft.Toolkit.Uwp.Notifications" Version="7.1.3" />
</BootstrapperPackage> <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1"> <PackageReference Include="NLog" Version="5.2.5" />
<Visible>False</Visible> <PackageReference Include="SharpDX.Direct3D11" Version="4.2.0" />
<ProductName>.NET Framework 3.5 SP1</ProductName> <PackageReference Include="SharpDX.Mathematics" Version="4.2.0" />
<Install>false</Install> <PackageReference Include="System.Data.SQLite.Core" Version="1.0.118" />
</BootstrapperPackage> <PackageReference Include="System.Drawing.Common" Version="4.7.2" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
<PackageReference Include="System.Text.Json" Version="8.0.0" />
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<PackageReference Include="CefSharp.Common"> <Target Name="CefSharpAfterBuildDebug" AfterTargets="AfterBuild">
<Version>119.1.20</Version> <CallTarget Targets="CefSharpAfterBuildDiagnostic" />
</PackageReference> </Target>
<PackageReference Include="CefSharp.OffScreen">
<Version>119.1.20</Version>
</PackageReference>
<PackageReference Include="CefSharp.WinForms">
<Version>119.1.20</Version>
</PackageReference>
<PackageReference Include="DiscordRichPresence">
<Version>1.2.1.24</Version>
</PackageReference>
<PackageReference Include="Microsoft.Toolkit.Uwp.Notifications">
<Version>7.1.3</Version>
</PackageReference>
<PackageReference Include="Newtonsoft.Json">
<Version>13.0.3</Version>
</PackageReference>
<PackageReference Include="NLog">
<Version>5.2.5</Version>
</PackageReference>
<PackageReference Include="SharpDX.D3DCompiler">
<Version>4.2.0</Version>
</PackageReference>
<PackageReference Include="SharpDX.Desktop">
<Version>4.2.0</Version>
</PackageReference>
<PackageReference Include="SharpDX.Direct2D1">
<Version>4.2.0</Version>
</PackageReference>
<PackageReference Include="SharpDX.Direct3D11">
<Version>4.2.0</Version>
</PackageReference>
<PackageReference Include="SharpDX.Mathematics">
<Version>4.2.0</Version>
</PackageReference>
<PackageReference Include="System.Data.SQLite.Core">
<Version>1.0.118</Version>
</PackageReference>
<PackageReference Include="System.Text.Json">
<Version>7.0.3</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<ContentSQLiteInteropFiles>true</ContentSQLiteInteropFiles>
<CopySQLiteInteropFiles>false</CopySQLiteInteropFiles>
<CleanSQLiteInteropFiles>false</CleanSQLiteInteropFiles>
<CollectSQLiteInteropFiles>false</CollectSQLiteInteropFiles>
</PropertyGroup>
</Project> </Project>
+8 -3
View File
@@ -1,9 +1,14 @@
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16 # Visual Studio Version 17
VisualStudioVersion = 16.0.31605.320 VisualStudioVersion = 17.8.34309.116
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VRCX", "VRCX.csproj", "{D9F66F2E-3ED9-4D53-A6AC-ADCC1513562A}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VRCX", "VRCX.csproj", "{D9F66F2E-3ED9-4D53-A6AC-ADCC1513562A}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8612F19B-3C1F-4B17-8679-A2747A53EC6B}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
EndProjectSection
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
+1 -1
View File
@@ -1,4 +1,4 @@
@echo off @echo off
msbuild VRCX.sln -p:Configuration=Release -p:Platform=x64 -p:RestorePackagesConfig=true -t:"Restore;Clean;Build" -m dotnet build VRCX.sln -p:Configuration=Release -p:Platform=x64 -p:RestorePackagesConfig=true -t:"Restore;Clean;Build" -m
mklink /J "%~dp0\bin\x64\Release\html" "%~dp0\html\dist" mklink /J "%~dp0\bin\x64\Release\html" "%~dp0\html\dist"
pause pause
+2 -1
View File
@@ -87,6 +87,7 @@
"sort-vars": 0, "sort-vars": 0,
"strict": 0, "strict": 0,
"vars-on-top": 0, "vars-on-top": 0,
"object-curly-spacing": ["error", "always"] "object-curly-spacing": ["error", "always"],
"require-atomic-updates": 0
} }
} }
+501 -364
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -1677,7 +1677,7 @@ html
el-tooltip(placement="right" :content="$t('dialog.launch.copy_tooltip')" :disabled="hideTooltips") el-tooltip(placement="right" :content="$t('dialog.launch.copy_tooltip')" :disabled="hideTooltips")
el-button(@click="copyInstanceMessage(launchDialog.location)" size="mini" icon="el-icon-s-order" style="margin-right:5px" circle) el-button(@click="copyInstanceMessage(launchDialog.location)" size="mini" icon="el-icon-s-order" style="margin-right:5px" circle)
template(#footer) template(#footer)
el-checkbox(v-model="launchDialog.desktop" style="float:left;margin-top:5px") {{ $t('dialog.launch.start_as_desktop') }} el-checkbox(v-model="launchDialog.desktop" @change="saveLaunchDialog" style="float:left;margin-top:5px") {{ $t('dialog.launch.start_as_desktop') }}
el-button(size="small" @click="showPreviousInstanceInfoDialog(launchDialog.location)") {{ $t('dialog.launch.info') }} el-button(size="small" @click="showPreviousInstanceInfoDialog(launchDialog.location)") {{ $t('dialog.launch.info') }}
el-button(size="small" @click="showInviteDialog(launchDialog.location)" :disabled="!checkCanInvite(launchDialog.location)") {{ $t('dialog.launch.invite') }} el-button(size="small" @click="showInviteDialog(launchDialog.location)" :disabled="!checkCanInvite(launchDialog.location)") {{ $t('dialog.launch.invite') }}
el-button(type="primary" size="small" @click="launchGame(launchDialog.location, launchDialog.shortName, launchDialog.desktop)" :disabled="!launchDialog.secureOrShortName") {{ $t('dialog.launch.launch') }} el-button(type="primary" size="small" @click="launchGame(launchDialog.location, launchDialog.shortName, launchDialog.desktop)" :disabled="!launchDialog.secureOrShortName") {{ $t('dialog.launch.launch') }}
+5 -5
View File
@@ -13,7 +13,7 @@ async function syncLoop() {
await sqliteService.executeNonQuery('BEGIN'); await sqliteService.executeNonQuery('BEGIN');
try { try {
for (var key of dirtyKeySet) { for (var key of dirtyKeySet) {
var value = sharedRepository.getString(key); var value = await sharedRepository.getString(key);
if (value === null) { if (value === null) {
await sqliteService.executeNonQuery( await sqliteService.executeNonQuery(
'DELETE FROM configs WHERE `key` = @key', 'DELETE FROM configs WHERE `key` = @key',
@@ -54,9 +54,9 @@ class ConfigRepository extends SharedRepository {
syncLoop(); syncLoop();
} }
remove(key) { async remove(key) {
var _key = transformKey(key); var _key = transformKey(key);
sharedRepository.remove(_key); await sharedRepository.remove(_key);
dirtyKeySet.add(_key); dirtyKeySet.add(_key);
} }
@@ -65,10 +65,10 @@ class ConfigRepository extends SharedRepository {
return sharedRepository.getString(_key, defaultValue); return sharedRepository.getString(_key, defaultValue);
} }
setString(key, value) { async setString(key, value) {
var _key = transformKey(key); var _key = transformKey(key);
var _value = String(value); var _value = String(value);
sharedRepository.setString(_key, _value); await sharedRepository.setString(_key, _value);
dirtyKeySet.add(_key); dirtyKeySet.add(_key);
} }
} }
+24 -24
View File
@@ -10,35 +10,35 @@ class SharedRepository {
return SharedVariable.Remove(_key); return SharedVariable.Remove(_key);
} }
getString(key, defaultValue = null) { async getString(key, defaultValue = null) {
var _key = transformKey(key); var _key = transformKey(key);
var value = SharedVariable.Get(_key); var value = await SharedVariable.Get(_key);
if (value === null) { if (value === null) {
return defaultValue; return defaultValue;
} }
return value; return value;
} }
setString(key, value) { async setString(key, value) {
var _key = transformKey(key); var _key = transformKey(key);
var _value = String(value); var _value = String(value);
SharedVariable.Set(_key, _value); await SharedVariable.Set(_key, _value);
} }
getBool(key, defaultValue = null) { async getBool(key, defaultValue = null) {
var value = this.getString(key, null); var value = await this.getString(key, null);
if (value === null) { if (value === null) {
return defaultValue; return defaultValue;
} }
return value === 'true'; return value === 'true';
} }
setBool(key, value) { async setBool(key, value) {
this.setString(key, value ? 'true' : 'false'); await this.setString(key, value ? 'true' : 'false');
} }
getInt(key, defaultValue = null) { async getInt(key, defaultValue = null) {
var value = this.getString(key, null); var value = await this.getString(key, null);
if (value === null) { if (value === null) {
return defaultValue; return defaultValue;
} }
@@ -49,12 +49,12 @@ class SharedRepository {
return value; return value;
} }
setInt(key, value) { async setInt(key, value) {
this.setString(key, value); await this.setString(key, value);
} }
getFloat(key, defaultValue = null) { async getFloat(key, defaultValue = null) {
var value = this.getString(key, null); var value = await this.getString(key, null);
if (value === null) { if (value === null) {
return defaultValue; return defaultValue;
} }
@@ -65,12 +65,12 @@ class SharedRepository {
return value; return value;
} }
setFloat(key, value) { async setFloat(key, value) {
this.setString(key, value); await this.setString(key, value);
} }
getObject(key, defaultValue = null) { async getObject(key, defaultValue = null) {
var value = this.getString(key, null); var value = await this.getString(key, null);
if (value === null) { if (value === null) {
return defaultValue; return defaultValue;
} }
@@ -83,20 +83,20 @@ class SharedRepository {
return value; return value;
} }
setObject(key, value) { async setObject(key, value) {
this.setString(key, JSON.stringify(value)); await this.setString(key, JSON.stringify(value));
} }
getArray(key, defaultValue = null) { async getArray(key, defaultValue = null) {
var value = this.getObject(key, null); var value = await this.getObject(key, null);
if (Array.isArray(value) === false) { if (Array.isArray(value) === false) {
return defaultValue; return defaultValue;
} }
return value; return value;
} }
setArray(key, value) { async setArray(key, value) {
this.setObject(key, value); await this.setObject(key, value);
} }
} }