private void OnStart()
        {
            button_Start.Enabled      = false;
            checkBox_PerFrame.Enabled = false;
            checkBox_Append.Enabled   = false;
            button_Open.Enabled       = false;
            btnDeleteLog.Enabled      = false;

            try
            {
                int nLevel =
                    checkBox_PerFrame.Checked ? 2 : 1;
                m_collector.SetLevel(nLevel);
                m_collector.SetLog(tbxLogOutput.Text);
                this.Cursor = Cursors.WaitCursor;
                m_collector.Start();
                MsdkAnalyzerCpp.start();

                this.Cursor       = Cursors.Default;
                button_Start.Text = "Stop";
                timer1.Enabled    = true;
                timer1.Start();
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.ToString());
                checkBox_PerFrame.Enabled = true;
                checkBox_Append.Enabled   = true;
            }
            button_Start.Enabled = true;
        }
 private void RunConversion(object state)
 {
     m_status     = ConversionStatus.CONVERSION_STARTED;
     m_percentage = 50;
     MsdkAnalyzerCpp.convert_etl_to_text(0, 0, m_etlfilename + " " + m_textfilename, 1);
     m_percentage = 100;
     m_status     = ConversionStatus.CONVERSION_COMPLETED;
 }
        private void OnStop()
        {
            timer1.Stop();
            timer1.Enabled       = false;
            button_Start.Enabled = false;

            try
            {
                this.Cursor = Cursors.WaitCursor;
                m_collector.Stop();
                MsdkAnalyzerCpp.stop();
                RunConversionDialog();
                button_Start.Text         = "Start";
                button_Start.Enabled      = true;
                checkBox_PerFrame.Enabled = true;
                checkBox_Append.Enabled   = true;

                FileInfo log_path = new FileInfo(tbxLogOutput.Text);
                if (log_path.Exists)
                {
                    button_Open.Enabled  = true;
                    btnDeleteLog.Enabled = true;
                }
                else
                {
                    button_Open.Enabled  = false;
                    btnDeleteLog.Enabled = false;
                }
                this.Cursor = Cursors.Default;
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.ToString());
                button_Start.Text         = "Start";
                button_Start.Enabled      = true;
                checkBox_PerFrame.Enabled = true;
                checkBox_Append.Enabled   = true;

                FileInfo log_path = new FileInfo(tbxLogOutput.Text);
                if (log_path.Exists)
                {
                    button_Open.Enabled  = true;
                    btnDeleteLog.Enabled = true;
                }
                else
                {
                    button_Open.Enabled  = false;
                    btnDeleteLog.Enabled = false;
                }
                this.Cursor = Cursors.Default;
            }
        }
Пример #4
0
        static void Main(string[] args)
        {
            bool  bOwn;
            Mutex globalLock = new Mutex(true, "mediasdk_tracer_lock", out bOwn);

            if (!bOwn)
            {
                globalLock.Dispose();
                return;
            }

            try
            {
                string allapplicationpackages_group = "ALL APPLICATION PACKAGES";
                using (RegistryKey rk = Registry.CurrentUser.CreateSubKey(msdk_analyzer.Properties.Resources.msdk_registry_key, RegistryKeyPermissionCheck.ReadWriteSubTree))
                {
                    RegistrySecurity rs = new RegistrySecurity();
                    rs.AddAccessRule(new RegistryAccessRule(allapplicationpackages_group, RegistryRights.FullControl, InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit, PropagationFlags.InheritOnly, AccessControlType.Allow));
                    rk.SetAccessControl(rs);

                    DirectoryInfo     myDirectoryInfo     = new DirectoryInfo(Directory.GetCurrentDirectory());
                    DirectorySecurity myDirectorySecurity = myDirectoryInfo.GetAccessControl();
                    myDirectorySecurity.AddAccessRule(new FileSystemAccessRule(allapplicationpackages_group, FileSystemRights.FullControl, InheritanceFlags.ObjectInherit, PropagationFlags.InheritOnly, AccessControlType.Allow));
                    myDirectoryInfo.SetAccessControl(myDirectorySecurity);
                }
            }
            catch
            {
                globalLock.Dispose();
            }
            try
            {
                //////
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                UInt32 sts = MsdkAnalyzerCpp.install(Path.GetDirectoryName(Application.ExecutablePath)
                                                     , Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + _PATH.TRACER_PATH + _PATH.TRACER_LOG
                                                     , Path.GetDirectoryName(Application.ExecutablePath));
                if (sts == 0)
                {
                    MessageBox.Show("ERROR: Install error", "ERROR");
                }
                else
                {
                    SdkAnalyzerForm form = new SdkAnalyzerForm();
                    Application.Run(form);
                }
                MsdkAnalyzerCpp.uninstall();
                GC.KeepAlive(globalLock);//prevent releasing by GC if application uses long time
            }
            catch
            {
                MessageBox.Show("ERROR: Install error", "ERROR");
                globalLock.Dispose();
            }
            finally
            {
                globalLock.Dispose();
            }
        }