Skip to content

Commit 9443a42

Browse files
committed
Added compatibility for .frdt files
Also cleaned up the code a little
1 parent 59ff123 commit 9443a42

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

Diff for: Program.cs

+4-7
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ static bool ToJSON(Dictionary<string, Assembly> libraries)
8888
{
8989
OpenFileDialog ofd = new OpenFileDialog()
9090
{
91-
Filter = "Resonite DataTree File (*.brson;*.lz4bson;*.7zbson)|*.brson;*.lz4bson;*.7zbson",
91+
Filter = "Resonite DataTree File (*.frdt;*.brson;*.lz4bson;*.7zbson)|*.frdt;*.brson;*.lz4bson;*.7zbson",
9292
Title = "Choose a DataTree file for conversion",
9393
CheckFileExists = true,
9494
CheckPathExists = true,
@@ -124,13 +124,10 @@ static bool ToJSON(Dictionary<string, Assembly> libraries)
124124
StreamWriter fileStream = File.CreateText(save.FileName);
125125

126126
libraries.TryGetValue("Newtonsoft.Json", out Assembly NewtonsoftJson);
127-
Console.WriteLine(NewtonsoftJson.GetTypes());
128-
ConstructorInfo aaaaaa = NewtonsoftJson.GetType("Newtonsoft.Json.JsonTextWriter").GetConstructor(new Type[] {typeof(TextWriter)});
129-
object testy = aaaaaa.Invoke(new object[] { fileStream });
130-
//object testy = NewtonsoftJson.GetType("JsonTextWriter").GetConstructor(new Type[] { NewtonsoftJson.GetType("Newtonsoft.Json.JsonTextWriter") }).Invoke(null, new object[] { fileStream });
131-
//JsonTextWriter test = new JsonTextWriter(fileStream);
127+
ConstructorInfo jsonTextWriterConstructor = NewtonsoftJson.GetType("Newtonsoft.Json.JsonTextWriter").GetConstructor(new Type[] {typeof(TextWriter)});
128+
object jsonTextWriter = jsonTextWriterConstructor.Invoke(new object[] { fileStream });
132129
var writemethod = dataTreeConverter.GetMethod("Write", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static);
133-
writemethod.Invoke(null, new object[] { convert, testy });
130+
writemethod.Invoke(null, new object[] { convert, jsonTextWriter });
134131

135132
fileStream.Dispose();
136133
fileStream.Close();

Diff for: README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Resonite DataTree Converter
22

3-
This Windows tool allows you to convert any Resonite DataTree object file (.brson, .7zbson, .lz4bson) to JSON and vice-versa.
3+
This Windows tool allows you to convert any Resonite DataTree object file (.frdt, .brson, .7zbson, .lz4bson) to JSON and vice-versa.
4+
(To save a json file back to .frdt, save it as any other file type, then rename the extension. Yes, that is how it works.)
45

56
This tool uses Resonite's libraries to convert them, so it sohuld hopefully work for the forseeable future. This tool saves the location that you selected for Resonite in `%LOCALAPPDATA%/Lexevolution/Resonite DataTree Converter/app.config`.

0 commit comments

Comments
 (0)