Exemplo n.º 1
0
        public static async Task Start()
        {
            if (GetDefaultConfigurationDirectory().Length == 0)
            {
                await Save();
            }
            Default = await Storage.ReadData <DefaultConfig>(null, DefaultConfigurationFileName);

            if (GetDefaultConfigurationDirectory().Length > 0)
            {
                foreach (var file in Directory.GetFiles(GetDefaultConfigurationDirectory(), $"*{CategoryFileExtension}", SearchOption.TopDirectoryOnly))
                {
                    List <ShortKey> shortKeys = await Storage.ReadData <List <ShortKey> >(null, Path.GetFileName(file));

                    if (shortKeys.Count > 0)
                    {
                        if (CapturedShortKeys.ContainsKey(shortKeys[0].Category))
                        {
                            CapturedShortKeys[shortKeys[0].Category].AddRange(shortKeys);
                        }
                        else
                        {
                            CapturedShortKeys.Add(shortKeys[0].Category, shortKeys);
                        }
                    }
                }
            }
            Keylogger.WatchedShortKeys = GetShortKeys();
            keylogger               = new Keylogger(Path.Combine(GetDefaultConfigurationDirectory(), "keys.log"), true);
            keylogger.Enabled       = true;
            keylogger.FlushInterval = 60000;
        }
Exemplo n.º 2
0
 private void SaveCursorPosition()
 {
     if (chkSaveRepalcementKeyCursorPosition.Checked)
     {
         ShortKey key            = GetShortKey();
         string   guid           = Guid.NewGuid().ToString("N");
         string   replacementKey = key.ReplacementKey;
         replacementKey = replacementKey.Insert(txtReplacementKey.SelectionStart, guid);
         replacementKey = Keylogger.PerformNewLineFix(replacementKey);
         int index = replacementKey.IndexOf(guid);
         key.CursorLeftCount = replacementKey.Length - index - guid.Length;
     }
 }