Ejemplo n.º 1
0
        protected void ImageProcessFunctionAsync()
        {
            var func = new ProcessFunction(ImageProcessFunction);

            func.BeginInvoke(null, null);
            Logger.Trace("Image Processing Function has been invoked");
        }
Ejemplo n.º 2
0
        public InputHookWin(InputCombination inputCombination, ProcessFunction imageProcessFunction)
            : base(inputCombination, imageProcessFunction)
        {
            MouseHook_    = new MouseHook();
            KeyboardHook_ = new KeyboardHook();

            MouseHook_.MouseDown  += MouseHook_MouseDown;
            MouseHook_.MouseUp    += MouseHook_MouseUp;
            KeyboardHook_.KeyDown += KeyboardHook_KeyDown;
            KeyboardHook_.KeyUp   += KeyboardHook_KeyUp;

            InputCombination     = inputCombination;
            PressedMouseButtons_ = new Dictionary <MouseButtons, bool>();
            PressedKeyboardKeys_ = new Dictionary <Keys, bool>();
            foreach (var button in InputCombination.MouseButtons)
            {
                PressedMouseButtons_.Add(button, false);
            }
            foreach (var key in InputCombination.KeyboardKeys)
            {
                PressedKeyboardKeys_.Add(key, false);
            }

            MouseHook_.Start();
            KeyboardHook_.Start();
        }
Ejemplo n.º 3
0
 public void Register(ProcessFunction <T> pFunc)
 {
     if (RegisterFunc != null)
     {
         this.RegisterFunc(pFunc);
     }
 }
Ejemplo n.º 4
0
 public InputPin(string pinName, ProcessFunction <T> processingFunction, bool allowMultipleIn)
 {
     Name            = pinName;
     IsInputPin      = true;
     ProcessFunc     = processingFunction;
     AllowMultipleIn = allowMultipleIn;
 }
Ejemplo n.º 5
0
        public void AddInput(InputPin <T> inputPin)
        {
            ProcessFunction <T> pf = inputPin.ProcessFunc;

            if (!InputProcessFunctions.Contains(pf))
            {
                InputProcessFunctions.Add(pf);
            }
        }
Ejemplo n.º 6
0
        public void ProcessAll(string directoryPath, ProcessFunction processFunction)
        {
            string[] files = System.IO.Directory.GetFiles(directoryPath);

            for (int i = 0; i < files.Length; ++i)
            {
                processFunction(files[i]);
            }
        }
Ejemplo n.º 7
0
        static void Main(string[] args)
        {
            var client = new MongoClient("mongodb://*****:*****@mongoquickx4h3q4klpbxtq-vm0.southeastasia.cloudapp.azure.com/wdata");

            database        = client.GetDatabase("wdata");
            eaApproved      = database.GetCollection <EaApproved>("EaApproved");
            recordProcessed = database.GetCollection <RecordProcessed>("recordprocessed");
            surveyData      = database.GetCollection <SurveyData>("Survey");

            processFunction = new ProcessFunction(database);

            var eaLst = eaApproved.AsQueryable().Select(it => it.EA).ToList();

            Processing(eaLst);

            Console.WriteLine("Done!");
        }
Ejemplo n.º 8
0
        /// <summary>Iterates all processes in Windows, running the given function.  This is based on processes, NOT windows.  Some may be hidden/background</summary>
        public static void IterateRunningProcesses(ProcessFunction procFunction)
        {
            Windows.PROCESSENTRY32 pe32 = new Windows.PROCESSENTRY32();
            //  Take a snapshot of all processes in the system.
            var hProcessSnap = Windows.CreateToolhelp32Snapshot(Windows.SnapshotFlags.Process, 0);

            if (hProcessSnap.IsInvalid())
            {
                return;
            }

            //  Fill in the size of the structure before using it.
            pe32.dwSize = (uint)Marshal.SizeOf(typeof(Windows.PROCESSENTRY32));
            //  Walk the snapshot of the processes, and for each process, display information.
            if (Windows.Process32First(hProcessSnap, ref pe32))
            {
                do
                {
                    int           nLength = 1024;
                    StringBuilder szPath  = new StringBuilder(nLength);
                    // requires Vista or later:  (we no longer have the fall back that was in SAW6)
                    IntPtr hProcess = Windows.OpenProcess(Windows.ProcessAccessFlags.QueryLimitedInformation, false, (int)pe32.th32ProcessID);
                    if (!hProcess.IsZero())                     // will fail for a few (eg System process is protected), but they're not going to be the process we're looking for.
                    {
                        if (Windows.QueryFullProcessImageName(hProcess, 0, szPath, ref nLength))
                        {
                            if (!procFunction(pe32, szPath.ToString(0, nLength)))
                            {
                                Windows.CloseHandle(hProcessSnap);
                                Windows.CloseHandle(hProcess);
                                return;
                            }
                        }
                        Windows.CloseHandle(hProcess);
                    }
                } while (Windows.Process32Next(hProcessSnap, ref pe32));
            }
            Windows.CloseHandle(hProcessSnap);
        }
Ejemplo n.º 9
0
 void DefaultRegister(ProcessFunction <T> pFunc)
 {
     ProcessFunc = pFunc;
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Constructor requires processing function to be sent in.
 /// </summary>
 public ThreadMessage(ProcessFunction procFunc)
 {
     m_processFunc = procFunc;
 }
Ejemplo n.º 11
0
        /// <summary>
        /// Call the process-function on all file paths inside of the parameter root folder.
        /// Sample function is SetImageKeyword().
        /// </summary>
        public static void RunRecursive(ProcessParams p_params, ProcessFunction p_processFunc)
        {
            DirectoryInfo dirInfo = new DirectoryInfo(p_params.RootFolder);

            Utility.LogRight.WriteLog(p_params.RootFolder);

            // call on all subfolders

            DirectoryInfo[] subDirInfo = dirInfo.GetDirectories();

            ProcessParams createParams = new ProcessParams();
            createParams.Parameter1 = p_params.Parameter1;
            createParams.Parameter2 = p_params.Parameter2;

            for (int d = 0; d < subDirInfo.Length; d++)
            {
                createParams.RootFolder = subDirInfo[d].FullName;
                RunRecursive(createParams, p_processFunc);
            }

            // process the current folder

            FileInfo[] fileInfos = dirInfo.GetFiles();

            for (int f = 0; f < fileInfos.Length; f++)
            {
                string filePath = fileInfos[f].FullName;

                createParams.FilePath = filePath;

                try
                {
                    p_processFunc(createParams);
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
Ejemplo n.º 12
0
 public InputHook(InputCombination inputCombination, ProcessFunction imageProcessFunction)
 {
     Logger               = LogManager.GetCurrentClassLogger();
     InputCombination     = inputCombination;
     ImageProcessFunction = imageProcessFunction;
 }