Browse Source

Fixed a lot of things

* No static HasKey in ModPrefs
* SteamCheck not working correctly
* Updater not creating directories like it should
refactor
Anairkoen Schno 6 years ago
parent
commit
c2643ba70e
7 changed files with 20 additions and 15 deletions
  1. +2
    -2
      IPA/Properties/AssemblyInfo.cs
  2. +0
    -1
      IllusionInjector/Logging/StandardLogger.cs
  3. +2
    -1
      IllusionInjector/Updating/Backup/BackupUnit.cs
  4. +3
    -1
      IllusionInjector/Updating/ModsaberML/Updater.cs
  5. +1
    -1
      IllusionInjector/Updating/SelfPlugin.cs
  6. +7
    -4
      IllusionInjector/Utilities/SteamCheck.cs
  7. +5
    -5
      IllusionPlugin/ModPrefs.cs

+ 2
- 2
IPA/Properties/AssemblyInfo.cs View File

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("3.8.3")]
[assembly: AssemblyFileVersion("3.8.3")]
[assembly: AssemblyVersion("3.8.4")]
[assembly: AssemblyFileVersion("3.8.4")]

+ 0
- 1
IllusionInjector/Logging/StandardLogger.cs View File

@ -124,7 +124,6 @@ namespace IllusionInjector.Logging
{ {
try try
{ {
if (((byte)msg.level & (byte)printer.Filter) != 0) if (((byte)msg.level & (byte)printer.Filter) != 0)
{ {
if (!started.Contains(printer)) if (!started.Contains(printer))


+ 2
- 1
IllusionInjector/Updating/Backup/BackupUnit.cs View File

@ -26,6 +26,7 @@ namespace IllusionInjector.Updating.Backup
{ {
Name = name; Name = name;
_BackupPath = new DirectoryInfo(Path.Combine(backupPath, Name)); _BackupPath = new DirectoryInfo(Path.Combine(backupPath, Name));
_BackupPath.Create();
} }
public static BackupUnit FromDirectory(DirectoryInfo directory, string backupPath) public static BackupUnit FromDirectory(DirectoryInfo directory, string backupPath)
@ -71,7 +72,7 @@ namespace IllusionInjector.Updating.Backup
backupPath.Directory.Create(); backupPath.Directory.Create();
if (file.Exists) if (file.Exists)
{ {
file.CopyTo(backupPath.FullName);
file.CopyTo(backupPath.FullName, true);
} else } else
{ {
// Make empty file // Make empty file


+ 3
- 1
IllusionInjector/Updating/ModsaberML/Updater.cs View File

@ -175,7 +175,6 @@ namespace IllusionInjector.Updating.ModsaberML
protected override bool ReceiveData(byte[] data, int dataLength) protected override bool ReceiveData(byte[] data, int dataLength)
{ {
Logger.log.Debug("ReceiveData");
if (data == null || data.Length < 1) if (data == null || data.Length < 1)
{ {
Logger.log.Debug("CustomWebRequest :: ReceiveData - received a null/empty buffer"); Logger.log.Debug("CustomWebRequest :: ReceiveData - received a null/empty buffer");
@ -240,6 +239,7 @@ namespace IllusionInjector.Updating.ModsaberML
ostream.Seek(0, SeekOrigin.Begin); ostream.Seek(0, SeekOrigin.Begin);
FileInfo targetFile = new FileInfo(Path.Combine(Environment.CurrentDirectory, entry.FileName)); FileInfo targetFile = new FileInfo(Path.Combine(Environment.CurrentDirectory, entry.FileName));
Directory.CreateDirectory(targetFile.DirectoryName);
if (targetFile.FullName == item.plugin.Filename) if (targetFile.FullName == item.plugin.Filename)
shouldDeleteOldFile = false; // overwriting old file, no need to delete shouldDeleteOldFile = false; // overwriting old file, no need to delete
@ -287,6 +287,8 @@ namespace IllusionInjector.Updating.ModsaberML
IEnumerator UpdateModCoroutine(UpdateStruct item, string tempDirectory) IEnumerator UpdateModCoroutine(UpdateStruct item, string tempDirectory)
{ {
Logger.log.Debug($"Steam avaliable: {SteamCheck.IsAvailable}");
ApiEndpoint.Mod.PlatformFile platformFile; ApiEndpoint.Mod.PlatformFile platformFile;
if (SteamCheck.IsAvailable || item.externInfo.OculusFile == null) if (SteamCheck.IsAvailable || item.externInfo.OculusFile == null)
platformFile = item.externInfo.SteamFile; platformFile = item.externInfo.SteamFile;


+ 1
- 1
IllusionInjector/Updating/SelfPlugin.cs View File

@ -12,7 +12,7 @@ namespace IllusionInjector.Updating
internal class SelfPlugin : IBeatSaberPlugin internal class SelfPlugin : IBeatSaberPlugin
{ {
internal const string IPA_Name = "Beat Saber IPA"; 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; public string Name => IPA_Name;


+ 7
- 4
IllusionInjector/Utilities/SteamCheck.cs View File

@ -1,4 +1,5 @@
using System;
using IllusionInjector.Logging;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@ -15,9 +16,11 @@ namespace IllusionInjector.Utilities
private static bool FindSteamVRAsset() 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; return SteamVRCamera != null && SteamVRExternalCamera != null && SteamVRFade != null;
} }
} }


+ 5
- 5
IllusionPlugin/ModPrefs.cs View File

@ -125,7 +125,7 @@ namespace IllusionPlugin
if (value != "") if (value != "")
return value; return value;
else if (autoSave) else if (autoSave)
SetString(section, name, defaultValue);
(this as IModPrefs).SetString(section, name, defaultValue);
return defaultValue; return defaultValue;
} }
@ -145,7 +145,7 @@ namespace IllusionPlugin
if (int.TryParse(Instance.IniReadValue(section, name), out var value)) if (int.TryParse(Instance.IniReadValue(section, name), out var value))
return value; return value;
else if (autoSave) else if (autoSave)
SetInt(section, name, defaultValue);
(this as IModPrefs).SetInt(section, name, defaultValue);
return defaultValue; return defaultValue;
} }
@ -165,7 +165,7 @@ namespace IllusionPlugin
if (float.TryParse(Instance.IniReadValue(section, name), out var value)) if (float.TryParse(Instance.IniReadValue(section, name), out var value))
return value; return value;
else if (autoSave) else if (autoSave)
SetFloat(section, name, defaultValue);
(this as IModPrefs).SetFloat(section, name, defaultValue);
return defaultValue; return defaultValue;
} }
@ -188,7 +188,7 @@ namespace IllusionPlugin
return sVal == "1"; return sVal == "1";
} else if (autoSave) } else if (autoSave)
{ {
SetBool(section, name, defaultValue);
(this as IModPrefs).SetBool(section, name, defaultValue);
} }
return defaultValue; return defaultValue;
@ -214,7 +214,7 @@ namespace IllusionPlugin
/// <param name="section">Section of the key.</param> /// <param name="section">Section of the key.</param>
/// <param name="name">Name of the key.</param> /// <param name="name">Name of the key.</param>
/// <returns></returns> /// <returns></returns>
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) void IModPrefs.SetFloat(string section, string name, float value)
{ {


Loading…
Cancel
Save