Пример #1
0
        private static LangProperties GetLangProperties(string path, LangType lang)
        {
            LangProperties properties = null;
            int            length     = path.LastIndexOf('.');

            if (length != -1)
            {
                Dictionary <string, Dictionary <string, LangProperties> > dictionary;
                Dictionary <string, LangProperties> dictionary2;
                string moduleName = path.Substring(0, length);
                string key        = path.Remove(0, length + 1);
                string str3       = ResourceInfo(moduleName, Thread.CurrentThread.CurrentCulture.Name);
                LoadResources();
                if ((m_Resources.TryGetValue(str3, out dictionary) && dictionary.TryGetValue(lang.ToString(), out dictionary2)) && !dictionary2.TryGetValue(key, out properties))
                {
                    LangProperties properties2 = null;
                    if (dictionary2.TryGetValue(m_inheritName, out properties2))
                    {
                        key = properties2.GetItem(PropertyType.Inherit, key);
                        if (key.Length != 0)
                        {
                            dictionary2.TryGetValue(key, out properties);
                        }
                    }
                }
            }
            return(properties);
        }
Пример #2
0
        public static string GetText(string path, string name)
        {
            LangProperties langProperties = GetLangProperties(path, LangType.Class);

            if (langProperties == null)
            {
                return(string.Empty);
            }
            return(langProperties.GetItem(PropertyType.Caption, name));
        }
Пример #3
0
        public static string GetActionDescription(string path, string name)
        {
            LangProperties langProperties = GetLangProperties(path, LangType.Action);

            if (langProperties == null)
            {
                return(string.Empty);
            }
            return(langProperties.GetItem(PropertyType.Description, name));
        }
Пример #4
0
        public static string GetText(PropertyDescriptor pd)
        {
            string className = string.Empty;
            string propName  = string.Empty;

            if (!TryFindResourcePath(pd, ref className, ref propName))
            {
                return(string.Empty);
            }
            LangProperties langProperties = GetLangProperties(className, LangType.Class);

            if (langProperties == null)
            {
                return(string.Empty);
            }
            return(langProperties.GetItem(PropertyType.Caption, propName));
        }
Пример #5
0
        public static string GetEnumText(FieldInfo fi)
        {
            string enumName  = string.Empty;
            string valueName = string.Empty;

            if (!IsActive)
            {
                return(valueName);
            }
            if (!TryFindResourcePath(fi, ref enumName, ref valueName))
            {
                return(string.Empty);
            }
            LangProperties langProperties = GetLangProperties(enumName, LangType.Enum);

            if (langProperties == null)
            {
                return(string.Empty);
            }
            return(langProperties.GetItem(PropertyType.Caption, valueName));
        }