Пример #1
0
 public static string GetResourceFromFile(string filePath, MutiLanguage.Languages language)
 {
     string lang = MutiLanguage.EnumToString(language);
     string text = "";
     FileInfo fi = new FileInfo(filePath);
     string postfix;
     if (lang == MutiLanguage.EnumToString(MutiLanguage.Languages.en_us)) postfix = fi.Extension;
     else postfix = string.Concat(".", lang, fi.Extension);
     filePath = fi.FullName.Replace(fi.Extension, postfix);
     if (File.Exists(filePath))
     {
         text = File.ReadAllText(filePath, Encoding.UTF8);
     }
     return text;
 }
Пример #2
0
 public static string FormatDateToString(object xDateTime, DateFormat xDateFormat, MutiLanguage.Languages lang)
 {
     return FormatDateTimeToString(Convert.ToDateTime(xDateTime), xDateFormat, lang);
 }
Пример #3
0
 public static string FormatDateTimeToString(DateTime xDateTime, DateFormat xDateFormat, MutiLanguage.Languages lang)
 {
     if (xDateTime == null || Convert.ToDateTime(xDateTime) == DateTime.MinValue) return "";
     string langstr = MutiLanguage.EnumToString(lang);
     //System.Resources.ResourceManager rm = new System.Resources.ResourceManager(typeof(Resources.Date));
     //System.Resources.ResourceSet rs = rm.GetResourceSet(new System.Globalization.CultureInfo(langstr), false, false);
     //return xDateTime.ToString(rs.GetString(xDateFormat.ToString()), System.Globalization.DateTimeFormatInfo.InvariantInfo);
     return xDateTime.ToString(Resources.Date.ResourceManager.GetString(xDateFormat.ToString(), new System.Globalization.CultureInfo(langstr)), System.Globalization.DateTimeFormatInfo.InvariantInfo);
 }