Skip to content

Commit

Permalink
WIP: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
TheXDS committed Oct 15, 2024
1 parent a66625e commit e2448ed
Show file tree
Hide file tree
Showing 78 changed files with 554 additions and 913 deletions.
14 changes: 2 additions & 12 deletions src/Lib/MCART/Attributes/AuthorAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,7 @@ namespace TheXDS.MCART.Attributes;
/// <summary>
/// Establece el autor del elemento.
/// </summary>
/// <param name="attrValue">Valor del atributo.</param>
[AttributeUsage(Property | Method | Constructor | Class | Module | Assembly, AllowMultiple = true)]
[Serializable]
public sealed class AuthorAttribute : TextAttribute
{
/// <summary>
/// Inicializa una nueva instancia de la clase
/// <see cref="DescriptionAttribute" />.
/// </summary>
/// <param name="attrValue">Valor del atributo.</param>
public AuthorAttribute(string attrValue)
: base(attrValue)
{
}
}
public sealed class AuthorAttribute(string attrValue) : TextAttribute(attrValue);
4 changes: 1 addition & 3 deletions src/Lib/MCART/Attributes/BetaAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,4 @@ namespace TheXDS.MCART.Attributes;
/// </summary>
[AttributeUsage(Method | Class | Module | Assembly)]
[Serializable]
public sealed class BetaAttribute : Attribute
{
}
public sealed class BetaAttribute : Attribute;
53 changes: 0 additions & 53 deletions src/Lib/MCART/Attributes/BoolAttribute.cs

This file was deleted.

