Skip to content

Instantly share code, notes, and snippets.

View UweKeim's full-sized avatar
😊
www.uwe.co

Uwe Keim UweKeim

😊
www.uwe.co
View GitHub Profile
namespace ZetaProducer.RuntimeGui.ExtendedWebBrowser
{
using JetBrains.Annotations;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using Zeta.VoyagerLibrary.Common.IO;
@UweKeim
UweKeim / BlazorTimer.cs
Last active January 28, 2024 21:30
Timer in Blazor 3.1
namespace ZetaHelpdesk.MainBlazor.Code.Components
{
using System;
using System.Timers;
// https://wellsb.com/csharp/aspnet/blazor-timer-navigate-programmatically/
public sealed class BlazorTimer
{
private Timer _timer;
@UweKeim
UweKeim / FileSize.cs
Created October 27, 2020 07:45
Automatically formatting an integer for human-readable file size
namespace Extensions
{
using System;
using System.Globalization;
using System.Threading;
public static class FileSizeExtensions
{
public static string FormatFileSize(
this long fileSize,
@UweKeim
UweKeim / NetworkConnection.cs
Created March 22, 2024 12:20
NET USE in .NET C#
namespace Tools;
using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices;
/// <summary>
/// Wrapper for the "NET USE" functionality.
/// Connect to a network resource, e.g. a network share under a different user.
/// </summary>
@UweKeim
UweKeim / Impersonator.cs
Last active March 22, 2024 12:21
Impersonation in .NET
namespace Tools;
using Microsoft.Win32.SafeHandles;
using System.ComponentModel;
using System.Runtime.InteropServices;
using System.Security.Principal;
/// <summary>
/// Impersonation of a user. Allows to execute code under another
/// user context.