using System; using System.Collections; using System.Resources; namespace AyAEM.ExceptionManagement { public class ExceptionManagerReadResx { #region Constructores /// /// Constructor with codeError param. /// public ExceptionManagerReadResx(string codeError) { readResx(codeError); } #endregion #region Variables // Member variable declarations private string codeDescription; #endregion #region Propiedades Públicas /// /// Machine name where the exception occurred. /// public string CodeDescription { get { return codeDescription; } set { codeDescription = value; } } #endregion public string readResx(string codeError) { //Updated at 20061228 by Jorge Calvo Morales // Create a ResXResourceReader for the file ExceptionManagerCodes.resx. ResXResourceReader rsxr = new ResXResourceReader(AppDomain.CurrentDomain.BaseDirectory + "App_GlobalResources/ExceptionManagerCodes.resx"); // Create an IDictionaryEnumerator to iterate through the resources. IDictionaryEnumerator id = rsxr.GetEnumerator(); // Iterate through the resources and display the contents to the console. foreach (DictionaryEntry d in rsxr) { // Console.WriteLine(d.Key.ToString() + ":\t" + d.Value.ToString()); if (codeError == d.Key.ToString()) { codeDescription = d.Value.ToString(); break; } } //Close the reader. rsxr.Close(); return codeDescription; } } }