Ejemplo n.º 1
0
        public void SerializeObject(string filename, ObjectToSerialize objectToSerialize)
        {
            Stream          stream     = File.Open(filename, FileMode.Create);
            BinaryFormatter bFormatter = new BinaryFormatter();

            bFormatter.Serialize(stream, objectToSerialize);
            stream.Close();
        }
Ejemplo n.º 2
0
        private void recordStopButton_Click(object sender, EventArgs e)
        {
            ObjectToSerialize ots = new ObjectToSerialize();

            ots.Events = events;

            string filePath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\test";

            ConvertEvent(events);
            SerializeObject(filePath, ots);

            keyboardHook.Stop();
            mouseHook.Stop();
        }
Ejemplo n.º 3
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         isCancel = false;
         string            filePath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\test";
         ObjectToSerialize ots      = DeSerializeObject(filePath);
         events = ots.Events;
         Thread thread = new Thread(() => WorkThreadFunction(int.Parse(txtLoop.Text)));
         thread.Start();
     }catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Ejemplo n.º 4
0
        private void recordStopButton_Click(object sender, EventArgs e)
        {
            ObjectToSerialize ots = new ObjectToSerialize();

            ots.Events = events;

            //string filePath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\test";
            string filePath = Environment.CurrentDirectory + "\\data\\" + DateTime.Now.ToString("ddMMyyyy-HHmmss");

            ConvertEvent(events);
            SerializeObject(filePath, ots);

            keyboardHook.Stop();
            mouseHook.Stop();
        }
Ejemplo n.º 5
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                string         filePath  = null;
                OpenFileDialog theDialog = new OpenFileDialog();
                theDialog.Title            = "Open Data File";
                theDialog.InitialDirectory = Environment.CurrentDirectory;
                if (theDialog.ShowDialog() == DialogResult.OK)
                {
                    filePath = theDialog.FileName.ToString();
                }

                isCancel = false;
                ObjectToSerialize ots = DeSerializeObject(filePath);
                events = ots.Events;
                Thread thread = new Thread(() => WorkThreadFunction(int.Parse(txtLoop.Text)));
                thread.Start();
            }catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }