Ejemplo n.º 1
0
        public CaptureStrategy GetStrategy(CaptureType captureType, MainForm mainForm)
        {
            CaptureStrategy strategy = null;

            switch (captureType)
            {
                case CaptureType.Screen:
                    strategy = new CaptureScreen(mainForm);
                    break;
                case CaptureType.ActiveWindow:
                    strategy = new CaptureActiveWindow(mainForm);
                    break;
                case CaptureType.ActiveMonitor:
                    strategy = new CaptureActiveMonitor(mainForm);
                    break;
                case CaptureType.Rectangle:
                case CaptureType.RectangleWindow:
                case CaptureType.Polygon:
                case CaptureType.Freehand:
                    strategy = new CaptureRegion(mainForm);
                    break;
                case CaptureType.CustomRegion:
                    strategy = new CaptureCustomRegion(mainForm);
                    break;
                case CaptureType.LastRegion:
                    strategy = new CaptureLastRegion(mainForm);
                    break;
            }
            return strategy;
        }
Ejemplo n.º 2
0
        public void showUpGradeFrame()
        {
            UpgradeFrame.SetActive(true);

            #region recordShareImg
            CaptureScreen.GetInstance().CaptureAreaImage(new CaptureAreaImgData(shareImgPath, GetRecordRect()));
            #endregion

            DwonFrame.SetActive(false);
            UpgradeImg.sprite = USpriteManager.Instance.GetSprite(USpriteManager.ESpriteType.EST_RankImage, WndID.WND_ID_WAR_MAIN_FRAME, 1, LogicDataCenter.rankDataManager.getRankID());

            if (m_RankEffectParam != null)
            {
                UEffectManager.Instance.DestroyEffect(UEffectType.UET_EffectPrefab, ref m_RankEffectParam);
                m_RankEffectParam = null;
            }

            int nOffset = LogicDataCenter.rankDataManager.getRankID() - 1;
            if (nOffset >= 0)
            {
                UEffectParamBase param = new UEffectPrefabParam(_eType: UEffectPrefabType.UEPT_WarMain_RankEffect1 + nOffset, _tfAttachParent: this.UpgradeImg.transform);
                UEffectManager.Instance.CreateEffect(UEffectType.UET_EffectPrefab, ref param);

                m_RankEffectParam = param;
                UEffectPrefabParam paramPrefab = (UEffectPrefabParam)param;
                paramPrefab.EffectGameObject.transform.SetAsFirstSibling();
            }

            // 显示描述
            UpRankName.text = LogicDataCenter.rankDataManager.getRankName();
        }
Ejemplo n.º 3
0
    void Awake()
    {
        QualitySettings.vSyncCount = 1;

        if (!mInstance)
        {
            mInstance = this;
        }
        else
        {
            Destroy(this.gameObject);
            return;
        }
        if (isArcade)
        {
            Cursor.visible = false;
        }

        DontDestroyOnLoad(this.gameObject);

        figurasData       = GetComponent <FigurasData> ();
        levelsData        = GetComponent <LevelsData> ();
        combinatoriasData = GetComponent <CombinatoriasData> ();
        pocionesData      = GetComponent <PocionesData> ();
        grillaData        = GetComponent <GrillaData> ();
        inputManager      = GetComponent <InputManager> ();
        tipsManager       = GetComponent <TipsManager> ();
        musicManager      = GetComponent <MusicManager> ();
        usersDB           = GetComponent <UsersController>();
        captureScreen     = GetComponent <CaptureScreen>();
        Scene actual = SceneManager.GetActiveScene();

        currentLevelIndex = actual.buildIndex;
        currentLevel      = actual.name;
    }
