public static byte[] GenerateImage( System.Web.HttpContext context, string profile, string file) { return(GenerateImage(context, profile, file, ImagerConfig.Empty(), null)); }
public static ImagerConfig GetImagerConfig(System.Web.HttpContext context, string profile) { ImagerConfig config = ImagerConfig.Empty(); try { System.Data.DataTable tbProfile = Sota.Web.SimpleSite.Config.GetConfigTable("imager.config", "profile"); System.Data.DataRow rConfigMain = Sota.Web.SimpleSite.Config.GetConfigTable("imager.config", "imager").Rows[0]; if (Util.IsBlank(profile)) { if (rConfigMain["allowqs"].ToString() == "0") { config = ImagerConfig.FromDataRow(tbProfile.Select("id='" + rConfigMain["default"] + "'")[0]); } else { config = ImagerConfig.FromQueryString(context.Request.QueryString); } } else { DataRow[] rows = tbProfile.Select("id='" + profile + "'"); if (rows.Length > 0) { config = ImagerConfig.FromDataRow(rows[0]); } } } catch (FileNotFoundException ex)//на случай если файл конфигурации не существует { Config.ReportError(ex); System.Data.DataTable tbMain = new System.Data.DataTable("imager"); tbMain.Columns.Add("allowqs"); tbMain.Columns.Add("default"); tbMain.Rows.Add(new object[] { "1", "1" }); Sota.Web.SimpleSite.Config.WriteConfigTable("imager.config", tbMain, "root"); System.Data.DataTable tbProfile = new System.Data.DataTable("profile"); tbProfile.Columns.Add("id"); tbProfile.Rows.Add(new object[] { "1" }); Sota.Web.SimpleSite.Config.WriteConfigTable("imager.config", tbProfile, "root"); } return(config); }