コード例 #1
0
ファイル: SmartDetection.cs プロジェクト: RyanChang0369/tMLH2
        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);
        }
コード例 #2
0
 /// <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);
 }
コード例 #3
0
ファイル: SmartDetection.cs プロジェクト: RyanChang0369/tMLH2
        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);
        }
コード例 #4
0
        /// <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 &lt;= x &lt;= 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;
        }
コード例 #5
0
 public static bool IsArmorLike(MainWindow.ItemType itemType)
 {
     return(GetGrouping(itemType) == (int)ItemType.Armor ||
            GetGrouping(itemType) == (int)ItemType.Static);
 }
コード例 #6
0
 /// <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;
 }