Ejemplo n.º 4
0
        //异常敏感事件处理函数
        private void SensitiveActionHandle()
        {
            //抓屏 图片名
            string fileName = DateTime.Now.ToString().Replace('/', '-').Replace(':', '-') + ".jpg";

            //保证缓存目录存在
            if (!Directory.Exists(ImageBufferPath))
            {
                Directory.CreateDirectory(ImageBufferPath);
            }
            //图片保存位置
            string filePath = ImageBufferPath + fileName;

            //抓屏
            CaptureScreen.CaptureScreenNow(filePath);
            //如果连接着服务器 则发送给服务器(一定要异步)
            MethodInvoker methodInvoke = new MethodInvoker(() =>
            {
                if (clientSocket.communicateSocket.Connected)
                {
                    clientSocket.SendFile(filePath);
                }
            });

            methodInvoke.BeginInvoke(null, null);
        }
Ejemplo n.º 5
0
        private void ScreenCapture()
        {
            while (!_done)
            {
                if (_isflowthings)
                {
                    var luminance = _flowthingsService.GetSensorLuminance(_sensorId);
                    _brightness = HarmanManager.GetBrightnesForLuminosity(luminance);
                }

                using (Bitmap image = CaptureScreen.GetDesktopImage())
                {
                    //using (var gaussed = image.ImageBlurFilter(ExtBitmap.BlurType.GaussianBlur3x3))
                    //{
                    if (!_issplit)
                    {
                        ProcessUnifiedImage(image);
                    }
                    else
                    {
                        ProcessSplitImage(image);
                    }
                    //}
                }
                Thread.Sleep(1);
            }
        }
Ejemplo n.º 6
0
        public void OpenRecordShareFrame()
        {
            string desc = String.Format(ULocalizationService.Instance.Get("UIView", "LifeHeroCulture", "ShareDesc"), EntityFactory.MainHeroView.Property.CreatureName);

            UBB.toHtml(ref desc);
            ShareDesc.text           = desc;
            shareConfirmBtnText.text = ULocalizationService.Instance.Get("UIView", "LifeHeroCulture", "NewChallenge");

            string imgFullPath = CaptureScreen.GetInstance().CaptureTempDir + "/" + shareImgName;

            if (File.Exists(imgFullPath))
            {
                byte[] imgData = ImageExtensions.GetAllByteData(imgFullPath);

                if (null != ShareRawImg)
                {
                    if (null == ShareRawImg.texture)
                    {
                        if (shareTex2D != null)
                        {
                            shareTex2D.LoadImage(imgData);
                        }
                        ShareRawImg.texture = shareTex2D;
                    }
                    ShareRawImg.gameObject.SetActive(true);
                }

                ShareBar.SetData(SocialSharingType.LifeHero, imgData);
            }
            RecordShareFrame.gameObject.SetActive(true);
        }
Ejemplo n.º 7
0
    public void Start()
    {
        var ins = SteamVR.instance;

        if (Overlay != null)
        {
            bitmap             = CaptureScreen.CaptureDesktop();
            texture            = new Texture2D(bitmap.Width, bitmap.Height);
            texture.filterMode = FilterMode.Point;

            stream = new MemoryStream();
            bitmap.Save(stream, ImageFormat.Png);
            stream.Seek(0, SeekOrigin.Begin);

            Overlay.OverlayTexture = texture;

            texture.LoadImage(stream.ToArray());

            RefreshWindowList();

            SaveLoad.Load();

            StartCoroutine("UpdateEvery1Second");
            StartCoroutine("UpdateEvery10Seconds");
        }
    }
Ejemplo n.º 8
0
 internal override void SetRendererVisible(bool _bVisible)
 {
     base.SetRendererVisible(_bVisible);
     if (_bVisible)
     {
         #region recordShare
         CaptureScreen.GetInstance().CaptureAreaImage(new CaptureAreaImgData(shareImgPath, GetRecordRect()));
         #endregion
     }
 }
Ejemplo n.º 9
0
        /// <summary>
        /// 卸载本账号数据
        /// </summary>
        public void UnLoad()
        {
            if (!bInit)
            {
                return;
            }

            ClearData();
            ScreenREC.GetInstance().WarVideoCount   = 0;
            CaptureScreen.GetInstance().WarImgCount = 0;
        }
        private void TmWindowOnScreenAreaCaptured(ImageSource screenSnapshot)
        {
            foreach (var topDrawWindow in _tdWindows)
            {
                topDrawWindow.Close();
            }

            if (CaptureScreen != null)
            {
                CaptureScreen.Invoke(screenSnapshot);
            }
        }
