private static MainWindow.ItemType DetectByMethodNames(string fileContents, int pixelHeight) { // Find UseStyle Methods MainWindow.ItemType selectedOption = DetectByUseStyle(fileContents); if (selectedOption > 0) { return(selectedOption); } // Find Armor Methods selectedOption = DetectByMethodNames_Armor(fileContents, pixelHeight); if (selectedOption > 0) { return(selectedOption); } // Find Accessory Methods selectedOption = DetectByMethodNames_Accessory(fileContents); if (selectedOption > 0) { return(selectedOption); } return(MainWindow.ItemType.Unknown); }
/// <summary> /// Use when a new source is required. /// </summary> public void NewSource(BitmapImage bitmapImage, string fullPath) { ItemType = SmartDetection.DetectType(fullPath, bitmapImage); UpdateSource(bitmapImage); DisposeWatcher(); CheckForSourceUpdate(fullPath); PixelsPerFrame = SmartDetection.DetectFrameHeight(bitmapImage.PixelHeight, ItemType); }
public static int DetectFrameHeight(int sourceHeight, MainWindow.ItemType itemType) { if (MainWindow.IsArmorLike(itemType)) { if (sourceHeight == 1120) { return(56); } else if (sourceHeight == 1118) { return(56); } } return(sourceHeight); }
/// <summary> /// Creates a paned image object. RUN INITSTATIC BEFORE RUNNING THIS. /// </summary> /// <param name="startFrame">Total number of frames in this paned image</param> /// <param name="itemType"></param> /// <param name="startFrame">Current frame of this paned image. This equals x, where 0 <= x <= frames</param> /// <param name="bitmapImage">The bitmap associated with this object</param> /// <param name="imageElement">The System.Windows.Controls.Image associated with this object</param> /// <param name="nextPaneButton">The button that increments the current pane that is associated with this object</param> /// <param name="prevPaneButton">The button that decrements the current pane that is associated with this object</param> public PanedImage(int startFrame, MainWindow.ItemType itemType, int pixelsPerFrame, BitmapImage bitmapImage, Image imageElement, Button nextPaneButton, Button prevPaneButton) { PixelsPerFrame = pixelsPerFrame; CurrentFrame = startFrame; SourceImage = bitmapImage; ImageElement = imageElement; NextPaneButton = nextPaneButton; PreviousPaneButton = prevPaneButton; nextPaneButton.Click += NextPaneButton_Click; prevPaneButton.Click += PrevPaneButton_Click; TogglePaneButtons(); CroppedBitmap = new CroppedBitmap(SourceImage, ImageHandler.GetCropRect(Frames, CurrentFrame, SourceImage)); imageElement.Source = CroppedBitmap; }
public static bool IsArmorLike(MainWindow.ItemType itemType) { return(GetGrouping(itemType) == (int)ItemType.Armor || GetGrouping(itemType) == (int)ItemType.Static); }
/// <summary> /// Changes the ItemType to a new value. /// </summary> /// <param name="newType">The new type. Refer to MainWidow ItemType enum</param> public void ChangeItemType(MainWindow.ItemType newType) { ItemType = newType; }