Exemplo n.º 1
0
        public static string GetString(IUniResStore reader, string resId, out DateTime LastModified, string defval = null, string langs = null)
        {
            LastModified = DateTime.MinValue;
            if (reader == null)
            {
                return(string.IsNullOrEmpty(defval) ? "string database not found...." : defval);
            }
            int        lcid = GetEffective(langs).LCID;
            ResStrItem itm  = null;
            ResStrItem ritm = new ResStrItem();

            ritm.ID = resId;
            do
            {
                if (lcid != -1)
                {
                    ritm.LocID = lcid;
                    itm        = reader.GetText(ritm);
                }
                else
                {
                    ritm.LocID = 0;
                    itm        = reader.GetText(ritm);
                    if (itm == null)
                    {
                        return(defval == null ? "string not found...." : defval);
                    }
                }
                if (itm != null)
                {
                    LastModified = itm.LastModified;
                    if (itm.ContentType.Contains("html"))
                    {
                        return(itm.Text.Replace("_webroot_", VirtualPathUtility.ToAbsolute("~/")));
                    }
                    else
                    {
                        return(itm.Text);
                    }
                }
                lcid = GetParentLCID(lcid);
            } while (lcid != -1);
            ritm.LocID = 0;
            itm        = reader.GetText(ritm);
            if (itm == null)
            {
                return(defval == null ? "string not found...." : defval);
            }
            LastModified = itm.LastModified;
            if (itm.ContentType.Contains("html"))
            {
                return(itm.Text.Replace("_webroot_", VirtualPathUtility.ToAbsolute("~/")));
            }
            else
            {
                return(itm.Text);
            }
        }
Exemplo n.º 2
0
 public static string GetString(IUniResStore reader, string resId, out DateTime LastModified, string defval = null)
 {
     LastModified = DateTime.MinValue;
     if (reader == null)
         return string.IsNullOrEmpty(defval) ? "string database not found...." : defval;
     int lcid = GetEffective().LCID;
     ResStrItem itm = null;
     ResStrItem ritm = new ResStrItem();
     ritm.ID = resId;
     do
     {
         if (lcid != -1)
         {
             ritm.LocID = lcid;
             itm = reader.GetText(ritm);
         }
         else
         {
             ritm.LocID = 0;
             itm = reader.GetText(ritm);
             if (itm == null)
                 return defval == null ? "string not found...." : defval;
         }
         if (itm != null)
         {
             LastModified = itm.LastModified;
             if (itm.ContentType.Contains("html"))
                 return itm.Text.Replace("_webroot_", VirtualPathUtility.ToAbsolute("~/"));
             else
                 return itm.Text;
         }
         lcid = GetParentLCID(lcid);
     } while (lcid != -1);
     ritm.LocID = 0;
     itm = reader.GetText(ritm);
     if (itm == null)
         return defval == null ? "string not found...." : defval;
     LastModified = itm.LastModified;
     if (itm.ContentType.Contains("html"))
         return itm.Text.Replace("_webroot_", VirtualPathUtility.ToAbsolute("~/"));
     else
         return itm.Text;
 }