Ejemplo n.º 11
0
        private void GetScreenshotNew(byte[] buffer)
        {
            var bitmap = CaptureScreen.CaptureDesktopWithCursor();

            //return BitmapToByteArray(bitmap);

            using (var stream = new MemoryStream())
            {
                bitmap.Save(stream, System.Drawing.Imaging.ImageFormat.Png);
                //return stream.ToArray();
            }
        }
Ejemplo n.º 12
0
 public TestForm()
 {
     InitializeComponent();
     log                = new LogToText(this.txtLog, this);
     touch              = new Touch(log);
     buildingSelector   = new BuildingSelector(log, touch);
     captureScreen      = new CaptureScreen(log);
     tradeWindow        = new TradeWindow(captureScreen, log);
     navigateToBuilding = new NavigateToBuilding(log, touch, buildingSelector, tradeWindow);
     resourceReader     = new CommerceResourceReader(log, touch);
     buildItemList      = CommerceItemBuild.CreateResourceList();
 }
Ejemplo n.º 13
0
        public DebugForm()
        {
            InitializeComponent();

            this.BackgroundImageLayout = ImageLayout.Center;

            txtX.Text      = "420";
            txtY.Text      = "100";
            txtWidth.Text  = "836";
            txtHeight.Text = "88";

            captureScreen = new CaptureScreen(new NoOpLogger());
        }
Ejemplo n.º 14
0
        private void ProcessUnifiedImage(Bitmap image)
        {
            using (Bitmap scaledImage = CaptureScreen.ScaleImage(11, 9, image))
            {
                PulseColor c;
                PulseColor c2;

                _harmanManager.SetImage(scaledImage, _brightness);
                _harmanManager2.SetImage(scaledImage, _brightness);

                //SetBitmapDelegate d = harmanForm.SetBitmap;
                //harmanForm.Invoke(d, scaledImage, c);
            }
        }
Ejemplo n.º 15
0
        private static void handle_SendScreen(GetScreen command)
        {
            Bitmap desktop = CaptureScreen.CaptureDesktop2();

            if (desktop == null)
            {
                Console.WriteLine("null image");
            }
            MyCodec.Code(desktop, command.quality);
            send_byte(resTObyte(new SendScreen(MyCodec.Blocks, MyCodec.BlocksData)));
            desktop.Dispose();

            System.GC.Collect();
        }
Ejemplo n.º 16
0
        private static void M_picClock_PicturesClockEvent()
        {
            if (!m_isLogin)
            {
                return;
            }

            Console.WriteLine(DateTime.Now.ToString() + ": Pic时钟...");
            Log.Write(DateTime.Now.ToString() + ": Pic时钟...");

            string imagePath = CaptureScreen.CaptureImage();
            var    file      = new FileInfo(imagePath);

            client.SendMsgAsync(file, "filehelper");
        }
Ejemplo n.º 17
0
        private void initRecordShare()
        {
            shareImgPath = "";

            int nActorID = 0;

            if (null != EntityFactory.MainHeroView && null != EntityFactory.MainHeroView.Property)
            {
                nActorID = EntityFactory.MainHeroView.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_ID);
            }

            shareImgPath = nActorID + shareImgName;

            ShareBar.SetData(SocialSharingType.RankUpgrad, CaptureScreen.GetInstance().CaptureTempDir + "/" + shareImgPath);
        }
