예제 #1
0
 private void OnChanged(object sender, FileSystemEventArgs e)
 {
     if (e.ChangeType != WatcherChangeTypes.Changed)
     {
         return;
     }
     Console.WriteLine($"Changed: {e.FullPath}");
     if (DirectoryAndFileMethods.GetFileType(e.FullPath).Equals("pe"))
     {
         List <string> signatures = AntivirusLibrary.DataBaseMethods.DataBaseGetOneField("Signatures", 1);
         ScanMethods.Scan(ScanMethods.GetScanBuffer(e.FullPath), signatures, e.FullPath, path);
     }
 }
예제 #2
0
        public static void ServerReadThread()
        {
            while (true)
            {
                string mail = ReadMail();
                if (mail != "")
                {
                    Quest quest = new Quest(int.Parse(mail.Split('|')[0]));

                    for (int i = 1; i <= int.Parse(mail.Split('|')[1].Split('?')[0]); i++)
                    {
                        quest.setPaths(mail.Split('|')[1].Split('?')[i]);
                        Console.WriteLine(mail.Split('|')[1]);
                    }
                    for (int i = 1; i <= int.Parse(mail.Split('|')[2].Split('?')[0]); i++)
                    {
                        quest.setOptions(mail.Split('|')[2].Split('?')[i]);
                    }
                    quest.Show();

                    switch (quest.command)
                    {
                    case 0:
                        DataBaseMethods.DataBaseDeleteAllNotes("Scan");
                        StartScanDir(quest);
                        break;

                    case 1:
                        DeleteFiles(quest);
                        break;

                    case 2:
                        QuarantineFiles(quest);
                        break;

                    case 3:
                        IgnorFiles(quest);
                        break;

                    case 4:
                        StartMonitoring(quest);
                        break;

                    case 5:
                        StopMonitoring();
                        break;

                    case 6:
                        var status = GetScanStatus();
                        WriteMail("Status_" + status);
                        break;

                    case 7:
                        GetScanProgress();

                        break;

                    case 8:
                        ScanMethods.StopScan();
                        break;

                    case 9:
                        Recover(quest);
                        break;

                    default:
                        break;
                    }
                }
            }
        }