Ejemplo n.º 1
0
        public bool check_license()
        {
            string license_file = Task.pFind_license;

            if (!File.Exists(license_file))
            {
                License_Dialog ld = new License_Dialog();
                ld.Show();
                return(false);
            }
            bool        flag    = true;
            string      license = File_Help.get_license(license_file, ref flag);
            MachineCode mc      = new MachineCode();
            string      code    = mc.Get_Code();

            code = mc.MD5_PWD(code);
            string code_license = mc.MD5(code);

            if (code_license != license || !flag)
            {
                MessageBox.Show(Message_Help.LICENSE_WRONG);
                License_Dialog ld = new License_Dialog();
                ld.Show();
                return(false);
            }
            return(true);
        }
Ejemplo n.º 2
0
        private static bool is_process_in(string task_path)
        {
            //get this running process
            Process proc = Process.GetCurrentProcess();

            //get all other (possible) running instances
            Process[] processes = Process.GetProcessesByName(proc.ProcessName);

            if (processes.Length > 1)
            {
                //iterate through all running target applications
                foreach (Process p in processes)
                {
                    if (p.Id != proc.Id)
                    {
                        //COPYDATASTRUCT cds = new COPYDATASTRUCT();
                        //byte[] sarr = System.Text.Encoding.Default.GetBytes(task_path);
                        //int len = sarr.Length;
                        //cds.dwData = (IntPtr)100;
                        //cds.path = task_path;
                        //cds.cbData = len + 1;

                        //NativeMethods.SendMessage(p.MainWindowHandle, NativeMethods.WM_SHOWME, IntPtr.Zero, ref cds);
                        File_Help.write_task_path_Process(Task.task_path_process, task_path);
                        NativeMethods.SendMessage(p.MainWindowHandle, NativeMethods.WM_SHOWME, IntPtr.Zero, IntPtr.Zero);
                        return(true);
                    }
                }
            }
            return(false);
        }
Ejemplo n.º 3
0
        void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            //try
            //{
            GenerateReport(e.ExceptionObject, 1);

            ProcessStartInfo psi = new ProcessStartInfo();

            psi.FileName = "CrashReporter.exe";
            Process p = Process.GetCurrentProcess();
            //psi.Arguments = p.ProcessName + " " + "\"" + e.ExceptionObject.ToString() + "\"";
            string user_information = File_Help.get_userInformation_inLicense(Task.pFind_license);

            psi.Arguments = p.ProcessName + " pBuild " + "CrashReportLog.txt " + user_information;
            Process.Start(psi);

            if (e.IsTerminating)
            {
                Environment.Exit(0);
            }
            //}
            //catch (Exception ex)
            //{
            //    MessageBox.Show("UnhandledException: " + ex.ToString());
            //}
        }
Ejemplo n.º 4
0
        void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
        {
            //try
            //{
            GenerateReport(e.Exception, 0);
            ProcessStartInfo psi = new ProcessStartInfo();

            psi.FileName = "CrashReporter.exe";
            Process p = Process.GetCurrentProcess();
            // psi.Arguments = p.ProcessName + " " + "\"" + e.Exception.ToString() + "\"";
            string user_information = File_Help.get_userInformation_inLicense(Task.pFind_license);

            psi.Arguments = p.ProcessName + " pBuild " + "CrashReportLog.txt " + user_information;
            Process.Start(psi);
            //}
            //catch (Exception ex)
            //{
            //    MessageBox.Show("ThreadException: " + ex.ToString());
            //}
        }
Ejemplo n.º 5
0
        public void update_psms(int index, string raw_name) //根据卡FDR1%的结果将raw_name的RAW的结果放入到psms[index]中
        {
            const double fdr_value = 0.01;

            if (index < 0 || index >= psms.Count)
            {
                return;
            }
            List <PSM> all_psms = new List <PSM>(File_Help.readPSM(task.identification_file));

            for (int i = 0; i < all_psms.Count; ++i)
            {
                string title = all_psms[i].Title;
                title = title.Split('.')[0];
                if (title == raw_name && all_psms[i].Q_value <= fdr_value)
                {
                    all_psms[i].Sq = all_psms[i].Sq.Replace('L', 'I'); //将得到的序列的L全部转化成I
                    this.psms[index].Add((PSM)all_psms[i]);
                }
            }
            this.psms[index].Sort();
        }