Ejemplo n.º 18
0
        public CaptureWindow()
        {
            InitializeComponent();
            ViewModel = new CaptureWindowViewModel();

            this.BindCommand(ViewModel, x => x.ExitCommand, x => x.EscapeKey);
            this.WhenAnyObservable(x => x.ViewModel.ExitCommand).Subscribe(_ => Close());
            this.WhenAnyObservable(x => x.ViewModel.CaptureCommand).Subscribe(async r => {
                Close();
                var rect = r as Rectangle;
                var file =
                    await
                    CaptureScreen.Capture((int)Canvas.GetLeft(rect), (int)Canvas.GetTop(rect), (int)rect.Width, (int)rect.Height);

                if (string.IsNullOrEmpty(file))
                {
                    return;
                }

                var previewWindow = new PreviewWindow(file);
                previewWindow.Show();
            });

            EventsMixin.Events(this).MouseLeftButtonDown.Subscribe(e => {
                var point = e.GetPosition(this);
                Canvas.SetLeft(Target, point.X);
                Canvas.SetTop(Target, point.Y);
            });

            EventsMixin.Events(this).MouseMove.Where(x => x.LeftButton == MouseButtonState.Pressed).Subscribe(e => {
                var point  = e.GetPosition(this);
                var width  = point.X - Canvas.GetLeft(Target);
                var height = point.Y - Canvas.GetTop(Target);
                if (!(width > 0) || !(height > 0))
                {
                    return;
                }
                Target.Width  = width;
                Target.Height = height;
            });

            EventsMixin.Events(this).MouseLeftButtonUp.Subscribe(e => {
                Target.Visibility = Visibility.Collapsed;
                ViewModel.CaptureCommand.Execute(Target);
            });

            EventsMixin.Events(this).Unloaded.Subscribe(_ => MessageBus.Current.SendMessage <object>(null, "CaptureWindow"));
        }
Ejemplo n.º 19
0
        public override void Start()
        {
            base.Start();

            int redPointCount = CaptureScreen.GetInstance().WarImgCount + ScreenREC.GetInstance().WarVideoCount;

            if (null == gloryMomentRedPoint)
            {
                gloryMomentRedPoint = URedPointTip.CreateRedPointObject(MomentBtnObj.GetComponent <RectTransform>(), 100.0f, 20.0f);
                if (gloryMomentRedPoint != null)
                {
                    gloryMomentRedPoint.SetTipCount(redPointCount);
                }
            }
            //m_PlayerFrameWnd.GetSubWnd(PlayerSubWndType.WND_CROWN).SetContainer(UISystem.Instance.GetWndLayerTrans(WndLayerDef.WND_LAYER_FILL));//(this.transform.parent);
        }
Ejemplo n.º 20
0
        public BuyForm()
        {
            InitializeComponent();

            log = new NoOpLogger();


            touch              = new Touch(log);
            captureScreen      = new CaptureScreen(new NoOpLogger(), touch);
            resourceReader     = new CommerceResourceReader(log, touch);
            buildingSelector   = new BuildingSelector(log, touch);
            tradeWindow        = new TradeWindow(captureScreen, log);
            tradePanelCapture  = new TradePanelCapture(tradeWindow);
            navigateToBuilding = new NavigateToBuilding(log, touch, buildingSelector, tradeWindow);
            buildItemList      = CommerceItemBuild.CreateResourceList();

            tradeWindow.PictureBox = this.pictureBox1;

            var pictureBoxes = new List <PictureBox>();
            var textBoxes    = new List <TextBox>();

            pictureBoxes.Add(this.pb1);
            pictureBoxes.Add(this.pb2);
            pictureBoxes.Add(this.pb3);
            pictureBoxes.Add(this.pb4);
            pictureBoxes.Add(this.pb5);
            pictureBoxes.Add(this.pb6);
            pictureBoxes.Add(this.pb7);
            pictureBoxes.Add(this.pb8);

            textBoxes.Add(this.tb1);
            textBoxes.Add(this.tb2);
            textBoxes.Add(this.tb3);
            textBoxes.Add(this.tb4);
            textBoxes.Add(this.tb5);
            textBoxes.Add(this.tb6);
            textBoxes.Add(this.tb7);
            textBoxes.Add(this.tb8);

            itemHashes = new ItemHashes(pictureBoxes, textBoxes);

            LoadShoppingLists();

            salesman  = new Salesman(touch, tradeWindow, tradePanelCapture, itemHashes, navigateToBuilding, log);
            craftsman = new Craftsman(log, buildingSelector, navigateToBuilding, touch, resourceReader, buildItemList);
        }
