diff --git a/AppApi.cs b/AppApi.cs index 343eaad3..de298931 100644 --- a/AppApi.cs +++ b/AppApi.cs @@ -16,7 +16,7 @@ namespace VRCX { public class AppApi { - public static AppApi Instance { get; private set; } + public static readonly AppApi Instance; static AppApi() { diff --git a/CefService.cs b/CefService.cs index 7e7d541d..434e38c5 100644 --- a/CefService.cs +++ b/CefService.cs @@ -7,7 +7,7 @@ namespace VRCX { public class CefService { - public static CefService Instance { get; private set; } + public static readonly CefService Instance; static CefService() { diff --git a/CpuMonitor.cs b/CpuMonitor.cs index cdb8f168..59ca2f77 100644 --- a/CpuMonitor.cs +++ b/CpuMonitor.cs @@ -10,7 +10,7 @@ namespace VRCX { public class CpuMonitor { - public static CpuMonitor Instance { get; private set; } + public static readonly CpuMonitor Instance; public float CpuUsage { get; private set; } private readonly PerformanceCounter m_Counter; private Thread m_Thread; diff --git a/Discord.cs b/Discord.cs index 2c5a41d8..cc57280d 100644 --- a/Discord.cs +++ b/Discord.cs @@ -11,7 +11,7 @@ namespace VRCX { public class Discord { - public static Discord Instance { get; private set; } + public static readonly Discord Instance; private readonly ReaderWriterLockSlim m_Lock; private readonly RichPresence m_Presence; private DiscordRpcClient m_Client; diff --git a/LogWatcher.cs b/LogWatcher.cs index c57772e0..1e3113f5 100644 --- a/LogWatcher.cs +++ b/LogWatcher.cs @@ -20,7 +20,7 @@ namespace VRCX public long Position; } - public static LogWatcher Instance { get; private set; } + public static readonly LogWatcher Instance; private readonly DirectoryInfo m_LogDirectoryInfo; private readonly Dictionary m_LogContextMap; // private readonly ReaderWriterLockSlim m_LogListLock; diff --git a/MainForm.cs b/MainForm.cs index e1ef4b71..6ce23246 100644 --- a/MainForm.cs +++ b/MainForm.cs @@ -15,8 +15,8 @@ namespace VRCX { public partial class MainForm : Form { - public static MainForm Instance { get; private set; } - public ChromiumWebBrowser Browser { get; private set; } + public static MainForm Instance; + public ChromiumWebBrowser Browser; private int LastLocationX; private int LastLocationY; private int LastSizeWidth; @@ -162,6 +162,5 @@ namespace VRCX { Application.Exit(); } - } } diff --git a/SQLite.cs b/SQLite.cs index ebaefd19..60648c42 100644 --- a/SQLite.cs +++ b/SQLite.cs @@ -9,7 +9,7 @@ namespace VRCX { public class SQLite { - public static SQLite Instance { get; private set; } + public static readonly SQLite Instance; private readonly ReaderWriterLockSlim m_ConnectionLock; private readonly SQLiteConnection m_Connection; diff --git a/SharedVariable.cs b/SharedVariable.cs index 6fd15bca..8b51d9b6 100644 --- a/SharedVariable.cs +++ b/SharedVariable.cs @@ -10,7 +10,7 @@ namespace VRCX { public class SharedVariable { - public static SharedVariable Instance { get; private set; } + public static readonly SharedVariable Instance; private readonly ReaderWriterLockSlim m_MapLock; private readonly Dictionary m_Map; diff --git a/VRCXStorage.cs b/VRCXStorage.cs index b0799aa8..80cd09c3 100644 --- a/VRCXStorage.cs +++ b/VRCXStorage.cs @@ -12,7 +12,7 @@ namespace VRCX { public class VRCXStorage { - public static VRCXStorage Instance { get; private set; } + public static readonly VRCXStorage Instance; private static readonly ReaderWriterLockSlim m_Lock = new ReaderWriterLockSlim(); private static Dictionary m_Storage = new Dictionary(); private static string m_JsonPath = Path.Combine(Program.BaseDirectory, "VRCX.json"); diff --git a/VRChatRPC.cs b/VRChatRPC.cs index 7ce288d7..1f934b24 100644 --- a/VRChatRPC.cs +++ b/VRChatRPC.cs @@ -11,7 +11,7 @@ namespace VRCX { public class VRChatRPC { - public static VRChatRPC Instance { get; private set; } + public static readonly VRChatRPC Instance; [DllImport("VRChatRPC", CallingConvention = CallingConvention.Cdecl)] private static extern bool VRChatRPC_000(); diff --git a/VRForm.cs b/VRForm.cs index ce6b8b02..8f2addf3 100644 --- a/VRForm.cs +++ b/VRForm.cs @@ -13,9 +13,9 @@ namespace VRCX { public partial class VRForm : Form { - public static VRForm Instance { get; private set; } - public static ChromiumWebBrowser Browser1 { get; private set; } - public static ChromiumWebBrowser Browser2 { get; private set; } + public static VRForm Instance; + private ChromiumWebBrowser Browser1; + private ChromiumWebBrowser Browser2; public VRForm() { diff --git a/WebApi.cs b/WebApi.cs index 0818282d..1b52611f 100644 --- a/WebApi.cs +++ b/WebApi.cs @@ -9,8 +9,8 @@ namespace VRCX { public class WebApi { - private readonly string COOKIE_FILE_NAME = Path.Combine(Program.BaseDirectory, "cookies.dat"); - public static WebApi Instance { get; private set; } + public static readonly WebApi Instance; + private readonly string _cookieFilePath; private CookieContainer _cookieContainer; static WebApi() @@ -21,6 +21,7 @@ namespace VRCX public WebApi() { + _cookieFilePath = Path.Combine(Program.BaseDirectory, "cookies.dat"); _cookieContainer = new CookieContainer(); } @@ -28,7 +29,7 @@ namespace VRCX { try { - using (var file = File.Open(COOKIE_FILE_NAME, FileMode.Open, FileAccess.Read)) + using (var file = File.Open(_cookieFilePath, FileMode.Open, FileAccess.Read)) { _cookieContainer = (CookieContainer)new BinaryFormatter().Deserialize(file); } @@ -42,7 +43,7 @@ namespace VRCX { try { - using (var file = File.Open(COOKIE_FILE_NAME, FileMode.Create, FileAccess.Write)) + using (var file = File.Open(_cookieFilePath, FileMode.Create, FileAccess.Write)) { new BinaryFormatter().Serialize(file, _cookieContainer); }