diff --git a/Browser.cs b/Browser.cs index f2923aeb..bc434c43 100644 --- a/Browser.cs +++ b/Browser.cs @@ -6,6 +6,7 @@ using CefSharp; using CefSharp.OffScreen; using SharpDX.Direct3D11; +using System; using System.Drawing; using System.Threading; @@ -52,7 +53,7 @@ namespace VRCX { var context = m_Texture.Device.ImmediateContext; var box = context.MapSubresource(m_Texture, 0, MapMode.WriteDiscard, MapFlags.None); - if (!box.IsEmpty) + if (box.DataPointer != IntPtr.Zero) { if (box.RowPitch == H.Width * 4) { diff --git a/Discord.cs b/Discord.cs index 09475805..afd2b4cd 100644 --- a/Discord.cs +++ b/Discord.cs @@ -61,10 +61,7 @@ namespace VRCX client = null; } } - if (client != null) - { - client.Dispose(); - } + client?.Dispose(); }) { IsBackground = true diff --git a/LogWatcher.cs b/LogWatcher.cs index 332390f3..db7d0981 100644 --- a/LogWatcher.cs +++ b/LogWatcher.cs @@ -63,11 +63,11 @@ namespace VRCX if (di.Exists) { var files = di.GetFiles("output_log_*.txt", SearchOption.TopDirectoryOnly); - Array.Sort(files, (A, B) => A.CreationTime.CompareTo(B.CreationTime)); - var bias = DateTime.Now.AddMinutes(-5d); + Array.Sort(files, (A, B) => A.CreationTimeUtc.CompareTo(B.CreationTimeUtc)); + var bias = DateTime.UtcNow.AddMinutes(-5d); foreach (var fi in files) { - if (bias.CompareTo(fi.LastWriteTime) <= 0) + if (bias.CompareTo(fi.LastWriteTimeUtc) <= 0) { fi.Refresh(); } diff --git a/VRCXStorage.cs b/VRCXStorage.cs index ca415356..6effc296 100644 --- a/VRCXStorage.cs +++ b/VRCXStorage.cs @@ -58,9 +58,9 @@ namespace VRCX { if (m_Storage.Count > 0) { + m_Storage.Clear(); m_Dirty = true; } - m_Storage.Clear(); } finally { diff --git a/VRCXVR.cs b/VRCXVR.cs index 8d7b4363..ffeda980 100644 --- a/VRCXVR.cs +++ b/VRCXVR.cs @@ -98,13 +98,13 @@ namespace VRCX var system = OpenVR.System; if (system == null) { - if (DateTime.Now.CompareTo(nextInit) <= 0) + if (DateTime.UtcNow.CompareTo(nextInit) <= 0) { continue; } var _err = EVRInitError.None; system = OpenVR.Init(ref _err, EVRApplicationType.VRApplication_Overlay); - nextInit = DateTime.Now.AddSeconds(5); + nextInit = DateTime.UtcNow.AddSeconds(5); if (system == null) { continue; @@ -118,22 +118,22 @@ namespace VRCX { active = false; OpenVR.Shutdown(); - nextInit = DateTime.Now.AddSeconds(10); + nextInit = DateTime.UtcNow.AddSeconds(10); system = null; break; } } if (system != null) { - if (DateTime.Now.CompareTo(nextDeviceUpdate) >= 0) + if (DateTime.UtcNow.CompareTo(nextDeviceUpdate) >= 0) { overlayIndex = OpenVR.k_unTrackedDeviceIndexInvalid; UpdateDevices(system, ref overlayIndex); if (overlayIndex != OpenVR.k_unTrackedDeviceIndexInvalid) { - nextOverlay = DateTime.Now.AddSeconds(10); + nextOverlay = DateTime.UtcNow.AddSeconds(10); } - nextDeviceUpdate = DateTime.Now.AddSeconds(0.1); + nextDeviceUpdate = DateTime.UtcNow.AddSeconds(0.1); } var overlay = OpenVR.Overlay; if (overlay != null) @@ -457,7 +457,7 @@ namespace VRCX } if (!dashboardVisible && - DateTime.Now.CompareTo(nextOverlay) <= 0) + DateTime.UtcNow.CompareTo(nextOverlay) <= 0) { var texture = new Texture_t {