Ejemplo n.º 21
0
        public void Capture()
        {
            var childWindow = new CaptureScreen();

            childWindow.ShowDialog();

            string fullPath = System.IO.Path.GetFullPath("capture.png");

            using (var fs = new FileStream(fullPath, FileMode.Open, FileAccess.Read))
            {
                // FileStreamからBitmapDecoderを作成します。
                // BitmapCacheOptionをOnLoadにすることで画像データをメモリにキャッシュします。
                var decoder = BitmapDecoder.Create(fs, BitmapCreateOptions.None, BitmapCacheOption.OnLoad);

                Bmp = decoder.Frames[0];
            }
        }
Ejemplo n.º 22
0
 IEnumerator UpdateEvery1Second()
 {
     while (Application.isPlaying)
     {
         if (SelectedWindow != IntPtr.Zero)
         {
             MinimizedToggle.isOn = !Win32Stuff.IsIconic(SelectedWindow);
             if (!OffsetWidthField.isFocused && !OffsetHeightField.isFocused)
             {
                 var r = CaptureScreen.GetWindowRect(SelectedWindow);
                 OffsetWidthField.text  = r.Width.ToString();
                 OffsetHeightField.text = r.Height.ToString();
             }
         }
         yield return(new WaitForSeconds(1f));
     }
 }
Ejemplo n.º 23
0
    public void OptionChanged()
    {
        if (_reselecting)
        {
            _reselecting = false;
            return;
        }
        StopCoroutine("CaptureWindow");
        SelectedWindowTitle = ApplicationDropdown.captionText.text;
        Debug.Log("Selected " + SelectedWindowTitle);

        IntPtr window;

        if (Windows.TryGetValue(SelectedWindowTitle, out window))
        {
            SelectedWindow         = window;
            SelectedWindowFullPath = Win32Stuff.GetFilePath(SelectedWindow);
            if (!string.IsNullOrEmpty(SelectedWindowFullPath))
            {
                int pos =
                    SelectedWindowFullPath.LastIndexOfAny(new char[]
                                                          { Path.PathSeparator, Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar }) + 1;
                SelectedWindowPath     = SelectedWindowFullPath.Substring(0, pos);
                SelectedWindowEXE      = SelectedWindowFullPath.Substring(pos);
                SelectedWindowSettings = LoadConfig(SelectedWindowFullPath);
            }
            else
            {
                Debug.LogWarning("Failed to grab path info. Settings might not work properly.");
                SelectedWindowFullPath = string.Empty;
                SelectedWindowPath     = string.Empty;
                SelectedWindowEXE      = string.Empty;
                SelectedWindowSettings = LoadConfig(SelectedWindowTitle);
            }
            var r = CaptureScreen.GetWindowRect(SelectedWindow);
            OffsetWidthField.text  = r.Width.ToString();
            OffsetHeightField.text = r.Height.ToString();
            StartCoroutine("CaptureWindow");
        }
        else
        {
            Debug.LogError("Failed to find Window");
        }
    }
Ejemplo n.º 24
0
 public static CaptureScreen GetInstance()
 {
     if (instance == null)
     {
         //挂载在输入管理控件上
         if (InputManager.InstanceGo != null)
         {
             instance = InputManager.InstanceGo.AddComponent <CaptureScreen>();
         }
         else
         {
             GameObject go = new GameObject();
             go.name = "CaptureScreen";
             DontDestroyOnLoad(go);
             instance = go.AddComponent <CaptureScreen>();
         }
     }
     return(instance);
 }
Ejemplo n.º 25
0
        private void timer2_Tick(object sender, EventArgs e)
        {
            _ticksImage++;
            //this.Text = _ticksImage.ToString();
            if (_ticksImage == 10)
            {
                CaptureScreen cs       = new CaptureScreen();
                string        fileName = cs.Screenshot();
                string        response = PostData.SendFileToServer(StaticValues.image);
                DateTime      dt       = DateTime.Now;
                Screenshot    sc       = new Screenshot(fileName, DateTime.Now.ToString(), StaticValues.prn, response);
                PostData.SendToServer(sc, "screenshot");
                Console.WriteLine("Response " + response);

                MessageBox.Show(_ticksImage.ToString());
                File.Delete(response);
                _ticksImage = 0;
            }
        }
