コード例 #1
0
        /// <summary>
        /// Injects the hook into the specified process
        /// </summary>
        /// <param name="process">The process to inject into</param>
        public void Inject(Process process)
        {
            // Skip if the process is already hooked, or if there is no main window
            if (this.GraphicsInterface != null || this.SpeedHackInterface != null || (process == null || process.MainWindowHandle == IntPtr.Zero))
            {
                return;
            }

            String projectDirectory = Path.GetDirectoryName(ProjectExplorerViewModel.GetInstance().ProjectFilePath);
            String channelName      = null;

            this.GraphicsInterface  = GraphicsFactory.GetGraphicsInterface(projectDirectory);
            this.SpeedHackInterface = new SpeedHackInterface();

            // Initialize the IPC server, giving the server access to the interfaces defined here
            RemoteHooking.IpcCreateServer <HookClient>(ref channelName, WellKnownObjectMode.Singleton, this);

            try
            {
                // Inject DLL into target process
                RemoteHooking.Inject(
                    process.Id,
                    InjectionOptions.Default,
                    typeof(HookClient).Assembly.Location,
                    typeof(HookClient).Assembly.Location,
                    channelName,
                    projectDirectory);
            }
            catch (Exception ex)
            {
                throw new Exception("Unable to Inject:" + ex);
            }
        }
コード例 #2
0
ファイル: StatsView.cs プロジェクト: yangfan111/CsharpCode
        protected override void UpdateStyle()
        {
            _text1.font     = _statsMonitor.fontFace;
            _text1.fontSize = _statsMonitor.FontSizeLarge;

            if (_statsMonitor.colorOutline.a > 0.0f)
            {
                GraphicsFactory.AddOutlineAndShadow(_text1.gameObject, _statsMonitor.colorOutline);
            }
            else
            {
                GraphicsFactory.RemoveEffects(_text1.gameObject);
            }

            _fpsTemplates[0]  = "<color=#" + Util.Utils.Color32ToHex(_statsMonitor.colorFPS) + ">FPS:";
            _fpsTemplates[1]  = "<color=#" + Util.Utils.Color32ToHex(_statsMonitor.colorFPSWarning) + ">FPS:";
            _fpsTemplates[2]  = "<color=#" + Util.Utils.Color32ToHex(_statsMonitor.colorFPSCritical) + ">FPS:";
            _fpsMinTemplate   = "<color=#" + Util.Utils.Color32ToHex(_statsMonitor.colorFPSMin) + ">MIN:";
            _fpsMaxTemplate   = "<color=#" + Util.Utils.Color32ToHex(_statsMonitor.colorFPSMax) + ">MAX:";
            _fpsAvgTemplate   = "<color=#" + Util.Utils.Color32ToHex(_statsMonitor.colorFPSAvg) + ">AVG:";
            _fxuTemplate      = "<color=#" + Util.Utils.Color32ToHex(_statsMonitor.colorFXD) + ">FXD:";
            _msTemplate       = "<color=#" + Util.Utils.Color32ToHex(_statsMonitor.colorMS) + ">";
            _objTemplate      = "<color=#" + Util.Utils.Color32ToHex(_statsMonitor.colorObjCount) + ">";
            _memTotalTemplate = "<color=#" + Util.Utils.Color32ToHex(_statsMonitor.colorMemTotal) + ">TOTAL:";
            _memAllocTemplate = "<color=#" + Util.Utils.Color32ToHex(_statsMonitor.colorMemAlloc) + ">ALLOC:";
            _memMonoTemplate  = "<color=#" + Util.Utils.Color32ToHex(_statsMonitor.colorMemMono) + ">MONO:";
        }
コード例 #3
0
        /// <summary>
        /// Test a plot.
        /// </summary>
        /// <param name="test"></param>
        /// <param name="name"></param>
        private void TestPlot(Action test, [CallerMemberName] string name = null)
        {
            Task <System.Drawing.Bitmap> getExpected = null;

            if (!saveBitmap)
            {
                // start loading the expected image asyncronously
                string expected = Path.Combine(expectedDataFolder.FullName, GetFileName(name, this.plotSize.Width, this.plotSize.Height));
                getExpected = Task.Factory.StartNew(() => (System.Drawing.Bitmap)System.Drawing.Bitmap.FromFile(expected));
            }

            test.Invoke();

            IBitmap actual = GetBitmap();

            if (saveBitmap)
            {
                SaveBitmap(actual, name);
                return;
            }

            IBitmap expectedBitmap = GraphicsFactory.CreateBitmap(getExpected.Result);

            AssertImagesAreEqual(expectedBitmap, actual);
        }
