示例#1
0
 public static string GetString(string name)
 {
     System.IO.Compression.SR loader = System.IO.Compression.SR.GetLoader();
     if (loader == null)
     {
         return(null);
     }
     return(loader.resources.GetString(name, System.IO.Compression.SR.Culture));
 }
示例#2
0
 private static System.IO.Compression.SR GetLoader()
 {
     if (System.IO.Compression.SR.loader == null)
     {
         System.IO.Compression.SR sR = new System.IO.Compression.SR();
         Interlocked.CompareExchange <System.IO.Compression.SR>(ref System.IO.Compression.SR.loader, sR, null);
     }
     return(System.IO.Compression.SR.loader);
 }
示例#3
0
        public static string GetString(string name, params object[] args)
        {
            System.IO.Compression.SR loader = System.IO.Compression.SR.GetLoader();
            if (loader == null)
            {
                return(null);
            }
            string str = loader.resources.GetString(name, System.IO.Compression.SR.Culture);

            if (args == null || args.Length == 0)
            {
                return(str);
            }
            for (int i = 0; i < (int)args.Length; i++)
            {
                string str1 = args[i] as string;
                if (str1 != null && str1.Length > 1024)
                {
                    args[i] = string.Concat(str1.Substring(0, 1021), "...");
                }
            }
            return(string.Format(CultureInfo.CurrentCulture, str, args));
        }