示例#1
0
        private void RViewProcess(Keys[] key, SessionProgram Session)
        {
            var now = DateTime.Now;

            TimeSpan diff = now - RViewDT;

            string keystr = " ";

            if (key.Length < 2)
            {
                keystr += key[0].ToString();
            }
            else
            {
                keystr += "(";
                foreach (var k in key)
                {
                    string ks = k.ToString();

                    // On Digit Key
                    if (ks.Length == 2 && ks.StartsWith("D"))
                    {
                        ks = ks.TrimStart('D');
                    }
                    // On Special Key
                    else if (ks.Length > 1)
                    {
                        ks = '<' + ks + '>';
                    }

                    keystr += ' ' + ks;
                }
                keystr += " )";
            }

            // If New Input
            if (diff > RViewOffset || !Session.Equals(LastSession))
            {
                string log = $"\n {now.ToLongTimeString()}: {Session.ProcessName}[{Session.WindowName}]:";
                rviewer.rbox_log.AppendText(log);
                WriteLog(log);

                LastSession = Session.Clone();
            }

            // Write Key
            rviewer.rbox_log.AppendText(keystr);
            WriteLog(keystr);

            // Reset Time Counter
            RViewDT = now;
        }
示例#2
0
        internal static SessionProgram GetKeySession()
        {
            var toret = new SessionProgram();

            toret.hWnd = GetForegroundWindow();

            int ProcId;

            GetWindowThreadProcessId(toret.hWnd, out ProcId);
            toret.ProcessId = ProcId;

            var proc = Process.GetProcessById(ProcId, ".");

            toret.ProcessName = proc.ProcessName;
            toret.WindowName  = proc.MainWindowTitle;

            return(toret);
        }
示例#3
0
 internal KeyDownAndUpEventArgs(Keys[] keys, SessionProgram session)
 {
     Keys    = keys;
     Session = session;
 }