Ejemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (processname != null &&
                username != null &&
                cpuperformance != null &&
                memory != null &&
                description != null &&
                processid != null)
            {
                //弹出对话框
                Process process = Process.GetProcessById(Convert.ToInt32(processid));
                int pid = Convert.ToInt32(processid);
                SaveFileDialog save = new SaveFileDialog();
                save.Title = "文件另存为";
                save.InitialDirectory = @"C:\Users\wsx\Documents\Visual Studio 2012\Projects";
                save.FileName = processname + "_" + processid;
                save.Filter = "上下文文件(*.context)|*.context";
                save.DefaultExt = "context";
                save.OverwritePrompt = true;
                save.RestoreDirectory = true;
                save.OverwritePrompt = true;

               if (save.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    string path = save.FileName.ToString();

                   checkpoint check = new checkpoint();

                   check.DumpProcState(pid, path);

                   processname = null;
                   username = null;
                   cpuperformance = null;
                   memory = null;
                   description = null;
                   processid = null;
                }
            }
            else
            {
                System.Windows.Forms.MessageBox.Show("Nothing available!");
            }
        }
Ejemplo n.º 2
0
        private void button6_Click(object sender, EventArgs e)
        {
            OpenFileDialog open = new OpenFileDialog();
            open.AddExtension = true;
            open.Filter = "上下文文件(*.context)|*.context";
            open.DefaultExt = "context";
            open.RestoreDirectory = true;
            open.Multiselect = false;
            open.InitialDirectory = @"C:\Users\wsx\Documents\Visual Studio 2012\Projects";
            open.Title = "选择一个上下文文件";

            checkpoint check = new checkpoint();

            if (open.ShowDialog() == DialogResult.OK)
            {
                string path = open.FileName;
                int start = path.IndexOf('_');
                int end = path.IndexOf('.');
                int pid = Convert.ToInt32(path.Substring(start+1, end - start-1));
                check.ResumeProcState(pid, path);
            }
        }