예제 #1
0
        /// <summary>
        /// Get a string value from settings and converts the value of objects to strings based on
        /// the formats specified and inserts them into another string.
        /// </summary>
        /// <param name="key">Key identifier.</param>
        /// <param name="defaultValue">Default value returned when the key isn't present.</param>
        /// <returns>The string value corresponding to the key.</returns>
        public static string GetString(string key, string defaultValue, params object[] list)
        {
            try
            {
                // Get the dictionary key
                string dictionaryKey = Path.GetFileNameWithoutExtension(System.Reflection.Assembly.GetCallingAssembly().Location);

                return(string.Format(XmlTranslator.GetTranslatedString(dictionaryKey, key, defaultValue), list));
            }
            catch
            {
                return(StringUtils.ReplaceTextCodes(defaultValue));
            }
        }
예제 #2
0
        /// <summary>
        /// Get a string value from settings.
        /// </summary>
        /// <param name="key">Key identifier.</param>
        /// <returns>The string value corresponding to the key or 0 if the key isn't present.</returns>
        public static string GetString(string key)
        {
            try
            {
                // Get the dictionary key
                string dictionaryKey = Path.GetFileNameWithoutExtension(System.Reflection.Assembly.GetCallingAssembly().Location);

                return(XmlTranslator.GetTranslatedString(dictionaryKey, key, string.Empty));
            }
            catch
            {
                return(string.Empty);
            }
        }