Beispiel #1
0
        public virtual void Step()
        {
            if (!Active)
            {
                return;
            }

            ++StepNumber;
            Stepped?.Invoke(this);
        }
Beispiel #2
0
        public virtual void Step()
        {
            Kernel.Log.Verbose(90, $"{Name}:{GetType().Name} Stepped #{StepNumber}");

            if (!Active)
            {
                return;
            }

            ++StepNumber;

            Stepped?.Invoke(this);
        }
 /// <summary>
 /// Steps the simulation.
 /// </summary>
 internal void Step(float step)
 {
     lock (Locker)
     {
         if (RunService.SimulationState != SimulationState.Running)
         {
             if (!(_stopwatch.Elapsed.TotalSeconds > Engine.GameThread.FixedStep))
             {
                 return;
             }
             //World.UpdateAabbs();
             //World.ComputeOverlappingPairs();
             _stopwatch.Restart();
         }
         else
         {
             Stepped?.Invoke();
             //World.StepSimulation(step, 1, Engine.GameThread.FixedStep);
         }
     }
 }
    public void InvokeStepInvoke()
    {
        _movementController.StepTime += Time.deltaTime;

        if (_movementController.StepTime < _targetStepTime)
        {
            return;
        }

        Stepped?.Invoke();

        _movementController.StepTime = 0;

        if (_leftIsLastStep)
        {
            OnLeftStep?.Invoke();
            _leftIsLastStep = false;
            return;
        }

        _leftIsLastStep = true;
        OnRightStep?.Invoke();
    }
Beispiel #5
0
 protected virtual void OnStepped(DebuggeeThreadEventArgs e)
 {
     Stepped?.Invoke(this, e);
 }
Beispiel #6
0
        public void UploadFile(UploadDataItem udi)
        {
            lock (this)
            {
                udi.Success = false;

                string localpathfile  = udi.Source;
                string remotepathfile = udi.Target;

                try
                {
                    if (!Connected)
                    {
                        Connect();
                    }

                    if (!File.Exists(localpathfile))
                    {
                        throw new FileNotFoundException("找不到文件:" + Path.GetFileName(localpathfile));
                    }
                    if (udi.Replied)
                    {
                        Began?.Invoke(udi, (new FileInfo(localpathfile)).Length);
                    }

                    string name     = udi.Target.Replace(Path.GetFileName(udi.Target), "");
                    string dir      = name.Replace(CurrentRemotePath + Path.AltDirectorySeparatorChar, "");
                    string filename = Path.Combine(dir, Path.GetFileName(udi.Target));

                    Socket socketData = CreateDataSocket();
                    SendCommand("STOR " + filename);
                    if (!(_code == 125 || _code == 150))
                    {
                        throw new IOException(_reply);
                    }
                    FileStream input  = new FileStream(localpathfile, FileMode.Open);
                    int        iBytes = 0;
                    while ((iBytes = input.Read(_buffer, 0, _buffer.Length)) > 0)
                    {
                        socketData.Send(_buffer, iBytes, 0);
                        if (udi.Replied)
                        {
                            Stepped?.Invoke(udi, iBytes);
                        }
                    }
                    input.Close();
                    if (socketData.Connected)
                    {
                        socketData.Close();
                    }
                    if (!(_code == 226 || _code == 250))
                    {
                        ReadReply();
                        if (!(_code == 226 || _code == 250))
                        {
                            throw new IOException(_reply.Substring(4));
                        }
                    }

                    udi.Success = true;
                }
                catch (FileNotFoundException fnfe)
                {
                    udi.Message = fnfe.Message;
                    Notified?.Invoke(CVResult.FileNotFoundExceptionHanppened, fnfe);
                }
                catch (IOException ex)
                {
                    udi.Message = ex.Message;
                    Notified?.Invoke(CVResult.UploadExceptionHappened, udi);
                }
                catch (Exception ex)
                {
                    throw new IOException(ex.Message);
                }
                finally
                {
                    if (udi.Replied)
                    {
                        Ended?.Invoke(udi);
                    }
                }
            }
        }
Beispiel #7
0
        public void DownloadMemory(DownloadMemoryItem dmi)
        {
            lock (this)
            {
                dmi.Success = false;

                string strRemoteFileName = dmi.Source.Replace(CurrentRemotePath + Path.AltDirectorySeparatorChar, "");

                string strFolder        = Path.GetDirectoryName(dmi.Target);
                string strLocalFileName = Path.GetFileName(dmi.Target);

                string localpathfile = dmi.Target;

                try
                {
                    if (!Connected)
                    {
                        Connect();
                    }

                    if (dmi.CreateDirectory && !Directory.Exists(strFolder))
                    {
                        Directory.CreateDirectory(strFolder);
                    }

                    long size = GetFileSize(strRemoteFileName);
                    if (dmi.Replied)
                    {
                        Began?.Invoke(dmi, size);
                    }

                    SetTransferType(TransferType.Binary);
                    if (strLocalFileName.Equals(""))
                    {
                        strLocalFileName = strRemoteFileName;
                    }
                    Socket socketData = CreateDataSocket();
                    SendCommand("RETR " + strRemoteFileName);
                    if (!(_code == 150 || _code == 125 ||
                          _code == 226 || _code == 250))
                    {
                        throw new IOException(_reply.Substring(4));
                    }

                    FileStream output = new FileStream(strFolder + "\\" + strLocalFileName, FileMode.Create);

                    int bytesTotalRead = 0;
                    dmi.Buffer = new byte[size];

                    while (true)
                    {
                        int iBytes = socketData.Receive(_buffer, _buffer.Length, 0);
                        output.Write(_buffer, 0, iBytes);
                        if (dmi.Replied)
                        {
                            Stepped?.Invoke(dmi, iBytes);
                        }
                        if (iBytes <= 0)
                        {
                            break;
                        }
                        Buffer.BlockCopy(_buffer, 0, dmi.Buffer, bytesTotalRead, iBytes);
                        bytesTotalRead += iBytes;
                    }
                    output.Close();
                    if (socketData.Connected)
                    {
                        socketData.Close();
                    }
                    if (!(_code == 226 || _code == 250))
                    {
                        ReadReply();
                        if (!(_code == 226 || _code == 250))
                        {
                            throw new IOException(_reply);
                        }
                    }

                    dmi.Success = true;
                }
                catch (IOException ioex)
                {
                    dmi.Message = ioex.Message;
                    Notified?.Invoke(CVResult.IOExceptionHappened, dmi);
                }
                catch (Exception ex)
                {
                    dmi.Message = ex.Message;
                    Notified?.Invoke(CVResult.DownloadExceptionHappened, dmi);
                }
                finally
                {
                    if (dmi.Replied)
                    {
                        Ended?.Invoke(dmi);
                    }
                }
            }
        }
 private void _dc_Stepped(IDataOpItem item, long segment)
 {
     Stepped?.Invoke(item, segment);
 }
Beispiel #9
0
 protected virtual void OnStepped(JintDebuggerSteppedEventArgs e)
 {
     Stepped?.Invoke(this, e);
 }
Beispiel #10
0
 /// <summary>
 /// Execute a single instruction on the CPU and then raise the stepped event.
 /// </summary>
 public void Step()
 {
     _emulator.Tick();
     Stepped?.Invoke();
 }