Beispiel #1
0
 public static void DeathCapture()
 {
     if (!PacketPlayer.Playing)               // dont take SS of RPV deaths
     {
         Timer.DelayedCallback(TimeSpan.FromSeconds(0.5), m_DoCaptureCall).Start();
     }
 }
Beispiel #2
0
        private static void SendNextPacket()
        {
            if (!Playing)
            {
                return;
            }

            if (World.Player == null)
            {
                btnPlay.Text  = "Play";
                tbPos.Enabled = btnClose.Enabled = btnPlay.Enabled = btnStop.Enabled = btnRec.Enabled = true;
                tbPos.Value   = tbPos.Minimum;

                if (m_PlayTimer != null && m_PlayTimer.Running)
                {
                    m_PlayTimer.Stop();
                }

                if (m_ScrollTimer != null && m_ScrollTimer.Running)
                {
                    m_ScrollTimer.Stop();
                }
                return;
            }

            int delay      = 0;
            int totalDelay = 0;

            do
            {
                // peek ahead 1 byte... and no, BinaryReader does not have a peek function.
                if (m_GZIn.Compressed.ReadByte() == 0xFF)
                {
                    break;
                }
                m_GZIn.Seek(-1, SeekOrigin.Current);

                ClientCommunication.ProcessPlaybackData(m_GZIn.Compressed);

                if (!m_GZIn.EndOfFile)
                {
                    totalDelay += (delay = m_GZIn.Compressed.ReadInt32());
                }
            } while ((totalDelay * SpeedScalar() < 2 || delay * SpeedScalar() < 2) && !m_GZIn.EndOfFile);

            m_Elapsed += TimeSpan.FromMilliseconds(totalDelay);
            UpdateTimeText();
            //tbPos.Value = (int)m_Elapsed.TotalSeconds;

            if (!m_GZIn.EndOfFile)
            {
                m_PlayTimer = Timer.DelayedCallback(TimeSpan.FromMilliseconds(delay * SpeedScalar() * 0.75), m_SendNext);
                m_PlayTimer.Start();
            }
            else
            {
                Stop();
            }
        }
Beispiel #3
0
        public static void Stop()
        {
            if (m_Recording)
            {
                byte[] hash;

                // the final timestamp
                m_GZOut.Compressed.Write((int)((DateTime.UtcNow - m_LastTime).TotalMilliseconds));
                m_GZOut.Compressed.Write((byte)0xFF);

                m_GZOut.ForceFlush();
                m_GZOut.BufferAll = true;

                m_GZOut.RawStream.Seek(1 + 16 + 8, SeekOrigin.Begin);
                m_GZOut.Raw.Write((int)((DateTime.UtcNow - m_StartTime).TotalMilliseconds));

                m_GZOut.RawStream.Seek(1 + 16, SeekOrigin.Begin);
                using (MD5 md5 = MD5.Create())
                    hash = md5.ComputeHash(m_GZOut.RawStream);

                m_GZOut.RawStream.Seek(1, SeekOrigin.Begin);
                m_GZOut.Raw.Write(hash);

                m_GZOut.RawStream.Flush();
                m_GZOut.Close();
                m_GZOut = null;

                m_Recording     = false;
                btnRec.Text     = "Record PacketVideo";
                btnPlay.Enabled = btnStop.Enabled = true;
            }
            else if (Playing)
            {
                //ClientCommunication.SetDeathMsg( Language.GetString( LocString.PacketPlayerStop + Utility.Random( 10 ) ) );
                ClientCommunication.ForceSendToClient(new DeathStatus(true));

                RemoveAll();

                if (m_PlayTimer != null && m_PlayTimer.Running)
                {
                    m_PlayTimer.Stop();
                }

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

                m_PlayTimer = Timer.DelayedCallback(FadeDelay, m_EndPlay);
                m_PlayTimer.Start();

                btnPlay.Text     = "Play";
                btnClose.Enabled = tbPos.Enabled = btnPlay.Enabled = btnStop.Enabled = false;
            }
        }
Beispiel #4
0
        public void RemoveRequest()
        {
            if (m_RemoveTimer == null)
            {
                m_RemoveTimer = Timer.DelayedCallback(TimeSpan.FromSeconds(0.25), new TimerCallback(Remove));
            }
            else if (m_RemoveTimer.Running)
            {
                m_RemoveTimer.Stop();
            }

            m_RemoveTimer.Start();
        }
Beispiel #5
0
        public override void BeginCalibratePosition()
        {
            if (World.Player == null || DLLImport.Razor.IsCalibrated())
            {
                return;
            }

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

            m_CalPos = new Point2D(World.Player.Position);

            m_CalTimer = Timer.DelayedCallback(TimeSpan.FromSeconds(0.5), m_CalibrateNow);
            m_CalTimer.Start();
        }
