|
@@ -285,10 +285,12 @@ namespace CM3D2.MultipleMaids.Plugin
|
|
|
private void ReadScene()
|
|
|
{
|
|
|
string filePath = scenes[selectedScene].info.FullName;
|
|
|
+
|
|
|
+ sceneData = null;
|
|
|
+
|
|
|
if (!File.Exists(filePath))
|
|
|
{
|
|
|
RefreshSceneManager();
|
|
|
- sceneData = null;
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -301,7 +303,7 @@ namespace CM3D2.MultipleMaids.Plugin
|
|
|
{
|
|
|
if (pos < 0)
|
|
|
{
|
|
|
- sceneData = null;
|
|
|
+ Util.Logger.Log(LogLevel.Error, $"Could not read '{Path.GetFileName(filePath)}'");
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -314,7 +316,7 @@ namespace CM3D2.MultipleMaids.Plugin
|
|
|
}
|
|
|
fileStream.Position += 4;
|
|
|
|
|
|
- byte[] kankyo = new byte[6];
|
|
|
+ byte[] kankyo = new byte[kankyoHeader.Length];
|
|
|
fileStream.Read(kankyo, 0, kankyo.Length);
|
|
|
|
|
|
if (BytesEqual(kankyo, kankyoHeader))
|
|
@@ -324,13 +326,19 @@ namespace CM3D2.MultipleMaids.Plugin
|
|
|
else
|
|
|
{
|
|
|
kankyoScene = false;
|
|
|
- fileStream.Position -= 6;
|
|
|
+ fileStream.Position -= kankyoHeader.Length;
|
|
|
}
|
|
|
|
|
|
- using (MemoryStream sceneStream = LZMA.Decompress(fileStream))
|
|
|
+ try
|
|
|
+ {
|
|
|
+ using (var sceneStream = LZMA.Decompress(fileStream))
|
|
|
+ {
|
|
|
+ sceneData = Encoding.Unicode.GetString(sceneStream.ToArray());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (Exception e)
|
|
|
{
|
|
|
- sceneData = Encoding.Unicode.GetString(sceneStream.ToArray());
|
|
|
- return;
|
|
|
+ Util.Logger.Log(LogLevel.Error, $"Failed to decompress scene data because '{e}'\n");
|
|
|
}
|
|
|
}
|
|
|
}
|