first commit

This commit is contained in:
Beyhan Oğur
2026-09-03 04:45:36 +03:00
commit d5f52cc3d3
1038 changed files with 169579 additions and 0 deletions
@@ -0,0 +1,61 @@
using System;
using System.Runtime.CompilerServices;
using ClassicAssist.Shared.Resources;
namespace ClassicAssist.Data.Macros
{
public class CommandsDisplayAttribute : Attribute
{
private string _category;
public CommandsDisplayAttribute( [CallerMemberName] string member = "" )
{
string memberName = member.ToUpper();
string description = MacroCommandHelp.ResourceManager.GetString( $"{memberName}_COMMAND_DESCRIPTION" );
if ( string.IsNullOrEmpty( description ) )
{
throw new ArgumentNullException( $"Macro command help not translated: {member}" );
}
Description = description;
string insertText = MacroCommandHelp.ResourceManager.GetString( $"{memberName}_COMMAND_INSERTTEXT" );
if ( string.IsNullOrEmpty( insertText ) )
{
throw new ArgumentNullException( $"Macro command help not translated: {member}" );
}
InsertText = insertText;
string example = MacroCommandHelp.ResourceManager.GetString( $"{memberName}_COMMAND_EXAMPLE" );
Example = string.IsNullOrEmpty( example ) ? insertText : example;
}
public string Category
{
get => _category;
set => SetCategory( value );
}
public string Description { get; set; }
public string Example { get; set; }
public string InsertText { get; set; }
public string[] Parameters { get; set; }
private void SetCategory( string value )
{
string resourceName = Strings.ResourceManager.GetString( value );
if ( string.IsNullOrEmpty( resourceName ) )
{
throw new ArgumentNullException( $"String not translated: {value}" );
}
_category = resourceName;
}
}
}