コード例 #4
0
        public void PinvokeTests()
        {
            var handle = WindowAttacher.GetHandleByWindowTitleBeginningWith("BLACK DESERT");

            var tmp = GraphicsFactory.CopyFromScreen(handle);

            Clipboard.SetImage(tmp);
        }
コード例 #5
0
        public void OnDrop(DropInfo dropInfo)
        {
            Point position = dropInfo.DropPosition;

            GraphicsVM gvm = dropInfo.Data as GraphicsVM;

            GraphicsBase graphics = GraphicsFactory.Create(position, gvm.Type);

            DrawableLayer.DrawVisual(graphics);
        }
コード例 #6
0
ファイル: SysInfoView.cs プロジェクト: yangfan111/CsharpCode
        // ----------------------------------------------------------------------------
        // Protected & Private Methods
        // ----------------------------------------------------------------------------

        protected override GameObject CreateChildren()
        {
            GameObject container = new GameObject();

            container.name = "SysInfoView";
            container.transform.SetParent(_statsMonitor.transform, false);

            var g = new GraphicsFactory(container, _statsMonitor.colorFPS, _statsMonitor.fontFace, _statsMonitor.fontSizeSmall);

            _text = g.Text("Text", "", null, 0, null, false);

            return(container);
        }
コード例 #7
0
ファイル: SysInfoView.cs プロジェクト: yangfan111/CsharpCode
 protected override void UpdateStyle()
 {
     _text.font     = _statsMonitor.fontFace;
     _text.fontSize = _statsMonitor.FontSizeSmall;
     if (_statsMonitor.colorOutline.a > 0.0f)
     {
         GraphicsFactory.AddOutlineAndShadow(_text.gameObject, _statsMonitor.colorOutline);
     }
     else
     {
         GraphicsFactory.RemoveEffects(_text.gameObject);
     }
     _isDirty = true;
 }
コード例 #8
0
ファイル: AXApplication.cs プロジェクト: joffarex/AcidarX
        public AXApplication
        (
            AXWindow window, RenderCommandDispatcher renderCommandDispatcher, GraphicsFactory graphicsFactory,
            LayerStack layers, LayerFactory layerFactory
        )
        {
            _layers               = layers;
            _layerFactory         = layerFactory;
            _window               = window;
            _window.EventCallback = OnEvent;

            _renderCommandDispatcher = renderCommandDispatcher;
            _graphicsFactory         = graphicsFactory;
        }
コード例 #9
0
        public void ScreenHelperPerf()
        {
            var g = new GraphicsFactory();
            var a = new ScreenHelper(g);
            var r = new Rectangle()
            {
                X = 0, Y = 0, Width = 500, Height = 500
            };

            Debug.WriteLine(@"Start Perftest with 100 step");
            var st = new Stopwatch();

            st.Start();
            for (var i = 0; i < 100; i++)
            {
                var bmp = a.ScreenArea(r);
                bmp.Dispose();
            }
            st.Stop();
            Debug.WriteLine(@"End Perftest with 100 step");
            Debug.WriteLine($@"Total time {st.ElapsedMilliseconds} ms, average {st.ElapsedMilliseconds / 100}");

            Debug.WriteLine(@"Start Perftest with 1000 step");
            var st2 = new Stopwatch();

            st2.Start();
            for (var i = 0; i < 1000; i++)
            {
                var bmp = a.ScreenArea(r);
                bmp.Dispose();
            }
            st2.Stop();
            Debug.WriteLine(@"End Perftest with 1000 step");
            Debug.WriteLine($@"Total time {st2.ElapsedMilliseconds} ms, average {st2.ElapsedMilliseconds / 1000}");

            Debug.WriteLine(@"Start Perftest with 10000 step");
            var st3 = new Stopwatch();

            st3.Start();
            for (var i = 0; i < 10000; i++)
            {
                var bmp = a.ScreenArea(r);
                bmp.Dispose();
            }
            st3.Stop();
            Debug.WriteLine(@"End Perftest with 10000 step");
            Debug.WriteLine($@"Total time {st3.ElapsedMilliseconds} ms, average {st3.ElapsedMilliseconds / 10000}");
        }
