public TimetubeForm() { InitializeComponent(); // Attempt to open the key; create it if it doesn't exist RegistryKey key = Registry.CurrentUser.OpenSubKey("Software\\Randomnoun\\Timetube"); if (key == null) { key = Registry.CurrentUser.CreateSubKey("Software\\Randomnoun\\Timetube"); } txtSaveDirectory.Text = (string)key.GetValue("SaveDirectory", "C:\\docs"); txtInterval.Text = (string)key.GetValue("Interval", "10"); cmbFormat.Text = (string)key.GetValue("Format", "JPEG"); trkQuality.Value = (int)key.GetValue("Quality", 80); key.Close(); /* load from registry */ trkQuality.Enabled = (cmbFormat.Text.Equals("JPEG")); lblQuality.Enabled = (cmbFormat.Text.Equals("JPEG")); sc = new ScreenCapture(); screenImage = sc.CaptureScreen(); picPreview.Image = screenImage; picPreview.SizeMode = PictureBoxSizeMode.Normal; CalcPreview(); timeTube = new Timetube(); timeTube.SaveDirectory = txtSaveDirectory.Text; timeTube.Interval = Convert.ToInt32(txtInterval.Text); cmdStopLogging.Enabled = false; IsInitialised = true; }
public void Win32ProcCreated(object sender, EventArrivedEventArgs e) { List<string> eventList = Timetube.getInstance().eventList; if (Timetube.getInstance().eventList != null) { foreach (PropertyData pd in e.NewEvent.Properties) { ManagementBaseObject mbo = null; if ((mbo = pd.Value as ManagementBaseObject) != null) { lock (eventList) { eventList.Add(String.Format("{0} Start process {1} exe='{2}' cl='{3}'", TimeFormat.GetTime(), mbo.Properties["ProcessId"].Value, mbo.Properties["ExecutablePath"].Value, mbo.Properties["CommandLine"].Value)); } } } } /* foreach (PropertyData pd in e.NewEvent.Properties) { ManagementBaseObject mbo = null; if ((mbo = pd.Value as ManagementBaseObject) != null) { Console.WriteLine("--------------Properties------------------"); foreach (PropertyData prop in mbo.Properties) Console.WriteLine("{0} - {1}", prop.Name, prop.Value); } } */ }
public int iconNum = 0; // number of icons cached so far public static Timetube getInstance() { if (singleton == null) { singleton = new Timetube(); } return(singleton); }
public static int Main2(string[] args) { Timetube tt = Timetube.getInstance(); tt.SaveDirectory = "c:\\temp\\newDir"; tt.Interval = 10; Console.WriteLine("*** Started " + TimeFormat.GetDate() + " " + TimeFormat.GetTime()); // initialise icon cache tt.loadIconMap(); tt.BeginCapture(); // spin wheels Console.WriteLine("press <enter> to stop..."); Console.ReadLine(); // shut down timer & event watchers tt.EndCapture(); return(0); }
public void Win32ProcDeleted(object sender, EventArrivedEventArgs e) { List<string> eventList = Timetube.getInstance().eventList; if (eventList != null) { foreach (PropertyData pd in e.NewEvent.Properties) { ManagementBaseObject mbo = null; if ((mbo = pd.Value as ManagementBaseObject) != null) { lock (eventList) { eventList.Add(String.Format("{0} Start process {1} exe='{2}' cl='{3}'", TimeFormat.GetTime(), mbo.Properties["ProcessId"].Value, mbo.Properties["ExecutablePath"].Value, mbo.Properties["CommandLine"].Value)); } } } } /* //lock (Timetube.eventList) { if (Timetube.eventList != null) { Timetube.eventList.Add(String.Format("{0} End process {1} exe='{2}' cl='{3}'", TimeFormat.GetTime(), e.NewEvent.Properties["ProcessId"])); } //} Console.WriteLine("evc={0}",Timetube.eventList.Count); */ }