Extended Msg hook text limit, msg hook prompts before switching between 32 and 64 bits, optionally disable uiabridge's caches

Message Hook Viewer text limit is not set to 700,000 characters,
allowing it to show many more messages/lines
Message Hook Viewer will prompt user if the want to switch between 64
and 32 bits.
UiaBridge has an optional flag to disable cache.  This fixes an issue
where caching is either slower or causes issues when using multiple
threads in OASIS.
This commit is contained in:
Edward Jakubowski
2014-06-04 06:46:56 -04:00
parent d100d23259
commit eaff0dd277
21 changed files with 162 additions and 53 deletions

Binary file not shown.

Binary file not shown.

View File

@@ -37,6 +37,16 @@ JNIEXPORT void JNICALL Java_org_synthuse_UiaBridge_shutdown(JNIEnv *env, jobject
{
}
/*
* Class: org_synthuse_UiaBridge
* Method: useCachedRequests
* Signature: (Z)V
*/
JNIEXPORT void JNICALL Java_org_synthuse_UiaBridge_useCachedRequests(JNIEnv *env, jobject obj, jboolean jcacheRequestsFlg)
{
Global::AUTO_BRIDGE->useCachedRequests((bool)(jcacheRequestsFlg == JNI_TRUE));
}
/*
* Class: org_synthuse_UiaBridge
* Method: addEnumFilter

View File

@@ -23,6 +23,14 @@ JNIEXPORT void JNICALL Java_org_synthuse_UiaBridge_initialize
JNIEXPORT void JNICALL Java_org_synthuse_UiaBridge_shutdown
(JNIEnv *, jobject);
/*
* Class: org_synthuse_UiaBridge
* Method: useCachedRequests
* Signature: (Z)V
*/
JNIEXPORT void JNICALL Java_org_synthuse_UiaBridge_useCachedRequests
(JNIEnv *, jobject, jboolean);
/*
* Class: org_synthuse_UiaBridge
* Method: addEnumFilter

View File

@@ -18,6 +18,7 @@ AutomationBridge::AutomationBridge()
{
enumFilters = gcnew Dictionary<System::String ^, System::String ^>();
cacheRequest = nullptr;
useCache = true;
initializeCache("");
}
@@ -25,6 +26,7 @@ AutomationBridge::AutomationBridge(System::String ^cachedProperties)
{
enumFilters = gcnew Dictionary<System::String ^, System::String ^>();
cacheRequest = nullptr;
useCache = true;
initializeCache(cachedProperties);
}
@@ -36,6 +38,11 @@ AutomationBridge::~AutomationBridge()
//Console::WriteLine("disposing of AutomationBridge");
}
void AutomationBridge::useCachedRequests(System::Boolean cacheRequestsFlg)
{
useCache = cacheRequestsFlg;
}
void AutomationBridge::initializeCache(System::String ^cachedProperties)
{
cacheRequest = gcnew CacheRequest();
@@ -158,7 +165,10 @@ Boolean AutomationBridge::isElementFiltered(System::Windows::Automation::Automat
}
else //all other property types that are strings
{
valStr = element->GetCachedPropertyValue(ap)->ToString();
if (useCache)
valStr = element->GetCachedPropertyValue(ap)->ToString();
else
valStr = element->GetCurrentPropertyValue(ap)->ToString();
//valStr = element->GetCurrentPropertyValue(ap)->ToString();
}
//System::Console::WriteLine("test property vals: {0} , {1}", valStr, enumFilters[key]);
@@ -285,7 +295,12 @@ array<System::String ^> ^ AutomationBridge::enumWindowInfo(AutomationElement ^pa
//System::Console::WriteLine("get info: {0}", getWindowInfo(element, properties));
//AutomationElement ^currentElement = tw->GetFirstChild(element, cacheRequest);
AutomationElement ^currentElement = nullptr;
currentElement = tw->GetFirstChild(parentElement, cacheRequest);
if (useCache)
currentElement = tw->GetFirstChild(parentElement, cacheRequest);
else
currentElement = tw->GetFirstChild(parentElement);
if (currentElement == nullptr)
{
//System::Console::WriteLine("no children {0}", element->CachedChildren->Count);
@@ -319,7 +334,10 @@ array<System::String ^> ^ AutomationBridge::enumWindowInfo(AutomationElement ^pa
{
output(ex, "");
}
currentElement = tw->GetNextSibling(currentElement, cacheRequest);
if (useCache)
currentElement = tw->GetNextSibling(currentElement, cacheRequest);
else
currentElement = tw->GetNextSibling(currentElement);
}
return winInfoList->ToArray();
}
@@ -387,7 +405,12 @@ System::String ^ AutomationBridge::getWindowInfo(AutomationElement ^element, Sys
else
currentVal = element->GetCurrentPropertyValue(ap); //cached pattern was having issues;
}
currentVal = element->GetCachedPropertyValue(ap);
if (useCache)
currentVal = element->GetCachedPropertyValue(ap);
else
currentVal = element->GetCurrentPropertyValue(ap);
if (currentVal == nullptr)
continue;
if (ap->ProgrammaticName->Equals(L"AutomationElementIdentifiers.RuntimeIdProperty"))

View File

@@ -20,6 +20,7 @@ namespace uiabridge {
AutomationBridge(void);
AutomationBridge(System::String ^cachedProperties);
~AutomationBridge();
void useCachedRequests(System::Boolean cacheRequestsFlg);
int addEnumFilter(System::String ^propertyName, System::String ^propertyValue);
void clearEnumFilters();
Boolean isElementFiltered(System::Windows::Automation::AutomationElement ^element);
@@ -38,12 +39,14 @@ namespace uiabridge {
static System::String ^PARENT_MODIFIER = L"Parent";//find all children of this matching parent filter
static System::String ^FIRST_MODIFIER = L"First"; //find first element matching this filter then stop
static System::String ^DEFAULT_CACHED_PROPS = L"RuntimeIdProperty,ParentRuntimeIdProperty,NativeWindowHandleProperty,ProcessIdProperty,FrameworkIdProperty,LocalizedControlTypeProperty,ControlTypeProperty,ClassNameProperty,NameProperty,BoundingRectangleProperty,ValueProperty";
private:
void initializeCache(System::String ^cachedProperties);
void output(Exception ^ex, System::String ^message);
Dictionary<System::String ^, System::String ^> ^enumFilters;
void AutomationBridge::processFilterModifier(Boolean filtered, Boolean modifierChanged, List<System::String ^> ^filterModifierList);
CacheRequest ^cacheRequest;
System::Boolean useCache;
array<AutomationProperty^> ^cachedRootProperties;
};
}