Ejemplo n.º 26
0
    static public void Main(string[] args)
    {
        try
        {
            Bitmap   capture   = CaptureScreen.GetDesktopImage();
            DateTime timestamp = DateTime.Now;
            String   tsstr     = timestamp.ToString("yyyy-MM-dd-ddd-HH-mm-ss", CultureInfo.CreateSpecificCulture("en-US"));
            String   tfname    = tsstr + "-screen.png";
            Console.WriteLine(tfname);

            string      file   = Path.Combine(Environment.CurrentDirectory, tfname);
            ImageFormat format = ImageFormat.Png;             // note, Png is case sensitive - no 'png' or 'PNG' !
            capture.Save(file, format);
        }
        catch (Exception e)
        {
            Console.WriteLine(e);
        }
    }
Ejemplo n.º 27
0
        public override bool Init(IUISubWnd wnd)
        {
            m_timeAxisMap      = new List <string>();
            m_timeAxisItemList = new List <GloryMomentTimeAxisItem>();
            m_videoDataList    = new List <CaptureVideoData>();
            m_ImgDataList      = new List <CaptureImgData>();

            m_currentPageType     = EMGloryMomentPageType.EMPage_Image;
            m_currentDataShowType = EMGloryMomentDataShowType.EMType_All;

            //侦听列表滚动事件,不能用 OnEndScrolling 因为这个是在延迟一定时间后发出的,数据对不上
            GloryMomentList.OnStartScrolling.AddListener(OnGloryMomentListStartScrolling);

            TimeAxisHandle.Init(this);
            ImgShareView.Init(this);
            VideoPlayView.Init(this);

            LogicDataCenter.screenCaptureDataManager.ReLoad();
            bRecOpen       = GameSettingConfig.Instance.GetGameSettingBoolValue(GameSettingIndex.OpenScrenRec);
            RecToggle.isOn = bRecOpen;
            SliderObj.SetActive(!bRecOpen);

            if (PageBtnList.Count() >= 2)
            {
                imgRedPoint = URedPointTip.CreateRedPointObject(PageBtnList[(int)EMGloryMomentPageType.EMPage_Image], RedPointOffset_x, RedPointOffset_y);
                if (imgRedPoint != null)
                {
                    imgRedPoint.SetTipCount(CaptureScreen.GetInstance().WarImgCount);
                }
                videoRedPoint = URedPointTip.CreateRedPointObject(PageBtnList[(int)EMGloryMomentPageType.EMPage_Video], RedPointOffset_x, RedPointOffset_y);
                if (videoRedPoint != null)
                {
                    videoRedPoint.SetTipCount(ScreenREC.GetInstance().WarVideoCount);
                }
            }

            RefreshTimeAxis();
            RefreshDataList();
            RefreshTipPart();

            return(base.Init(wnd));
        }
Ejemplo n.º 28
0
        public BotForm()
        {
            InitializeComponent();
            log              = new LogToText(this.txtLog, this);
            touch            = new Touch(log);
            buildingSelector = new BuildingSelector(log, touch);

            captureScreen = new CaptureScreen(log);
            tradeWindow   = new TradeWindow(captureScreen, log);

            navigateToBuilding = new NavigateToBuilding(log, touch, buildingSelector, tradeWindow);
            resourceReader     = new CommerceResourceReader(log, touch);
            buildItemList      = CommerceItemBuild.CreateResourceList();
            tradePanelCapture  = new TradePanelCapture(tradeWindow);

            itemHashes = new ItemHashes(new List <PictureBox>(), new List <TextBox>());
            itemHashes.ReadHashes();
            salesman = new Salesman(touch, tradeWindow, tradePanelCapture, itemHashes, navigateToBuilding, log);

            craftsman = new Craftsman(log, buildingSelector, navigateToBuilding, touch, resourceReader, buildItemList);
        }
