diff --git a/src/DotTiled/Color.cs b/src/DotTiled/Color.cs index 367c942..78d0b80 100644 --- a/src/DotTiled/Color.cs +++ b/src/DotTiled/Color.cs @@ -37,7 +37,7 @@ public class Color : IParsable, IEquatable /// An object that supplies culture-specific information about the format of s. /// The parsed /// Thrown in case the provided string is not in a valid format. - public static Color Parse(string s, IFormatProvider? provider) + public static Color Parse(string s, IFormatProvider provider) { _ = TryParse(s, provider, out var result); return result ?? throw new FormatException($"Invalid format for TiledColor: {s}"); @@ -52,8 +52,8 @@ public class Color : IParsable, IEquatable /// When this method returns, contains the parsed or null on failure. /// true if was successfully parsed; otherwise, false. public static bool TryParse( - [NotNullWhen(true)] string? s, - IFormatProvider? provider, + [NotNullWhen(true)] string s, + IFormatProvider provider, [MaybeNullWhen(false)] out Color result) { if (s is not null && !s.StartsWith('#')) @@ -90,7 +90,7 @@ public class Color : IParsable, IEquatable } /// - public bool Equals(Color? other) + public bool Equals(Color other) { if (other is null) return false; @@ -99,7 +99,7 @@ public class Color : IParsable, IEquatable } /// - public override bool Equals(object? obj) => obj is Color other && Equals(other); + public override bool Equals(object obj) => obj is Color other && Equals(other); /// public override int GetHashCode() => HashCode.Combine(R, G, B, A); diff --git a/src/DotTiled/Properties/ClassProperty.cs b/src/DotTiled/Properties/ClassProperty.cs index 933660b..2df32ee 100644 --- a/src/DotTiled/Properties/ClassProperty.cs +++ b/src/DotTiled/Properties/ClassProperty.cs @@ -51,7 +51,7 @@ public class ClassProperty : IHasProperties, IProperty> } /// - public bool TryGetProperty(string name, [NotNullWhen(true)] out T? property) where T : IProperty + public bool TryGetProperty(string name, [NotNullWhen(true)] out T property) where T : IProperty { if (Value.FirstOrDefault(_properties => _properties.Name == name) is T prop) { diff --git a/src/DotTiled/Properties/CustomTypes/CustomClassDefinition.cs b/src/DotTiled/Properties/CustomTypes/CustomClassDefinition.cs index 457a17d..6a99f62 100644 --- a/src/DotTiled/Properties/CustomTypes/CustomClassDefinition.cs +++ b/src/DotTiled/Properties/CustomTypes/CustomClassDefinition.cs @@ -76,7 +76,7 @@ public class CustomClassDefinition : HasPropertiesBase, ICustomTypeDefinition /// /// The color of the custom class inside the Tiled editor. /// - public Color? Color { get; set; } + public Color Color { get; set; } /// /// Whether the custom class should be drawn with a fill color. diff --git a/src/DotTiled/Properties/IHasProperties.cs b/src/DotTiled/Properties/IHasProperties.cs index 21bf0bb..8ffd9f0 100644 --- a/src/DotTiled/Properties/IHasProperties.cs +++ b/src/DotTiled/Properties/IHasProperties.cs @@ -22,7 +22,7 @@ public interface IHasProperties /// The name of the property to get. /// The property with the specified name, if found. /// True if a property with the specified name was found; otherwise, false. - bool TryGetProperty(string name, out T? property) where T : IProperty; + bool TryGetProperty(string name, out T property) where T : IProperty; /// /// Gets a property of the specified type with the specified name. @@ -57,7 +57,7 @@ public abstract class HasPropertiesBase : IHasProperties } /// - public bool TryGetProperty(string name, [NotNullWhen(true)] out T? property) where T : IProperty + public bool TryGetProperty(string name, [NotNullWhen(true)] out T property) where T : IProperty { var properties = GetProperties(); if (properties.FirstOrDefault(_properties => _properties.Name == name) is T prop) diff --git a/src/DotTiled/Serialization/Helpers.cs b/src/DotTiled/Serialization/Helpers.cs index 40ab825..b259d15 100644 --- a/src/DotTiled/Serialization/Helpers.cs +++ b/src/DotTiled/Serialization/Helpers.cs @@ -106,7 +106,7 @@ internal static partial class Helpers }).ToList(); } - internal static IList MergeProperties(IList? baseProperties, IList? overrideProperties) + internal static IList MergeProperties(IList baseProperties, IList overrideProperties) { if (baseProperties is null) return overrideProperties ?? []; @@ -148,7 +148,7 @@ internal static partial class Helpers properties[index] = property; } - internal static void SetAtMostOnce(ref T? field, T value, string fieldName) + internal static void SetAtMostOnce(ref T field, T value, string fieldName) { if (field is not null) throw new InvalidOperationException($"{fieldName} already set"); @@ -156,7 +156,7 @@ internal static partial class Helpers field = value; } - internal static void SetAtMostOnceUsingCounter(ref T? field, T value, string fieldName, ref int counter) + internal static void SetAtMostOnceUsingCounter(ref T field, T value, string fieldName, ref int counter) { if (counter > 0) throw new InvalidOperationException($"{fieldName} already set"); diff --git a/src/DotTiled/Serialization/MapReader.cs b/src/DotTiled/Serialization/MapReader.cs index 35341f6..d202e8f 100644 --- a/src/DotTiled/Serialization/MapReader.cs +++ b/src/DotTiled/Serialization/MapReader.cs @@ -16,8 +16,8 @@ public class MapReader : IMapReader private readonly Func _externalTemplateResolver; private readonly Func _customTypeResolver; - private readonly StringReader? _mapStringReader; - private readonly XmlReader? _xmlReader; + private readonly StringReader _mapStringReader; + private readonly XmlReader _xmlReader; private readonly IMapReader _mapReader; private bool disposedValue; diff --git a/src/DotTiled/Serialization/TemplateReader.cs b/src/DotTiled/Serialization/TemplateReader.cs index 2fe92ec..bf210c0 100644 --- a/src/DotTiled/Serialization/TemplateReader.cs +++ b/src/DotTiled/Serialization/TemplateReader.cs @@ -16,8 +16,8 @@ public class TemplateReader : ITemplateReader private readonly Func _externalTemplateResolver; private readonly Func _customTypeResolver; - private readonly StringReader? _templateStringReader; - private readonly XmlReader? _xmlReader; + private readonly StringReader _templateStringReader; + private readonly XmlReader _xmlReader; private readonly ITemplateReader _templateReader; private bool disposedValue; diff --git a/src/DotTiled/Serialization/TilesetReader.cs b/src/DotTiled/Serialization/TilesetReader.cs index b8ba69b..180d269 100644 --- a/src/DotTiled/Serialization/TilesetReader.cs +++ b/src/DotTiled/Serialization/TilesetReader.cs @@ -16,8 +16,8 @@ public class TilesetReader : ITilesetReader private readonly Func _externalTemplateResolver; private readonly Func _customTypeResolver; - private readonly StringReader? _tilesetStringReader; - private readonly XmlReader? _xmlReader; + private readonly StringReader _tilesetStringReader; + private readonly XmlReader _xmlReader; private readonly ITilesetReader _tilesetReader; private bool disposedValue; diff --git a/src/DotTiled/Serialization/Tmx/TsxTilesetReader.cs b/src/DotTiled/Serialization/Tmx/TsxTilesetReader.cs index 3b442da..f0dbcc9 100644 --- a/src/DotTiled/Serialization/Tmx/TsxTilesetReader.cs +++ b/src/DotTiled/Serialization/Tmx/TsxTilesetReader.cs @@ -21,5 +21,5 @@ public class TsxTilesetReader : TmxReaderBase, ITilesetReader { } /// - public new Tileset ReadTileset() => base.ReadTileset(); + public Tileset ReadTileset() => base.ReadTileset(); }