From ab6d46a69097cb0834bd84003d56b4eaced320fc Mon Sep 17 00:00:00 2001 From: biwa <6475593+biwa@users.noreply.github.com> Date: Thu, 2 Jun 2022 00:06:27 +0200 Subject: [PATCH] Visplane Explorer Mode: fixed an issue where detecting nodes type failed in certain situations --- Source/Plugins/VisplaneExplorer/VisplaneExplorerMode.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Source/Plugins/VisplaneExplorer/VisplaneExplorerMode.cs b/Source/Plugins/VisplaneExplorer/VisplaneExplorerMode.cs index 76c320db..707165d9 100755 --- a/Source/Plugins/VisplaneExplorer/VisplaneExplorerMode.cs +++ b/Source/Plugins/VisplaneExplorer/VisplaneExplorerMode.cs @@ -5,7 +5,8 @@ using System.Collections.Generic; using System.Drawing; using System.Drawing.Imaging; using System.IO; -using System.Runtime.InteropServices; +using System.Linq; +using System.Text; using System.Windows.Forms; using CodeImp.DoomBuilder.Data; using CodeImp.DoomBuilder.Editing; @@ -250,11 +251,11 @@ namespace CodeImp.DoomBuilder.Plugins.VisplaneExplorer using (BinaryReader reader = new BinaryReader(stream)) { - List formats = new List { "ZNOD", "XNOD" }; + List formats = new List { Encoding.ASCII.GetBytes("ZNOD"), Encoding.ASCII.GetBytes("XNOD") }; - string nodesformat = new string(reader.ReadChars(4)); + byte[] format = reader.ReadBytes(4); - if (formats.Contains(nodesformat)) + if(formats.Any(f => f.SequenceEqual(format))) throw new Exception("ZDBSP nodes detected. This format is not supporeted by the Visplane Explorer Mode"); } }