예제 #1
0
        public static string GetString(string name, params object[] args)
        {
            TextRes sys = GetLoader();

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

            string res = sys.resources.GetString(name, TextRes.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 TextRes GetLoader()
 {
     if (loader == null)
     {
         TextRes sr = new TextRes();
         Interlocked.CompareExchange(ref loader, sr, null);
     }
     return(loader);
 }
예제 #3
0
        public static object GetObject(string name)
        {
            TextRes sys = GetLoader();

            if (sys == null)
            {
                return(null);
            }
            return(sys.resources.GetObject(name, TextRes.Culture));
        }
예제 #4
0
 protected override string GetLocalizedString(string value)
 {
     return(TextRes.GetString(value));
 }
예제 #5
0
 private static TextRes GetLoader() {
     if (loader == null) {
         TextRes sr = new TextRes();
         Interlocked.CompareExchange(ref loader, sr, null);
     }
     return loader;
 }