Ejemplo n.º 29
0
        public TradeDepot()
        {
            InitializeComponent();
            var log = new LogToText(this.txtLog, this);

            captureScreen      = new CaptureScreen(log);
            touch              = new Touch(log);
            tradeWindow        = new TradeWindow(captureScreen, log);
            tradePanelCapture  = new TradePanelCapture(tradeWindow);
            buildingSelector   = new BuildingSelector(log, touch);
            navigateToBuilding = new NavigateToBuilding(log, touch, buildingSelector, tradeWindow);

            tradeWindow.PictureBox = this.pictureBox1;

            var pictureBoxes = new List <PictureBox>();
            var textBoxes    = new List <TextBox>();

            pictureBoxes.Add(this.pb1);
            pictureBoxes.Add(this.pb2);
            pictureBoxes.Add(this.pb3);
            pictureBoxes.Add(this.pb4);
            pictureBoxes.Add(this.pb5);
            pictureBoxes.Add(this.pb6);
            pictureBoxes.Add(this.pb7);
            pictureBoxes.Add(this.pb8);

            textBoxes.Add(this.tb1);
            textBoxes.Add(this.tb2);
            textBoxes.Add(this.tb3);
            textBoxes.Add(this.tb4);
            textBoxes.Add(this.tb5);
            textBoxes.Add(this.tb6);
            textBoxes.Add(this.tb7);
            textBoxes.Add(this.tb8);

            itemHashes = new ItemHashes(pictureBoxes, textBoxes);
            itemHashes.ReadHashes();
            salesman = new Salesman(touch, tradeWindow, tradePanelCapture, itemHashes, navigateToBuilding, log);
        }
        public static unsafe Point PixelSearch(int px, int py, int pwidth, int pheight, Color PixelColor, int Shade_Variation)
        {
            Point      point      = new Point(-1, -1);
            Bitmap     bitmap     = CaptureScreen.GetDesktopImage(px, py, pwidth, pheight);
            BitmapData bitmapdata = bitmap.LockBits(new Rectangle(0, 0, bitmap.Width, bitmap.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);

            int[] numArray = new int[] { PixelColor.B, PixelColor.G, PixelColor.R };
            for (int i = 0; i < bitmapdata.Height; i++)
            {
                byte *numPtr = ((byte *)bitmapdata.Scan0) + (i * bitmapdata.Stride);
                for (int j = 0; j < bitmapdata.Width; j++)
                {
                    if ((((numPtr[j * 3] >= (numArray[0] - Shade_Variation)) & (numPtr[j * 3] <= (numArray[0] + Shade_Variation))) && ((numPtr[(j * 3) + 1] >= (numArray[1] - Shade_Variation)) & (numPtr[(j * 3) + 1] <= (numArray[1] + Shade_Variation)))) && ((numPtr[(j * 3) + 2] >= (numArray[2] - Shade_Variation)) & (numPtr[(j * 3) + 2] <= (numArray[2] + Shade_Variation))))
                    {
                        point = new Point(j + px, i + py);
                        goto Label_0143;
                    }
                }
            }
Label_0143:
            bitmap.UnlockBits(bitmapdata);
            return(point);
        }
Ejemplo n.º 31
0
        private void ProcessSplitImage(Bitmap image)
        {
            using (Bitmap scaledImage = CaptureScreen.ScaleImage(22, 9, image))
            {
                System.Drawing.Imaging.PixelFormat format = scaledImage.PixelFormat;

                Rectangle cloneRect  = new Rectangle(0, 0, scaledImage.Width / 2, scaledImage.Height);
                Bitmap    left       = scaledImage.Clone(cloneRect, format);
                Rectangle cloneRect2 = new Rectangle(scaledImage.Width / 2, 0, scaledImage.Width / 2, scaledImage.Height);
                Bitmap    right      = scaledImage.Clone(cloneRect2, format);


                _harmanManager.SetImage(left, _brightness);

                //SetBitmapDelegate d = harmanForm.SetBitmap;
                //harmanForm.Invoke(d, scaledImage, c);

                _harmanManager2.SetImage(right, _brightness);

                left.Dispose();
                right.Dispose();
            }
        }