public virtual string MapJavaScriptVallue(string name, string value) { string s = WebPageCompilerUtility.MapJavaScriptVallue(name, value, _resourceFiles); if (s != null) { return(s); } return(value); }
public virtual string MapJavaScriptVallue(string name, string value) { string s = WebPageCompilerUtility.MapJavaScriptVallue(name, value, _resourceFiles); if (s != null) { return(s); } if (string.CompareOrdinal(name, "ImageData") == 0) { if (string.IsNullOrEmpty(value)) { return("null"); } return(string.Format(CultureInfo.InvariantCulture, "('data:image/jpg;base64,'+{0})", value)); } if (string.CompareOrdinal(name, "ImageFilePath") == 0) { if (!string.IsNullOrEmpty(value)) { string f = null; if (value.StartsWith("'", StringComparison.Ordinal)) { f = value.Substring(1); if (f.EndsWith("'", StringComparison.Ordinal)) { f = f.Substring(0, f.Length - 1); } } if (!string.IsNullOrEmpty(f)) { if (File.Exists(f)) { bool b; _resourceFiles.Add(new WebResourceFile(f, WebResourceFile.WEBFOLDER_Images, out b)); return(string.Format(CultureInfo.InvariantCulture, "'{0}/{1}'", WebResourceFile.WEBFOLDER_Images, Path.GetFileName(f))); } else { if (value.IndexOf('.') >= 0 && value.IndexOf('/') >= 0) //assume it is an image file path { return(string.Format(CultureInfo.InvariantCulture, "'{0}'", f)); } //otherwise assume it is a variable } } } } return(value); }