cleanup code

This commit is contained in:
pypy
2020-11-08 15:32:14 +09:00
parent 0e5054d159
commit 7a1067e21c
12 changed files with 19 additions and 19 deletions

View File

@@ -16,7 +16,7 @@ namespace VRCX
{
public class AppApi
{
public static AppApi Instance { get; private set; }
public static readonly AppApi Instance;
static AppApi()
{

View File

@@ -7,7 +7,7 @@ namespace VRCX
{
public class CefService
{
public static CefService Instance { get; private set; }
public static readonly CefService Instance;
static CefService()
{

View File

@@ -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;

View File

@@ -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;

View File

@@ -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<string, LogContext> m_LogContextMap; // <FileName, LogContext>
private readonly ReaderWriterLockSlim m_LogListLock;

View File

@@ -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();
}
}
}

View File

@@ -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;

View File

@@ -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<string, string> m_Map;

View File

@@ -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<string, string> m_Storage = new Dictionary<string, string>();
private static string m_JsonPath = Path.Combine(Program.BaseDirectory, "VRCX.json");

View File

@@ -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();

View File

@@ -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()
{

View File

@@ -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);
}