uia 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +18 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +1 -0
- data/ext/.gitignore +151 -0
- data/ext/UiaDll/Release/UIA.Helper.dll +0 -0
- data/ext/UiaDll/Release/UiaDll.dll +0 -0
- data/ext/UiaDll/UIA.Helper/AutomationProperty.cs +24 -0
- data/ext/UiaDll/UIA.Helper/Clicker.cs +34 -0
- data/ext/UiaDll/UIA.Helper/Element.cs +87 -0
- data/ext/UiaDll/UIA.Helper/Extensions.cs +74 -0
- data/ext/UiaDll/UIA.Helper/Properties/AssemblyInfo.cs +36 -0
- data/ext/UiaDll/UIA.Helper/UIA.Helper.csproj +62 -0
- data/ext/UiaDll/UiaDll/ArrayHelper.cpp +22 -0
- data/ext/UiaDll/UiaDll/ArrayHelper.h +8 -0
- data/ext/UiaDll/UiaDll/AssemblyInfo.cpp +40 -0
- data/ext/UiaDll/UiaDll/DynamicAssemblyResolver.cpp +24 -0
- data/ext/UiaDll/UiaDll/DynamicAssemblyResolver.h +16 -0
- data/ext/UiaDll/UiaDll/ElementMethods.cpp +73 -0
- data/ext/UiaDll/UiaDll/ElementStructures.h +52 -0
- data/ext/UiaDll/UiaDll/ReadMe.txt +38 -0
- data/ext/UiaDll/UiaDll/Stdafx.cpp +5 -0
- data/ext/UiaDll/UiaDll/Stdafx.h +14 -0
- data/ext/UiaDll/UiaDll/StringHelper.cpp +17 -0
- data/ext/UiaDll/UiaDll/StringHelper.h +11 -0
- data/ext/UiaDll/UiaDll/UiaDll.cpp +9 -0
- data/ext/UiaDll/UiaDll/UiaDll.h +13 -0
- data/ext/UiaDll/UiaDll/UiaDll.vcxproj +105 -0
- data/ext/UiaDll/UiaDll/UiaDll.vcxproj.filters +57 -0
- data/ext/UiaDll/UiaDll/app.rc +0 -0
- data/ext/UiaDll/UiaDll.sln +42 -0
- data/lib/uia/version.rb +3 -0
- data/lib/uia.rb +117 -0
- data/uia.gemspec +30 -0
- metadata +130 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Levi Wilson
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Uia
|
2
|
+
|
3
|
+
The `Uia` gem is a low-level driver for interacting with Microsoft UIA elements in a Windows environment.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'uia'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install uia
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/ext/.gitignore
ADDED
@@ -0,0 +1,151 @@
|
|
1
|
+
## Ignore Visual Studio temporary files, build results, and
|
2
|
+
## files generated by popular Visual Studio add-ons.
|
3
|
+
|
4
|
+
# User-specific files
|
5
|
+
*.suo
|
6
|
+
*.user
|
7
|
+
*.sln.docstates
|
8
|
+
|
9
|
+
# Build results
|
10
|
+
|
11
|
+
[Dd]ebug/
|
12
|
+
[Rr]elease/
|
13
|
+
x64/
|
14
|
+
build/
|
15
|
+
[Bb]in/
|
16
|
+
[Oo]bj/
|
17
|
+
|
18
|
+
# Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets
|
19
|
+
!packages/*/build/
|
20
|
+
|
21
|
+
# MSTest test Results
|
22
|
+
[Tt]est[Rr]esult*/
|
23
|
+
[Bb]uild[Ll]og.*
|
24
|
+
|
25
|
+
*_i.c
|
26
|
+
*_p.c
|
27
|
+
*.ilk
|
28
|
+
*.meta
|
29
|
+
*.obj
|
30
|
+
*.pch
|
31
|
+
*.pdb
|
32
|
+
*.pgc
|
33
|
+
*.pgd
|
34
|
+
*.rsp
|
35
|
+
*.sbr
|
36
|
+
*.tlb
|
37
|
+
*.tli
|
38
|
+
*.tlh
|
39
|
+
*.tmp
|
40
|
+
*.tmp_proj
|
41
|
+
*.log
|
42
|
+
*.vspscc
|
43
|
+
*.vssscc
|
44
|
+
.builds
|
45
|
+
*.pidb
|
46
|
+
*.log
|
47
|
+
*.scc
|
48
|
+
|
49
|
+
# Visual C++ cache files
|
50
|
+
ipch/
|
51
|
+
*.aps
|
52
|
+
*.ncb
|
53
|
+
*.opensdf
|
54
|
+
*.sdf
|
55
|
+
*.cachefile
|
56
|
+
|
57
|
+
# Visual Studio profiler
|
58
|
+
*.psess
|
59
|
+
*.vsp
|
60
|
+
*.vspx
|
61
|
+
|
62
|
+
# Guidance Automation Toolkit
|
63
|
+
*.gpState
|
64
|
+
|
65
|
+
# ReSharper is a .NET coding add-in
|
66
|
+
_ReSharper*/
|
67
|
+
*.[Rr]e[Ss]harper
|
68
|
+
|
69
|
+
# TeamCity is a build add-in
|
70
|
+
_TeamCity*
|
71
|
+
|
72
|
+
# DotCover is a Code Coverage Tool
|
73
|
+
*.dotCover
|
74
|
+
|
75
|
+
# NCrunch
|
76
|
+
*.ncrunch*
|
77
|
+
.*crunch*.local.xml
|
78
|
+
|
79
|
+
# Installshield output folder
|
80
|
+
[Ee]xpress/
|
81
|
+
|
82
|
+
# DocProject is a documentation generator add-in
|
83
|
+
DocProject/buildhelp/
|
84
|
+
DocProject/Help/*.HxT
|
85
|
+
DocProject/Help/*.HxC
|
86
|
+
DocProject/Help/*.hhc
|
87
|
+
DocProject/Help/*.hhk
|
88
|
+
DocProject/Help/*.hhp
|
89
|
+
DocProject/Help/Html2
|
90
|
+
DocProject/Help/html
|
91
|
+
|
92
|
+
# Click-Once directory
|
93
|
+
publish/
|
94
|
+
|
95
|
+
# Publish Web Output
|
96
|
+
*.Publish.xml
|
97
|
+
*.pubxml
|
98
|
+
|
99
|
+
# NuGet Packages Directory
|
100
|
+
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
|
101
|
+
#packages/
|
102
|
+
|
103
|
+
# Windows Azure Build Output
|
104
|
+
csx
|
105
|
+
*.build.csdef
|
106
|
+
|
107
|
+
# Windows Store app package directory
|
108
|
+
AppPackages/
|
109
|
+
|
110
|
+
# Others
|
111
|
+
sql/
|
112
|
+
*.Cache
|
113
|
+
ClientBin/
|
114
|
+
[Ss]tyle[Cc]op.*
|
115
|
+
~$*
|
116
|
+
*~
|
117
|
+
*.dbmdl
|
118
|
+
*.[Pp]ublish.xml
|
119
|
+
*.pfx
|
120
|
+
*.publishsettings
|
121
|
+
|
122
|
+
# RIA/Silverlight projects
|
123
|
+
Generated_Code/
|
124
|
+
|
125
|
+
# Backup & report files from converting an old project file to a newer
|
126
|
+
# Visual Studio version. Backup files are not needed, because we have git ;-)
|
127
|
+
_UpgradeReport_Files/
|
128
|
+
Backup*/
|
129
|
+
UpgradeLog*.XML
|
130
|
+
UpgradeLog*.htm
|
131
|
+
|
132
|
+
# SQL Server files
|
133
|
+
App_Data/*.mdf
|
134
|
+
App_Data/*.ldf
|
135
|
+
|
136
|
+
# =========================
|
137
|
+
# Windows detritus
|
138
|
+
# =========================
|
139
|
+
|
140
|
+
# Windows image file caches
|
141
|
+
Thumbs.db
|
142
|
+
ehthumbs.db
|
143
|
+
|
144
|
+
# Folder config file
|
145
|
+
Desktop.ini
|
146
|
+
|
147
|
+
# Recycle Bin used on file shares
|
148
|
+
$RECYCLE.BIN/
|
149
|
+
|
150
|
+
# Mac crap
|
151
|
+
.DS_Store
|
Binary file
|
Binary file
|
@@ -0,0 +1,24 @@
|
|
1
|
+
using System;
|
2
|
+
using System.Windows.Automation;
|
3
|
+
|
4
|
+
namespace UIA.Helper
|
5
|
+
{
|
6
|
+
public class AutomationProperty
|
7
|
+
{
|
8
|
+
public enum Id
|
9
|
+
{
|
10
|
+
IsSelectionItem = 0,
|
11
|
+
}
|
12
|
+
|
13
|
+
public static PropertyCondition From(Id id)
|
14
|
+
{
|
15
|
+
switch (id)
|
16
|
+
{
|
17
|
+
case Id.IsSelectionItem:
|
18
|
+
return new PropertyCondition(AutomationElement.IsSelectionItemPatternAvailableProperty, true);
|
19
|
+
default:
|
20
|
+
throw new ArgumentException(id + " is not a supported property");
|
21
|
+
}
|
22
|
+
}
|
23
|
+
}
|
24
|
+
}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
using System;
|
2
|
+
using System.Runtime.InteropServices;
|
3
|
+
using System.Windows.Automation;
|
4
|
+
using System.Windows.Forms;
|
5
|
+
|
6
|
+
namespace UIA.Helper
|
7
|
+
{
|
8
|
+
public class Clicker
|
9
|
+
{
|
10
|
+
[DllImport("user32.dll")]
|
11
|
+
static extern void mouse_event(uint flags, uint x, uint y, uint data, int extraInfo);
|
12
|
+
|
13
|
+
[Flags]
|
14
|
+
public enum MouseEvent
|
15
|
+
{
|
16
|
+
Leftdown = 0x00000002,
|
17
|
+
Leftup = 0x00000004,
|
18
|
+
}
|
19
|
+
|
20
|
+
private const uint MOUSEEVENTLF_LEFTDOWN = 0x2;
|
21
|
+
private const uint MOUSEEVENTLF_LEFTUP = 0x4;
|
22
|
+
|
23
|
+
public static void MouseClick(AutomationElement element)
|
24
|
+
{
|
25
|
+
element.ScrollToIfPossible();
|
26
|
+
element.SetFocus();
|
27
|
+
|
28
|
+
var clickablePoint = element.GetClickablePoint();
|
29
|
+
Cursor.Position = new System.Drawing.Point((int)clickablePoint.X, (int)clickablePoint.Y);
|
30
|
+
mouse_event(MOUSEEVENTLF_LEFTDOWN, 0, 0, 0, 0);
|
31
|
+
mouse_event(MOUSEEVENTLF_LEFTUP, 0, 0, 0, 0);
|
32
|
+
}
|
33
|
+
}
|
34
|
+
}
|
@@ -0,0 +1,87 @@
|
|
1
|
+
using System;
|
2
|
+
using System.Linq;
|
3
|
+
using System.Windows.Automation;
|
4
|
+
|
5
|
+
namespace UIA.Helper
|
6
|
+
{
|
7
|
+
public class Element
|
8
|
+
{
|
9
|
+
private readonly AutomationElement _element;
|
10
|
+
|
11
|
+
private Element(AutomationElement element)
|
12
|
+
{
|
13
|
+
_element = element;
|
14
|
+
}
|
15
|
+
|
16
|
+
public int[] RuntimeId
|
17
|
+
{
|
18
|
+
get { return _element.GetRuntimeId(); }
|
19
|
+
}
|
20
|
+
|
21
|
+
public string Name
|
22
|
+
{
|
23
|
+
get { return _element.Current.Name; }
|
24
|
+
}
|
25
|
+
|
26
|
+
public int NativeWindowHandle
|
27
|
+
{
|
28
|
+
get { return _element.Current.NativeWindowHandle; }
|
29
|
+
}
|
30
|
+
|
31
|
+
public Element[] Children
|
32
|
+
{
|
33
|
+
get
|
34
|
+
{
|
35
|
+
return _element.FindAll(TreeScope.Children, Condition.TrueCondition).Cast<AutomationElement>()
|
36
|
+
.Select(x => new Element(x))
|
37
|
+
.ToArray();
|
38
|
+
}
|
39
|
+
}
|
40
|
+
|
41
|
+
public Element[] ChildrenOf(AutomationProperty.Id id)
|
42
|
+
{
|
43
|
+
return _element.FindAll(TreeScope.Children, AutomationProperty.From(id)).Cast<AutomationElement>()
|
44
|
+
.Select(x => new Element(x))
|
45
|
+
.ToArray();
|
46
|
+
}
|
47
|
+
|
48
|
+
public void MouseClick()
|
49
|
+
{
|
50
|
+
Clicker.MouseClick(_element);
|
51
|
+
}
|
52
|
+
|
53
|
+
public static Element ById(string automationId)
|
54
|
+
{
|
55
|
+
var foundElement = AutomationElement.RootElement.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.AutomationIdProperty, automationId));
|
56
|
+
if (null == foundElement)
|
57
|
+
{
|
58
|
+
throw new ArgumentException(string.Format("An element with the id \"{0}\" was not found", automationId));
|
59
|
+
}
|
60
|
+
|
61
|
+
return new Element(foundElement);
|
62
|
+
}
|
63
|
+
|
64
|
+
public static Element ByHandle(IntPtr windowHandle)
|
65
|
+
{
|
66
|
+
var foundElement = AutomationElement.FromHandle(windowHandle);
|
67
|
+
if (null == foundElement)
|
68
|
+
{
|
69
|
+
throw new ArgumentException(string.Format("An element with the handle 0x{0:x} was not found", windowHandle.ToInt32()));
|
70
|
+
}
|
71
|
+
|
72
|
+
return new Element(foundElement);
|
73
|
+
}
|
74
|
+
|
75
|
+
public static Element ByRuntimeId(int[] runtimeId)
|
76
|
+
{
|
77
|
+
var foundElement = AutomationElement.RootElement.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.RuntimeIdProperty, runtimeId));
|
78
|
+
if (null == foundElement)
|
79
|
+
{
|
80
|
+
throw new ArgumentException(string.Format("An element with the runtime id \"{0}\" was not found",
|
81
|
+
string.Join(", ", runtimeId.Select(x => x.ToString()))));
|
82
|
+
}
|
83
|
+
|
84
|
+
return new Element(foundElement);
|
85
|
+
}
|
86
|
+
}
|
87
|
+
}
|
@@ -0,0 +1,74 @@
|
|
1
|
+
using System;
|
2
|
+
using System.Collections.Generic;
|
3
|
+
using System.Linq;
|
4
|
+
using System.Threading;
|
5
|
+
using System.Windows;
|
6
|
+
using System.Windows.Automation;
|
7
|
+
|
8
|
+
namespace UIA.Helper
|
9
|
+
{
|
10
|
+
public static class Extensions
|
11
|
+
{
|
12
|
+
public static string Join<T>(this IEnumerable<T> items, string separator = ", ")
|
13
|
+
{
|
14
|
+
return string.Join(separator, items.Select(x => x.ToString()));
|
15
|
+
}
|
16
|
+
}
|
17
|
+
|
18
|
+
public static class ElementExtensions
|
19
|
+
{
|
20
|
+
|
21
|
+
public static bool ScrollToIfPossible(this AutomationElement automationElement)
|
22
|
+
{
|
23
|
+
if (!automationElement.CanScrollTo())
|
24
|
+
{
|
25
|
+
return false;
|
26
|
+
}
|
27
|
+
|
28
|
+
if (!automationElement.HasClickablePoint())
|
29
|
+
{
|
30
|
+
automationElement.AsScrollItem().ScrollIntoView();
|
31
|
+
automationElement.WaitUntilClickable(3);
|
32
|
+
}
|
33
|
+
|
34
|
+
return true;
|
35
|
+
}
|
36
|
+
|
37
|
+
|
38
|
+
public static bool CanScrollTo(this AutomationElement automationElement)
|
39
|
+
{
|
40
|
+
return (bool)automationElement.GetCurrentPropertyValue(AutomationElement.IsScrollItemPatternAvailableProperty);
|
41
|
+
}
|
42
|
+
|
43
|
+
|
44
|
+
public static bool HasClickablePoint(this AutomationElement automationElement)
|
45
|
+
{
|
46
|
+
Point point;
|
47
|
+
return automationElement.TryGetClickablePoint(out point);
|
48
|
+
}
|
49
|
+
|
50
|
+
|
51
|
+
public static void WaitUntilClickable(this AutomationElement automationElement, int howManySeconds)
|
52
|
+
{
|
53
|
+
var then = DateTime.Now;
|
54
|
+
while (!automationElement.HasClickablePoint())
|
55
|
+
{
|
56
|
+
Thread.Sleep(1);
|
57
|
+
if ((DateTime.Now - then).Seconds > howManySeconds)
|
58
|
+
{
|
59
|
+
throw new Exception(string.Format("Waited for more than {0} seconds to be able to click this", howManySeconds));
|
60
|
+
}
|
61
|
+
}
|
62
|
+
}
|
63
|
+
|
64
|
+
public static ScrollItemPattern AsScrollItem(this AutomationElement automationElement)
|
65
|
+
{
|
66
|
+
return automationElement.As<ScrollItemPattern>(ScrollItemPatternIdentifiers.Pattern);
|
67
|
+
}
|
68
|
+
|
69
|
+
public static T As<T>(this AutomationElement automationElement, AutomationPattern pattern)
|
70
|
+
{
|
71
|
+
return (T)automationElement.GetCurrentPattern(pattern);
|
72
|
+
}
|
73
|
+
}
|
74
|
+
}
|
@@ -0,0 +1,36 @@
|
|
1
|
+
using System.Reflection;
|
2
|
+
using System.Runtime.CompilerServices;
|
3
|
+
using System.Runtime.InteropServices;
|
4
|
+
|
5
|
+
// General Information about an assembly is controlled through the following
|
6
|
+
// set of attributes. Change these attribute values to modify the information
|
7
|
+
// associated with an assembly.
|
8
|
+
[assembly: AssemblyTitle("UIA.Helper")]
|
9
|
+
[assembly: AssemblyDescription("")]
|
10
|
+
[assembly: AssemblyConfiguration("")]
|
11
|
+
[assembly: AssemblyCompany("")]
|
12
|
+
[assembly: AssemblyProduct("UIA.Helper")]
|
13
|
+
[assembly: AssemblyCopyright("Copyright © 2013")]
|
14
|
+
[assembly: AssemblyTrademark("")]
|
15
|
+
[assembly: AssemblyCulture("")]
|
16
|
+
|
17
|
+
// Setting ComVisible to false makes the types in this assembly not visible
|
18
|
+
// to COM components. If you need to access a type in this assembly from
|
19
|
+
// COM, set the ComVisible attribute to true on that type.
|
20
|
+
[assembly: ComVisible(false)]
|
21
|
+
|
22
|
+
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
23
|
+
[assembly: Guid("a2579041-e1cd-4916-9d8a-dd96d91ed966")]
|
24
|
+
|
25
|
+
// Version information for an assembly consists of the following four values:
|
26
|
+
//
|
27
|
+
// Major Version
|
28
|
+
// Minor Version
|
29
|
+
// Build Number
|
30
|
+
// Revision
|
31
|
+
//
|
32
|
+
// You can specify all the values or you can default the Build and Revision Numbers
|
33
|
+
// by using the '*' as shown below:
|
34
|
+
// [assembly: AssemblyVersion("1.0.*")]
|
35
|
+
[assembly: AssemblyVersion("1.0.0.0")]
|
36
|
+
[assembly: AssemblyFileVersion("1.0.0.0")]
|
@@ -0,0 +1,62 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
3
|
+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
4
|
+
<PropertyGroup>
|
5
|
+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
6
|
+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
7
|
+
<ProjectGuid>{C2D567A8-B059-41A8-B9F5-FF4F8F961C1F}</ProjectGuid>
|
8
|
+
<OutputType>Library</OutputType>
|
9
|
+
<AppDesignerFolder>Properties</AppDesignerFolder>
|
10
|
+
<RootNamespace>UIA.Helper</RootNamespace>
|
11
|
+
<AssemblyName>UIA.Helper</AssemblyName>
|
12
|
+
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
13
|
+
<FileAlignment>512</FileAlignment>
|
14
|
+
<TargetFrameworkProfile />
|
15
|
+
</PropertyGroup>
|
16
|
+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
17
|
+
<DebugSymbols>true</DebugSymbols>
|
18
|
+
<DebugType>full</DebugType>
|
19
|
+
<Optimize>false</Optimize>
|
20
|
+
<OutputPath>bin\Debug\</OutputPath>
|
21
|
+
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
22
|
+
<ErrorReport>prompt</ErrorReport>
|
23
|
+
<WarningLevel>4</WarningLevel>
|
24
|
+
</PropertyGroup>
|
25
|
+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
26
|
+
<DebugType>pdbonly</DebugType>
|
27
|
+
<Optimize>true</Optimize>
|
28
|
+
<OutputPath>bin\Release\</OutputPath>
|
29
|
+
<DefineConstants>TRACE</DefineConstants>
|
30
|
+
<ErrorReport>prompt</ErrorReport>
|
31
|
+
<WarningLevel>4</WarningLevel>
|
32
|
+
</PropertyGroup>
|
33
|
+
<ItemGroup>
|
34
|
+
<Reference Include="System" />
|
35
|
+
<Reference Include="System.Core" />
|
36
|
+
<Reference Include="System.Drawing" />
|
37
|
+
<Reference Include="System.Windows.Forms" />
|
38
|
+
<Reference Include="System.Xml.Linq" />
|
39
|
+
<Reference Include="System.Data.DataSetExtensions" />
|
40
|
+
<Reference Include="Microsoft.CSharp" />
|
41
|
+
<Reference Include="System.Data" />
|
42
|
+
<Reference Include="System.Xml" />
|
43
|
+
<Reference Include="UIAutomationClient" />
|
44
|
+
<Reference Include="UIAutomationTypes" />
|
45
|
+
<Reference Include="WindowsBase" />
|
46
|
+
</ItemGroup>
|
47
|
+
<ItemGroup>
|
48
|
+
<Compile Include="AutomationProperty.cs" />
|
49
|
+
<Compile Include="Clicker.cs" />
|
50
|
+
<Compile Include="Element.cs" />
|
51
|
+
<Compile Include="Extensions.cs" />
|
52
|
+
<Compile Include="Properties\AssemblyInfo.cs" />
|
53
|
+
</ItemGroup>
|
54
|
+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
55
|
+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
56
|
+
Other similar extension points exist, see Microsoft.Common.targets.
|
57
|
+
<Target Name="BeforeBuild">
|
58
|
+
</Target>
|
59
|
+
<Target Name="AfterBuild">
|
60
|
+
</Target>
|
61
|
+
-->
|
62
|
+
</Project>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
#include "stdafx.h"
|
2
|
+
#include "ArrayHelper.h"
|
3
|
+
|
4
|
+
array<int>^ ArrayHelper::ToArray(const int items[], const int length) {
|
5
|
+
auto managedItems = gcnew array<int>(length);
|
6
|
+
for(auto index = 0; index < length; ++index) {
|
7
|
+
managedItems[index] = items[index];
|
8
|
+
}
|
9
|
+
return managedItems;
|
10
|
+
}
|
11
|
+
|
12
|
+
|
13
|
+
int* ArrayHelper::FromArray(array<int>^ items) {
|
14
|
+
auto unmanagedArray = new int[items->Length];
|
15
|
+
|
16
|
+
auto index = 0;
|
17
|
+
for each(auto item in items) {
|
18
|
+
unmanagedArray[index++] = item;
|
19
|
+
}
|
20
|
+
|
21
|
+
return unmanagedArray;
|
22
|
+
}
|
@@ -0,0 +1,40 @@
|
|
1
|
+
#include "stdafx.h"
|
2
|
+
|
3
|
+
using namespace System;
|
4
|
+
using namespace System::Reflection;
|
5
|
+
using namespace System::Runtime::CompilerServices;
|
6
|
+
using namespace System::Runtime::InteropServices;
|
7
|
+
using namespace System::Security::Permissions;
|
8
|
+
|
9
|
+
//
|
10
|
+
// General Information about an assembly is controlled through the following
|
11
|
+
// set of attributes. Change these attribute values to modify the information
|
12
|
+
// associated with an assembly.
|
13
|
+
//
|
14
|
+
[assembly:AssemblyTitleAttribute("UiaDll")];
|
15
|
+
[assembly:AssemblyDescriptionAttribute("")];
|
16
|
+
[assembly:AssemblyConfigurationAttribute("")];
|
17
|
+
[assembly:AssemblyCompanyAttribute("")];
|
18
|
+
[assembly:AssemblyProductAttribute("UiaDll")];
|
19
|
+
[assembly:AssemblyCopyrightAttribute("Copyright (c) 2013")];
|
20
|
+
[assembly:AssemblyTrademarkAttribute("")];
|
21
|
+
[assembly:AssemblyCultureAttribute("")];
|
22
|
+
|
23
|
+
//
|
24
|
+
// Version information for an assembly consists of the following four values:
|
25
|
+
//
|
26
|
+
// Major Version
|
27
|
+
// Minor Version
|
28
|
+
// Build Number
|
29
|
+
// Revision
|
30
|
+
//
|
31
|
+
// You can specify all the value or you can default the Revision and Build Numbers
|
32
|
+
// by using the '*' as shown below:
|
33
|
+
|
34
|
+
[assembly:AssemblyVersionAttribute("1.0.*")];
|
35
|
+
|
36
|
+
[assembly:ComVisible(false)];
|
37
|
+
|
38
|
+
[assembly:CLSCompliantAttribute(true)];
|
39
|
+
|
40
|
+
[assembly:SecurityPermission(SecurityAction::RequestMinimum, UnmanagedCode = true)];
|
@@ -0,0 +1,24 @@
|
|
1
|
+
#include "StdAfx.h"
|
2
|
+
#include "DynamicAssemblyResolver.h"
|
3
|
+
|
4
|
+
void DynamicAssemblyResolver::PrivatePath::set(String^ path) {
|
5
|
+
_PrivatePath = path;
|
6
|
+
AppDomain::CurrentDomain->AssemblyResolve += gcnew ResolveEventHandler(Resolve);
|
7
|
+
}
|
8
|
+
|
9
|
+
Assembly^ DynamicAssemblyResolver::Resolve(Object^ sender, ResolveEventArgs^ args)
|
10
|
+
{
|
11
|
+
try
|
12
|
+
{
|
13
|
+
auto fullPrivatePath = Path::Combine(_PrivatePath, AssemblyFromQualifiedName(args->Name));
|
14
|
+
return Assembly::LoadFrom(fullPrivatePath);
|
15
|
+
}
|
16
|
+
catch(...) { }
|
17
|
+
|
18
|
+
return nullptr;
|
19
|
+
}
|
20
|
+
|
21
|
+
String^ DynamicAssemblyResolver::AssemblyFromQualifiedName(String^ qualifiedName)
|
22
|
+
{
|
23
|
+
return qualifiedName->Substring(0, qualifiedName->IndexOf(",")) + ".dll";
|
24
|
+
}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
#pragma once
|
2
|
+
using namespace System::IO;
|
3
|
+
using namespace System::Reflection;
|
4
|
+
|
5
|
+
ref class DynamicAssemblyResolver
|
6
|
+
{
|
7
|
+
public:
|
8
|
+
static property String^ PrivatePath {
|
9
|
+
void set(String^ value);
|
10
|
+
}
|
11
|
+
|
12
|
+
private:
|
13
|
+
static String^ _PrivatePath = nullptr;
|
14
|
+
static Assembly^ Resolve(Object^ sender, ResolveEventArgs^ args);
|
15
|
+
static String^ AssemblyFromQualifiedName(String^ qualifiedName);
|
16
|
+
};
|