Exemplo n.º 1
0
        private static void Main()
        {
            //var process = Process.GetProcessesByName("telegram").Single(x => x.MainWindowHandle != IntPtr.Zero);
            var window = new OverlayWindow(0, 0, 1920, 1080, true)
            {
                FramesPerSecond = 5000
            };

            window.OnDraw += Overlay_OnDraw;

            GenerateCircles(window);

            void UpdateCircles()
            {
                foreach (var circle in Circles)
                {
                    circle.Update(window.Width, window.Height);
                }
            }

            for (int i = 0; i < 180; i++)
            {
                RunHelper.ConsistentRun(UpdateCircles, 16);
            }

            window.Dispose();

            Console.ReadKey(true);
        }
Exemplo n.º 2
0
        public override int Startup(IPluginHostDelegates hostDelegates)
        {
            _hostDelegates = hostDelegates;
            Config         = LoadConfiguration <PluginConfig>();

            try
            {
                GenerateClipping();
                InitializeOverlay();
            }
            catch (Exception ex)
            {
                _hostDelegates.ExceptionMessage(ex);
                _characterToImageTranslation = null;

                _graphics?.Dispose();
                _graphics = null;
                _window?.Dispose();
                _window = null;

                _isOverlayInitialized = false;
                _isOverlayReady       = false;

                return(1);
            }

            try
            {
                Thread t = new Thread(new ThreadStart(() =>
                {
                    _windowEventDispatcher = Dispatcher.CurrentDispatcher;
                    Dispatcher.Run();
                }));

                t.IsBackground = true;
                t.SetApartmentState(ApartmentState.STA);
                t.Start();
            }
            catch (Exception ex)
            {
                _hostDelegates.ExceptionMessage(ex);
                _windowEventDispatcher = null;
            }

            return(0);
        }
Exemplo n.º 3
0
        public void DestroyInstance()
        {
            _frameTimer.Stop();

            _frameTimer.Dispose();
            _device.Dispose();
            _window.Dispose();
            _device     = null;
            _frameTimer = null;
        }
Exemplo n.º 4
0
 public void Uninitialize()
 {
     if (graphics != null)
     {
         graphics.Dispose();
     }
     if (overlayWindow != null)
     {
         overlayWindow.Dispose();
     }
 }
Exemplo n.º 5
0
 public void Dispose()
 {
     Free();
     if (_graphics != null)
     {
         _graphics.Dispose();
         _graphics = null;
     }
     if (_window != null)
     {
         _window.Dispose();
         _window = null;
     }
 }
Exemplo n.º 6
0
        public bool Detach()
        {
            if (overlay != null)
            {
                overlay.Close();
                overlay.Dispose();
                overlay = null;
            }

            syncTimer.Stop();
            gameCheckTimer.Stop();
            selectedUnitTimer.Stop();

            if (Pickit != null)
            {
                Pickit.Stop();
                Pickit = null;
            }

            if (MapHandler != null)
            {
                MapHandler.Reset();
                MapHandler = null;
            }

            if (AutoTeleport != null)
            {
                AutoTeleport.Terminate();
                AutoTeleport = null;
            }

            PlayerInfo = null;

            if (Installed)
            {
                try
                {
                    pd.StopDebugging();
                    pd.Join();
                    pd = null;
                }
                catch
                {
                    return(false);
                }
            }

            return(true);
        }
Exemplo n.º 7
0
        public void DestroyInstance()
        {
            _frameTimer.Stop();

            //Begin and clear scene to stop last draw sticking on screen
            _device.BeginScene();
            _device.ClearScene();

            _frameTimer.Dispose();
            _device.Dispose();
            _window.Dispose();

            _window     = null;
            _device     = null;
            _frameTimer = null;
        }
Exemplo n.º 8
0
        private bool disposedValue = false; // To detect redundant calls

        protected virtual void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                    // TODO: dispose managed state (managed objects).
                    _graphics?.Dispose();
                    _window?.Dispose();
                }

                // TODO: free unmanaged resources (unmanaged objects) and override a finalizer below.
                // TODO: set large fields to null.

                disposedValue = true;
            }
        }
Exemplo n.º 9
0
 public void Dispose()
 {
     if (_graphics != null)
     {
         _graphics.Dispose();
         _graphics = null;
     }
     if (_window != null)
     {
         _window.Dispose();
         _window = null;
     }
     if (exitEvent != null)
     {
         exitEvent.Dispose();
         exitEvent = null;
     }
 }
Exemplo n.º 10
0
        protected override void Dispose(bool isDisposing)
        {
            if (_isDisposed)
            {
                return;
            }

            if (isDisposing)
            {
                _tickEngine.PreTick -= OnPreTick;
                _tickEngine.Tick    -= OnTick;

                ClearScreen();
                OverlayWindow?.Dispose();
            }

            base.Dispose();
            _isDisposed = true;
        }
 public override void Dispose()
 {
     OverlayWindow.Dispose();
     base.Dispose();
 }