/// <summary> /// Loads the message from the resource associated with the enum type and formats it /// using 'String.Format'. Because this function is intended to be used during error /// handling it never raises an exception. /// </summary> /// <param name="id">The type of the parameter identifies the resource /// and the name of the enum identifies the message in the resource.</param> /// <param name="args">Parameters passed through 'String.Format'.</param> /// <returns>The formatted message.</returns> public static string Format(PSXMsgID id, params object[] args) { string message; try { message = GetString(id); if (message != null) { message = Format(message, args); } else { message = "INTERNAL ERROR: Message not found in resources."; } return(message); } catch (Exception ex) { message = String.Format("UNEXPECTED ERROR while formatting message with ID {0}: {1}", id.ToString(), ex.ToString()); } return(message); }
/// <summary> /// Gets the localized message identified by the specified DomMsgID. /// </summary> public static string GetString(PSXMsgID id) { return PSXSR.ResMngr.GetString(id.ToString()); }
/// <summary> /// Loads the message from the resource associated with the enum type and formats it /// using 'String.Format'. Because this function is intended to be used during error /// handling it never raises an exception. /// </summary> /// <param name="id">The type of the parameter identifies the resource /// and the name of the enum identifies the message in the resource.</param> /// <param name="args">Parameters passed through 'String.Format'.</param> /// <returns>The formatted message.</returns> public static string Format(PSXMsgID id, params object[] args) { string message; try { message = PSXSR.GetString(id); if (message != null) message = Format(message, args); else message = "INTERNAL ERROR: Message not found in resources."; return message; } catch (Exception ex) { message = String.Format("UNEXPECTED ERROR while formatting message with ID {0}: {1}", id.ToString(), ex.ToString()); } return message; }
/// <summary> /// Gets the localized message identified by the specified DomMsgID. /// </summary> public static string GetString(PSXMsgID id) { return(ResMngr.GetString(id.ToString())); }