Esempio n. 1
0
        public Bitmap GetFrame()
        {
            if (IsOpen)
            {
                try
                {
                    //DateTime begin = DateTime.Now;
                    Bitmap bmp = GetCurFrame();
                    //System.Console.Out.WriteLine(string.Format("抓帧耗时:{0}", DateTime.Now.Millisecond - begin.Millisecond));

                    if (mConfig.IsRecord && bmp != null)
                    {
                        if (mRecorder == null)
                        {
                            initImageRecorder();
                        }

                        if (mRecorder != null)
                        {
                            mRecorder.Append(new Bitmap(bmp), false);
                        }
                    }
                    return(bmp);
                }
                catch (Exception e)
                {
                    CLocalSystem.WriteErrorLog(string.Format("{0} GetFrame Exception: {1}", Name, e));

                    Process curproc = Process.GetCurrentProcess();

                    StringBuilder sb = new StringBuilder(curproc.ProcessName + "进程信息:\n");
                    sb.Append("进程分配的物理内存量=" + curproc.WorkingSet64 + "字节\n");
                    sb.Append("进程分配的虚拟内存量=" + curproc.VirtualMemorySize64 + "字节\n");
                    sb.Append("进程分配的专用内存量=" + curproc.PrivateMemorySize64 + "字节\n");
                    sb.Append("进程分配的分页内存量=" + curproc.PagedMemorySize64 + "字节\n");
                    sb.Append("进程分配的可分页系统内存量=" + curproc.PagedSystemMemorySize64 + "字节\n");
                    sb.Append("进程使用的虚拟内存分页文件中的最大内存量=" + curproc.PeakPagedMemorySize64 + "字节\n");
                    sb.Append("进程使用的最大虚拟内存量=" + curproc.PeakVirtualMemorySize64 + "字节\n");
                    sb.Append("进程打开的句柄数=" + curproc.HandleCount + "个\n");

                    CLocalSystem.WriteDebugLog(string.Format("{0} GetFrame Exception: 内存信息={1}", Name, sb.ToString()));
                }
            }
            return(null);
        }