Beispiel #6
0
        public static void Play()
        {
            if (m_Recording || Playing || m_GZIn == null)
            {
                return;
            }

            if (World.Player == null)
            {
                MessageBox.Show(Engine.MainWindow, "You must be logged in to ANY shard to play a packet video.", "Must Log in", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            btnPlay.Enabled = btnStop.Enabled = btnClose.Enabled = btnRec.Enabled = false;
            btnPlay.Text    = "Pause";

            // save the real player data
            m_TempWriter = new BinaryWriter(new MemoryStream());
            World.Player.SaveState(m_TempWriter);

            //m_InStream = new BinaryReader( new FileStream( fileName, FileMode.Open, FileAccess.Read, FileShare.Read ) );

            m_Playing = true;
            ClientCommunication.SetAllowDisconn(false);

            ClientCommunication.BringToFront(ClientCommunication.FindUOWindow());

            //ClientCommunication.SetDeathMsg( "Playing..." );
            ClientCommunication.ForceSendToClient(new DeathStatus(true));

            RemoveAll();

            m_GZIn.Seek(m_StartPos, SeekOrigin.Begin);

            LoadWorldState();

            m_PlayTimer = Timer.DelayedCallback(FadeDelay, m_BeginPlay);
            m_PlayTimer.Start();
            tbPos.Value = tbPos.Minimum;

            m_Elapsed = TimeSpan.Zero;
            UpdateTimeText();

            ClientCommunication.RequestTitlebarUpdate();
        }
Beispiel #7
0
        private static void BeginPlayback()
        {
            DoLogin(World.Player);

            //ClientCommunication.SetDeathMsg( "You are dead." );
            ClientCommunication.BringToFront(ClientCommunication.FindUOWindow());

            TimeSpan delay = TimeSpan.FromMilliseconds(m_GZIn.Compressed.ReadInt32());

            m_PlayTimer = Timer.DelayedCallback(delay, m_SendNext);
            m_PlayTimer.Start();
            if (m_ScrollTimer == null)
            {
                m_ScrollTimer = new ScrollTimer();
            }
            m_ScrollTimer.Start();
            m_StartTime = DateTime.UtcNow;
            m_Elapsed   = delay;
            UpdateTimeText();

            btnPlay.Enabled = btnStop.Enabled = true;
        }
Beispiel #8
0
 internal static void DeathCapture()
 {
     Timer.DelayedCallback(TimeSpan.FromSeconds(0.5), m_DoCaptureCall).Start();
 }
Beispiel #9
0
 public static void DeathCapture(double delay)
 {
     Timer.DelayedCallback(TimeSpan.FromSeconds(delay), m_DoCaptureCall).Start();
 }
Beispiel #10
0
        public static void OnScroll()
        {
            bool     wasRunning = m_PlayTimer.Running;
            TimeSpan delay      = TimeSpan.Zero;
            TimeSpan target     = TimeSpan.FromSeconds(tbPos.Value);

            try
            {
                if (!Playing)
                {
                    tbPos.Value = tbPos.Minimum;
                    return;
                }
                else if (target <= m_Elapsed)
                {
                    tbPos.Value = (int)m_Elapsed.TotalSeconds;
                    return;
                }
            }
            catch
            {
                return;
            }

            if (wasRunning)
            {
                m_PlayTimer.Stop();
            }

            PlayerData.ExternalZ = false;

            int sleepCount = 0;

            while (m_Elapsed < target && !m_GZIn.EndOfFile)
            {
                // peek ahead 1 byte... and no, BinaryReader doesnt have a peek function.
                byte peek = m_GZIn.Compressed.ReadByte();
                if (peek == 0xFF)
                {
                    break;
                }
                m_GZIn.Seek(-1, SeekOrigin.Current);

                ClientCommunication.ProcessPlaybackData(m_GZIn.Compressed);

                if (!m_GZIn.EndOfFile)
                {
                    delay      = TimeSpan.FromMilliseconds(m_GZIn.Compressed.ReadInt32());
                    m_Elapsed += delay;

                    if (((++sleepCount) % 5) == 0)
                    {
                        tbPos.Value = (int)m_Elapsed.TotalSeconds;
                        Application.DoEvents();
                        System.Threading.Thread.Sleep(TimeSpan.FromMilliseconds(1));
                    }
                }
            }

            try
            {
                tbPos.Value = (int)m_Elapsed.TotalSeconds;
            }
            catch
            {
            }

            UpdateTimeText();

            ClientCommunication.ForceSendToClient(new MobileUpdate(World.Player));
            ClientCommunication.ForceSendToClient(new MobileIncoming(World.Player));

            if (wasRunning)               // paused?
            {
                if (!m_GZIn.EndOfFile)
                {
                    m_PlayTimer = Timer.DelayedCallback(delay, m_SendNext);
                    m_PlayTimer.Start();
                }
                else
                {
                    Stop();
                }
            }

            ClientCommunication.BeginCalibratePosition();
        }