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.Runtime.InteropServices; | |
using System.Text; | |
internal class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Console.WriteLine("Generation, Name, X,Y,Width,Height"); | |
foreach (var w in GetAllWindows()) |
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.Runtime.InteropServices; | |
using System.Text; | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
ShowDiskDrives(); | |
} |
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.Diagnostics; | |
using System.Runtime.InteropServices; | |
internal static class InputDeviceHelper | |
{ | |
[DllImport("User32", SetLastError = true)] | |
private static extern uint GetRawInputDeviceList( | |
[Out] RAWINPUTDEVICELIST[]? pRawInputDeviceList, | |
ref uint puiNumDevices, | |
uint cbSize); |
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 class PropertyPatternTest | |
{ | |
public static void Test() | |
{ | |
var t = new TestClass(); | |
// Case 1: False | |
TestBase(() => t is { Data: { Length: > 0 } }); | |
// Case 2: False |
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 class BytesConverter | |
{ | |
/// <summary> | |
/// Converts 4 data bytes to unsigned integer. | |
/// </summary> | |
/// <param name="mh">High order bytes when using four data bytes</param> | |
/// <param name="ml">Low order bytes when using four data bytes</param> | |
/// <param name="sh">High order bytes when using two data bytes</param> | |
/// <param name="sl">Low order bytes when using two data bytes</param> | |
/// <returns>Unsigned integer</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
using System; | |
using System.Runtime.InteropServices; | |
using System.Windows; | |
using System.Windows.Interop; | |
public static class WindowHelper | |
{ | |
public static void SetWindowRect(Window window, int x, int y, int width, int height) | |
{ | |
IntPtr windowHandle = new WindowInteropHelper(window).EnsureHandle(); |
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.Diagnostics; | |
using System.IO; | |
using System.Text; | |
using System.Text.RegularExpressions; | |
using System.Threading.Tasks; | |
using System.Xml.Linq; | |
using Windows.Storage; | |
using Windows.Storage.Streams; | |
using Windows.UI.Xaml.Media.Imaging; |
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.IO; | |
using System.Windows.Media.Imaging; | |
using SkiaSharp; | |
public static class SKHelper | |
{ | |
public static BitmapImage Convert(string filePath) | |
{ | |
using SKImage image = SKImage.FromEncodedData(filePath); | |
using SKData encoded = image.Encode(); // PNG format |
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; | |
using System.Collections.Specialized; | |
using System.ComponentModel; | |
using System.Windows.Controls; | |
using System.Windows.Controls.Primitives; | |
using Microsoft.Xaml.Behaviors; | |
public class ItemsControlBehavior : Behavior<ItemsControl> | |
{ |
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.Threading.Tasks; | |
using System.Windows.Interop; | |
using Windows.Storage.Pickers; | |
public static async Task<string?> OpenFileDialog(System.Windows.Window window) | |
{ | |
var picker = new FileOpenPicker() | |
{ | |
ViewMode = PickerViewMode.Thumbnail |
NewerOlder