コード例 #10
0
        // ----------------------------------------------------------------------------
        // Protected & Private Methods
        // ----------------------------------------------------------------------------

        protected override GameObject CreateChildren()
        {
            _fpsTemplates = new string[3];

            GameObject container = new GameObject();

            container.name = "FPSView";
            container.transform.SetParent(_statsMonitor.transform, false);

            var g = new GraphicsFactory(container, _statsMonitor.colorFPS, _statsMonitor.fontFace, _statsMonitor.fontSizeSmall);

            _text           = g.Text("Text", "000FPS");
            _text.alignment = TextAnchor.MiddleCenter;

            return(container);
        }
コード例 #11
0
        // ----------------------------------------------------------------------------
        // Protected & Private Methods
        // ----------------------------------------------------------------------------

        protected override GameObject CreateChildren()
        {
            GameObject container = new GameObject();

            container.name = "StatsView";
            container.transform.SetParent(_statsMonitor.transform, false);
            var rect = container.AddComponent <RectTransform>();
            var g    = new GraphicsFactory(container, _statsMonitor.colorFPS, _statsMonitor.fontFace, _statsMonitor.fontSizeSmall);

            _text1 = g.Text("Text1", "");
            var _image = container.AddComponent <RawImage>();

            _image.color = Util.Utils.HexToColor32("00314ABE");

            return(container);
        }
コード例 #12
0
ファイル: GraphView.cs プロジェクト: yangfan111/CsharpCode
 protected override void UpdateStyle()
 {
     if (_graph != null)
     {
         _graph.color = _statsMonitor.colorGraphBG;
     }
     if (_statsMonitor.colorOutline.a > 0.0f)
     {
         GraphicsFactory.AddOutlineAndShadow(_image.gameObject, _statsMonitor.colorOutline);
     }
     else
     {
         GraphicsFactory.RemoveEffects(_image.gameObject);
     }
     _fpsColors[0] = null;
     _fpsColors[1] = new Color(_statsMonitor.colorFPSWarning.r, _statsMonitor.colorFPSWarning.g, _statsMonitor.colorFPSWarning.b, _statsMonitor.colorFPSWarning.a / 4);
     _fpsColors[2] = new Color(_statsMonitor.ColorFPSCritical.r, _statsMonitor.ColorFPSCritical.g, _statsMonitor.ColorFPSCritical.b, _statsMonitor.ColorFPSCritical.a / 4);
 }
コード例 #13
0
ファイル: StatsView.cs プロジェクト: yangfan111/CsharpCode
        // ----------------------------------------------------------------------------
        // Protected & Private Methods
        // ----------------------------------------------------------------------------

        protected override GameObject CreateChildren()
        {
            _fpsTemplates = new string[3];

            GameObject container = new GameObject();

            container.name = "StatsView";
            container.transform.SetParent(_statsMonitor.transform, false);

            var g = new GraphicsFactory(container, _statsMonitor.colorFPS, _statsMonitor.fontFace, _statsMonitor.fontSizeSmall);

            _text1 = g.Text("Text1", "");
            var layout = container.AddComponent <VerticalLayoutGroup>();

            layout.childControlHeight = true;
            layout.childControlWidth  = true;

            return(container);
        }
コード例 #14
0
        protected override void UpdateStyle()
        {
            _text.font     = _statsMonitor.fontFace;
            _text.fontSize = _statsMonitor.FontSizeLarge;
            _text.color    = _statsMonitor.colorFPS;

            if (_statsMonitor.colorOutline.a > 0.0f)
            {
                GraphicsFactory.AddOutlineAndShadow(_text.gameObject, _statsMonitor.colorOutline);
            }
            else
            {
                GraphicsFactory.RemoveEffects(_text.gameObject);
            }

            _fpsTemplates[0] = "<color=#" + Util.Utils.Color32ToHex(_statsMonitor.colorFPS) + ">";
            _fpsTemplates[1] = "<color=#" + Util.Utils.Color32ToHex(_statsMonitor.colorFPSWarning) + ">";
            _fpsTemplates[2] = "<color=#" + Util.Utils.Color32ToHex(_statsMonitor.colorFPSCritical) + ">";
        }
