Ejemplo n.º 1
0
        private void AddProcess_Click(object sender, EventArgs e)
        {
            string name    = AddProcess_TextBox_name.Text;
            string explain = AddProcess_TextBox_exp.Text;

            if (name.Equals("chrome"))
            {
                MessageBox.Show("크롬은 등록 불가능 합니다.");
                return;
            }
            ProcessList.BeginUpdate();
            ListViewItem lvi = new ListViewItem(name);

            lvi.SubItems.Add(explain);
            ProcessList.Items.Add(lvi);
            ProcessList.EndUpdate();
            AddProcess_TextBox_name.Clear();
            AddProcess_TextBox_exp.Clear();
            System.IO.FileStream   fs     = new System.IO.FileStream(Environment.GetEnvironmentVariable("FreezerPC", EnvironmentVariableTarget.Machine) + "\\Process.dat", System.IO.FileMode.Create, System.IO.FileAccess.ReadWrite);
            System.IO.StreamWriter writer = new System.IO.StreamWriter(fs, System.Text.Encoding.Default);
            for (int i = 0; i < ProcessList.Items.Count; i++)
            {
                writer.WriteLine(ProcessList.Items[i].SubItems[0].Text);
                writer.WriteLine(ProcessList.Items[i].SubItems[1].Text);
            }

            writer.Close();
        }
Ejemplo n.º 2
0
        public PythonExplorer(TaskScheduler scheduler, Common script)
            : base(scheduler)
        {
            InitializeComponent();
            Script = script;

            SubscribeTo <ProcessInfo>(Program.EventBus, Program.Profile, "RunningProcessAdded", (e, pi) => {
                ProcessList.Items.Add(pi);
            });
            SubscribeTo <ProcessInfo>(Program.EventBus, Program.Profile, "RunningProcessRemoved", (e, pi) => {
                ProcessList.Items.Remove(pi);
            });

            Context       = new string[] { "__main__" };
            ActiveContext = 0;
            RefreshBreadcrumbs();

            ProcessList.BeginUpdate();
            foreach (var pi in Program.RunningProcesses)
            {
                ProcessList.Items.Add(pi);
            }
            ProcessList.SelectedIndex = 0;
            ProcessList.EndUpdate();
        }
Ejemplo n.º 3
0
 internal SelectProcess()
 {
     InitializeComponent();
     procs.AddRange(Process.GetProcessesByName("Warcraft III"));
     procs.AddRange(Process.GetProcessesByName("war3"));
     try
     {
         ProcessList.BeginUpdate();
         foreach (Process p in procs)
         {
             string[]     row     = { p.Id.ToString(), p.ProcessName };
             ListViewItem newitem = new ListViewItem(row)
             {
                 Tag = p
             };
             ProcessList.Items.Add(newitem);
         }
     }
     finally
     {
         ProcessList.EndUpdate();
     }
 }
