Skip to content

Commit

Permalink
reorg some other files
Browse files Browse the repository at this point in the history
  • Loading branch information
BenjaminSutas committed Oct 25, 2023
1 parent 6607fef commit b4e95e8
Show file tree
Hide file tree
Showing 14 changed files with 18 additions and 17 deletions.
2 changes: 1 addition & 1 deletion OpenLocoTool/DatFileParsing/Typedefs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
global using Speed32 = System.Int32;
global using MicroZ = System.Byte;
global using SoundObjectId = System.Byte;
global using StringTable = System.Collections.Generic.Dictionary<(int, OpenLocoTool.DatFileParsing.LanguageId), string>;
global using StringTable = System.Collections.Generic.Dictionary<(int, OpenLocoTool.LanguageId), string>;
using System.ComponentModel;

namespace OpenLocoTool.DatFileParsing
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace OpenLocoTool.DataFiles
namespace OpenLocoTool
{
public static class ImageIds
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace OpenLocoTool.DatFileParsing
namespace OpenLocoTool
{
public enum LanguageId : uint8_t
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace OpenLocoTool.DataFiles
namespace OpenLocoTool
{
public static class OriginalDataFiles
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace OpenLocoTool.DataFiles
namespace OpenLocoTool
{
// these are indexed to the strings in OriginalDateFiles.cs
public enum OriginalDataPathIds : uint8_t
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace OpenLocoTool
{
public static class OriginalObjects
public static class OriginalObjectFiles
{
public static readonly HashSet<string> Names = new()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace OpenLocoTool.DatFileParsing
namespace OpenLocoTool
{
public enum SawyerEncoding : byte
{
Expand Down
1 change: 1 addition & 0 deletions OpenLocoTool/Objects/CargoObject.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.ComponentModel;
using OpenLocoTool.DatFileParsing;
using OpenLocoTool.Headers;
using OpenLocoTool;

namespace OpenLocoTool.Objects
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Reflection;
using System.Text;

namespace OpenLocoTool
namespace OpenLocoToolCommon
{
public static class ReflectionLogger
{
Expand Down
8 changes: 4 additions & 4 deletions OpenLocoToolGui/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,12 @@ ImageList MakeImageList(MainFormModel model)

static void AddObjectNode(string key, string text, string objName, TreeView tv)
{
var imageIndex = OriginalObjects.Names.Contains(objName.Trim()) ? 1 : 0;
var imageIndex = OriginalObjectFiles.Names.Contains(objName.Trim()) ? 1 : 0;
_ = tv.Nodes.Add(key, text, imageIndex, imageIndex);
}
static void AddObjectNode(string key, string text, string objName, TreeNode tn)
{
var imageIndex = OriginalObjects.Names.Contains(objName.Trim()) ? 1 : 0;
var imageIndex = OriginalObjectFiles.Names.Contains(objName.Trim()) ? 1 : 0;
_ = tn.Nodes.Add(key, text, imageIndex, imageIndex);
}

Expand All @@ -208,7 +208,7 @@ void InitFileTreeView(bool vanillaOnly, string fileFilter)
? model.HeaderIndex
: model.HeaderIndex.Where(hdr => hdr.Key.Contains(fileFilter, StringComparison.InvariantCultureIgnoreCase));

filteredFiles = filteredFiles.Where(f => !vanillaOnly || OriginalObjects.Names.Contains(f.Value.Name.Trim()));
filteredFiles = filteredFiles.Where(f => !vanillaOnly || OriginalObjectFiles.Names.Contains(f.Value.Name.Trim()));

tvFileTree.ImageList = MakeImageList(model);

Expand Down Expand Up @@ -251,7 +251,7 @@ void InitCategoryTreeView(bool vanillaOnly, string fileFilter)
? model.HeaderIndex
: model.HeaderIndex.Where(hdr => hdr.Key.Contains(fileFilter, StringComparison.InvariantCultureIgnoreCase));

filteredFiles = filteredFiles.Where(f => !vanillaOnly || OriginalObjects.Names.Contains(f.Value.Name.Trim()));
filteredFiles = filteredFiles.Where(f => !vanillaOnly || OriginalObjectFiles.Names.Contains(f.Value.Name.Trim()));

tvObjType.ImageList = MakeImageList(model);

Expand Down
1 change: 0 additions & 1 deletion OpenLocoToolGui/MainFormModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using OpenLocoTool.Objects;
using OpenLocoToolCommon;
using OpenLocoTool.Headers;
using OpenLocoTool.DataFiles;

namespace OpenLocoToolGui
{
Expand Down
7 changes: 4 additions & 3 deletions OpenLocoToolTests/ObjectLoadingTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using NUnit.Framework;
using OpenLocoTool;
using OpenLocoTool.DatFileParsing;
using OpenLocoTool.Headers;
using OpenLocoTool.Objects;
Expand Down Expand Up @@ -158,11 +159,11 @@ public void LoadCargoObject()

Assert.Multiple(() =>
{
Assert.That(obj.Name, Is.EqualTo(0), nameof(obj.Name));
Assert.That(obj.Name, Is.EqualTo(string.Empty), nameof(obj.Name));
Assert.That(obj.var_02, Is.EqualTo(256), nameof(obj.var_02));
Assert.That(obj.var_04, Is.EqualTo(64), nameof(obj.var_04));
Assert.That(obj.UnitsAndCargoName, Is.EqualTo(0), nameof(obj.UnitsAndCargoName));
Assert.That(obj.UnitNameSingular, Is.EqualTo(0), nameof(obj.UnitNameSingular));
Assert.That(obj.UnitsAndCargoName, Is.EqualTo(string.Empty), nameof(obj.UnitsAndCargoName));
Assert.That(obj.UnitNameSingular, Is.EqualTo(string.Empty), nameof(obj.UnitNameSingular));
Assert.That(obj.UnitInlineSprite, Is.EqualTo(0), nameof(obj.UnitInlineSprite));
Assert.That(obj.MatchFlags, Is.EqualTo(4), nameof(obj.MatchFlags));
Assert.That(obj.Flags, Is.EqualTo(CargoObjectFlags.Delivering), nameof(obj.Flags));
Expand Down
2 changes: 1 addition & 1 deletion OpenLocoToolTests/ObjectSavingTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public void WriteLocoStruct()
var loaded = ssr.LoadFull(testFile);

// load data in raw bytes for test
ReadOnlySpan<byte> fullData = ssr.LoadBytesFromFile(testFile);
ReadOnlySpan<byte> fullData = SawyerStreamReader.LoadBytesFromFile(testFile);

// make openlocotool useful objects
var s5Header = S5Header.Read(fullData[0..S5Header.StructLength]);
Expand Down

0 comments on commit b4e95e8

Please sign in to comment.