public void LoadPage() { if (!AjaxLoadCheck()) { return; } string msg = ""; HttpFileCollection files = HttpContext.Current.Request.Files; BaseConfig conf = ShopCache.GetBaseConfig(); B_WaterConfig bc = new B_WaterConfig(); WaterConfig mx = bc.LoadConfig(); if (files.Count > 0) { ///'检查文件扩展名字 HttpPostedFile postedFile = files[0]; string name = "icon"; string savepath = GetPath(); string fileName, fileExtension; fileName = System.IO.Path.GetFileName(postedFile.FileName); fileExtension = System.IO.Path.GetExtension(fileName); name = name + fileExtension; string ServerPath = System.Web.HttpContext.Current.Server.MapPath("/"); string fdir = ServerPath + savepath + "/icon" + fileExtension; string fdirs = ServerPath + savepath + "/icon_small" + fileExtension; if (File.Exists(fdir)) { File.Delete(fdir); } if (File.Exists(fdirs)) { File.Delete(fdirs); } int status = ImageHelper.SaveImage(postedFile, savepath, name); if (status != 290) { msg = Language.Tag(EX_Type.TypeName(status)); Response.Write("{\"msg\":\"" + msg + "\"}"); return; } string OldImage = savepath + name; //生成所有自定义规格 ImageHelper.UPLoad(OldImage, savepath, "icon_small" + fileExtension, 100, 100, "Cut"); //写入数据库 Lebi_Image model = new Lebi_Image(); model.Image = name; model.Keyid = 0; model.Size = "100,100"; model.TableName = "temp"; B_Lebi_Image.Add(model); msg = "OK"; Response.Write("{\"msg\":\"" + msg + "\",\"ImageUrl\":\"" + model.Image + "\"}"); return; } msg = Language.Tag("没有选择任何文件", ""); Response.Write("{\"msg\":\"" + msg + "\"}"); }
public WaterConfig LoadConfig() { WaterConfig model = new WaterConfig(); model = (WaterConfig)SerializationHelper.Load(model.GetType(), this.xmlpath); return(model); }
private void showpic(System.Drawing.Image image, string exname) { System.IO.MemoryStream ms = new System.IO.MemoryStream(); System.Drawing.Imaging.ImageFormat t = System.Drawing.Imaging.ImageFormat.Jpeg; if (exname.ToLower() == ".gif") { t = System.Drawing.Imaging.ImageFormat.Gif; } if (exname.ToLower() == ".png") { t = System.Drawing.Imaging.ImageFormat.Png; } if (image.Width > 300) { B_WaterConfig bc = new B_WaterConfig(); WaterConfig mx = bc.LoadConfig(); if (mx.OnAndOff == "1") { image = ImageHelper.MakeWater(image, mx); } } image.Save(ms, t); Response.ClearContent(); Response.ContentType = "image/jpeg"; Response.BinaryWrite(ms.ToArray()); }
void OnGUI() { UTW = UTWC.config; windowRect = new Rect(Screen.width - 200, 0, 200, Screen.height); waveRect = new Rect(0, 0, 200, Screen.height); windowRect = GUI.Window(0, windowRect, ShowControls, "Controls"); //waveRect = GUI.Window(1,waveRect,ShowWaves,"Waves"); }
void OnGUI() { UTW = UTWC.config; windowRect = new Rect(Screen.width-200,0,200,Screen.height); waveRect = new Rect(0,0,200,Screen.height); windowRect = GUI.Window(0,windowRect,ShowControls,"Controls"); //waveRect = GUI.Window(1,waveRect,ShowWaves,"Waves"); }
private void InitWaterConfig() { waterConfig = (WaterConfig)config.objectReferenceValue; if (waterConfig != null) { wConfigSer = new SerializedObject(waterConfig); aWaveForms = wConfigSer.FindProperty("waveForms"); } }
protected void Page_Load(object sender, EventArgs e) { if (!EX_Admin.Power("watermark_edit", "水印设置")) { PageReturnMsg = PageNoPowerMsg(); } B_WaterConfig bconfig = new B_WaterConfig(); model = bconfig.LoadConfig(); }
public void Create(GridResourceConfig config) { _waterResCompute = config.ComputeShader; _material = config.Material; // set params _config = config as WaterConfig; // create buffers GetKernel(); CreateBuffer(); }
public GenTerrianGpu( int size, Vector3Int origin, GroundConfig groundConfig, WaterConfig waterConfig, StoneConfig stoneConfig, BoundsInt bounds, ComputeShader shader) { _size = size; _origin = origin; _groundConfig = groundConfig; _waterConfig = waterConfig; _stoneConfig = stoneConfig; _bounds = bounds; _dataSize = size; _shader = shader; }
public void LoadPage() { if (!AjaxLoadCheck()) { return; } string msg = ""; string name = ""; string sizestr = "100,100"; //缩略图大小 HttpFileCollection files = HttpContext.Current.Request.Files; BaseConfig conf = ShopCache.GetBaseConfig(); B_WaterConfig bc = new B_WaterConfig(); WaterConfig mx = bc.LoadConfig(); if (files.Count > 0) { ///'检查文件扩展名字 HttpPostedFile postedFile = files[0]; string savepath = GetPath(conf.UpLoadPath); string fileName, fileExtension; fileName = System.IO.Path.GetFileName(postedFile.FileName); fileExtension = System.IO.Path.GetExtension(fileName); if (conf.UpLoadSaveName == "" || conf.UpLoadSaveName == null) { conf.UpLoadSaveName = "0"; } if (conf.UpLoadSaveName == "0") { name = DateTime.Now.ToString("yyMMddssfff") + "_w$h_"; } else { name = System.IO.Path.GetFileNameWithoutExtension(fileName) + "_w$h_"; } name = conf.UpLoadRName + name + fileExtension; int status = ImageHelper.SaveImage(postedFile, savepath, name); if (status != 290) { msg = Language.Tag(EX_Type.TypeName(status)); Response.Write("{\"msg\":\"" + msg + "\"}"); return; } string OldImage = savepath + name; string SmallImage = ""; //生成所有自定义规格 string[] sizes = sizestr.Split('$'); foreach (string ss in sizes) { string[] s = ss.Split(','); int w = Convert.ToInt32(s[0]); int h = Convert.ToInt32(s[1]); SmallImage = name.Replace("_w$h_", "_" + w + "$" + h + "_"); ImageHelper.UPLoad(OldImage, savepath, SmallImage, w, h); } SmallImage = savepath + SmallImage; //写入数据库 Lebi_Image model = new Lebi_Image(); model.Image = savepath + name; model.Keyid = 0; model.Size = sizestr; model.TableName = "temp"; B_Lebi_Image.Add(model); msg = "OK"; Response.Write("{\"msg\":\"" + msg + "\",\"ImageSmall\":\"" + SmallImage + "\",\"ImageUrl\":\"" + model.Image + "\"}"); return; } msg = Language.Tag("没有选择任何文件", ""); Response.Write("{\"msg\":\"" + msg + "\"}"); }
public void LoadPage() { if (!AjaxLoadCheck()) { return; } string msg = ""; string name = ""; HttpFileCollection files = HttpContext.Current.Request.Files; BaseConfig conf = ShopCache.GetBaseConfig(); B_WaterConfig bc = new B_WaterConfig(); WaterConfig mx = bc.LoadConfig(); if (files.Count > 0) { ///'检查文件扩展名字 HttpPostedFile postedFile = files[0]; string savepath = GetPath(conf.UpLoadPath); string fileName, fileExtension; fileName = System.IO.Path.GetFileName(postedFile.FileName); fileExtension = System.IO.Path.GetExtension(fileName); if (conf.UpLoadSaveName == "" || conf.UpLoadSaveName == null) { conf.UpLoadSaveName = "0"; } if (conf.UpLoadSaveName == "0") { name = DateTime.Now.ToString("yyMMddssfff") + "_w$h_"; } else { name = System.IO.Path.GetFileNameWithoutExtension(fileName) + "_w$h_"; } name = conf.UpLoadRName + name + fileExtension; int status = ImageHelper.SaveImage(postedFile, savepath, name); if (status != 290) { msg = Language.Tag(EX_Type.TypeName(status)); Response.Write("{\"msg\":\"" + msg + "\"}"); return; } //if (Shop.LebiAPI.Service.Instanse.Check("imageserver") && WebConfig.Instrance.UpLoadURL != "") //{ // try // { // string url = WebConfig.Instrance.UpLoadURL; // if (url.Contains("?")) // url += "&filename=" + fileName; // else // url += "?filename=" + fileName; // if (WebConfig.Instrance.ImageServerKey != "") // url += "&key=" + WebConfig.Instrance.ImageServerKey; // string res = HtmlEngine.PostFile(url, ImageHelper.rootpath(savepath + name)); // //api = jss.Deserialize<LBAPI>(res); // ImageHelper.DeleteImage(savepath + name); // Response.Write(res); // } // catch (Exception ex) // { // Response.Write("{\"msg\":\"" + ex.Message + "\"}"); // } // return; //} string pos = ""; Thread thread = new Thread(() => { pos = PostFiles(fileName, savepath, name); }); thread.IsBackground = true; thread.Start(); thread.Join(); Response.Write(pos); return; } msg = Language.Tag("没有选择任何文件", ""); Response.Write("{\"msg\":\"" + msg + "\"}"); }
public void LoadPage() { if (!AjaxLoadCheck()) { return; } string msg = ""; string name = ""; int theme_id = RequestTool.RequestInt("theme_id", 0); Lebi_Theme theme = B_Lebi_Theme.GetModel(theme_id); if (theme == null) { Response.Write("{\"msg\":\"" + Language.Tag("参数错误") + "\"}"); return; } HttpFileCollection files = HttpContext.Current.Request.Files; BaseConfig conf = ShopCache.GetBaseConfig(); B_WaterConfig bc = new B_WaterConfig(); WaterConfig mx = bc.LoadConfig(); if (files.Count > 0) { ///'检查文件扩展名字 HttpPostedFile postedFile = files[0]; string savepath = GetPath(theme.Path_Advert); string fileName, fileExtension; fileName = System.IO.Path.GetFileName(postedFile.FileName); fileExtension = System.IO.Path.GetExtension(fileName); if (conf.UpLoadSaveName == "" || conf.UpLoadSaveName == null) { conf.UpLoadSaveName = "0"; } if (conf.UpLoadSaveName == "0") { name = DateTime.Now.ToString("yyMMddssfff") + "_w$h_"; } else { name = System.IO.Path.GetFileNameWithoutExtension(fileName) + "_w$h_"; } name = conf.UpLoadRName + name + fileExtension; int status = ImageHelper.SaveImage(postedFile, savepath, name); if (status != 290) { msg = Language.Tag(EX_Type.TypeName(status)); Response.Write("{\"msg\":\"" + msg + "\"}"); return; } string OldImage = savepath + name; OldImage = ThemeUrl.CheckURL(OldImage); string ImageSmall = name.Replace("_w$h_", "_100$100_"); string size = "100$100"; ImageHelper.UPLoad(OldImage, savepath, ImageSmall, Convert.ToInt32(conf.ImageSmallWidth), Convert.ToInt32(conf.ImageSmallHeight)); //写入数据库 Lebi_Image model = new Lebi_Image(); model.Image = savepath + name; model.Keyid = 0; model.Size = size; model.TableName = "temp"; B_Lebi_Image.Add(model); msg = "OK"; Response.Write("{\"msg\":\"" + msg + "\",\"url\":\"" + savepath + name + "\",\"Image\":\"" + name + "\",\"ImageSmall\":\"" + ImageSmall + "\"}"); return; } msg = Language.Tag("没有选择任何文件", ""); Response.Write("{\"msg\":\"" + msg + "\"}"); }
private string TestUpload() { HttpFileCollection files = HttpContext.Current.Request.Files; B_WaterConfig bc = new B_WaterConfig(); WaterConfig mx = bc.LoadConfig(); BaseConfig conf = ShopCache.GetBaseConfig(); string result = ""; string name = ""; StringBuilder strMsg = new StringBuilder(); string savepath = GetPath(conf.UpLoadPath); try { for (int iFile = 0; iFile < files.Count; iFile++) { ///'检查文件扩展名字 HttpPostedFile postedFile = files[iFile]; string fileName, fileExtension; fileName = System.IO.Path.GetFileName(postedFile.FileName); fileExtension = System.IO.Path.GetExtension(fileName); if (conf.UpLoadSaveName == "" || conf.UpLoadSaveName == null) { conf.UpLoadSaveName = "0"; } if (conf.UpLoadSaveName == "0") { name = DateTime.Now.ToString("yyMMddssfff") + "_w$h_"; } else { name = System.IO.Path.GetFileNameWithoutExtension(fileName) + "_w$h_"; } name = conf.UpLoadRName + name + fileExtension; int status = ImageHelper.SaveImage(postedFile, savepath, name); if (status != 290) { continue; } if (Shop.LebiAPI.Service.Instanse.Check("imageserver") && WebConfig.Instrance.UpLoadURL != "") { try { string res = HtmlEngine.PostFile(WebConfig.Instrance.UpLoadURL, ImageHelper.rootpath(savepath + name)); JavaScriptSerializer jss = new JavaScriptSerializer(); LBAPI api = jss.Deserialize <LBAPI>(res); result = res; } catch (Exception ex) { result = "{\"msg\":\"" + ex.Message + "\"}"; } } else { string OldImage = savepath + name; //string ImageBig = name.Replace("_w$h_", "_" + conf.ImageBigWidth + "$" + conf.ImageBigHeight + "_"); //string ImageMedium = name.Replace("_w$h_", "_" + conf.ImageMediumWidth + "$" + conf.ImageMediumHeight + "_"); //string ImageSmall = name.Replace("_w$h_", "_" + conf.ImageSmallWidth + "$" + conf.ImageSmallHeight + "_"); //string size = conf.ImageBigWidth + "$" + conf.ImageBigHeight + "," + conf.ImageMediumWidth + "$" + conf.ImageMediumHeight + "," + conf.ImageSmallWidth + "$" + conf.ImageSmallHeight; //if (mx.OnAndOff == "1") //{ // ImageHelper.UPLoad(OldImage, savepath, "temp_" + name, Convert.ToInt32(conf.ImageBigWidth), Convert.ToInt32(conf.ImageBigHeight)); // ImageHelper.MakeWater(System.Web.HttpContext.Current.Server.MapPath(savepath) + "temp_" + name, savepath, ImageBig, mx); // ImageHelper.DeleteImage(savepath + "temp_" + name); //} //else //{ // ImageHelper.UPLoad(OldImage, savepath, ImageBig, Convert.ToInt32(conf.ImageBigWidth), Convert.ToInt32(conf.ImageBigHeight)); //} //ImageHelper.UPLoad(OldImage, savepath, ImageMedium, Convert.ToInt32(conf.ImageMediumWidth), Convert.ToInt32(conf.ImageMediumHeight)); //ImageHelper.UPLoad(OldImage, savepath, ImageSmall, Convert.ToInt32(conf.ImageSmallWidth), Convert.ToInt32(conf.ImageSmallHeight)); ////生成所有规格 //string where = "id not in (select id from Lebi_ImageSize where (Width=" + conf.ImageBigWidth + " and Height=" + conf.ImageBigHeight + ") or (Width=" + conf.ImageMediumWidth + " and Height=" + conf.ImageMediumHeight + ") or (Width=" + conf.ImageSmallWidth + " and Height=" + conf.ImageSmallHeight + "))"; //List<Lebi_ImageSize> ss = B_Lebi_ImageSize.GetList(where, ""); //foreach (Lebi_ImageSize s in ss) //{ // ImageHelper.UPLoad(OldImage, savepath, name.Replace("_w$h_", "_" + s.Width + "$" + s.Height + "_"), s.Width, s.Height); // size += "," + s.Width + "$" + s.Height; //} //写入数据库 Lebi_Image model = new Lebi_Image(); model.Image = savepath + name; model.Keyid = 0; model.Size = ""; model.TableName = "temp"; B_Lebi_Image.Add(model); result = "{\"img\":\"" + OldImage + "\",\"msg\":\"OK\"}"; } } } catch (System.Exception ex) { result = "{\"msg\":\"" + ex.Message + "\"}"; } return(result); }
public void LoadPage() { if (!AjaxLoadCheck()) { return; } string msg = ""; string name = ""; int minWidth = 80; //最小宽度 int minHeight = 80; //最小高度 int maxWidth = 200; //最大宽度 int maxHeight = 200; //最大高度 HttpFileCollection files = HttpContext.Current.Request.Files; BaseConfig conf = ShopCache.GetBaseConfig(); B_WaterConfig bc = new B_WaterConfig(); WaterConfig mx = bc.LoadConfig(); if (files.Count > 0) { ///'检查文件扩展名字 HttpPostedFile postedFile = files[0]; string savepath = GetPath(ShopCache.GetBaseConfig().UpLoadPath); string fileName, fileExtension; fileName = System.IO.Path.GetFileName(postedFile.FileName); fileExtension = System.IO.Path.GetExtension(fileName); if (conf.UpLoadSaveName == "" || conf.UpLoadSaveName == null) { conf.UpLoadSaveName = "0"; } if (conf.UpLoadSaveName == "0") { name = DateTime.Now.ToString("yyMMddssfff") + "_w$h_"; } else { name = System.IO.Path.GetFileNameWithoutExtension(fileName) + "_w$h_"; } if (RequestTool.RequestSafeString("path") == "Temp") { name = DateTime.Now.ToString("yyMMddssfff") + "_w$h_"; } name = conf.UpLoadRName + name + fileExtension; int status = ImageHelper.SaveImage(postedFile, savepath, name); if (status != 290) { msg = Language.Tag(EX_Type.TypeName(status)); Response.Write("{\"msg\":\"" + msg + "\"}"); return; } else { string OldImage = savepath + name; string ImageMedium = name.Replace("_w$h_", "_200$200_"); ////写入数据库 //Lebi_Image model = new Lebi_Image(); //model.Image = savepath + ImageMedium; //model.Keyid = 0; //model.Size = ""; //model.TableName = "temp"; //B_Lebi_Image.Add(model); //if (originalImage.Width > minWidth && originalImage.Height > minHeight) //{ ImageHelper.UPLoad(OldImage, savepath, ImageMedium, maxWidth, maxHeight); //} string FilePath = ImageHelper.rootpath(savepath + ImageMedium); System.Drawing.Image originalImage = System.Drawing.Image.FromFile(FilePath); ImageHelper.DeleteImage(OldImage); Response.Write("{\"msg\":\"OK\",\"ImageUrl\":\"" + savepath + ImageMedium + "\",\"width\":\"" + originalImage.Width + "\",\"height\":\"" + originalImage.Height + "\"}"); return; } } msg = Language.Tag("没有选择任何文件"); Response.Write("{\"msg\":\"" + msg + "\"}"); }
/// 〈summary> /// 在图片上增加文字水印 /// 〈/summary> /// 〈param name="oldimage">原图片位置〈/param> /// 〈param name="Path_sy">生成的带文字水印的图片路径〈/param> protected static string MakeWaterTxt(string Oldimage, string NewPath, string NewName, WaterConfig mx) { try { NewPath = ServerPath + NewPath + "/"; if (!File.Exists(NewPath)) //如果路径不存在,则创建 { System.IO.Directory.CreateDirectory(NewPath); } System.Drawing.Image image = System.Drawing.Image.FromFile(Oldimage); System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(image); g.DrawImage(image, 0, 0, image.Width, image.Height); System.Drawing.FontStyle s = System.Drawing.FontStyle.Regular; switch (mx.WM_FontForm) { case "Bold": s = System.Drawing.FontStyle.Bold; break; case "Underline": s = System.Drawing.FontStyle.Underline; break; case "Italic": s = System.Drawing.FontStyle.Italic; break; case "Strikeout": s = System.Drawing.FontStyle.Strikeout; break; } System.Drawing.Font f = new System.Drawing.Font(mx.WM_FontForm, Convert.ToInt32(mx.WM_FontSize), s); //字体 System.Drawing.Color c = System.Drawing.Color.FromName(mx.WM_FontColor); System.Drawing.Brush b = new System.Drawing.SolidBrush(c); if (mx.WM_Height == "0" || mx.WM_Width == "0") { mx.WM_Height = "100"; mx.WM_Width = "200"; } Rectangle rf = new System.Drawing.Rectangle(image.Width - Convert.ToInt32(mx.WM_PlaceX), image.Height - Convert.ToInt32(mx.WM_PlaceY), Convert.ToInt32(mx.WM_Width), Convert.ToInt32(mx.WM_Height)); switch (mx.WM_Location) { case "LeftTop": rf = new System.Drawing.Rectangle(Convert.ToInt32(mx.WM_PlaceX), Convert.ToInt32(mx.WM_PlaceY), Convert.ToInt32(mx.WM_Width), Convert.ToInt32(mx.WM_Height)); break; case "LeftBottom": rf = new System.Drawing.Rectangle(Convert.ToInt32(mx.WM_PlaceX), image.Height - Convert.ToInt32(mx.WM_PlaceY), Convert.ToInt32(mx.WM_Width), Convert.ToInt32(mx.WM_Height)); break; case "RightTop": rf = new System.Drawing.Rectangle(image.Width - Convert.ToInt32(mx.WM_PlaceX), Convert.ToInt32(mx.WM_PlaceY), Convert.ToInt32(mx.WM_Width), Convert.ToInt32(mx.WM_Height)); break; //case "RightBottom": // rf = new System.Drawing.Rectangle(image.Width - Convert.ToInt32(mx.WM_PlaceX), image.Height - Convert.ToInt32(mx.WM_PlaceY), Convert.ToInt32(mx.WM_Width), Convert.ToInt32(mx.WM_Height)); // break; } g.DrawString(mx.WM_Text, f, b, rf); //字体位置20X20 //g.DrawString(mx.WM_Text, f, b, Convert.ToInt32(mx.WM_PlaceX), Convert.ToInt32(mx.WM_PlaceY)); //字体位置20X20 g.Dispose(); if (File.Exists(NewPath + NewName))//检查同名文件,如存在,删除 { File.Delete(NewPath + NewName); } image.Save(NewPath + NewName); image.Dispose(); return("OK"); } catch (Exception ex) { return(ex.Message); } }
public static string MakeWater(string Oldimage, string NewPath, string NewName, WaterConfig mx) { string Msg = "OK"; if (mx.OnAndOff == "1") { if (mx.PicAndText.ToLower() == "logo") { Msg = MakeWaterPic(Oldimage, NewPath, NewName, mx); } else { Msg = MakeWaterTxt(Oldimage, NewPath, NewName, mx); } } return(Msg); }
public void LoadPage() { if (!AjaxLoadCheck()) { return; } string msg = ""; string name = ""; HttpFileCollection files = HttpContext.Current.Request.Files; BaseConfig conf = ShopCache.GetBaseConfig(); B_WaterConfig bc = new B_WaterConfig(); WaterConfig mx = bc.LoadConfig(); if (files.Count > 0) { ///'检查文件扩展名字 HttpPostedFile postedFile = files[0]; string savepath = GetPath(conf.UpLoadPath); string fileName, fileExtension; fileName = System.IO.Path.GetFileName(postedFile.FileName); fileExtension = System.IO.Path.GetExtension(fileName); if (conf.UpLoadSaveName == "" || conf.UpLoadSaveName == null) { conf.UpLoadSaveName = "0"; } if (conf.UpLoadSaveName == "0") { name = DateTime.Now.ToString("yyMMddssfff") + "_w$h_"; } else { name = System.IO.Path.GetFileNameWithoutExtension(fileName) + "_w$h_"; } name = conf.UpLoadRName + name + fileExtension; int status = ImageHelper.SaveImage(postedFile, savepath, name); if (status != 290) { msg = Language.Tag(EX_Type.TypeName(status)); Response.Write("{\"msg\":\"" + msg + "\"}"); return; } if (Shop.LebiAPI.Service.Instanse.Check("imageserver") && WebConfig.Instrance.UpLoadURL != "") { try { string url = WebConfig.Instrance.UpLoadURL; if (url.Contains("?")) { url += "&filename=" + fileName; } else { url += "?filename=" + fileName; } if (WebConfig.Instrance.ImageServerKey != "") { url += "&key=" + WebConfig.Instrance.ImageServerKey; } string res = HtmlEngine.PostFile(url, ImageHelper.rootpath(savepath + name)); //api = jss.Deserialize<LBAPI>(res); ImageHelper.DeleteImage(savepath + name); Response.Write(res); } catch (Exception ex) { Response.Write("{\"msg\":\"" + ex.Message + "\"}"); } return; } string OldImage = savepath + name; //string ImageBig = name.Replace("_w$h_", "_" + conf.ImageBigWidth + "$" + conf.ImageBigHeight + "_"); //string ImageMedium = name.Replace("_w$h_", "_" + conf.ImageMediumWidth + "$" + conf.ImageMediumHeight + "_"); //string ImageSmall = name.Replace("_w$h_", "_" + conf.ImageSmallWidth + "$" + conf.ImageSmallHeight + "_"); //string size = conf.ImageBigWidth + "$" + conf.ImageBigHeight + "," + conf.ImageMediumWidth + "$" + conf.ImageMediumHeight + "," + conf.ImageSmallWidth + "$" + conf.ImageSmallHeight; string size = ""; //if (mx.OnAndOff == "1") //{ // ImageHelper.UPLoad(OldImage, savepath, "temp_" + name, Convert.ToInt32(conf.ImageBigWidth), Convert.ToInt32(conf.ImageBigHeight)); // ImageHelper.MakeWater(System.Web.HttpContext.Current.Server.MapPath(savepath) + "temp_" + name, savepath, ImageBig, mx); // ImageHelper.DeleteImage(savepath + "temp_" + name); //} //else //{ // ImageHelper.UPLoad(OldImage, savepath, ImageBig, Convert.ToInt32(conf.ImageBigWidth), Convert.ToInt32(conf.ImageBigHeight)); //} //ImageHelper.UPLoad(OldImage, savepath, ImageMedium, Convert.ToInt32(conf.ImageMediumWidth), Convert.ToInt32(conf.ImageMediumHeight)); //ImageHelper.UPLoad(OldImage, savepath, ImageSmall, Convert.ToInt32(conf.ImageSmallWidth), Convert.ToInt32(conf.ImageSmallHeight)); ////生成所有规格 //string where = "id not in (select id from Lebi_ImageSize where (Width=" + conf.ImageBigWidth + " and Height=" + conf.ImageBigHeight + ") or (Width=" + conf.ImageMediumWidth + " and Height=" + conf.ImageMediumHeight + ") or (Width=" + conf.ImageSmallWidth + " and Height=" + conf.ImageSmallHeight + "))"; //List<Lebi_ImageSize> ss = B_Lebi_ImageSize.GetList(where, ""); //foreach (Lebi_ImageSize s in ss) //{ // ImageHelper.UPLoad(OldImage, savepath, name.Replace("_w$h_", "_" + s.Width + "$" + s.Height + "_"), s.Width, s.Height); // size += "," + s.Width + "$" + s.Height; //} //写入数据库 Lebi_Image model = new Lebi_Image(); model.Image = OldImage; model.Keyid = 0; model.Size = size; model.TableName = "Product"; B_Lebi_Image.Add(model); msg = "OK"; Response.Write("{\"msg\":\"" + msg + "\",\"img\":\"" + OldImage + "\",\"file\":\"" + fileName + "\"}"); return; } msg = Language.Tag("没有选择任何文件", ""); Response.Write("{\"msg\":\"" + msg + "\"}"); }
public void LoadPage() { if (!AjaxLoadCheck()) { return; } string msg = ""; string name = ""; HttpFileCollection files = HttpContext.Current.Request.Files; BaseConfig conf = ShopCache.GetBaseConfig(); B_WaterConfig bc = new B_WaterConfig(); WaterConfig mx = bc.LoadConfig(); if (files.Count > 0) { ///'检查文件扩展名字 HttpPostedFile postedFile = files[0]; string savepath = GetPath(ShopCache.GetBaseConfig().UpLoadPath); string fileName, fileExtension; fileName = System.IO.Path.GetFileName(postedFile.FileName); fileExtension = System.IO.Path.GetExtension(fileName); if (conf.UpLoadSaveName == "" || conf.UpLoadSaveName == null) { conf.UpLoadSaveName = "0"; } if (conf.UpLoadSaveName == "0") { name = DateTime.Now.ToString("yyMMddssfff") + "_w$h_"; } else { name = System.IO.Path.GetFileNameWithoutExtension(fileName) + "_w$h_"; } if (RequestTool.RequestSafeString("path") == "verified") { name = DateTime.Now.ToString("yyMMddssfff") + "_w$h_"; } name = conf.UpLoadRName + name + fileExtension; int status = ImageHelper.SaveImage(postedFile, savepath, name); if (status != 290) { msg = Language.Tag(EX_Type.TypeName(status)); Response.Write("{\"msg\":\"" + msg + "\"}"); return; } else { //写入数据库 Lebi_Image model = new Lebi_Image(); model.Image = savepath + name; model.Keyid = 0; model.Size = ""; model.TableName = "temp"; B_Lebi_Image.Add(model); Response.Write("{\"msg\":\"OK\",\"ImageUrl\":\"" + model.Image + "\"}"); return; } } msg = Language.Tag("没有选择任何文件"); Response.Write("{\"msg\":\"" + msg + "\"}"); }
public WaterTracker(WaterConfig config, Waterfalls waterfalls) { _config = config; _waterfalls = waterfalls; }
public override void OnInspectorGUI() { EditorGUILayout.HelpBox("Not all changes made during editing in the asset inspector will be applied to the scene.", MessageType.Warning); WaterConfig config = (WaterConfig)target; openBasic = EditorGUILayout.Foldout(openBasic, "Basic settings:"); if (openBasic == true) { float fSizeOld = fSize.floatValue; float fMeshPointDistanceOld = fMeshPointDistance.floatValue; fSize.floatValue = EditorGUILayout.FloatField("Square Water Size: ", fSize.floatValue); fMeshPointDistance.floatValue = EditorGUILayout.FloatField("Meshpoint Distance: ", fMeshPointDistance.floatValue); if (fSizeOld != fSize.floatValue || fMeshPointDistanceOld != fMeshPointDistance.floatValue) { //needGenerateMesh = true; } } openAppearance = EditorGUILayout.Foldout(openAppearance, "Appearance:"); if (openAppearance == true) { Color cWaterColorNew = cWaterColor.colorValue; Color cWaveColorNew = cWaveColor.colorValue; cWaterColorNew = EditorGUILayout.ColorField("Water Color:", cWaterColorNew); cWaveColorNew = EditorGUILayout.ColorField("Wave Color:", cWaveColorNew); cWaterColorNew.a = EditorGUILayout.Slider("Water transparency:", cWaterColorNew.a, 0f, 1f); if (cWaterColorNew != cWaterColor.colorValue || cWaveColorNew != cWaveColor.colorValue) { cWaterColor.colorValue = cWaterColorNew; cWaveColor.colorValue = cWaveColorNew; //needUpdateColors = true; } float fColorTextureRatioOld = fColorTextureRatio.floatValue; float fHeightColoringOld = fHeightColoring.floatValue; float fShoreFoamLineOld = fShoreFoamLine.floatValue; float fShoreFoamCutOld = fShoreFoamCut.floatValue; float fTextureBiasOld = fTextureBias.floatValue; fColorTextureRatio.floatValue = EditorGUILayout.Slider("Color/Texture ratio:", fColorTextureRatio.floatValue, 0f, 1f); fTextureBias.floatValue = EditorGUILayout.Slider("Texture mix:", fTextureBias.floatValue, 0f, 1f); fHeightColoring.floatValue = EditorGUILayout.Slider("Steepness coloring:", fHeightColoring.floatValue, 0f, 1f); fShoreFoamLine.floatValue = EditorGUILayout.FloatField("Shore foam amount:", fShoreFoamLine.floatValue); fShoreFoamCut.floatValue = EditorGUILayout.Slider("Shoe foam cut:", fShoreFoamCut.floatValue, 0f, 1f); if (fColorTextureRatio.floatValue != fColorTextureRatioOld || fTextureBias.floatValue != fTextureBiasOld || fHeightColoring.floatValue != fHeightColoringOld || fShoreFoamLine.floatValue != fShoreFoamLineOld || fShoreFoamCut.floatValue != fShoreFoamCutOld ) { //needUpdateTextureProps = true; } Object tMainTextureOld = tMainTexture.objectReferenceValue; Object tDetailTextureOld = tDetailTexture.objectReferenceValue; tMainTexture.objectReferenceValue = EditorGUILayout.ObjectField("Main Texture:", tMainTexture.objectReferenceValue, typeof(Texture2D), false); tDetailTexture.objectReferenceValue = EditorGUILayout.ObjectField("Detail Texture:", tDetailTexture.objectReferenceValue, typeof(Texture2D), false); if (tMainTexture.objectReferenceValue != tMainTextureOld || tDetailTexture.objectReferenceValue != tDetailTextureOld) { //needUpdateTextures = true; } Vector2 v2MainTextureTitleOld = v2MainTextureTitle.vector2Value; Vector2 v2DetailTextureTitleOld = v2DetailTextureTitle.vector2Value; Vector2 v2MainTexturScrollOld = v2MainTexturScroll.vector2Value; Vector2 v2DetailTexturScrollOld = v2DetailTexturScroll.vector2Value; v2MainTextureTitle.vector2Value = EditorGUILayout.Vector2Field("Main Texture Size:", v2MainTextureTitle.vector2Value); v2DetailTextureTitle.vector2Value = EditorGUILayout.Vector2Field("Detail Texture Size:", v2DetailTextureTitle.vector2Value); v2MainTexturScroll.vector2Value = EditorGUILayout.Vector2Field("Main Texture Scroll:", v2MainTexturScroll.vector2Value); v2DetailTexturScroll.vector2Value = EditorGUILayout.Vector2Field("Detail Texture Scroll:", v2DetailTexturScroll.vector2Value); if (v2MainTextureTitle.vector2Value != v2MainTextureTitleOld || v2DetailTextureTitle.vector2Value != v2DetailTextureTitleOld || v2MainTexturScroll.vector2Value != v2MainTexturScrollOld || v2DetailTexturScroll.vector2Value != v2DetailTexturScrollOld) { //needUpdateTextureSize = true; } } openWaves = EditorGUILayout.Foldout(openWaves, "Waves:"); if (openWaves == true) { if (config.waveForms.Count > 2) { EditorGUILayout.HelpBox("If more than 2 waves are used,\nCPU rendering will be enabled.\nThis is much slower than GPU rendering.", MessageType.Warning); } EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(aWaveForms, true); if (EditorGUI.EndChangeCheck()) { serializedObject.ApplyModifiedProperties(); } } showDefaultInspectorOptions = EditorGUILayout.Foldout(showDefaultInspectorOptions, "Default Inspector:"); if (showDefaultInspectorOptions == true) { DrawDefaultInspector(); } dimObj.ApplyModifiedProperties(); }
private string TestUpload() { HttpFileCollection files = HttpContext.Current.Request.Files; B_WaterConfig bc = new B_WaterConfig(); WaterConfig mx = bc.LoadConfig(); BaseConfig conf = ShopCache.GetBaseConfig(); string result = ""; string name = ""; StringBuilder strMsg = new StringBuilder(); string savepath = GetPath(conf.UpLoadPath); try { for (int iFile = 0; iFile < files.Count; iFile++) { ///'检查文件扩展名字 HttpPostedFile postedFile = files[iFile]; string fileName, fileExtension; fileName = System.IO.Path.GetFileName(postedFile.FileName); fileExtension = System.IO.Path.GetExtension(fileName); if (conf.UpLoadSaveName == "" || conf.UpLoadSaveName == null) { conf.UpLoadSaveName = "0"; } if (conf.UpLoadSaveName == "0") { name = DateTime.Now.ToString("yyMMddssfff") + "_w$h_"; } else { name = System.IO.Path.GetFileNameWithoutExtension(fileName) + "_w$h_"; } name = conf.UpLoadRName + name + fileExtension; int status = ImageHelper.SaveImage(postedFile, savepath, name); if (status != 290) { continue; } if (Shop.LebiAPI.Service.Instanse.Check("imageserver") && WebConfig.Instrance.UpLoadURL != "") { try { string res = HtmlEngine.PostFile(WebConfig.Instrance.UpLoadURL, ImageHelper.rootpath(savepath + name)); res = ImageHelper.GetImageByServerResult(res); ImageHelper.DeleteImage(savepath + name); return(res); } catch (Exception ex) { return(ex.Message); } } string OldImage = savepath + name; result = OldImage; } } catch (System.Exception Ex) { string err = Ex.Message; } return(result); }
public bool SaveConfig(WaterConfig model) { return(SerializationHelper.Save(model, this.xmlpath)); }
private void InitWaterConfig() { waterConfig = (WaterConfig) config.objectReferenceValue; if (waterConfig != null) { wConfigSer = new SerializedObject(waterConfig); aWaveForms = wConfigSer.FindProperty("waveForms"); } }