mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-24 01:03:50 +02:00
Split AppApi
This commit is contained in:
36
Dotnet/AppApi/VrcConfigFile.cs
Normal file
36
Dotnet/AppApi/VrcConfigFile.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace VRCX
|
||||
{
|
||||
public partial class AppApi
|
||||
{
|
||||
/// <summary>
|
||||
/// Reads the VRChat config file and returns its contents as a string.
|
||||
/// </summary>
|
||||
/// <returns>The contents of the VRChat config file as a string, or an empty string if the file does not exist.</returns>
|
||||
public string ReadConfigFile()
|
||||
{
|
||||
var logPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"Low\VRChat\VRChat\";
|
||||
var configFile = Path.Combine(logPath, "config.json");
|
||||
if (!Directory.Exists(logPath) || !File.Exists(configFile))
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
var json = File.ReadAllText(configFile);
|
||||
return json;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Writes the specified JSON string to the VRChat config file.
|
||||
/// </summary>
|
||||
/// <param name="json">The JSON string to write to the config file.</param>
|
||||
public void WriteConfigFile(string json)
|
||||
{
|
||||
var logPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"Low\VRChat\VRChat\";
|
||||
var configFile = Path.Combine(logPath, "config.json");
|
||||
File.WriteAllText(configFile, json);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user