private void Watcher_ProcessStarted(object sender, ProcessEventArgs e)
        {
            //byte[] multipatch = new byte[] { 0xE3, 0xA8, 0x8E };
            //byte[] epc = new byte[] { 0x03, 0xC4, 0x8F };
            //byte[] ukbox = new byte[] { 0x7F, 0x76, 0x6A };
            //byte[] german = new byte[] { 0x54, 0xC3, 0x8F };
            //byte[] soul = new byte[] { 0x70, 0x7C, 0x6A };
            //byte[] jpn = new byte[] { 0x6F, 0xB6, 0xA3 };

            AbstractTomp2Exe exe = Tomp2ExeFactory.Get(e.Process.ReadBytes(_exeIDAddress, 3));

            if (exe != null)
            {
                if (!LoadScriptLevels(e.Process))
                {
                    return;
                }

                TrackingChanged?.Invoke(this, new TrackingEventArgs
                {
                    Exe    = (_trackingExe = exe),
                    Status = TrackingStatus.ExeStarted,
                    Levels = _scriptLevels
                });

                _trackingProcess = e.Process;
                _tracking        = true;
                new Thread(TrackLevels).Start();
            }
        }
        private void FireLevelChanged(int currentLevel, bool titleScreen)
        {
            TrackingEventArgs e = new TrackingEventArgs
            {
                Exe = _trackingExe
            };

            if (titleScreen)
            {
                e.Status = TrackingStatus.TitleScreen;
                currentLevel--;
            }
            else
            {
                currentLevel--;
                if (currentLevel >= _scriptLevels.Count)
                {
                    e.Status = TrackingStatus.InDemo;
                }
                else
                {
                    e.Status = TrackingStatus.InLevel;
                }
            }

            e.Levels          = _scriptLevels;
            e.CurrentLevel    = currentLevel >= 0 && currentLevel < _scriptLevels.Count ? _scriptLevels[currentLevel] : null;
            e.CurrentSequence = currentLevel;

            TrackingChanged?.Invoke(this, e);
        }
 private void FireCreditsReached()
 {
     TrackingChanged.Invoke(this, new TrackingEventArgs
     {
         Exe    = _trackingExe,
         Status = TrackingStatus.Credits
     });
 }
        public void EndTracking()
        {
            var session = Interlocked.Exchange(ref _session, null);

            Contract.ThrowIfNull(session, "Active statement tracking not started.");
            session.EndTracking();

            TrackingChanged?.Invoke();
        }
Exemple #5
0
        public async ValueTask StartTrackingAsync(Solution solution, IActiveStatementSpanProvider spanProvider, CancellationToken cancellationToken)
        {
            var newSession = new TrackingSession(_workspace, spanProvider);

            if (Interlocked.CompareExchange(ref _session, newSession, null) != null)
            {
                newSession.EndTracking();
                Contract.Fail("Can only track active statements for a single edit session.");
            }

            await newSession.TrackActiveSpansAsync(solution, cancellationToken).ConfigureAwait(false);

            TrackingChanged?.Invoke();
        }
Exemple #6
0
        public void StartTracking()
        {
            var newSession = new TrackingSession(_workspace, _workspace.Services.GetRequiredService <IEditAndContinueWorkspaceService>());

            if (Interlocked.CompareExchange(ref _session, newSession, null) != null)
            {
                newSession.EndTracking();
                Contract.Fail("Can only track active statements for a single edit session.");
            }

            // fire and forget on a background thread:
            _ = newSession.TrackActiveSpansAsync();

            TrackingChanged?.Invoke();
        }
        private void Watcher_ProcessStopped(object sender, ProcessEventArgs e)
        {
            if (_trackingExe != null)
            {
                TrackingChanged?.Invoke(this, new TrackingEventArgs
                {
                    Exe    = _trackingExe,
                    Status = TrackingStatus.ExeStopped
                });

                _trackingProcess = null;
                _tracking        = false;
                _trackingExe     = null;
            }
        }
Exemple #8
0
        public void StartTracking()
        {
            var newSession = new TrackingSession(_workspace, _spanProvider);

            if (Interlocked.CompareExchange(ref _session, newSession, null) != null)
            {
                newSession.EndTracking();
                Contract.Fail("Can only track active statements for a single edit session.");
            }

            // fire and forget on a background thread:
            _ = Task.Run(() => newSession.TrackActiveSpansAsync()).ReportNonFatalErrorAsync();

            TrackingChanged?.Invoke();
        }