diff --git a/IllusionInjector/BeatSaber/CompositeBSPlugin.cs b/IllusionInjector/BeatSaber/CompositeBSPlugin.cs
index 37dba73b..cc4c26c7 100644
--- a/IllusionInjector/BeatSaber/CompositeBSPlugin.cs
+++ b/IllusionInjector/BeatSaber/CompositeBSPlugin.cs
@@ -82,7 +82,7 @@ namespace IllusionInjector {
get { throw new NotImplementedException(); }
}
- public string Version {
+ public Version Version {
get { throw new NotImplementedException(); }
}
diff --git a/IllusionInjector/Bootstrapper.cs b/IllusionInjector/Bootstrapper.cs
index 8af36da4..f7f8db54 100644
--- a/IllusionInjector/Bootstrapper.cs
+++ b/IllusionInjector/Bootstrapper.cs
@@ -13,10 +13,10 @@ namespace IllusionInjector
void Awake()
{
- if (Environment.CommandLine.Contains("--verbose") && !Screen.fullScreen)
- {
+ //if (Environment.CommandLine.Contains("--verbose"))
+ //{
Windows.GuiConsole.CreateConsole();
- }
+ //}
Application.logMessageReceived += delegate (string condition, string stackTrace, LogType type)
{
diff --git a/IllusionInjector/IllusionInjector.csproj b/IllusionInjector/IllusionInjector.csproj
index 48a39058..dae9245d 100644
--- a/IllusionInjector/IllusionInjector.csproj
+++ b/IllusionInjector/IllusionInjector.csproj
@@ -34,6 +34,9 @@
false
+
+ ..\packages\Ionic.Zlib.1.9.1.5\lib\Ionic.Zlib.dll
+
@@ -45,9 +48,6 @@
..\Libs\UnityEngine.CoreModule.dll
False
-
- ..\packages\zlib.net.1.0.4.0\lib\zlib.net.dll
-
@@ -56,7 +56,7 @@
-
+
diff --git a/IllusionInjector/Logging/Printers/GlobalZFIlePrinter.cs b/IllusionInjector/Logging/Printers/GlobalZFIlePrinter.cs
index 67d7cd5a..5d8f8b7d 100644
--- a/IllusionInjector/Logging/Printers/GlobalZFIlePrinter.cs
+++ b/IllusionInjector/Logging/Printers/GlobalZFIlePrinter.cs
@@ -1,44 +1,45 @@
using IllusionPlugin.Logging;
+using Ionic.Zlib;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
-using zlib;
namespace IllusionInjector.Logging.Printers
{
- public class GlobalZFIlePrinter : LogPrinter
+ public class GlobalZFilePrinter : LogPrinter
{
- public override IllusionPlugin.Logging.Logger.LogLevel Filter { get; set; }
+ public override IllusionPlugin.Logging.Logger.LogLevel Filter { get; set; } = IllusionPlugin.Logging.Logger.LogLevel.All;
private FileInfo fileInfo;
private StreamWriter fileWriter;
+ private GZipStream zstream;
+ private FileStream fstream;
private static FileInfo GetFileInfo()
{
var logsDir = new DirectoryInfo("Logs");
logsDir.Create();
- var finfo = new FileInfo(Path.Combine(logsDir.FullName, $"{DateTime.Now:YYYY.MM.DD.HH.MM}.log.z"));
+ var finfo = new FileInfo(Path.Combine(logsDir.FullName, $"{DateTime.Now:yyyy.MM.dd.HH.MM}.log.z"));
finfo.Create().Close();
return finfo;
}
- public GlobalZFIlePrinter()
+ public GlobalZFilePrinter()
{
fileInfo = GetFileInfo();
}
public override void StartPrint()
{
- fileWriter = new StreamWriter(
- new ZOutputStream(fileInfo.Open(FileMode.Append, FileAccess.Write, FileShare.Read))
- {
- FlushMode = zlibConst.Z_FULL_FLUSH
- },
- Encoding.UTF8
- );
+ fstream = fileInfo.Open(FileMode.Append, FileAccess.Write);
+ zstream = new GZipStream(fstream, CompressionMode.Compress)
+ {
+ FlushMode = FlushType.Full
+ };
+ fileWriter = new StreamWriter(zstream, Encoding.UTF8);
}
public override void Print(IllusionPlugin.Logging.Logger.Level level, DateTime time, string logName, string message)
@@ -49,7 +50,15 @@ namespace IllusionInjector.Logging.Printers
public override void EndPrint()
{
+ fileWriter.Flush();
+ zstream.Flush();
+ fstream.Flush();
+ fileWriter.Close();
+ zstream.Close();
+ fstream.Close();
fileWriter.Dispose();
+ zstream.Dispose();
+ fstream.Dispose();
}
}
}
diff --git a/IllusionInjector/Logging/Printers/PluginLogFilePrinter.cs b/IllusionInjector/Logging/Printers/PluginLogFilePrinter.cs
index af46ee6e..de573470 100644
--- a/IllusionInjector/Logging/Printers/PluginLogFilePrinter.cs
+++ b/IllusionInjector/Logging/Printers/PluginLogFilePrinter.cs
@@ -10,7 +10,7 @@ namespace IllusionInjector.Logging.Printers
{
public class PluginLogFilePrinter : LogPrinter
{
- public override IllusionPlugin.Logging.Logger.LogLevel Filter { get; set; }
+ public override IllusionPlugin.Logging.Logger.LogLevel Filter { get; set; } = IllusionPlugin.Logging.Logger.LogLevel.All;
private FileInfo fileInfo;
private StreamWriter fileWriter;
@@ -19,7 +19,7 @@ namespace IllusionInjector.Logging.Printers
{
var logsDir = new DirectoryInfo(Path.Combine("Logs",modName));
logsDir.Create();
- var finfo = new FileInfo(Path.Combine(logsDir.FullName, $"{DateTime.Now:YYYY.MM.DD.HH.MM}.log"));
+ var finfo = new FileInfo(Path.Combine(logsDir.FullName, $"{DateTime.Now:yyyy.MM.dd.HH.MM}.log"));
finfo.CreateText().Close();
return finfo;
}
@@ -42,6 +42,8 @@ namespace IllusionInjector.Logging.Printers
public override void EndPrint()
{
+ fileWriter.Flush();
+ fileWriter.Close();
fileWriter.Dispose();
}
}
diff --git a/IllusionInjector/Logging/StandardLogger.cs b/IllusionInjector/Logging/StandardLogger.cs
index 0ebb402c..c506c325 100644
--- a/IllusionInjector/Logging/StandardLogger.cs
+++ b/IllusionInjector/Logging/StandardLogger.cs
@@ -55,7 +55,7 @@ namespace IllusionInjector.Logging
Filter = LogLevel.CriticalOnly,
Color = ConsoleColor.Magenta,
},
- new GlobalZFIlePrinter()
+ new GlobalZFilePrinter()
};
private string logName;
@@ -104,22 +104,39 @@ namespace IllusionInjector.Logging
while (_logQueue.TryTake(out LogMessage msg, Timeout.Infinite)) {
foreach (var printer in msg.logger.printers)
{
- if (((byte)msg.level & (byte)printer.Filter) != 0)
+ try
{
- if (!started.Contains(printer))
+
+ if (((byte)msg.level & (byte)printer.Filter) != 0)
{
- printer.StartPrint();
- started.Add(printer);
- }
+ if (!started.Contains(printer))
+ {
+ printer.StartPrint();
+ started.Add(printer);
+ }
- printer.Print(msg.level, msg.time, msg.logger.logName, msg.message);
+ printer.Print(msg.level, msg.time, msg.logger.logName, msg.message);
+ }
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine($"printer errored {e}");
}
}
if (_logQueue.Count == 0)
{
foreach (var printer in started)
- printer.EndPrint();
+ {
+ try
+ {
+ printer.EndPrint();
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine($"printer errored {e}");
+ }
+ }
started.Clear();
}
}
diff --git a/IllusionInjector/PluginManager.cs b/IllusionInjector/PluginManager.cs
index 06dc1158..bf0a5ec2 100644
--- a/IllusionInjector/PluginManager.cs
+++ b/IllusionInjector/PluginManager.cs
@@ -101,6 +101,11 @@ namespace IllusionInjector
Logger.log.Info($"{plugin.Name}: {plugin.Version}");
}
Logger.log.Info("-----------------------------");
+ foreach (var plugin in _ipaPlugins)
+ {
+ Logger.log.Info($"{plugin.Name}: {plugin.Version}");
+ }
+ Logger.log.Info("-----------------------------");
}
private static Tuple, IEnumerable> LoadPluginsFromFile(string file, string exeName)
diff --git a/IllusionInjector/obj/Debug/IllusionInjector.csproj.CoreCompileInputs.cache b/IllusionInjector/obj/Debug/IllusionInjector.csproj.CoreCompileInputs.cache
index 320879d5..6c5e77d0 100644
--- a/IllusionInjector/obj/Debug/IllusionInjector.csproj.CoreCompileInputs.cache
+++ b/IllusionInjector/obj/Debug/IllusionInjector.csproj.CoreCompileInputs.cache
@@ -1 +1 @@
-8c1883c8697a3dc7189ee9ff1c9d85d453a46fe5
+479f561c6be8784a5830081167b62f103b95e138
diff --git a/IllusionInjector/packages.config b/IllusionInjector/packages.config
index c76aa60f..9795940b 100644
--- a/IllusionInjector/packages.config
+++ b/IllusionInjector/packages.config
@@ -1,4 +1,4 @@
-
+
\ No newline at end of file
diff --git a/IllusionPlugin/BeatSaber/IBeatSaberPlugin.cs b/IllusionPlugin/BeatSaber/IBeatSaberPlugin.cs
index 8a692109..1f35af29 100644
--- a/IllusionPlugin/BeatSaber/IBeatSaberPlugin.cs
+++ b/IllusionPlugin/BeatSaber/IBeatSaberPlugin.cs
@@ -20,7 +20,7 @@ namespace IllusionPlugin
///
/// Gets the version of the plugin.
///
- string Version { get; }
+ Version Version { get; }
///
/// Gets invoked when the application is started.