This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private Accessible GetFocused(Accessible objParent) | |
{ | |
Accessible objToReturn = default(Accessible); | |
if (objParent != null) | |
{ | |
Accessible[] children = null; | |
objParent.Children(out children); | |
if (children != null) | |
{ | |
foreach (var accessible in children) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static string GetText() | |
{ | |
try | |
{ | |
var element = AutomationElement.FocusedElement; | |
if (element != null) | |
{ | |
object pattern; | |
if (element.TryGetCurrentPattern(TextPattern.Pattern, out pattern)) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ImageOpacity | |
{ | |
private const int bytesPerPixel = 4; | |
/// <summary> | |
/// Change the opacity of an image | |
/// </summary> | |
/// <param name="originalImage">The original image</param> | |
/// <param name="opacity">Opacity, where 1.0 is no opacity, 0.0 is full transparency</param> | |
/// <returns>The changed image</returns> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var start = reachTextBox.Document.ContentStart; | |
var textrange = new TextRange(GetPoint(start, pos), GetPoint(start, pos + len)); | |
private TextPointer GetPoint(TextPointer start, int x) | |
{ | |
var ret = start; | |
var i = 0; | |
while (true) | |
{ | |
string stringSoFar = new TextRange(ret, ret.GetPositionAtOffset(i, LogicalDirection.Forward)).Text; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)] | |
[return: MarshalAs(UnmanagedType.Bool)] | |
static extern bool GetDiskFreeSpaceEx(string lpDirectoryName, | |
out ulong lpFreeBytesAvailable, | |
out ulong lpTotalNumberOfBytes, | |
out ulong lpTotalNumberOfFreeBytes); | |
ulong FreeBytesAvailable; | |
ulong TotalNumberOfBytes; | |
ulong TotalNumberOfFreeBytes; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Runtime.InteropServices; | |
using System.IO; | |
namespace WiredPrairie.Samples | |
{ | |
public static class Pathing |