예제 #1
0
        private IDictionary <string, string> getAllCurrenciesShortcuts()
        {
            IDictionary <string, string> returnedCurrencies = new Dictionary <string, string>();

            Properties.Resources resources = new Properties.Resources();
            Type resourcesType             = resources.GetType();
            var  props = resourcesType.GetProperties();

            foreach (var prop in props)
            {
                if (prop.Name.ToLower().Contains("currencyshortcut") && prop.Name.Length > "currencyshortcut".Length + 1)
                {
                    returnedCurrencies.Add(prop.Name, prop.GetValue(resources).ToString());
                }
            }
            return(returnedCurrencies);
        }
예제 #2
0
        public string Translate(string source)
        {
            if (source == null)
            {
                return(null);
            }
            Properties.Resources resources = new Properties.Resources();
            Type resourcesType             = resources.GetType();
            var  props = resourcesType.GetProperties();

            foreach (var prop in props)
            {
                if (prop.Name.ToLower() == source.ToLower())
                {
                    return(prop.GetValue(resources).ToString());
                }
            }
            return(null);
        }