/// <summary> /// Updates the specified thumb with the specified path /// </summary> /// <param name="thumbType"></param> /// <param name="thumbPath"></param> public void UpdateThumb(ThumbType thumbType, string thumbPath) { switch (thumbType) { case ThumbType.FrontCover: frontCover.Path = thumbPath; break; case ThumbType.BackCover: backCover.Path = thumbPath; break; case ThumbType.TitleScreen: titleScreen.Path = thumbPath; break; case ThumbType.InGameScreen: inGame.Path = thumbPath; break; case ThumbType.Fanart: fanart.Path = thumbPath; break; } }
/// <summary> /// Updates the specified thumb with the specified image /// </summary> /// <param name="thumbType"></param> /// <param name="thumb"></param> public void UpdateThumb(ThumbType thumbType, Image thumb) { switch (thumbType) { case ThumbType.FrontCover: frontCover.Image = thumb; break; case ThumbType.BackCover: backCover.Image = thumb; break; case ThumbType.TitleScreen: titleScreen.Image = thumb; break; case ThumbType.InGameScreen: inGame.Image = thumb; break; case ThumbType.Fanart: fanart.Image = thumb; break; } }
public Thumb(ThumbType thumbType) { switch (thumbType) { case ThumbType.FrontCover: friendlyName = "Front Cover"; break; case ThumbType.BackCover: friendlyName = "Back Cover"; break; case ThumbType.TitleScreen: friendlyName = "Title Screen"; break; case ThumbType.InGameScreen: friendlyName = "Ingame Screen"; break; case ThumbType.Fanart: friendlyName = "Fanart"; break; } }
//激发路由事件,借用Click事件的激发方法 protected void OnDragDeltaChanged(ThumbType thumbType = ThumbType.Center) { ObjectRoutedEventArgs <ThumbType> args = new ObjectRoutedEventArgs <ThumbType>(DragDeltaChangedRoutedEvent, this); args.Entity = thumbType; this.RaiseEvent(args); }
/// <summary> /// 获取群图片 /// </summary> /// <param name="groupId">群ID</param> /// <param name="type">图片大小</param> /// <returns>群图片路径</returns> public static string GetGroupImg(object groupId, ThumbType type) { string text = string.Format("{0}face/{1}{2}.jpg", ClientGroupFolder(groupId), groupId, type); //Debug.Trace(HttpContext.Current.Request.PhysicalApplicationPath + text); // if (IOFactory.StoreFile.Exists(HttpContext.Current.Request.PhysicalApplicationPath + text)) { return(text); //} //return "/images/logoMain.jpg"; }
/// <summary> /// 用户头像 /// </summary> /// <param name="userid"></param> /// <param name="type"></param> /// <returns></returns> public static string GetFace(object userid, ThumbType type) { string text = string.Format("{0}Face/{1}{2}.jpg", UserWebPath(userid.ToString()), userid, type); //if (IOFactory.StoreFile.Exists(HttpContext.Current.Request.PhysicalApplicationPath + text)) { return(text); // } //return EmptyImage(type); }
public static string GetFaceEmpty(string userid, ThumbType type) { //如果没有图片则返回空串 if (userid.Length > 3) { string text = string.Format("{0}face/{1}{2}.jpg", UserWebPath(userid), userid.Substring(0, 3), type); // if (IOFactory.StoreFile.Exists(HttpContext.Current.Request.PhysicalApplicationPath + text)) { return(text); // } } return(String.Empty); }
public static bool IsThumbFile(string path, out ThumbType thumbType) { thumbType = ThumbType.FrontCover; string filename; string extension; try { filename = Path.GetFileNameWithoutExtension(path).ToLowerInvariant(); extension = Path.GetExtension(path).ToLowerInvariant(); } catch { return false; } if (extension == ".jpg" || extension == ".png") { if (filename == LOGO_NAME.ToLowerInvariant()) { thumbType = ThumbType.Logo; return true; } else if (filename == BOX_FRONT_NAME.ToLowerInvariant()) { thumbType = ThumbType.FrontCover; return true; } else if (filename == BOX_BACK_NAME.ToLowerInvariant()) { thumbType = ThumbType.BackCover; return true; } else if (filename == TITLESCREEN_NAME.ToLowerInvariant()) { thumbType = ThumbType.TitleScreen; return true; } else if (filename == INGAME_NAME.ToLowerInvariant()) { thumbType = ThumbType.InGameScreen; return true; } else if (filename == FANART_NAME.ToLowerInvariant()) { thumbType = ThumbType.Fanart; return true; } } return false; }
string getThumbPath(ThumbType thumbType) { string path = ThumbPath; switch (thumbType) { case ThumbType.FrontCover: if (parentItemIsGame) { path += BOX_FRONT_NAME; } else { path += LOGO_NAME; } break; case ThumbType.BackCover: path += BOX_BACK_NAME; break; case ThumbType.TitleScreen: path += TITLESCREEN_NAME; break; case ThumbType.InGameScreen: path += INGAME_NAME; break; case ThumbType.Fanart: path += FANART_NAME; break; } if (System.IO.File.Exists(path + ".jpg")) { return(path + ".jpg"); } if (System.IO.File.Exists(path + ".png")) { return(path + ".png"); } return(""); }
/// <summary> /// Returns the Image for the specified thumb /// </summary> /// <param name="thumbType"></param> /// <returns></returns> public Image GetThumb(ThumbType thumbType) { switch (thumbType) { case ThumbType.FrontCover: return(frontCover.Image); case ThumbType.BackCover: return(backCover.Image); case ThumbType.TitleScreen: return(titleScreen.Image); case ThumbType.InGameScreen: return(inGame.Image); case ThumbType.Fanart: return(fanart.Image); default: return(null); } }
/// <summary> /// Returns the path to the specified thumb /// </summary> /// <param name="thumbType"></param> /// <returns></returns> public string GetThumbPath(ThumbType thumbType) { switch (thumbType) { case ThumbType.FrontCover: return(frontCover.Path); case ThumbType.BackCover: return(backCover.Path); case ThumbType.TitleScreen: return(titleScreen.Path); case ThumbType.InGameScreen: return(inGame.Path); case ThumbType.Fanart: return(fanart.Path); default: return(""); } }
public Thumb(ThumbType thumbType) { switch (thumbType) { case ThumbType.Logo: friendlyName = "Logo"; break; case ThumbType.FrontCover: friendlyName = "Front Cover"; break; case ThumbType.BackCover: friendlyName = "Back Cover"; break; case ThumbType.TitleScreen: friendlyName = "Title Screen"; break; case ThumbType.InGameScreen: friendlyName = "Ingame Screen"; break; case ThumbType.Fanart: friendlyName = "Fanart"; break; } }
/// <summary> 更新数据 </summary> void RefreshData(ThumbType thumb) { if (_flag) { _flag = false; Canvas parent = _center_thumb.Parent as Canvas; var left = Canvas.GetLeft(_center_thumb) / parent.ActualWidth; var right = (Canvas.GetLeft(_center_thumb) + this._center_thumb.ActualWidth) / parent.ActualWidth; if (thumb == ThumbType.Left) { this.LeftPercent = (left * MaxValue - (left * MaxValue) % minSplite) / MaxValue; } else if (thumb == ThumbType.Right) { this.RightPercent = (right * MaxValue - (right * MaxValue) % minSplite + minSplite) / MaxValue; } else { //this.LeftPercent = Convert.ToDouble((int)(left * MaxValue)) / MaxValue; //this.RightPercent = Convert.ToDouble((int)(right * MaxValue)) / MaxValue; this.LeftPercent = (left * MaxValue - (left * MaxValue) % minSplite) / MaxValue; this.RightPercent = (right * MaxValue - (right * MaxValue) % minSplite) / MaxValue; } Debug.WriteLine("左:" + this.LeftPercent + " 右:" + this.RightPercent); _flag = true; } }
/// <summary> /// Opens the Thumb Directory in Windows Explorer, /// highlighting the selected thumb if it exists /// </summary> /// <param name="thumbType">The thumb to select</param> public void BrowseThumbs(ThumbType thumbType) { if (ID < -1) { Logger.LogDebug("Unable to browse thumb directory, the emulator is not in the database"); return; } string file = ""; //get file name switch (thumbType) { case ThumbType.FrontCover: if (parentItemIsGame) { file = BOX_FRONT_NAME; } else { file = LOGO_NAME; } break; case ThumbType.BackCover: file = BOX_BACK_NAME; break; case ThumbType.TitleScreen: file = TITLESCREEN_NAME; break; case ThumbType.InGameScreen: file = INGAME_NAME; break; case ThumbType.Fanart: file = FANART_NAME; break; } string args = ""; string path = ThumbPath; if (System.IO.File.Exists(path + file + ".jpg")) { //selected thumb exists, set arguments to highlight file args = "/select," + path + file + ".jpg"; } else if (System.IO.File.Exists(path + file + ".png")) { //selected thumb exists, set arguments to highlight file args = "/select," + path + file + ".png"; } else { //selected thumb doesn't exist, //check if directory exists and create if necessary if (!System.IO.Directory.Exists(ThumbPath)) { try { System.IO.Directory.CreateDirectory(ThumbPath); } catch (Exception ex) { Logger.LogError("Error creating thumb directory for {0} - {1}", ParentTitle, ex.Message); return; } } //set args to just open directory args = ThumbPath; } // launch Explorer with selected args using (Process proc = new Process()) { proc.StartInfo = new ProcessStartInfo(); proc.StartInfo.FileName = "explorer.exe"; proc.StartInfo.Arguments = args; proc.Start(); } }
private static string EmptyImage(ThumbType type) { return(string.Format("/images/no_{0}.jpg", type)); }
/// <summary> /// Save specified thumb /// </summary> public void SaveThumb(ThumbType thumbType) { if (ID < -1) { //new Emulator, no save directory return; } string friendlyName = null; string fileName = null; Image thumb = null; bool resize = false; string savePath = ThumbPath; //check and create thumb directory if (!System.IO.Directory.Exists(savePath)) { try { System.IO.Directory.CreateDirectory(savePath); } catch (Exception ex) { Logger.LogError("Error creating thumb directory for {0} - {1}", ParentTitle, ex.Message); return; } } //get file/friendly name and set resize option switch (thumbType) { case ThumbType.FrontCover: if (parentItemIsGame) { friendlyName = "Front Cover"; savePath += BOX_FRONT_NAME; resize = Options.Instance.GetBoolOption("resizethumbs"); } else { //Emulator so set front cover to Logo friendlyName = "Logo"; savePath += LOGO_NAME; } fileName = frontCover.Path; thumb = frontCover.Image; break; case ThumbType.BackCover: friendlyName = "Back Cover"; savePath += BOX_BACK_NAME; resize = Options.Instance.GetBoolOption("resizethumbs"); fileName = backCover.Path; thumb = backCover.Image; break; case ThumbType.TitleScreen: friendlyName = "Title Screen"; savePath += TITLESCREEN_NAME; fileName = titleScreen.Path; thumb = titleScreen.Image; break; case ThumbType.InGameScreen: friendlyName = "In Game Screen"; savePath += INGAME_NAME; fileName = inGame.Path; thumb = inGame.Image; break; case ThumbType.Fanart: friendlyName = "Fanart"; savePath += FANART_NAME; fileName = fanart.Path; thumb = fanart.Image; break; } if (thumb == null) { //only delete if filename is also empty, else there was a problem //loading the image but path may still be valid if (fileName == "") { //Delete thumb try { System.IO.File.Delete(savePath + ".jpg"); } catch { } try { System.IO.File.Delete(savePath + ".png"); } catch { } } else { Logger.LogError("Unable to save {0} for {1} - error loading path '{2}'", friendlyName, ParentTitle, fileName); } return; } bool shrinkThumb = false; int maxThumbDimension = 0; if (thumbType != ThumbType.Fanart) { maxThumbDimension = Options.Instance.GetIntOption("maxthumbdimension"); if (maxThumbDimension < 0) { maxThumbDimension = 0; } shrinkThumb = maxThumbDimension > 0 && (thumb.Width > maxThumbDimension || thumb.Height > maxThumbDimension); } string ext = ".png"; //if we are not resizing and we have a reference to an image in a valid format //on the local file system, copy the file to the thumb location if (!resize && !shrinkThumb && isValidThumbPath(fileName, ref ext)) { if (fileName != savePath + ext) //check that image actually needs updating { try { System.IO.File.Copy(fileName, savePath + ext, true); } catch (Exception ex) { Logger.LogError("Error copying new {0} for {1} - {2}", friendlyName, ParentTitle, ex.Message); return; } } } else { //If first save set image encoder parameters if (jpegCodec == null) { initImageEncoder(); } try { if (resize || shrinkThumb) { thumb = ImageHandler.ResizeImage(thumb, resize ? thumbaspect : 0, shrinkThumb ? maxThumbDimension : 0); } //save image to thumb location thumb.Save(savePath + ext, jpegCodec, encoderParams); } catch (Exception ex) { Logger.LogError("Error saving new {0} for {1} - {2}", friendlyName, ParentTitle, ex.Message); return; } } //if image is jpg, remove any png's and vice versa RemoveAlternateThumb(savePath + ext); //update thumb path to save location switch (thumbType) { case ThumbType.FrontCover: frontCover.Path = savePath + ext; break; case ThumbType.BackCover: backCover.Path = savePath + ext; break; case ThumbType.TitleScreen: titleScreen.Path = savePath + ext; break; case ThumbType.InGameScreen: inGame.Path = savePath + ext; break; case ThumbType.Fanart: fanart.Path = savePath + ext; break; } }
public void SetThumb(ThumbType thumb, double value) { thumbMapping[thumb] = value; updateADSR(); updateFrequencyFilter(); }
string getThumbPath(ThumbType thumbType) { if (string.IsNullOrEmpty(thumbPath)) { Logger.LogWarn("No thumb path found for '{0}'", parentItem); return null; } string path = thumbPath; switch (thumbType) { case ThumbType.Logo: path += LOGO_NAME; break; case ThumbType.FrontCover: path += BOX_FRONT_NAME; break; case ThumbType.BackCover: path += BOX_BACK_NAME; break; case ThumbType.TitleScreen: path += TITLESCREEN_NAME; break; case ThumbType.InGameScreen: path += INGAME_NAME; break; case ThumbType.Fanart: path += FANART_NAME; break; } if (System.IO.File.Exists(path + ".png")) return path + ".png"; if (System.IO.File.Exists(path + ".jpg")) return path + ".jpg"; return null; }
/// <summary> /// Returns the path to the specified thumb /// </summary> /// <param name="thumbType"></param> /// <returns></returns> public string GetThumbPath(ThumbType thumbType) { switch (thumbType) { case ThumbType.Logo: return logo.Path; case ThumbType.FrontCover: return frontCover.Path; case ThumbType.BackCover: return backCover.Path; case ThumbType.TitleScreen: return titleScreen.Path; case ThumbType.InGameScreen: return inGame.Path; case ThumbType.Fanart: return fanart.Path; default: return null; } }
/// <summary> /// Updates the specified thumb with the specified path /// </summary> /// <param name="thumbType"></param> /// <param name="thumbPath"></param> public void UpdateThumb(ThumbType thumbType, string thumbPath) { switch (thumbType) { case ThumbType.Logo: logo.Path = thumbPath; break; case ThumbType.FrontCover: frontCover.Path = thumbPath; break; case ThumbType.BackCover: backCover.Path = thumbPath; break; case ThumbType.TitleScreen: titleScreen.Path = thumbPath; break; case ThumbType.InGameScreen: inGame.Path = thumbPath; break; case ThumbType.Fanart: fanart.Path = thumbPath; break; } }
/// <summary> /// Updates the specified thumb with the specified image /// </summary> /// <param name="thumbType"></param> /// <param name="thumb"></param> public void UpdateThumb(ThumbType thumbType, Image thumb) { switch (thumbType) { case ThumbType.Logo: logo.Image = thumb; break; case ThumbType.FrontCover: frontCover.Image = thumb; break; case ThumbType.BackCover: backCover.Image = thumb; break; case ThumbType.TitleScreen: titleScreen.Image = thumb; break; case ThumbType.InGameScreen: inGame.Image = thumb; break; case ThumbType.Fanart: fanart.Image = thumb; break; } }
/// <summary> /// 计算手柄所在位置 /// </summary> /// <param name="rc"></param> /// <param name="thumbType"></param> /// <returns></returns> public static Point GetThumbPosition(this Rect rc, ThumbType thumbType) { switch (thumbType) { case ThumbType.Left: return rc.LeftCenter(); case ThumbType.Right: return rc.RightCenter(); case ThumbType.Top: return rc.TopCenter(); case ThumbType.Bottom: return rc.BottomCenter(); case ThumbType.TopLeft: return rc.TopLeft; case ThumbType.TopRight: return rc.TopRight; case ThumbType.BottomLeft: return rc.BottomLeft; case ThumbType.BottomRight: return rc.BottomRight; default: throw new ApplicationException("UnSupport Handle: " + thumbType); } }
public string ThumbPhoto(string path, ThumbType thumbType) { int x = path.LastIndexOf("."); return(x > 0 ? path.Insert(x - 1, thumbType.ToString()).ToLower() : ""); }
bool saveImage(SafeImage image, RomMatch romMatch, ThumbGroup thumbGroup, ThumbType thumbType) { if (!doWork) return false; lock (romMatch.SyncRoot) { if (!romMatch.OwnedByThread()) return false; if (image != null) { thumbGroup.GetThumbObject(thumbType).SetSafeImage(image.Image); thumbGroup.SaveThumb(thumbType); } } return true; }
public bool HasLocalThumb(ThumbType thumbType) { string path; return HasLocalThumb(thumbType, out path); }
/// <summary> /// Opens the specified thumb in the default image viewer /// </summary> /// <param name="thumbType"></param> public void LaunchThumb(ThumbType thumbType) { Thumb thumb = null; //get specified thumb switch (thumbType) { case ThumbType.FrontCover: thumb = frontCover; break; case ThumbType.BackCover: thumb = backCover; break; case ThumbType.TitleScreen: thumb = titleScreen; break; case ThumbType.InGameScreen: thumb = inGame; break; case ThumbType.Fanart: thumb = fanart; break; } if (thumb == null) { return; } string thumbPath = ""; //path is in local file system use that if (thumb.Path != "" && !thumb.Path.ToLower().StartsWith("http://")) { thumbPath = thumb.Path; } //else if we have an image, save a temp image and use temp path else if (thumb.Image != null) { thumbPath = getTempThumbPath(thumb.Image); } else { return; //no path or image } if (thumbPath == "") { return; } //open selected path using (Process proc = new Process()) { proc.StartInfo = new ProcessStartInfo(thumbPath); proc.Start(); } }
public string ThumbUrl(string url, ThumbType thumbType, IContext context) { return(string.IsNullOrEmpty(url) ? "" : System.IO.Path.Combine(context.Site.Upload.Domain, ThumbPhoto(url, thumbType))); }
/// <summary> /// Save specified thumb /// </summary> public void SaveThumb(ThumbType thumbType) { if (string.IsNullOrEmpty(thumbPath)) { Logger.LogWarn("No thumb path found for '{0}'", parentItem); return; } Thumb thumbObject; string thumbName; bool shrink = true; bool isCover = false; //get file/friendly name and set resize option switch (thumbType) { case ThumbType.Logo: thumbObject = logo; thumbName = LOGO_NAME; break; case ThumbType.FrontCover: thumbObject = frontCover; thumbName = BOX_FRONT_NAME; isCover = true; break; case ThumbType.BackCover: thumbObject = backCover; thumbName = BOX_BACK_NAME; isCover = true; break; case ThumbType.TitleScreen: thumbObject = titleScreen; thumbName = TITLESCREEN_NAME; break; case ThumbType.InGameScreen: thumbObject = inGame; thumbName = INGAME_NAME; break; case ThumbType.Fanart: thumbObject = fanart; thumbName = FANART_NAME; shrink = false; break; default: return; } if (!thumbObject.NeedsUpdate) return; if (thumbObject.Image == null) { //only delete if filename is also empty, else there was a problem //loading the image but path may still be valid if (string.IsNullOrEmpty(thumbObject.Path)) deleteThumb(thumbPath, thumbName); else Logger.LogError("Unable to save {0} for {1} - error loading path '{2}'", thumbType, parentItem, thumbObject.Path); } else { saveThumb(thumbObject, thumbPath + thumbName, isCover, shrink); } thumbObject.NeedsUpdate = false; }
public static string Photo(long UserID, DateTime dt, string ext, ThumbType t) { return(Photo(UserID, dt, ext, t.ToString())); }
/// <summary> /// Opens the specified thumb in the default image viewer /// </summary> /// <param name="thumbType"></param> public void LaunchThumb(ThumbType thumbType) { Thumb thumb = null; //get specified thumb switch (thumbType) { case ThumbType.Logo: thumb = logo; break; case ThumbType.FrontCover: thumb = frontCover; break; case ThumbType.BackCover: thumb = backCover; break; case ThumbType.TitleScreen: thumb = titleScreen; break; case ThumbType.InGameScreen: thumb = inGame; break; case ThumbType.Fanart: thumb = fanart; break; } string thumbPath; //path is in local file system use that if (!string.IsNullOrEmpty(thumb.Path) && !thumb.Path.ToLower().StartsWith("http://")) thumbPath = thumb.Path; //else if we have an image, save a temp image and use temp path else if (thumb.Image != null) thumbPath = getTempThumbPath(thumb.Image); else return; //no path or image if (thumbPath != null) { //open selected path using (Process proc = new Process()) { proc.StartInfo = new ProcessStartInfo(thumbPath); proc.Start(); } } }
public bool HasLocalThumb(ThumbType thumbType, out string path) { path = GetThumbPath(thumbType); string extension; return isValidThumbPath(path, out extension); }
/// <summary> /// Opens the Thumb Directory in Windows Explorer, /// highlighting the selected thumb if it exists /// </summary> /// <param name="thumbType">The thumb to select</param> public void BrowseThumbs(ThumbType thumbType) { if (string.IsNullOrEmpty(thumbPath)) { Logger.LogWarn("No thumb path found for '{0}'", parentItem); return; } string file = ""; //get file name switch (thumbType) { case ThumbType.Logo: file = LOGO_NAME; break; case ThumbType.FrontCover: file = BOX_FRONT_NAME; break; case ThumbType.BackCover: file = BOX_BACK_NAME; break; case ThumbType.TitleScreen: file = TITLESCREEN_NAME; break; case ThumbType.InGameScreen: file = INGAME_NAME; break; case ThumbType.Fanart: file = FANART_NAME; break; } string args = ""; if (System.IO.File.Exists(thumbPath + file + ".jpg")) { //selected thumb exists, set arguments to highlight file args = "/select," + thumbPath + file + ".jpg"; } else if (System.IO.File.Exists(thumbPath + file + ".png")) { //selected thumb exists, set arguments to highlight file args = "/select," + thumbPath + file + ".png"; } else { //selected thumb doesn't exist, //check if directory exists and create if necessary if (!System.IO.Directory.Exists(thumbPath)) { try { System.IO.Directory.CreateDirectory(thumbPath); } catch (Exception ex) { Logger.LogError("Error creating thumb directory for {0} - {1}", parentItem, ex.Message); return; } } //set args to just open directory args = thumbPath; } // launch Explorer with selected args using (Process proc = new Process()) { proc.StartInfo = new ProcessStartInfo(); proc.StartInfo.FileName = "explorer.exe"; proc.StartInfo.Arguments = args; proc.Start(); } }
public Thumb GetThumbObject(ThumbType thumbType) { switch (thumbType) { case ThumbType.Logo: return logo; case ThumbType.FrontCover: return frontCover; case ThumbType.BackCover: return backCover; case ThumbType.TitleScreen: return titleScreen; case ThumbType.InGameScreen: return inGame; case ThumbType.Fanart: return fanart; default: return null; } }
/// <summary> /// Returns the Image for the specified thumb /// </summary> /// <param name="thumbType"></param> /// <returns></returns> public Image GetThumb(ThumbType thumbType) { switch (thumbType) { case ThumbType.Logo: return logo.Image; case ThumbType.FrontCover: return frontCover.Image; case ThumbType.BackCover: return backCover.Image; case ThumbType.TitleScreen: return titleScreen.Image; case ThumbType.InGameScreen: return inGame.Image; case ThumbType.Fanart: return fanart.Image; default: return null; } }
/// <summary> /// 将举行某个边或角拖动一定偏移量,计算偏移之后的矩形位置 /// 计算时须保证矩形边长不小于minSize /// </summary> /// <param name="rc"></param> /// <param name="thumbType"></param> /// <param name="offset"></param> /// <param name="minSize">最小大小</param> /// <returns></returns> public static Rect Drag(this Rect rc, ThumbType thumbType, Vector offset, double minSize) { double left = rc.Left; double top = rc.Top; double right = rc.Right; double bottom = rc.Bottom; switch (thumbType) { case ThumbType.Drag: left += offset.X; right += offset.X; top += offset.Y; bottom += offset.Y; break; case ThumbType.Left: left = Math.Min(left + offset.X, right - minSize); break; case ThumbType.Right: right = Math.Max(right + offset.X, left + minSize); break; case ThumbType.Top: top = Math.Min(top + offset.Y, bottom - minSize); break; case ThumbType.Bottom: bottom = Math.Max(bottom + offset.Y, top + minSize); break; case ThumbType.TopLeft: left = Math.Min(left + offset.X, right - minSize); top = Math.Min(top + offset.Y, bottom - minSize); break; case ThumbType.TopRight: right = Math.Max(right + offset.X, left + minSize); top = Math.Min(top + offset.Y, bottom - minSize); break; case ThumbType.BottomLeft: left = Math.Min(left + offset.X, right - minSize); bottom = Math.Max(bottom + offset.Y, top + minSize); break; case ThumbType.BottomRight: right = Math.Max(right + offset.X, left + minSize); bottom = Math.Max(bottom + offset.Y, top + minSize); break; } return new Rect(left, top, right - left, bottom - top); }
public ToneThumbEvent(ThumbType type, ThumbDirection direction) : base(ToneEventType.Thumb) { Type = type; Direction = direction; }