From f359bb73672f094289b1dfc8602180201d5a1d28 Mon Sep 17 00:00:00 2001 From: Anairkoen Schno Date: Sun, 5 Aug 2018 21:13:40 -0500 Subject: [PATCH] Fixed a lot of things * No static HasKey in ModPrefs * SteamCheck not working correctly * Updater not creating directories like it should --- IPA/Properties/AssemblyInfo.cs | 4 ++-- IllusionInjector/Logging/StandardLogger.cs | 1 - IllusionInjector/Updating/Backup/BackupUnit.cs | 3 ++- IllusionInjector/Updating/ModsaberML/Updater.cs | 4 +++- IllusionInjector/Updating/SelfPlugin.cs | 2 +- IllusionInjector/Utilities/SteamCheck.cs | 11 +++++++---- IllusionPlugin/ModPrefs.cs | 10 +++++----- 7 files changed, 20 insertions(+), 15 deletions(-) diff --git a/IPA/Properties/AssemblyInfo.cs b/IPA/Properties/AssemblyInfo.cs index 26f940c5..8bf8c45a 100644 --- a/IPA/Properties/AssemblyInfo.cs +++ b/IPA/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("3.8.3")] -[assembly: AssemblyFileVersion("3.8.3")] +[assembly: AssemblyVersion("3.8.4")] +[assembly: AssemblyFileVersion("3.8.4")] diff --git a/IllusionInjector/Logging/StandardLogger.cs b/IllusionInjector/Logging/StandardLogger.cs index 40e347db..4b4a329a 100644 --- a/IllusionInjector/Logging/StandardLogger.cs +++ b/IllusionInjector/Logging/StandardLogger.cs @@ -124,7 +124,6 @@ namespace IllusionInjector.Logging { try { - if (((byte)msg.level & (byte)printer.Filter) != 0) { if (!started.Contains(printer)) diff --git a/IllusionInjector/Updating/Backup/BackupUnit.cs b/IllusionInjector/Updating/Backup/BackupUnit.cs index 547540d6..3aad5ab0 100644 --- a/IllusionInjector/Updating/Backup/BackupUnit.cs +++ b/IllusionInjector/Updating/Backup/BackupUnit.cs @@ -26,6 +26,7 @@ namespace IllusionInjector.Updating.Backup { Name = name; _BackupPath = new DirectoryInfo(Path.Combine(backupPath, Name)); + _BackupPath.Create(); } public static BackupUnit FromDirectory(DirectoryInfo directory, string backupPath) @@ -71,7 +72,7 @@ namespace IllusionInjector.Updating.Backup backupPath.Directory.Create(); if (file.Exists) { - file.CopyTo(backupPath.FullName); + file.CopyTo(backupPath.FullName, true); } else { // Make empty file diff --git a/IllusionInjector/Updating/ModsaberML/Updater.cs b/IllusionInjector/Updating/ModsaberML/Updater.cs index 062dafb9..5318d54a 100644 --- a/IllusionInjector/Updating/ModsaberML/Updater.cs +++ b/IllusionInjector/Updating/ModsaberML/Updater.cs @@ -175,7 +175,6 @@ namespace IllusionInjector.Updating.ModsaberML protected override bool ReceiveData(byte[] data, int dataLength) { - Logger.log.Debug("ReceiveData"); if (data == null || data.Length < 1) { Logger.log.Debug("CustomWebRequest :: ReceiveData - received a null/empty buffer"); @@ -240,6 +239,7 @@ namespace IllusionInjector.Updating.ModsaberML ostream.Seek(0, SeekOrigin.Begin); FileInfo targetFile = new FileInfo(Path.Combine(Environment.CurrentDirectory, entry.FileName)); + Directory.CreateDirectory(targetFile.DirectoryName); if (targetFile.FullName == item.plugin.Filename) shouldDeleteOldFile = false; // overwriting old file, no need to delete @@ -287,6 +287,8 @@ namespace IllusionInjector.Updating.ModsaberML IEnumerator UpdateModCoroutine(UpdateStruct item, string tempDirectory) { + Logger.log.Debug($"Steam avaliable: {SteamCheck.IsAvailable}"); + ApiEndpoint.Mod.PlatformFile platformFile; if (SteamCheck.IsAvailable || item.externInfo.OculusFile == null) platformFile = item.externInfo.SteamFile; diff --git a/IllusionInjector/Updating/SelfPlugin.cs b/IllusionInjector/Updating/SelfPlugin.cs index 7d08f614..4916b980 100644 --- a/IllusionInjector/Updating/SelfPlugin.cs +++ b/IllusionInjector/Updating/SelfPlugin.cs @@ -12,7 +12,7 @@ namespace IllusionInjector.Updating internal class SelfPlugin : IBeatSaberPlugin { internal const string IPA_Name = "Beat Saber IPA"; - internal const string IPA_Version = "3.8.3"; + internal const string IPA_Version = "3.8.4"; public string Name => IPA_Name; diff --git a/IllusionInjector/Utilities/SteamCheck.cs b/IllusionInjector/Utilities/SteamCheck.cs index 00f829af..a4f9624b 100644 --- a/IllusionInjector/Utilities/SteamCheck.cs +++ b/IllusionInjector/Utilities/SteamCheck.cs @@ -1,4 +1,5 @@ -using System; +using IllusionInjector.Logging; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -15,9 +16,11 @@ namespace IllusionInjector.Utilities private static bool FindSteamVRAsset() { - SteamVRCamera = Type.GetType("SteamVR_Camera", false); - SteamVRExternalCamera = Type.GetType("SteamVR_ExternalCamera", false); - SteamVRFade = Type.GetType("SteamVR_Fade", false); + // these require assembly qualified names.... + SteamVRCamera = Type.GetType("SteamVR_Camera, Assembly-CSharp-firstpass, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", false); + SteamVRExternalCamera = Type.GetType("SteamVR_ExternalCamera, Assembly-CSharp-firstpass, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", false); + SteamVRFade = Type.GetType("SteamVR_Fade, Assembly-CSharp-firstpass, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", false); + return SteamVRCamera != null && SteamVRExternalCamera != null && SteamVRFade != null; } } diff --git a/IllusionPlugin/ModPrefs.cs b/IllusionPlugin/ModPrefs.cs index 0db65aff..198cc6aa 100644 --- a/IllusionPlugin/ModPrefs.cs +++ b/IllusionPlugin/ModPrefs.cs @@ -125,7 +125,7 @@ namespace IllusionPlugin if (value != "") return value; else if (autoSave) - SetString(section, name, defaultValue); + (this as IModPrefs).SetString(section, name, defaultValue); return defaultValue; } @@ -145,7 +145,7 @@ namespace IllusionPlugin if (int.TryParse(Instance.IniReadValue(section, name), out var value)) return value; else if (autoSave) - SetInt(section, name, defaultValue); + (this as IModPrefs).SetInt(section, name, defaultValue); return defaultValue; } @@ -165,7 +165,7 @@ namespace IllusionPlugin if (float.TryParse(Instance.IniReadValue(section, name), out var value)) return value; else if (autoSave) - SetFloat(section, name, defaultValue); + (this as IModPrefs).SetFloat(section, name, defaultValue); return defaultValue; } @@ -188,7 +188,7 @@ namespace IllusionPlugin return sVal == "1"; } else if (autoSave) { - SetBool(section, name, defaultValue); + (this as IModPrefs).SetBool(section, name, defaultValue); } return defaultValue; @@ -214,7 +214,7 @@ namespace IllusionPlugin /// Section of the key. /// Name of the key. /// - public bool HasKey(string section, string name) => StaticInstace.HasKey(section, name); + public static bool HasKey(string section, string name) => StaticInstace.HasKey(section, name); void IModPrefs.SetFloat(string section, string name, float value) {