Ejemplo n.º 6
0
        private void raw_select(object sender, SelectionChangedEventArgs e)
        {
            this.Cursor = Cursors.Wait;
            string        raw_name = this.raw_comboBox.SelectedItem as string;
            List <string> pf_paths = mainW.task.get_raws_path();
            string        pf_path  = "";

            for (int i = 0; i < pf_paths.Count; ++i)
            {
                int index  = pf_paths[i].LastIndexOf('\\');
                int index2 = pf_paths[i].LastIndexOf('.');
                if (pf_paths[i].Substring(index + 1, index2 - index - 1) == raw_name)
                {
                    pf_path = pf_paths[i].Substring(0, index2) + ".pf1";
                    break;
                }
            }
            if (MS1_Ratio == 0)
            {
                List <List <Spectra_MS1> > ms1_list = File_Help.load_ms1(pf_path, raw_name, mainW);
                Display_Help dh = new Display_Help(ms1_list, this.mainW);
                this.Model = dh.display_heat_map();
            }
            else if (MS1_Ratio == 1)
            {
                if (!mainW.task.has_ratio)
                {
                    MessageBox.Show("No ratio!");
                    return;
                }
                double max_scan = double.MinValue;
                double min_scan = double.MaxValue;
                for (int i = 0; i < mainW.psms.Count; ++i)
                {
                    string title = mainW.psms[i].Title.Split('.')[0];
                    if (title != raw_name)
                    {
                        continue;
                    }
                    double scan = mainW.psms[i].get_scan();
                    if (max_scan < scan)
                    {
                        max_scan = scan;
                    }
                    if (min_scan > scan)
                    {
                        min_scan = scan;
                    }
                }
                int           bin_number    = 49;
                double        scan_width    = (max_scan - min_scan) / bin_number; //打分宽度,让最终形成50个bin
                double        cur_scan      = min_scan;
                List <double> all_scans     = new List <double>();
                List <int>    scan_bin_list = new List <int>();
                while (cur_scan <= max_scan)
                {
                    all_scans.Add(cur_scan);
                    cur_scan += scan_width;
                    scan_bin_list.Add(0);
                }
                for (int i = 0; i < mainW.psms.Count; ++i)
                {
                    string title = mainW.psms[i].Title.Split('.')[0];
                    if (title != raw_name)
                    {
                        continue;
                    }
                    double ratio = mainW.psms[i].Ratio;
                    if (ratio >= 1024 || ratio <= 0.001)
                    {
                        continue;
                    }
                    int index = (int)((mainW.psms[i].get_scan() - min_scan) / scan_width);
                    if (index < scan_bin_list.Count)
                    {
                        ++scan_bin_list[index];
                    }
                }

                Display_Help dh = new Display_Help(all_scans, scan_bin_list, this.mainW);
                this.Model = dh.display_scan_ratio_graph();
            }
            this.model.Model = this.Model;
            this.Cursor      = null;
        }
Ejemplo n.º 7
0
 public StartPage()
 {
     recent_taskInfo = File_Help.load_all_recent_taskInfo(Task.recent_task_path_file);
 }
Ejemplo n.º 8
0
        private void update_window()
        {
            if (this.mods_comboBox.Items.Count > 0)
            {
                return;
            }
            if (this.mods_comboBox2.Items.Count > 0)
            {
                return;
            }
            if (this.label_comboBox.Items.Count > 0)
            {
                return;
            }
            ComboBoxItem item = new ComboBoxItem();

            item.Content = "Show All";
            this.mods_comboBox.Items.Add(item);
            this.mods_comboBox.Text = "Show All";
            ComboBoxItem item2 = new ComboBoxItem();

            item2.Content = "None";
            this.mods_comboBox.Items.Add(item2);
            List <Identification_Modification> modifications = null;

            File_Help.read_Summary_Modification_TXT(mainW.task.summary_file, ref modifications);
            for (int i = 0; i < modifications.Count; ++i)
            {
                item         = new ComboBoxItem();
                item.Content = modifications[i].modification_name;
                this.mods_comboBox.Items.Add(item);
            }
            this.mods_comboBox.SelectedIndex = 0;
            item         = new ComboBoxItem();
            item.Content = "Show All";
            this.mods_comboBox2.Items.Add(item);
            this.mods_comboBox2.Text = "Show All";
            for (int i = 0; i < Config_Help.mod_label_name.Count(); ++i)
            {
                if (Config_Help.mod_label_name[i] == "")
                {
                    continue;
                }
                item         = new ComboBoxItem();
                item.Content = Config_Help.mod_label_name[i];
                this.mods_comboBox2.Items.Add(item);
            }
            this.mods_comboBox2.SelectedIndex = 0;
            item         = new ComboBoxItem();
            item.Content = "Show All";
            this.label_comboBox.Items.Add(item);
            this.label_comboBox.Text = "Show All";
            for (int i = 1; i < Config_Help.label_name.Count(); ++i)
            {
                if (Config_Help.label_name[i] == "")
                {
                    continue;
                }
                item         = new ComboBoxItem();
                item.Content = Config_Help.label_name[i];
                this.label_comboBox.Items.Add(item);
            }
            this.label_comboBox.SelectedIndex = 0;
        }