Ejemplo n.º 4
0
        public MainForm(string ID, string Pass)
        {
            InitializeComponent();
            LoginID.Text = ID;
            socket       = IO.Socket("http://localhost:8005");
            socket.On("start", (data) =>
            {
                URLT = new Thread(new ThreadStart(URLThread));
                URLT.Start();
                ProcessT = new Thread(new ThreadStart(ProcessThread));
                ProcessT.Start();
                Lock.Icon = FreezerPC.Properties.Resources.object_locked;
                LightChange(URL_red, URL_green, true);
                LightChange(Process_red, Process_green, true);
                try
                {
                    if (URLF == null || !URLF.CanRead)
                    {
                        URLF = new System.IO.FileStream(Environment.GetEnvironmentVariable("FreezerPC", EnvironmentVariableTarget.Machine) + "\\URL.dat", System.IO.FileMode.Open, System.IO.FileAccess.ReadWrite);
                    }
                    if (ProcessF == null || !ProcessF.CanRead)
                    {
                        ProcessF = new System.IO.FileStream(Environment.GetEnvironmentVariable("FreezerPC", EnvironmentVariableTarget.Machine) + "\\Process.dat", System.IO.FileMode.Open, System.IO.FileAccess.ReadWrite);
                    }
                    if (LoginF == null || !LoginF.CanRead)
                    {
                        LoginF = new System.IO.FileStream(Environment.GetEnvironmentVariable("FreezerPC", EnvironmentVariableTarget.Machine) + "\\login.dat", System.IO.FileMode.Open, System.IO.FileAccess.ReadWrite);
                    }
                }catch (System.IO.FileNotFoundException) { flag2 = false; }
                if (flag2)
                {
                    try
                    {
                        System.IO.StreamReader reader = new System.IO.StreamReader(LoginF, System.Text.Encoding.Default);
                        string Text = reader.ReadLine();
                        if (!Text.Equals("T"))
                        {
                            flag = false;
                            reader.Close();
                        }
                        reader.Close();
                        LoginF.Close();
                    }
                    catch (System.IO.FileNotFoundException) { }
                }
                if (LoginF == null || !LoginF.CanWrite)
                {
                    LoginF = new System.IO.FileStream(Environment.GetEnvironmentVariable("FreezerPC", EnvironmentVariableTarget.Machine) + "\\login.dat", System.IO.FileMode.Create, System.IO.FileAccess.ReadWrite);
                }
                System.IO.StreamWriter writer = new System.IO.StreamWriter(LoginF, System.Text.Encoding.Default);
                writer.WriteLine("I");
                writer.WriteLine(ID);
                writer.WriteLine(Pass);
                writer.Close();
            });
            socket.On("end", (data) =>
            {
                if (URLT != null && URLT.IsAlive)
                {
                    URLT.Abort();
                }
                if (ProcessT != null && ProcessT.IsAlive)
                {
                    ProcessT.Abort();
                }
                if (URLF != null)
                {
                    URLF.Close();
                }
                if (ProcessF != null)
                {
                    ProcessF.Close();
                }
                if (LoginF != null)
                {
                    LoginF.Close();
                }
                Lock.Icon = FreezerPC.Properties.Resources.object_unlocked;
                LightChange(URL_red, URL_green, false);
                LightChange(Process_red, Process_green, false);
                if (flag2)
                {
                    try
                    {
                        if (LoginF == null || !LoginF.CanWrite)
                        {
                            LoginF = new System.IO.FileStream(Environment.GetEnvironmentVariable("FreezerPC", EnvironmentVariableTarget.Machine) + "\\login.dat", System.IO.FileMode.Create, System.IO.FileAccess.ReadWrite);
                        }
                        System.IO.StreamWriter writer = new System.IO.StreamWriter(LoginF, System.Text.Encoding.Default);
                        if (flag)
                        {
                            writer.WriteLine("T");
                        }
                        else
                        {
                            writer.WriteLine("F");
                        }
                        writer.WriteLine(ID);
                        writer.WriteLine(Pass);
                        writer.Close();
                        LoginF.Close();
                    }
                    catch (System.IO.FileNotFoundException) { }
                }
                else
                {
                    System.IO.File.Delete(Environment.GetEnvironmentVariable("FreezerPC", EnvironmentVariableTarget.Machine) + "\\login.dat");
                }
            });
            socket.On("disconnect", (data) =>
            {
                LightChange(server_red, server_green, false);
            });
            socket.On("connect", (data) =>
            {
                LightChange(server_red, server_green, true);
                socket.Emit("setSocket", LoginID.Text);
            });

            BrowerList.Items.Add("Chrome");
            BrowerList.SelectedIndex = 0;


            try
            {
                System.IO.FileStream   fs     = new System.IO.FileStream(Environment.GetEnvironmentVariable("FreezerPC", EnvironmentVariableTarget.Machine) + "\\URL.dat", System.IO.FileMode.Open, System.IO.FileAccess.ReadWrite);
                System.IO.StreamReader reader = new System.IO.StreamReader(fs, System.Text.Encoding.Default);
                while (!reader.EndOfStream)
                {
                    URLList.Items.Add(reader.ReadLine());
                }
                reader.Close();
                fs.Close();
            }
            catch (System.IO.FileNotFoundException) { }


            ProcessList.BeginUpdate();
            ProcessList.View = View.Details;
            ProcessList.Columns.Add("프로세스이름", 120, HorizontalAlignment.Center);
            ProcessList.Columns.Add("설명", 232, HorizontalAlignment.Center);

            try
            {
                System.IO.FileStream   fs     = new System.IO.FileStream(Environment.GetEnvironmentVariable("FreezerPC", EnvironmentVariableTarget.Machine) + "\\Process.dat", System.IO.FileMode.Open, System.IO.FileAccess.ReadWrite);
                System.IO.StreamReader reader = new System.IO.StreamReader(fs, System.Text.Encoding.Default);
                while (!reader.EndOfStream)
                {
                    ListViewItem lvi = new ListViewItem(reader.ReadLine());
                    lvi.SubItems.Add(reader.ReadLine());
                    ProcessList.Items.Add(lvi);
                }
                reader.Close();
                fs.Close();
            }
            catch (System.IO.FileNotFoundException) { }

            ProcessList.EndUpdate();

            try
            {
                System.IO.FileStream   fs     = new System.IO.FileStream(Environment.GetEnvironmentVariable("FreezerPC", EnvironmentVariableTarget.Machine) + "\\login.dat", System.IO.FileMode.Open, System.IO.FileAccess.ReadWrite);
                System.IO.StreamReader reader = new System.IO.StreamReader(fs, System.Text.Encoding.Default);
                if (reader.ReadLine() == "I")
                {
                    socket.Emit("Force", ID);
                }
                reader.Close();
                fs.Close();
            }
            catch (System.IO.FileNotFoundException) { }
        }