예제 #1
0
파일: AVIRec.cs 프로젝트: uvbs/Razor
        public static void Stop()
        {
            if (m_RecTimer != null)
            {
                m_RecTimer.Stop();
            }
            m_RecTimer = null;

            if (m_Avi != null)
            {
                m_Avi.Close();
            }
            m_Avi = null;
        }
예제 #2
0
파일: AVIRec.cs 프로젝트: uvbs/Razor
        public static bool Record(int fps, double sizeFactor)
        {
            IntPtr hBmp = ClientCommunication.CaptureScreen(false, "");

            using (Bitmap bmp = Bitmap.FromHbitmap(hBmp))
            {
                m_ResX = (int)(bmp.Width * sizeFactor);
                m_ResY = (int)(bmp.Height * sizeFactor);
            }
            DeleteObject(hBmp);

            string filename;
            string name = "Unknown";
            string path = Config.GetString("RecFolder");

            if (World.Player != null)
            {
                name = World.Player.Name;
            }
            if (name == null || name.Trim() == "" || name.IndexOfAny(Path.GetInvalidPathChars()) != -1)
            {
                name = "Unknown";
            }

            name = String.Format("{0}_{1}", name, DateTime.Now.ToString("M-d_HH.mm"));
            Engine.EnsureDirectory(path);
            int count = 0;

            do
            {
                filename = Path.Combine(path, String.Format("{0}{1}.avi", name, count != 0 ? count.ToString() : ""));
                count--;                 // cause a - to be put in front of the number
            }while (File.Exists(filename));

            m_Avi = new AVIFile();
            if (!m_Avi.Open(filename, fps, m_ResX, m_ResY))
            {
                return(false);
            }

            UpdateFlip();

            m_RecTimer = new RecordTimer(fps);
            m_RecTimer.Start();

            return(true);
        }
예제 #3
0
파일: AVIRec.cs 프로젝트: herculesjr/razor
        public static void Stop()
        {
            if ( m_RecTimer != null )
                m_RecTimer.Stop();
            m_RecTimer = null;

            if ( m_Avi != null )
                m_Avi.Close();
            m_Avi = null;
        }
예제 #4
0
파일: AVIRec.cs 프로젝트: herculesjr/razor
        public static bool Record( int fps, double sizeFactor )
        {
            IntPtr hBmp = ClientCommunication.CaptureScreen( false, "" );
            using ( Bitmap bmp = Bitmap.FromHbitmap( hBmp ) )
            {
                m_ResX = (int)(bmp.Width * sizeFactor);
                m_ResY = (int)(bmp.Height * sizeFactor);
            }
            DeleteObject( hBmp );

            string filename;
            string name = "Unknown";
            string path = Config.GetString( "RecFolder" );

            if ( World.Player != null )
                name = World.Player.Name;
            if ( name == null || name.Trim() == "" || name.IndexOfAny( Path.GetInvalidPathChars() ) != -1 )
                name = "Unknown";

            name = String.Format( "{0}_{1}", name, DateTime.Now.ToString( "M-d_HH.mm" ) );
            Engine.EnsureDirectory( path );
            int count  = 0;
            do
            {
                filename = Path.Combine( path, String.Format( "{0}{1}.avi", name, count != 0 ? count.ToString() : ""  ) );
                count--; // cause a - to be put in front of the number
            }
            while ( File.Exists( filename ) );

            m_Avi = new AVIFile();
            if ( !m_Avi.Open( filename, fps, m_ResX, m_ResY ) )
                return false;

            UpdateFlip();

            m_RecTimer = new RecordTimer( fps );
            m_RecTimer.Start();

            return true;
        }