コード例 #1
0
        public void Dispose()
        {
            ModuleBox.SaveOptions(AppOptions);

            FilesTypeInSystem.Clear();
            AuditResult.Clear();
            ReleaseUnmanagedResources();
            GC.SuppressFinalize((object)this);
        }
コード例 #2
0
        private void LoopModule(object obj)
        {
            if (obj != null)
            {
                ModuleBox moduleBox = obj as ModuleBox;
                MBox = new ModuleBox(moduleBox)
                {
                    ModListener = UnpackBox
                };

                if (MBox.MainFListener != null)
                {
                    _isUiActive        = true;
                    MBox.MainFListener = moduleBox.MainFListener;
                    MBox.MainFListener(new ModuleBox()
                    {
                        CodeId      = CodeId.BindWithModule,
                        ModListener = MBox.ModListener
                    });
                }

                bool flag = true;
                while (flag)
                {
                    Thread.Sleep(100);
                    lock (_locker)
                    {
                        if (MustDo.Count > 0 && MBoxs.Count > 0)
                        {
                            switch (MustDo.Peek())
                            {
                            case CodeId.ListReportAudit:
                                MustDo.Dequeue();
                                if (_isUiActive)
                                {
                                    ModuleBox m = new ModuleBox()
                                    {
                                        CodeId = CodeId.ListReportAudit
                                    };
                                    for (int i = 0; i < AuditResult.Count; i++)
                                    {
                                        m.ListReportAudit.Add(AuditResult[i]);
                                        File.AppendAllText("TTX.txt", $"\r\n{AuditResult[i].FindWords.Count}");
                                    }
                                    MBox.MainFListener(m);
                                }
                                MBoxs.Dequeue();
                                break;

                            case CodeId.AddToAuditResult:
                                MustDo.Dequeue();
                                var ari = MBoxs.Peek();
                                this.AuditResult.Add(new AuditResultInfo(ari.Ari));
                                MBoxs.Dequeue();
                                break;

                            case CodeId.BindWithScanF:
                                MustDo.Dequeue();
                                var bwsf = MBoxs.Peek();
                                MBox.ScanFListener = bwsf.ScanFListener;
                                MBoxs.Dequeue();
                                break;

                            case CodeId.BindwithScan:
                                MustDo.Dequeue();
                                var bws = MBoxs.Peek();
                                MBox.ScanListener = bws.ScanListener;
                                MBoxs.Dequeue();
                                break;

                            case CodeId.UnBindWithScanF:
                                moduleBox.ScanFListener = null;
                                MustDo.Dequeue();
                                MBoxs.Dequeue();
                                break;

                            case CodeId.DisposeModule:
                                flag = false;
                                if (_scanTask != null)
                                {
                                    if (_scanTask.IsAlive)
                                    {
                                        _scanTask.Abort();
                                    }
                                }
                                MustDo.Clear();
                                MBoxs.Clear();
                                break;

                            case CodeId.RunScanForm:
                                AuditResult.Clear();
                                MustDo.Dequeue();
                                _scanTask = new Thread(RunScanFormExternalTrigger);
                                ModuleBox t = new ModuleBox(MBoxs.Dequeue());
                                _scanTask.Start(t);
                                break;

                            case CodeId.TestHookApp:
                                MustDo.Dequeue();
                                MBoxs.Dequeue();
                                new Thread(new TestAppHook(_mhf).Show).Start();
                                break;

                            case CodeId.TestHookKeyboard:
                                MustDo.Dequeue();
                                MBoxs.Dequeue();
                                new Thread(new TestKeyBoardHook(_mhf).Show).Start();
                                break;

                            case CodeId.TestHookMouse:
                                MustDo.Dequeue();
                                MBoxs.Dequeue();

                                new Thread(new TestMouseHook(_mhf).Show).Start();
                                break;

                            case CodeId.TestHookClipboard:
                                MustDo.Dequeue();
                                MBoxs.Dequeue();
                                new Thread(new TestClipBordHook(_mhf).Show).Start();
                                break;

                            case CodeId.TestHookPrint:
                                MustDo.Dequeue();
                                MBoxs.Dequeue();
                                new Thread(new TestPrintHook(_mhf).Show).Start();
                                break;

                            case CodeId.TestCameraSpy:
                                MustDo.Dequeue();
                                MBoxs.Dequeue();
                                new Thread(new ClientSpy.ClientSpy().TestRun);
                                new Thread(new ServerSpy.TestVideo().Show).Start();
                                break;
                            }
                        }
                    }
                }

                Dispose();
            }
        }