summaryrefslogtreecommitdiff
path: root/NW4RTools
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--NW4RTools.sln9
-rw-r--r--NW4RTools/BrresReader.cs14
-rw-r--r--NW4RTools/Logger.cs20
-rw-r--r--NW4RTools/ResFile.cs2
-rwxr-xr-xNW4RTools/bin/Debug/NW4RTools.dllbin238592 -> 239104 bytes
-rw-r--r--NW4RTools/bin/Debug/NW4RTools.dll.mdbbin114661 -> 114935 bytes
6 files changed, 39 insertions, 6 deletions
diff --git a/NW4RTools.sln b/NW4RTools.sln
index 224f5e3..953e643 100644
--- a/NW4RTools.sln
+++ b/NW4RTools.sln
@@ -5,12 +5,18 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NW4RTools", "NW4RTools\NW4R
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestApp", "TestApp\TestApp.csproj", "{3A064CD8-CFAD-412D-986F-ED7D2D54CDB1}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp", "ConsoleApp\ConsoleApp.csproj", "{0EDC614B-9673-48A3-BB48-3D6CC54D20ED}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {0EDC614B-9673-48A3-BB48-3D6CC54D20ED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {0EDC614B-9673-48A3-BB48-3D6CC54D20ED}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {0EDC614B-9673-48A3-BB48-3D6CC54D20ED}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {0EDC614B-9673-48A3-BB48-3D6CC54D20ED}.Release|Any CPU.Build.0 = Release|Any CPU
{3A064CD8-CFAD-412D-986F-ED7D2D54CDB1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3A064CD8-CFAD-412D-986F-ED7D2D54CDB1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3A064CD8-CFAD-412D-986F-ED7D2D54CDB1}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -38,12 +44,11 @@ Global
$3.MethodBraceStyle = EndOfLine
$3.ConstructorBraceStyle = EndOfLine
$3.DestructorBraceStyle = EndOfLine
- $3.BeforeMethodDeclarationParentheses = False
$3.BeforeMethodCallParentheses = False
+ $3.BeforeMethodDeclarationParentheses = False
$3.BeforeConstructorDeclarationParentheses = False
$3.BeforeDelegateDeclarationParentheses = False
$3.NewParentheses = False
- $3.SpacesBeforeBrackets = False
$3.inheritsSet = Mono
$3.inheritsScope = text/x-csharp
$3.scope = text/x-csharp
diff --git a/NW4RTools/BrresReader.cs b/NW4RTools/BrresReader.cs
index d5db720..aa54437 100644
--- a/NW4RTools/BrresReader.cs
+++ b/NW4RTools/BrresReader.cs
@@ -7,7 +7,11 @@ using NW4RTools.Models;
namespace NW4RTools {
public class BrresReader {
public static ResFile LoadFile(byte[] data) {
- return new BrresReader().Load(new InputStream(data, ByteEndian.BigEndian));
+ return LoadFile(data, true);
+ }
+
+ public static ResFile LoadFile(byte[] data, bool debug) {
+ return new BrresReader(debug).Load(new InputStream(data, ByteEndian.BigEndian));
}
@@ -21,8 +25,12 @@ namespace NW4RTools {
private ILogger Debug;
private SortedDictionary<int, string> OffsetMap;
- private BrresReader() {
- Debug = new ConsoleLogger();
+ private BrresReader(bool debug) {
+ if (debug)
+ Debug = new ConsoleLogger();
+ else
+ Debug = new NullLogger();
+
OffsetMap = new SortedDictionary<int, string>();
}
diff --git a/NW4RTools/Logger.cs b/NW4RTools/Logger.cs
index a6fbb70..9f7d063 100644
--- a/NW4RTools/Logger.cs
+++ b/NW4RTools/Logger.cs
@@ -24,6 +24,26 @@ namespace NW4RTools {
void Unblock();
}
+ public class NullLogger : ILogger {
+ public NullLogger() { }
+
+ public void Send(string format, params object[] args) {
+ }
+
+ public LogContext Push(string format, params object[] args) {
+ return new LogContext(this);
+ }
+
+ public void Pop() {
+ }
+
+ public void Block() {
+ }
+
+ public void Unblock() {
+ }
+ }
+
public class ConsoleLogger : ILogger {
private List<string> PrefixElements;
private List<string> Names;
diff --git a/NW4RTools/ResFile.cs b/NW4RTools/ResFile.cs
index 4f4a1b8..aae0038 100644
--- a/NW4RTools/ResFile.cs
+++ b/NW4RTools/ResFile.cs
@@ -19,7 +19,7 @@ namespace NW4RTools {
}
public ResDict<TValue> GetGroup<TValue>(string name) {
- return this[name] as ResDict<TValue>;
+ return ContainsKey(name) ? (this[name] as ResDict<TValue>) : null;
}
diff --git a/NW4RTools/bin/Debug/NW4RTools.dll b/NW4RTools/bin/Debug/NW4RTools.dll
index 9b33424..3e86a0a 100755
--- a/NW4RTools/bin/Debug/NW4RTools.dll
+++ b/NW4RTools/bin/Debug/NW4RTools.dll
Binary files differ
diff --git a/NW4RTools/bin/Debug/NW4RTools.dll.mdb b/NW4RTools/bin/Debug/NW4RTools.dll.mdb
index 183dfbb..1bff220 100644
--- a/NW4RTools/bin/Debug/NW4RTools.dll.mdb
+++ b/NW4RTools/bin/Debug/NW4RTools.dll.mdb
Binary files differ