public void Run()
        {
            int maxthread = 0;
            int io;

            ThreadPool.GetMaxThreads(out maxthread, out io);
            ThreadPool.SetMaxThreads(1, 1);

            //SimpleIOPlugin plugn = new SimpleIOPlugin();

            _plugn.onFileListenerChanged  += plugn_OnFileListenerChanged;
            _plugn.onFileListenerChanged2 += plugn_onFileListenerChanged2;
            _plugn.getMonitorDPI(65539, new Action <object, object>((x, y) => {
            }));

            _plugn.onOutputDebugString += plugn_onOutputDebugString;
            _plugn.listenOnProcess("LeagueClientUx", new Action <object, object>((x, y) => {
            }));

            var folder = _plugn.PROGRAMFILES + "/overwolf";

            _plugn.getLatestFileInDirectory(folder, new Action <object, object>((x, y) => {
            }));


            _plugn.getLatestFileInDirectory(folder + "/*.msi", new Action <object, object>((x, y) => {
            }));


            _plugn.getTextFile(@"c:\Users\elad.bahar\AppData\Local\Overwolf\Log\OverwolfCEF_13096.log", true, new Action <object, object>((x, y) => {
            }));

            _plugn.getBinaryFile(_plugn.PROGRAMFILES + "/overwolf/Overwolf.exe.config", -1, new Action <object, object>((x, y) => {
            }));

            _plugn.listDirectory(@"c:\Users\elad.bahar\AppData\Local\Overwolf", new Action <object, object>((x, y) => {
            }));

            _plugn.getCurrentCursorPosition(new Action <object, object, object, object>((status, reason, x, y) => {
                Trace.WriteLine(reason);
            }));

            _plugn.iniReadValue("Power", "ConsolePrinting", @"C:\Users\elad.bahar\AppData\Local\Blizzard\Hearthstone\log.config",
                                new Action <object, object>((status, result) => {
                Trace.WriteLine("iniReadValue: " + status + ", : " + result);
            }));


            //   plugn.iniWriterValue("Power", "LogLevel","2", @"C:\Users\elad.bahar\AppData\Local\Blizzard\Hearthstone\log.config",
            //     new Action<object, object>((status, result) => {
            //       Trace.WriteLine("iniReadValue: " + status + ", : " + result);
            //     }));

            //   plugn.iniWriterValue("Power", "LogLevel", "1", @"C:\Users\elad.bahar\AppData\Local\Blizzard\Hearthstone\log.config",
            //       new Action<object, object>((status, result) => {
            //  Trace.WriteLine("iniReadValue: " + status + ", : " + result);
            //}));


            _plugn.listenOnFile("test", @"e:\temp\python.log", false, new Action <object, object, object>((id, status, line) => {
                // Trace.WriteLine(line);
            }));
            Task.Run(() => {
                try {
                    Trace.WriteLine("left button pressed:" + _plugn.isMouseLeftButtonPressed);
                    _plugn.stopProcesseListen("LeagueClientUx", new Action <object, object>((x, y) => {
                    }));
                    Thread.Sleep(5000);
                    Trace.WriteLine("left button pressed:" + _plugn.isMouseLeftButtonPressed);
                    _plugn.stopFileListen("test");
                    //plugn.listenOnFile("test", @"c:\Temp\test.txt", true, new Action<object, object, object>((id, status, line) =>
                    //{
                    //  Trace.WriteLine(line);
                    //}));
                } catch (Exception) {
                    //callback(string.Format("error: ", ex.ToString()));
                }
            });
        }
Пример #2
0
        static void Main(string[] args)
        {
            int maxthread = 0;
            int io;

            ThreadPool.GetMaxThreads(out maxthread, out io);
            ThreadPool.SetMaxThreads(1, 1);

            SimpleIOPlugin plugn = new SimpleIOPlugin();

            plugn.onFileListenerChanged += plugn_OnFileListenerChanged;
            plugn.getMonitorDPI(65539, new Action <object, object>((x, y) =>
            {
            }));

            var folder = plugn.PROGRAMFILES + "/overwolf";

            plugn.getLatestFileInDirectory(folder, new Action <object, object>((x, y) =>
            {
            }));


            plugn.getLatestFileInDirectory(folder + "/*.msi", new Action <object, object>((x, y) =>
            {
            }));


            plugn.getTextFile(@"c:\Users\elad.bahar\AppData\Local\Overwolf\Log\OverwolfCEF_13096.log", true, new Action <object, object>((x, y) =>
            {
            }));

            plugn.getBinaryFile(plugn.PROGRAMFILES + "/overwolf/Overwolf.exe.config", -1, new Action <object, object>((x, y) =>
            {
            }));

            plugn.listDirectory(@"c:\Users\elad.bahar\AppData\Local\Overwolf", new Action <object, object>((x, y) =>
            {
            }));

            plugn.getCurrentCursorPosition(new Action <object, object, object, object>((status, reason, x, y) =>
            {
                Trace.WriteLine(reason);
            }));


            plugn.listenOnFile("test", @"c:\Temp\test.txt", false, new Action <object, object, object>((id, status, line) =>
            {
                Trace.WriteLine(line);
            }));

            Task.Run(() =>
            {
                try
                {
                    Thread.Sleep(1000);
                    plugn.stopFileListen("test");
                    //plugn.listenOnFile("test", @"c:\Temp\test.txt", true, new Action<object, object, object>((id, status, line) =>
                    //{
                    //  Trace.WriteLine(line);
                    //}));
                }
                catch (Exception ex)
                {
                    //callback(string.Format("error: ", ex.ToString()));
                }
            });

            Console.ReadLine();
        }