示例#1
0
        void InstalledApplication()
        {
            string path = FolderFileUtil.GetFullFilePath(textBox1.Text.Trim()) + "-InstalledApplication.txt";

            if (!File.Exists(path))
            {
                FileInfo   txtFile = new FileInfo(path);
                FileStream fs      = txtFile.Create();
                fs.Close();
            }

            StreamWriter sw = File.AppendText(path);

            sw.WriteLine(DateTime.Now.ToString());

            string registry_key = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall";

            using (Microsoft.Win32.RegistryKey key = Registry.LocalMachine.OpenSubKey(registry_key))
            {
                foreach (string subkey_name in key.GetSubKeyNames())
                {
                    using (RegistryKey subkey = key.OpenSubKey(subkey_name))
                    {
                        string displayName    = subkey.GetValue("DisplayName")?.ToString() ?? "";
                        string displayVersion = subkey.GetValue("DisplayVersion")?.ToString() ?? "";
                        string installDate    = subkey.GetValue("InstallDate")?.ToString() ?? "";
                        sw.WriteLine(string.Format("{0},{1},{2}", displayName, displayVersion, installDate));
                    }
                }
            }
            sw.Flush();
            sw.Close();
        }
示例#2
0
        private static void SaveSessionsToDesktop(List <Session> oAllSessions, string filePath)
        {
            bool   bSuccess  = false;
            string sFilename = FolderFileUtil.GetFullFilePath(filePath) + ".saz";

            try
            {
                try
                {
                    Monitor.Enter(oAllSessions);

                    bSuccess = Utilities.WriteSessionArchive(sFilename, oAllSessions.ToArray(), null, false);
                }
                finally
                {
                    Monitor.Exit(oAllSessions);
                }

                WriteCommandResponse(bSuccess ? ("Wrote: " + sFilename) : ("Failed to save: " + sFilename));
            }
            catch (Exception eX)
            {
                MessageBox.Show("Save failed: " + eX.Message);
            }
        }
示例#3
0
        private void RunPsPing(string filePath)
        {
            CheckPsPingProgram();


            //Create process
            System.Diagnostics.Process pProcess = new System.Diagnostics.Process();

            //strCommand is path and file name of command to run
            pProcess.StartInfo.FileName = Path.Combine(filePath, "psping.exe");

            //strCommandParameters are parameters to pass to program
            pProcess.StartInfo.Arguments = "-b -l 1500 -n 10 www.sina.com.cn -nobanner";

            pProcess.StartInfo.UseShellExecute = false;

            //Set output of program to be written to process output stream
            pProcess.StartInfo.RedirectStandardOutput = true;

            //Optional
            pProcess.StartInfo.WorkingDirectory = filePath;


            //Start the process
            pProcess.Start();

            //Get program output
            string strOutput = pProcess.StandardOutput.ReadToEnd();



            //Wait for process to finish
            pProcess.WaitForExit();


            string path = FolderFileUtil.GetFullFilePath(filePath) + "-Pspinglog.txt";

            if (!File.Exists(path))
            {
                FileInfo   txtFile = new FileInfo(path);
                FileStream fs      = txtFile.Create();
                fs.Close();
            }

            StreamWriter sw = File.AppendText(path);

            sw.WriteLine(DateTime.Now.ToString());
            sw.WriteLine(strOutput);
            sw.Flush();
            sw.Close();
        }
示例#4
0
        public void StartRecording(string filePath)
        {
            _cursor          = new MouseCursor(true);
            _currentFileName = FolderFileUtil.GetFullFilePath(filePath) + ".avi";
            var imgProvider  = GetImageProvider();
            var videoEncoder = GetVideoFileWriter(imgProvider);

            _recorder = new Recorder(videoEncoder, imgProvider, int.Parse(ConfigurationManager.AppSettings["VideoFrameRate"]), null);



            _recorder.RecordingStopped += (s, E) =>
            {
                OnStopped();
                if (E?.Error == null)
                {
                    return;
                }
            };

            _recorder.Start(0);
        }