From dea420be7c1c6ac99dad556bfbe01654e8035f84 Mon Sep 17 00:00:00 2001 From: Will Date: Mon, 8 Feb 2016 02:44:02 -0700 Subject: [PATCH] Add a constructor for Entities accepting a FileInfo. --- LibBSP/Source/Structs/Common/Lumps/Entities.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/LibBSP/Source/Structs/Common/Lumps/Entities.cs b/LibBSP/Source/Structs/Common/Lumps/Entities.cs index 859b2f3..cb2818b 100644 --- a/LibBSP/Source/Structs/Common/Lumps/Entities.cs +++ b/LibBSP/Source/Structs/Common/Lumps/Entities.cs @@ -1,4 +1,5 @@ using System; +using System.IO; using System.Collections.Generic; namespace LibBSP { @@ -24,10 +25,18 @@ namespace LibBSP { /// public Entities() : base() { } + /// + /// Initializes a new object, parsing all the bytes in the passed . + /// + /// The file to read. + /// The of the source map. + public Entities(FileInfo file, MapType type) : this(File.ReadAllBytes(file.FullName), type) { } + /// /// Initializes a new object, and parses the passed byte array into the List. /// /// Bytes read from a file. + /// The of the source map. public Entities(byte[] data, MapType type) : base() { // Keep track of whether or not we're currently in a set of quotation marks. // I came across a map where the idiot map maker used { and } within a value. This broke the code before.