Remove .Model namespace as it is unnecessary

This commit is contained in:
Daniel Cronqvist 2024-08-30 20:11:33 +02:00
parent 8a1da18dfd
commit d85494e7a9
98 changed files with 111 additions and 170 deletions

View file

@ -35,7 +35,7 @@ namespace DotTiled.Benchmark
[BenchmarkCategory("MapFromInMemoryTmxString")]
[Benchmark(Baseline = true, Description = "DotTiled")]
public DotTiled.Model.Map LoadWithDotTiledFromInMemoryTmxString()
public DotTiled.Map LoadWithDotTiledFromInMemoryTmxString()
{
using var stringReader = new StringReader(_tmxContents);
using var xmlReader = XmlReader.Create(stringReader);
@ -45,7 +45,7 @@ namespace DotTiled.Benchmark
[BenchmarkCategory("MapFromInMemoryTmjString")]
[Benchmark(Baseline = true, Description = "DotTiled")]
public DotTiled.Model.Map LoadWithDotTiledFromInMemoryTmjString()
public DotTiled.Map LoadWithDotTiledFromInMemoryTmjString()
{
using var mapReader = new DotTiled.Serialization.Tmj.TmjMapReader(_tmjContents, _ => throw new NotSupportedException(), _ => throw new NotSupportedException(), _ => throw new NotSupportedException());
return mapReader.ReadMap();

View file

@ -1,5 +1,3 @@
using DotTiled.Model;
namespace DotTiled.Tests;
public static partial class DotTiledAssert

View file

@ -1,5 +1,3 @@
using DotTiled.Model;
namespace DotTiled.Tests;
public static partial class DotTiledAssert

View file

@ -1,5 +1,3 @@
using DotTiled.Model;
namespace DotTiled.Tests;
public static partial class DotTiledAssert

View file

@ -1,6 +1,5 @@
using System.Collections;
using System.Numerics;
using DotTiled.Model;
namespace DotTiled.Tests;

View file

@ -1,22 +1,22 @@
using DotTiled.Model;
namespace DotTiled.Tests;
public static partial class DotTiledAssert
{
internal static void AssertObject(Model.Object expected, Model.Object actual)
internal static void AssertObject(DotTiled.Object expected, DotTiled.Object actual)
{
// Attributes
AssertEqual(expected.ID, actual.ID, nameof(Model.Object.ID));
AssertEqual(expected.Name, actual.Name, nameof(Model.Object.Name));
AssertEqual(expected.Type, actual.Type, nameof(Model.Object.Type));
AssertEqual(expected.X, actual.X, nameof(Model.Object.X));
AssertEqual(expected.Y, actual.Y, nameof(Model.Object.Y));
AssertEqual(expected.Width, actual.Width, nameof(Model.Object.Width));
AssertEqual(expected.Height, actual.Height, nameof(Model.Object.Height));
AssertEqual(expected.Rotation, actual.Rotation, nameof(Model.Object.Rotation));
AssertEqual(expected.Visible, actual.Visible, nameof(Model.Object.Visible));
AssertEqual(expected.Template, actual.Template, nameof(Model.Object.Template));
#pragma warning disable IDE0002
AssertEqual(expected.ID, actual.ID, nameof(DotTiled.Object.ID));
AssertEqual(expected.Name, actual.Name, nameof(DotTiled.Object.Name));
AssertEqual(expected.Type, actual.Type, nameof(DotTiled.Object.Type));
AssertEqual(expected.X, actual.X, nameof(DotTiled.Object.X));
AssertEqual(expected.Y, actual.Y, nameof(DotTiled.Object.Y));
AssertEqual(expected.Width, actual.Width, nameof(DotTiled.Object.Width));
AssertEqual(expected.Height, actual.Height, nameof(DotTiled.Object.Height));
AssertEqual(expected.Rotation, actual.Rotation, nameof(DotTiled.Object.Rotation));
AssertEqual(expected.Visible, actual.Visible, nameof(DotTiled.Object.Visible));
AssertEqual(expected.Template, actual.Template, nameof(DotTiled.Object.Template));
#pragma warning restore IDE0002
AssertProperties(expected.Properties, actual.Properties);

View file

@ -1,5 +1,3 @@
using DotTiled.Model;
namespace DotTiled.Tests;
public static partial class DotTiledAssert

View file

@ -1,5 +1,3 @@
using DotTiled.Model;
namespace DotTiled.Tests;
public static partial class DotTiledAssert

View file

@ -1,4 +1,3 @@
using DotTiled.Model;
using DotTiled.Serialization;
namespace DotTiled.Tests;

View file

@ -1,5 +1,4 @@
using System.Xml;
using DotTiled.Model;
namespace DotTiled.Tests;

View file

@ -1,5 +1,3 @@
using DotTiled.Model;
namespace DotTiled.Tests;
public partial class TestData

View file

@ -1,5 +1,4 @@
using System.Globalization;
using DotTiled.Model;
namespace DotTiled.Tests;

View file

@ -1,5 +1,4 @@
using System.Globalization;
using DotTiled.Model;
namespace DotTiled.Tests;

View file

@ -1,5 +1,4 @@
using System.Globalization;
using DotTiled.Model;
namespace DotTiled.Tests;

View file

@ -1,5 +1,4 @@
using System.Globalization;
using DotTiled.Model;
namespace DotTiled.Tests;

View file

@ -1,5 +1,4 @@
using System.Globalization;
using DotTiled.Model;
namespace DotTiled.Tests;

View file

@ -1,5 +1,4 @@
using System.Globalization;
using DotTiled.Model;
namespace DotTiled.Tests;

View file

@ -1,5 +1,4 @@
using System.Globalization;
using DotTiled.Model;
namespace DotTiled.Tests;

View file

@ -1,5 +1,4 @@
using System.Globalization;
using DotTiled.Model;
namespace DotTiled.Tests;

View file

@ -1,5 +1,4 @@
using System.Numerics;
using DotTiled.Model;
namespace DotTiled.Tests;

View file

@ -1,4 +1,3 @@
using DotTiled.Model;
using DotTiled.Serialization.Tmj;
namespace DotTiled.Tests;

View file

@ -1,4 +1,3 @@
using DotTiled.Model;
using DotTiled.Serialization.Tmx;
namespace DotTiled.Tests;

View file

@ -2,7 +2,7 @@ using System;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
namespace DotTiled.Model;
namespace DotTiled;
/// <summary>
/// Represents a Tiled color.

View file

@ -1,6 +1,6 @@
using System.Collections.Generic;
namespace DotTiled.Model;
namespace DotTiled;
/// <summary>
/// Base class for all layer types in a map.

View file

@ -1,6 +1,6 @@
using System;
namespace DotTiled.Model;
namespace DotTiled;
/// <summary>
/// Specifies the encoding used to encode the tile layer data.

View file

@ -1,6 +1,6 @@
using System.Collections.Generic;
namespace DotTiled.Model;
namespace DotTiled;
/// <summary>
/// Represents a group of layers, to form a hierarchy.

View file

@ -1,4 +1,4 @@
namespace DotTiled.Model;
namespace DotTiled;
/// <summary>
/// Represents an image layer in a map.

View file

@ -1,6 +1,6 @@
using System.Collections.Generic;
namespace DotTiled.Model;
namespace DotTiled;
/// <summary>
/// Represents the order in which objects can be drawn.

View file

@ -1,4 +1,4 @@
namespace DotTiled.Model;
namespace DotTiled;
/// <summary>
/// An ellipse object in a map. The existing <see cref="Object.X"/>, <see cref="Object.Y"/>, <see cref="Object.Width"/>,

View file

@ -1,6 +1,6 @@
using System.Collections.Generic;
namespace DotTiled.Model;
namespace DotTiled;
/// <summary>
/// Base class for objects in object layers.

View file

@ -1,4 +1,4 @@
namespace DotTiled.Model;
namespace DotTiled;
/// <summary>
/// A point object in a map. The existing <see cref="Object.X"/> and <see cref="Object.Y"/> properties are used to

View file

@ -1,7 +1,7 @@
using System.Collections.Generic;
using System.Numerics;
namespace DotTiled.Model;
namespace DotTiled;
/// <summary>
/// A polygon object in a map. The existing <see cref="Object.X"/> and <see cref="Object.Y"/> properties are used as

View file

@ -1,7 +1,7 @@
using System.Collections.Generic;
using System.Numerics;
namespace DotTiled.Model;
namespace DotTiled;
/// <summary>
/// A polyline object in a map. The existing <see cref="Object.X"/> and <see cref="Object.Y"/> properties are used as

View file

@ -1,4 +1,4 @@
namespace DotTiled.Model;
namespace DotTiled;
/// <summary>
/// A rectangle object in a map. The existing <see cref="Object.X"/>, <see cref="Object.Y"/>, <see cref="Object.Width"/>,

View file

@ -1,6 +1,6 @@
using System.Globalization;
namespace DotTiled.Model;
namespace DotTiled;
/// <summary>
/// The horizontal alignment of text.

View file

@ -1,4 +1,4 @@
namespace DotTiled.Model;
namespace DotTiled;
/// <summary>
/// A tile object in a map.

View file

@ -1,4 +1,4 @@
namespace DotTiled.Model;
namespace DotTiled;
/// <summary>
/// Represents a tile layer in a map.

View file

@ -1,7 +1,7 @@
using System.Collections.Generic;
using System.Globalization;
namespace DotTiled.Model;
namespace DotTiled;
/// <summary>
/// Map orientation enumeration. The map orientation determines the alignment of the tiles in the map.

View file

@ -1,4 +1,4 @@
namespace DotTiled.Model;
namespace DotTiled;
/// <summary>
/// Represents a boolean property.

View file

@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
namespace DotTiled.Model;
namespace DotTiled;
/// <summary>
/// Represents a class property.
@ -14,7 +14,7 @@ public class ClassProperty : IHasProperties, IProperty<IList<IProperty>>
public required string Name { get; set; }
/// <inheritdoc/>
public PropertyType Type => Model.PropertyType.Class;
public PropertyType Type => DotTiled.PropertyType.Class;
/// <summary>
/// The type of the class property. This will be the name of a custom defined

View file

@ -1,4 +1,4 @@
namespace DotTiled.Model;
namespace DotTiled;
/// <summary>
/// Represents a color property.

View file

@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
namespace DotTiled.Model;
namespace DotTiled;
/// <summary>
/// Represents the types of objects that can use a custom class.

View file

@ -1,6 +1,6 @@
using System.Collections.Generic;
namespace DotTiled.Model;
namespace DotTiled;
/// <summary>
/// Represents the storage type of a custom enum.

View file

@ -1,4 +1,4 @@
namespace DotTiled.Model;
namespace DotTiled;
/// <summary>
/// Base class for custom type definitions.

View file

@ -1,7 +1,7 @@
using System.Collections.Generic;
using System.Linq;
namespace DotTiled.Model;
namespace DotTiled;
/// <summary>
/// Represents an enum property.
@ -12,7 +12,7 @@ public class EnumProperty : IProperty<ISet<string>>
public required string Name { get; set; }
/// <inheritdoc/>
public PropertyType Type => Model.PropertyType.Enum;
public PropertyType Type => DotTiled.PropertyType.Enum;
/// <summary>
/// The type of the class property. This will be the name of a custom defined

View file

@ -1,4 +1,4 @@
namespace DotTiled.Model;
namespace DotTiled;
/// <summary>
/// Represents a file property.

View file

@ -1,4 +1,4 @@
namespace DotTiled.Model;
namespace DotTiled;
/// <summary>
/// Represents a float property.

View file

@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
namespace DotTiled.Model;
namespace DotTiled;
/// <summary>
/// Interface for objects that have properties attached to them.

View file

@ -1,4 +1,4 @@
namespace DotTiled.Model;
namespace DotTiled;
/// <summary>
/// Interface for properties that can be attached to objects, tiles, tilesets, maps etc.

View file

@ -1,4 +1,4 @@
namespace DotTiled.Model;
namespace DotTiled;
/// <summary>
/// Represents an integer property.

View file

@ -1,4 +1,4 @@
namespace DotTiled.Model;
namespace DotTiled;
/// <summary>
/// Represents an object property.

View file

@ -1,4 +1,4 @@
namespace DotTiled.Model;
namespace DotTiled;
/// <summary>
/// Represents the type of a property.

View file

@ -1,4 +1,4 @@
namespace DotTiled.Model;
namespace DotTiled;
/// <summary>
/// Represents a string property.

View file

@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Linq;
using DotTiled.Model;
namespace DotTiled.Serialization;

View file

@ -1,5 +1,4 @@
using System;
using DotTiled.Model;
namespace DotTiled.Serialization;

View file

@ -1,5 +1,4 @@
using System;
using DotTiled.Model;
namespace DotTiled.Serialization;

View file

@ -1,5 +1,4 @@
using System;
using DotTiled.Model;
namespace DotTiled.Serialization;

View file

@ -1,7 +1,6 @@
using System;
using System.IO;
using System.Xml;
using DotTiled.Model;
using DotTiled.Serialization.Tmj;
using DotTiled.Serialization.Tmx;

View file

@ -1,7 +1,6 @@
using System;
using System.IO;
using System.Xml;
using DotTiled.Model;
using DotTiled.Serialization.Tmj;
using DotTiled.Serialization.Tmx;

View file

@ -1,7 +1,6 @@
using System;
using System.IO;
using System.Xml;
using DotTiled.Model;
using DotTiled.Serialization.Tmj;
using DotTiled.Serialization.Tmx;

View file

@ -1,5 +1,4 @@
using System;
using DotTiled.Model;
namespace DotTiled.Serialization.Tmj;

View file

@ -1,5 +1,4 @@
using System;
using DotTiled.Model;
namespace DotTiled.Serialization.Tmj;

View file

@ -1,7 +1,6 @@
using System;
using System.IO;
using System.Text.Json;
using DotTiled.Model;
namespace DotTiled.Serialization.Tmj;

View file

@ -1,7 +1,6 @@
using System.Collections.Generic;
using System.Globalization;
using System.Text.Json;
using DotTiled.Model;
namespace DotTiled.Serialization.Tmj;

View file

@ -1,6 +1,5 @@
using System.Globalization;
using System.Text.Json;
using DotTiled.Model;
namespace DotTiled.Serialization.Tmj;

View file

@ -1,5 +1,4 @@
using System.Text.Json;
using DotTiled.Model;
namespace DotTiled.Serialization.Tmj;

View file

@ -1,7 +1,6 @@
using System.Collections.Generic;
using System.Globalization;
using System.Text.Json;
using DotTiled.Model;
namespace DotTiled.Serialization.Tmj;

View file

@ -2,7 +2,6 @@ using System.Collections.Generic;
using System.Globalization;
using System.Numerics;
using System.Text.Json;
using DotTiled.Model;
namespace DotTiled.Serialization.Tmj;
@ -34,7 +33,7 @@ public abstract partial class TmjReaderBase
_ => throw new JsonException($"Unknown draw order '{s}'.")
}, DrawOrder.TopDown);
var objects = element.GetOptionalPropertyCustom<List<Model.Object>>("objects", e => e.GetValueAsList<Model.Object>(el => ReadObject(el)), []);
var objects = element.GetOptionalPropertyCustom<List<DotTiled.Object>>("objects", e => e.GetValueAsList<DotTiled.Object>(el => ReadObject(el)), []);
return new ObjectLayer
{
@ -59,7 +58,7 @@ public abstract partial class TmjReaderBase
};
}
internal Model.Object ReadObject(JsonElement element)
internal DotTiled.Object ReadObject(JsonElement element)
{
uint? idDefault = null;
string nameDefault = "";

View file

@ -2,7 +2,6 @@ using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text.Json;
using DotTiled.Model;
namespace DotTiled.Serialization.Tmj;

View file

@ -1,5 +1,4 @@
using System.Text.Json;
using DotTiled.Model;
namespace DotTiled.Serialization.Tmj;
@ -9,7 +8,7 @@ public abstract partial class TmjReaderBase
{
var type = element.GetRequiredProperty<string>("type");
var tileset = element.GetOptionalPropertyCustom<Tileset?>("tileset", ReadTileset, null);
var @object = element.GetRequiredPropertyCustom<Model.Object>("object", ReadObject);
var @object = element.GetRequiredPropertyCustom<DotTiled.Object>("object", ReadObject);
return new Template
{

View file

@ -1,6 +1,5 @@
using System.Globalization;
using System.Text.Json;
using DotTiled.Model;
namespace DotTiled.Serialization.Tmj;

View file

@ -1,7 +1,6 @@
using System.Collections.Generic;
using System.Globalization;
using System.Text.Json;
using DotTiled.Model;
namespace DotTiled.Serialization.Tmj;

View file

@ -1,6 +1,5 @@
using System;
using System.Text.Json;
using DotTiled.Model;
namespace DotTiled.Serialization.Tmj;

View file

@ -1,5 +1,4 @@
using System;
using DotTiled.Model;
namespace DotTiled.Serialization.Tmj;

View file

@ -1,6 +1,5 @@
using System;
using System.Xml;
using DotTiled.Model;
namespace DotTiled.Serialization.Tmx;

View file

@ -1,5 +1,3 @@
using DotTiled.Model;
namespace DotTiled.Serialization.Tmx;
public abstract partial class TmxReaderBase

View file

@ -4,7 +4,6 @@ using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Xml;
using DotTiled.Model;
namespace DotTiled.Serialization.Tmx;

View file

@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using DotTiled.Model;
namespace DotTiled.Serialization.Tmx;

View file

@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Numerics;
using DotTiled.Model;
namespace DotTiled.Serialization.Tmx;
@ -36,7 +35,7 @@ public abstract partial class TmxReaderBase
// Elements
List<IProperty>? properties = null;
List<Model.Object> objects = [];
List<DotTiled.Object> objects = [];
_reader.ProcessChildren("objectgroup", (r, elementName) => elementName switch
{
@ -68,11 +67,11 @@ public abstract partial class TmxReaderBase
};
}
internal Model.Object ReadObject()
internal DotTiled.Object ReadObject()
{
// Attributes
var template = _reader.GetOptionalAttribute("template");
Model.Object? obj = null;
DotTiled.Object? obj = null;
if (template is not null)
obj = _externalTemplateResolver(template).Object;
@ -100,7 +99,7 @@ public abstract partial class TmxReaderBase
var visible = _reader.GetOptionalAttributeParseable<bool>("visible") ?? visibleDefault;
// Elements
Model.Object? foundObject = null;
DotTiled.Object? foundObject = null;
int propertiesCounter = 0;
List<IProperty>? properties = propertiesDefault;
@ -138,7 +137,7 @@ public abstract partial class TmxReaderBase
return OverrideObject(obj, foundObject);
}
internal static Model.Object OverrideObject(Model.Object? obj, Model.Object foundObject)
internal static DotTiled.Object OverrideObject(DotTiled.Object? obj, DotTiled.Object foundObject)
{
if (obj is null)
return foundObject;
@ -305,7 +304,7 @@ public abstract partial class TmxReaderBase
Tileset? tileset = null;
// Should contain exactly one of
Model.Object? obj = null;
DotTiled.Object? obj = null;
_reader.ProcessChildren("template", (r, elementName) => elementName switch
{

View file

@ -1,7 +1,6 @@
using System.Collections.Generic;
using System.Linq;
using System.Xml;
using DotTiled.Model;
namespace DotTiled.Serialization.Tmx;

View file

@ -1,6 +1,5 @@
using System.Collections.Generic;
using System.Linq;
using DotTiled.Model;
namespace DotTiled.Serialization.Tmx;

View file

@ -2,7 +2,6 @@ using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using DotTiled.Model;
namespace DotTiled.Serialization.Tmx;

View file

@ -1,6 +1,5 @@
using System;
using System.Xml;
using DotTiled.Model;
namespace DotTiled.Serialization.Tmx;

View file

@ -1,6 +1,5 @@
using System;
using System.Xml;
using DotTiled.Model;
namespace DotTiled.Serialization.Tmx;

View file

@ -1,6 +1,5 @@
using System;
using System.Xml;
using DotTiled.Model;
namespace DotTiled.Serialization.Tmx;

View file

@ -1,7 +1,7 @@
namespace DotTiled.Model;
namespace DotTiled;
/// <summary>
/// Represents a Tiled template. A template is a reusable object that can be placed in an <see cref="DotTiled.Model"/> inside the Tiled editor.
/// Represents a Tiled template. A template is a reusable object that can be placed in an <see cref="DotTiled"/> inside the Tiled editor.
/// </summary>
public class Template
{

View file

@ -1,4 +1,4 @@
namespace DotTiled.Model;
namespace DotTiled;
/// <summary>
/// A single frame of an animated tile.

View file

@ -1,4 +1,4 @@
namespace DotTiled.Model;
namespace DotTiled;
/// <summary>
/// Orientation of the grid for the tiles in this tileset.

View file

@ -1,4 +1,4 @@
namespace DotTiled.Model;
namespace DotTiled;
/// <summary>
/// The format of an image.

View file

@ -1,6 +1,6 @@
using System.Collections.Generic;
namespace DotTiled.Model;
namespace DotTiled;
/// <summary>
/// Represents a single tile in a tileset, when using a collection of images to represent the tileset.

View file

@ -1,4 +1,4 @@
namespace DotTiled.Model;
namespace DotTiled;
/// <summary>
/// Is used to specify an offset in pixels in tilesets, to be applied when drawing a tile from the related tileset.

View file

@ -1,6 +1,6 @@
using System.Collections.Generic;
namespace DotTiled.Model;
namespace DotTiled;
/// <summary>
/// The alignment of tile objects.

View file

@ -1,4 +1,4 @@
namespace DotTiled.Model;
namespace DotTiled;
/// <summary>
/// Represents which transformations can be applied to a tile in a tileset.

View file

@ -1,6 +1,6 @@
using System.Collections.Generic;
namespace DotTiled.Model;
namespace DotTiled;
/// <summary>
/// Represents a Wang color in a Wang set.

View file

@ -1,4 +1,4 @@
namespace DotTiled.Model;
namespace DotTiled;
/// <summary>
/// Represents a Wang tile in a Wang set.

View file

@ -1,6 +1,6 @@
using System.Collections.Generic;
namespace DotTiled.Model;
namespace DotTiled;
/// <summary>
/// Defines a list of colors and any number of Wang tiles using these colors.