示例#1
0
        public void Overwatch()
        {
            try
            {
                IEnumerable <ProcessData> test = GetProcesses();
                foreach (var item in test)
                {
                    if (item.ExecutablePath != null)
                    {
                        bool tttt = false;
                        for (int a = 0; a < sysprocess.Length; a++)
                        {
                            if (sysprocess[a].Contains(item.Name))
                            {
                                tttt = true;
                            }
                        }
                        if (!tttt)
                        {
                            ProcessList pl = new ProcessList();
                            pl.Processname    = item.Name;
                            pl.PID            = item.ProcessId.ToString();
                            pl.ProcessRunpath = item.ExecutablePath;

                            bool check1 = false;
                            for (int a = 0; a < prlist.Count; a++)
                            {
                                if (prlist[a].PID == item.ProcessId.ToString())
                                {
                                    check1 = true;
                                    break;
                                }
                            }
                            if (!check1)
                            {
                                bool check2 = false;
                                for (int b = 0; b < overwatchlist.Count; b++) // 오버와치 이미등록되어있는지체크
                                {
                                    if (overwatchlist[b].PID == item.ProcessId.ToString())
                                    {
                                        check2 = true;
                                    }
                                }
                                if (!check2)
                                {
                                    bool check3 = false;
                                    for (int c = 0; c < SendList.Count; c++)
                                    {
                                        if (SendList[c].PID == item.ProcessId.ToString())
                                        {
                                            check3 = true;
                                        }
                                    }
                                    if (!check3)
                                    {
                                        overwatchlist.Add(pl);
                                        Console.WriteLine("OverWatchlist added" + pl.Processname);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch
            {
            }
        }