コード例 #15
0
        public void PinvokeCapturePerf()
        {
            var handle = WindowAttacher.GetHandleByWindowTitleBeginningWith("BLACK DESERT");

            Debug.WriteLine(@"Start Perftest with 100 step");
            var st = new Stopwatch();

            st.Start();
            for (var i = 0; i < 100; i++)
            {
                var bmp = GraphicsFactory.CopyFromScreen(handle);
                bmp.Dispose();
            }
            st.Stop();
            Debug.WriteLine(@"End Perftest with 100 step");
            Debug.WriteLine($@"Total time {st.ElapsedMilliseconds} ms, average {st.ElapsedMilliseconds / 100}");

            Debug.WriteLine(@"Start Perftest with 1000 step");
            var st2 = new Stopwatch();

            st2.Start();
            for (var i = 0; i < 1000; i++)
            {
                var bmp = GraphicsFactory.CopyFromScreen(handle);
                bmp.Dispose();
            }
            st2.Stop();
            Debug.WriteLine(@"End Perftest with 1000 step");
            Debug.WriteLine($@"Total time {st2.ElapsedMilliseconds} ms, average {st2.ElapsedMilliseconds / 1000}");

            Debug.WriteLine(@"Start Perftest with 10000 step");
            var st3 = new Stopwatch();

            st3.Start();
            for (var i = 0; i < 10000; i++)
            {
                var bmp = GraphicsFactory.CopyFromScreen(handle);
                bmp.Dispose();
            }
            st3.Stop();
            Debug.WriteLine(@"End Perftest with 10000 step");
            Debug.WriteLine($@"Total time {st3.ElapsedMilliseconds} ms, average {st3.ElapsedMilliseconds / 10000}");
        }
コード例 #16
0
ファイル: DemoGame.cs プロジェクト: deccer/Xacor
        protected override void Initialize()
        {
            base.Initialize();

            Window.Title = "Xacor.Demo";

            _viewMatrix       = Matrix.LookAtRH(new Vector3(0, 0, 10f), Vector3.Zero, Vector3.UnitY);
            _projectionMatrix = Matrix.PerspectiveFovRH(MathF.PI / 3.0f, _renderResolution.Width / (float)_renderResolution.Height, 0.1f, 4096f);
            _leftMvp          = new InputBuffer
            {
                ModelViewProjectionMatrix = Matrix.Translation(-1.5f, 1, -0.5f) * _viewMatrix * _projectionMatrix
            };

            _rightMvp = new InputBuffer
            {
                ModelViewProjectionMatrix = Matrix.Translation(1.5f, -1, 0.5f) * _viewMatrix * _projectionMatrix
            };

            _viewport                 = new Viewport(0, 0, _renderResolution.Width, _renderResolution.Height, 0.1f, 4096f);
            _defaultBlendState        = GraphicsFactory.CreateBlendState(true, Blend.SourceAlpha, Blend.InverseSourceAlpha, BlendOperation.Add, Blend.One, Blend.Zero, BlendOperation.Add);
            _defaultDepthStencilState = GraphicsFactory.CreateDepthStencilState();
            _defaultRasterizerState   = GraphicsFactory.CreateRasterizerState(CullMode.None, FillMode.Solid, true, false, false, false);

            var macros = new[] { ("TEST", "0") };
コード例 #17
0
ファイル: GameBase.cs プロジェクト: MNAJIM75/Xacor
        protected virtual void Initialize()
        {
            Window = _gamePlatformFactory.CreateGameWindow(_options.Graphics);

            foreach (var inputMapping in _options.Input.InputMappings)
            {
                switch (inputMapping)
                {
                case KeyboardInputMapping keyboardInputMapping:
                    _inputMapper.AddMap(Xacor.Input.Input.CreateKeyboardInput(inputMapping.Name, keyboardInputMapping.Key1, keyboardInputMapping.Key2));
                    break;

                case MouseInputMapping mouseInputMapping:
                    _inputMapper.AddMap(Xacor.Input.Input.CreateMouseMovement(inputMapping.Name, mouseInputMapping.Axis));
                    break;
                }
            }

            var swapChainInfo = CreateSwapChainInfo();

            _swapchain                 = GraphicsFactory.CreateSwapchain(swapChainInfo);
            BackBufferView             = _swapchain.TextureView;
            BackBufferDepthStencilView = _swapchain.DepthStencilView;
        }
コード例 #18
0
 internal static GraphicsContext CreateGraphics(Window window, bool vsync)
 {
     return(GraphicsFactory.CreateGraphics(window, vsync));
 }