示例#1
0
        public static string GetString(string name, params object[] args)
        {
            EdmRes sys = GetLoader();

            if (sys == null)
            {
                return(null);
            }

            string res = sys.resources.GetString(name, EdmRes.Culture);

            if (args != null && args.Length > 0)
            {
                for (int i = 0; i < args.Length; i++)
                {
                    String value = args[i] as String;
                    if (value != null && value.Length > 1024)
                    {
                        args[i] = value.Substring(0, 1024 - 3) + "...";
                    }
                }
                return(String.Format(CultureInfo.CurrentCulture, res, args));
            }
            else
            {
                return(res);
            }
        }
示例#2
0
        private static EdmRes GetLoader()
        {
            if (loader == null)
            {
                EdmRes sr = new EdmRes();
                Interlocked.CompareExchange(ref loader, sr, null);
            }

            return(loader);
        }
示例#3
0
        public static string GetString(string name)
        {
            EdmRes sys = GetLoader();

            if (sys == null)
            {
                return(null);
            }

            return(sys.resources.GetString(name, EdmRes.Culture));
        }