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 GlobalKeyboardHookEventArgs : HandledEventArgs | |
{ | |
public GlobalKeyboardHook.KeyboardState KeyboardState { get; private set; } | |
public GlobalKeyboardHook.LowLevelKeyboardInputEvent KeyboardData { get; private set; } | |
public GlobalKeyboardHookEventArgs( | |
GlobalKeyboardHook.LowLevelKeyboardInputEvent keyboardData, | |
GlobalKeyboardHook.KeyboardState keyboardState) | |
{ | |
KeyboardData = keyboardData; |
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 = new TimeSpan(2, 45, 0); | |
var end = new TimeSpan(4, 0, 0); | |
var now = DateTime.Now.TimeOfDay; | |
if ((now > start) && (now < end)) | |
{ | |
return; | |
} |
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
if (!Directory.Exists(Variables.LogDirectory)) Directory.CreateDirectory(Variables.LogDirectory); | |
var logFile = $"[{DateTime.Now:yyyy-MM-dd}] Log.txt"; | |
if (error) logFile = $"[{DateTime.Now:yyyy-MM-dd}] ErrorLog.txt"; | |
logFile = Path.Combine(Variables.LogDirectory, logFile); | |
using (var stream = new FileStream(logFile, FileMode.Append, FileAccess.Write)) | |
using (var writer = new StreamWriter(stream)) | |
{ |
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
string newUrl; | |
var i = 0; | |
while ((newUrl = Uri.UnescapeDataString(url)) != url) | |
{ | |
url = newUrl; | |
i++; | |
if (i > 1000) break; | |
} |
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 (var pInstance = PowerShell.Create()) | |
{ | |
pInstance.AddCommand("Start-Process"); | |
pInstance.AddParameter("-WindowStyle", "hidden"); | |
pInstance.AddParameter("-FilePath", "\"explorer.exe\""); | |
pInstance.AddParameter("-ArgumentList", $"\"{drive}\""); | |
pInstance.Invoke(); | |
} |
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.Device.Location; | |
internal static double GetDistance(double lat, double lon) | |
{ | |
var sCoord = new GeoCoordinate(Variables.HomeLat, Variables.HomeLon); | |
var eCoord = new GeoCoordinate(lat, lon); | |
return sCoord.GetDistanceTo(eCoord); | |
} |
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
LvServers | |
.GetType() | |
.GetProperty("DoubleBuffered", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic) | |
?.SetValue(LvServers, true, null); |
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
internal static DateTime GetFirstMonday(int month, int year) | |
{ | |
var dt = new DateTime(year, month, 1, 12, 00, 00); | |
for (var i = 0; i < 7; i++) | |
{ | |
if (dt.DayOfWeek == DayOfWeek.Monday) | |
{ | |
return dt; | |
} |
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.Concurrent; | |
using System.ComponentModel; | |
using System.IO; | |
using System.Runtime.CompilerServices; | |
using System.Text.RegularExpressions; | |
using System.Threading; | |
using Coderr.Client; | |
namespace HDSupportIdentifier.Functions |
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
// Microsoft Excel object in references-> COM tab | |
using Excel = Microsoft.Office.Interop.Excel; | |
var xlApp = new Excel.Application(); | |
var xlWorkbook = xlApp.Workbooks.Open(Program.XmlFile); | |
Excel._Worksheet xlWorksheet = xlWorkbook.Sheets[1]; | |
var xlRange = xlWorksheet.UsedRange; | |
var rowCount = xlRange.Rows.Count; | |
var colCount = xlRange.Columns.Count; |
OlderNewer