13 changes: 2 additions & 11 deletions src/Lib/MCART/Attributes/CompressorAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,6 @@ namespace TheXDS.MCART.Attributes;
/// <summary>
/// Atributo que indica el compresor utilizado para este elemento.
/// </summary>
/// <param name="compressor">Nombre del compresor utilizado.</param>
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
public sealed class CompressorAttribute : TextAttribute
{
/// <summary>
/// Indica el compresor utilizado por este elemento.
/// </summary>
/// <param name="compressor">Nombre del compresor utilizado.</param>
public CompressorAttribute(string compressor)
: base(compressor)
{
}
}
public sealed class CompressorAttribute(string compressor) : TextAttribute(compressor);
13 changes: 2 additions & 11 deletions src/Lib/MCART/Attributes/CopyrightAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,11 @@ namespace TheXDS.MCART.Attributes;
/// <summary>
/// Establece la información de Copyright del elemento.
/// </summary>
/// <param name="copyright">Valor del atributo.</param>
[AttributeUsage(Method | Class | Module | Assembly)]
[Serializable]
public sealed class CopyrightAttribute : TextAttribute
public sealed class CopyrightAttribute(string copyright) : TextAttribute(GetCopyrightString(copyright))
{
/// <summary>
/// Inicializa una nueva instancia de la clase
/// <see cref="DescriptionAttribute" />.
/// </summary>
/// <param name="copyright">Valor del atributo.</param>
public CopyrightAttribute(string copyright)
: base(GetCopyrightString(copyright))
{
}

/// <summary>
/// Inicializa una nueva instancia de la clase
/// <see cref="DescriptionAttribute" />.
Expand Down
14 changes: 2 additions & 12 deletions src/Lib/MCART/Attributes/DescriptionAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,7 @@ namespace TheXDS.MCART.Attributes;
/// <summary>
/// Establece una descripción larga para este elemento.
/// </summary>
/// <param name="description">Valor del atributo.</param>
[AttributeUsage(AttributeTargets.All)]
[Serializable]
public sealed class DescriptionAttribute : TextAttribute
{
/// <summary>
/// Inicializa una nueva instancia de la clase
/// <see cref="DescriptionAttribute" />.
/// </summary>
/// <param name="description">Valor del atributo.</param>
public DescriptionAttribute(string description)
: base(description)
{
}
}
public sealed class DescriptionAttribute(string description) : TextAttribute(description);
52 changes: 0 additions & 52 deletions src/Lib/MCART/Attributes/FloatAttribute.cs

This file was deleted.

16 changes: 5 additions & 11 deletions src/Lib/MCART/Attributes/IdentifierAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,9 @@ namespace TheXDS.MCART.Attributes;
/// <summary>
/// Indica una cadena que puede utilizarse para identificar a este elemento.
/// </summary>
/// <remarks>
/// Indica una cadena que puede utilizarse para identificar a este elemento.
/// </remarks>
/// <param name="identifier">Identificador a utilizar.</param>
[AttributeUsage(AttributeTargets.All, AllowMultiple = true)]
public sealed class IdentifierAttribute : TextAttribute
{
/// <summary>
/// Indica una cadena que puede utilizarse para identificar a este elemento.
/// </summary>
/// <param name="identifier">Identificador a utilizar.</param>
public IdentifierAttribute(string identifier)
: base(identifier)
{
}
}
public sealed class IdentifierAttribute(string identifier) : TextAttribute(identifier);
52 changes: 0 additions & 52 deletions src/Lib/MCART/Attributes/IntAttribute.cs

This file was deleted.

4 changes: 1 addition & 3 deletions src/Lib/MCART/Attributes/LengthyOpAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,4 @@ namespace TheXDS.MCART.Attributes;
/// </summary>
[AttributeUsage(Method | AttributeTargets.Delegate)]
[Serializable]
public sealed class LengthyOpAttribute : Attribute
{
}
public sealed class LengthyOpAttribute : Attribute;
17 changes: 4 additions & 13 deletions src/Lib/MCART/Attributes/LicenseAttributeBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,11 @@ namespace TheXDS.MCART.Attributes;
/// Define una serie de miembros a implementar por un tipo que obtenga
/// licencias a partir del valor de un atributo.
/// </summary>
public abstract class LicenseAttributeBase : TextAttribute
/// <param name="text">
/// Texto a asociar con el valor de este atributo.
/// </param>
public abstract class LicenseAttributeBase(string text) : TextAttribute(text)
{
/// <summary>
/// Inicializa una nueva instancia de la clase
/// <see cref="LicenseAttributeBase"/>.
/// </summary>
/// <param name="text">
/// Texto a asociar con el valor de este atributo.
/// </param>
protected LicenseAttributeBase(string text)
: base(text)
{
}

/// <summary>
/// Obtiene una licencia asociada a este atributo.
/// </summary>
Expand Down
24 changes: 9 additions & 15 deletions src/Lib/MCART/Attributes/LocalizedDescriptionAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,24 +37,18 @@ namespace TheXDS.MCART.Attributes;
/// <summary>
/// Establece un nombre personalizado localizado para describir este elemento.
/// </summary>
/// <remarks>
/// Inicializa una nueva instancia de la clase
/// <see cref="LocalizedDescriptionAttribute" />.
/// </remarks>
/// <param name="stringId">Id de la cadena a localizar.</param>
/// <param name="resourceType">Tipo que contiene la información de localización a utilizar.</param>
[AttributeUsage(All)]
[Serializable]
public sealed class LocalizedDescriptionAttribute : System.ComponentModel.DescriptionAttribute, IValueAttribute<string>
public sealed class LocalizedDescriptionAttribute(string stringId, Type resourceType) : System.ComponentModel.DescriptionAttribute, IValueAttribute<string>
{
private readonly string _stringId;
private readonly ResourceManager _res;

/// <summary>
/// Inicializa una nueva instancia de la clase
/// <see cref="LocalizedDescriptionAttribute" />.
/// </summary>
/// <param name="stringId">Id de la cadena a localizar.</param>
/// <param name="resourceType">Tipo que contiene la información de localización a utilizar.</param>
public LocalizedDescriptionAttribute(string stringId, Type resourceType)
{
_stringId = EmptyChecked(stringId);
_res = new ResourceManager(NullChecked(resourceType));
}
private readonly string _stringId = EmptyChecked(stringId);
private readonly ResourceManager _res = new(NullChecked(resourceType));

/// <inheritdoc/>
public override string Description => _res.GetString(_stringId) ?? $"[[{_stringId}]]";
Expand Down
18 changes: 7 additions & 11 deletions src/Lib/MCART/Attributes/MaximumAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,13 @@ namespace TheXDS.MCART.Attributes;
/// Establece un valor máximo al cual se deben limitar los campos y
/// propiedades.
/// </summary>
/// <param name="attributeValue">Valor del atributo.</param>
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
public sealed class MaximumAttribute : ObjectAttribute
#if CLSCompliance
[CLSCompliant(false)]
#endif
public sealed class MaximumAttribute<T>(T attributeValue) : Attribute, IValueAttribute<T> where T : IComparable<T>
{
/// <summary>
/// Inicializa una nueva instancia del atributo
/// <see cref="MinimumAttribute" />
/// estableciendo el valor máximo a representar.
/// </summary>
/// <param name="attributeValue">Valor del atributo.</param>
public MaximumAttribute(object? attributeValue)
: base(attributeValue)
{
}
/// <inheritdoc/>
public T Value { get; } = attributeValue;
}
17 changes: 6 additions & 11 deletions src/Lib/MCART/Attributes/MinimumAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,11 @@ namespace TheXDS.MCART.Attributes;
/// Establece un valor mínimo al cual se deben limitar los campos y propiedades.
/// </summary>
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
public sealed class MinimumAttribute : ObjectAttribute
#if CLSCompliance
[CLSCompliant(false)]
#endif
public sealed class MinimumAttribute<T>(T attributeValue) : Attribute, IValueAttribute<T> where T : IComparable<T>
{
/// <summary>
/// Inicializa una nueva instancia del atributo
/// <see cref="MinimumAttribute" /> estableciendo el valor mínimo a
/// representar.
/// </summary>
/// <param name="attributeValue">Valor del atributo.</param>
public MinimumAttribute(object? attributeValue)
: base(attributeValue)
{
}
/// <inheritdoc/>
public T Value { get; } = attributeValue;
}
Loading

0 comments on commit e2448ed

Please sign in to comment.