示例#1
0
        public static void storeDataHash()
        {
            try
            {
                openExcelRunConfig("RunConfigurationManager", "TestScripts");
                string testcaseID = DriverContext.getTestCaseName();

                dataHash = new Hashtable();
                int rowNumber   = xlWorkSheet.Columns.Find(testcaseID).Cells.Row;
                int columnCount = xlWorkSheet.UsedRange.Columns.Count;
                for (int i = 1; i <= columnCount; i++)
                {
                    var testKey   = xlWorkSheet.Range[HookBase.getColumnNameFromIndex(i) + 1].Value2;
                    var testValue = xlWorkSheet.Range[HookBase.getColumnNameFromIndex(i) + rowNumber].Value2;
                    if (testKey != null)
                    {
                        dataHash.Add(testKey, testValue);
                    }
                }
            }
            catch (Exception e)
            {
                Logger.log("error" + e.Message);
            }
            finally
            {
                closeExcel();
            }
        }
示例#2
0
        public void Install(HookBase hookBase)
        {
            _hookBase = hookBase;

            using (var direct3D = new Direct3D())
            {
                var device = new Device(
                    direct3D,
                    0,
                    DeviceType.NullReference,
                    IntPtr.Zero,
                    CreateFlags.HardwareVertexProcessing,
                    new PresentParameters {
                    BackBufferWidth = 1, BackBufferHeight = 1
                });

                var baseAddress = Marshal.ReadIntPtr(device.NativePointer);

                // EndSceneHook
                _endSceneLocalHook =
                    LocalHook.Create(Marshal.ReadIntPtr(baseAddress, (int)VmtMethods.EndScene * IntPtr.Size),
                                     new DEndScene(EndSceneHook), this);
                _endSceneLocalHook.ThreadACL.SetExclusiveACL(new[] { 0 });

                // DrawIndexedPrimitiveHook
                _drawIndexedPrimitiveHook =
                    LocalHook.Create(
                        Marshal.ReadIntPtr(baseAddress, (int)VmtMethods.DrawIndexedPrimitive * IntPtr.Size),
                        new DDrawIndexedPrimitive(DrawIndexedPrimitiveHook), this);
                _drawIndexedPrimitiveHook.ThreadACL.SetExclusiveACL(new[] { 0 });
            }
        }
示例#3
0
        /// <summary>
        /// Creates a new hook for the owner on the given repository
        /// </summary>
        /// <param name="owner">The username of the owner of the hook</param>
        /// <param name="repo">The repository where the hooks should be created</param>
        /// <param name="hook">The basic information required by GitHub to create the hook itself</param>
        /// <returns>The complete hook returned by GitHub</returns>
        async public Task <Hook> Create(string owner, string repo, HookBase hook)
        {
            var request = CreateRequest(string.Format("/repos/{0}/{1}/hooks", owner, repo));

            var post = await PostAsJson <HookBase, Hook>(request, hook);

            return(post.Result);
        }
示例#4
0
        public void Install(HookBase hookBase)
        {
            _hookBase = hookBase;

            return;

            var moduleHandle = WinApi.GetModuleHandle(OpenGlLibrary);

            var wglSwapBuffersFuncIntPtr = WinApi.GetProcAddress(moduleHandle, WglSwapBuffersFuncName);

            _wglSwapBuffersHook = LocalHook.Create(wglSwapBuffersFuncIntPtr, new DSwapBuffers(SwapBuffersHook), this);
            _wglSwapBuffersHook.ThreadACL.SetExclusiveACL(new[] { 0 });
        }
示例#5
0
 public void Install(HookBase hookBase)
 {
     _orgHook = WinApi.SetWindowsHookEx(13, HookProc, IntPtr.Zero, 0);
 }
示例#6
0
        private static IntPtr MsHook_NativeHookProcEvent(int nCode, IntPtr wParam, IntPtr lParam)
        {
            MSLLHOOKSTRUCT ms =
                (MSLLHOOKSTRUCT)Marshal.PtrToStructure(lParam, typeof(MSLLHOOKSTRUCT));

            switch ((WM)wParam)
            {
            case WM.LBUTTONDOWN:
                Console.WriteLine(Keys.LButton + $" Down on ({ms.pt.x}, {ms.pt.y})");
                break;

            case WM.LBUTTONUP:
                Console.WriteLine(Keys.LButton + $" Up on ({ms.pt.x}, {ms.pt.y})");
                break;

            case WM.MOUSEMOVE:
                Console.WriteLine($"Mouse Move to ({ms.pt.x}, {ms.pt.y})");
                break;

            case WM.MOUSEWHEEL:
                Console.WriteLine($"Mouse Wheel with data {HookBase.HighWord(ms.mouseData)} on ({ms.pt.x}, {ms.pt.y})");
                break;

            case WM.MOUSEHWHEEL:
                Console.WriteLine($"Mouse HWheel with data {HookBase.HighWord(ms.mouseData)} on ({ms.pt.x}, {ms.pt.y})");
                break;

            case WM.RBUTTONDOWN:
                Console.WriteLine(Keys.RButton + $" Down on ({ms.pt.x}, {ms.pt.y})");
                break;

            case WM.RBUTTONUP:
                Console.WriteLine(Keys.RButton + $" Up on ({ms.pt.x}, {ms.pt.y})");
                break;

            case WM.MBUTTONDOWN:
                Console.WriteLine(Keys.MButton + $" Down on ({ms.pt.x}, {ms.pt.y})");
                break;

            case WM.MBUTTONUP:
                Console.WriteLine(Keys.MButton + $" Up on ({ms.pt.x}, {ms.pt.y})");
                break;

            case WM.XBUTTONDOWN:
                if (HookBase.HighWord(ms.mouseData) == (int)MOUSEDATA.XBUTTON1)
                {
                    Console.Write(Keys.XButton1);
                }
                else if (HookBase.HighWord(ms.mouseData) == (int)MOUSEDATA.XBUTTON2)
                {
                    Console.Write(Keys.XButton2);
                }
                Console.WriteLine($" Down on ({ms.pt.x}, {ms.pt.y})");
                break;

            case WM.XBUTTONUP:
                if (HookBase.HighWord(ms.mouseData) == (int)MOUSEDATA.XBUTTON1)
                {
                    Console.Write(Keys.XButton1);
                }
                else if (HookBase.HighWord(ms.mouseData) == (int)MOUSEDATA.XBUTTON2)
                {
                    Console.Write(Keys.XButton2);
                }
                Console.WriteLine($" Up on ({ms.pt.x}, {ms.pt.y})");
                break;
            }
            return(IntPtr.Zero);
        }