using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Text;
namespace CUETools.Codecs
{
///
/// Localized description attribute
///
[AttributeUsage(AttributeTargets.All, AllowMultiple = false, Inherited = true)]
public class SRDescriptionAttribute : DescriptionAttribute
{
///
/// Construct the description attribute
///
///
public SRDescriptionAttribute(Type SR, string text)
: base(text)
{
this.localized = false;
this.SR = SR;
}
///
/// Override the return of the description text to localize the text
///
public override string Description
{
get
{
if (!localized)
{
localized = true;
this.DescriptionValue = SR.InvokeMember(
this.DescriptionValue,
System.Reflection.BindingFlags.GetProperty | System.Reflection.BindingFlags.Static |
System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic,
null,
null,
new object[] { }) as string;
}
return base.Description;
}
}
///
/// Store a flag indicating whether this has been localized
///
private bool localized;
///
/// Resource manager to use;
///
private Type SR;
}
}