initial commit
Pulsar .NET 9.0 Windows Release / build (push) Waiting to run
Mirror to Codeberg and Gitea / mirror (push) Waiting to run

This commit is contained in:
i2p
2026-08-27 10:57:58 -06:00
commit 773d05f8f1
1038 changed files with 109261 additions and 0 deletions
@@ -0,0 +1,35 @@
using Pulsar.Common.Helpers;
using Pulsar.Server.Helper;
using Pulsar.Server.Utilities;
using System;
using System.Windows.Forms;
namespace Pulsar.Server.Extensions
{
public static class ListViewExtensions
{
private const uint SET_COLUMN_WIDTH = 4126;
private static readonly IntPtr AUTOSIZE_USEHEADER = new IntPtr(-2);
/// <summary>
/// Automatically determines the correct column size on the the given listview.
/// </summary>
/// <param name="targetListView">The listview whose columns are to be autosized.</param>
public static void AutosizeColumns(this ListView targetListView)
{
for (int lngColumn = 0; lngColumn <= (targetListView.Columns.Count - 1); lngColumn++)
{
NativeMethods.SendMessage(targetListView.Handle, SET_COLUMN_WIDTH, new IntPtr(lngColumn), AUTOSIZE_USEHEADER);
}
}
/// <summary>
/// Selects all items on the given listview.
/// </summary>
/// <param name="targetListView">The listview whose items are to be selected.</param>
public static void SelectAllItems(this ListView targetListView)
{
NativeMethodsHelper.SetItemState(targetListView.Handle, -1, 2, 2);
}
}
}
@@ -0,0 +1,55 @@
using Microsoft.Win32;
using System;
namespace Pulsar.Server.Extensions
{
public static class RegistryKeyExtensions
{
public static string RegistryTypeToString(this RegistryValueKind valueKind, object valueData)
{
if (valueData == null)
return "(value not set)";
switch (valueKind)
{
case RegistryValueKind.Binary:
return ((byte[])valueData).Length > 0 ? BitConverter.ToString((byte[])valueData).Replace("-", " ").ToLower() : "(zero-length binary value)";
case RegistryValueKind.MultiString:
return string.Join(" ", (string[])valueData);
case RegistryValueKind.DWord: //Convert with hexadecimal before int
return String.Format("0x{0} ({1})", ((uint)((int)valueData)).ToString("x8"), ((uint)((int)valueData)).ToString());
case RegistryValueKind.QWord:
return String.Format("0x{0} ({1})", ((ulong)((long)valueData)).ToString("x8"), ((ulong)((long)valueData)).ToString());
case RegistryValueKind.String:
case RegistryValueKind.ExpandString:
return valueData.ToString();
case RegistryValueKind.Unknown:
default:
return string.Empty;
}
}
public static string RegistryTypeToString(this RegistryValueKind valueKind)
{
switch (valueKind)
{
case RegistryValueKind.Binary:
return "REG_BINARY";
case RegistryValueKind.MultiString:
return "REG_MULTI_SZ";
case RegistryValueKind.DWord:
return "REG_DWORD";
case RegistryValueKind.QWord:
return "REG_QWORD";
case RegistryValueKind.String:
return "REG_SZ";
case RegistryValueKind.ExpandString:
return "REG_EXPAND_SZ";
case RegistryValueKind.Unknown:
return "(Unknown)";
default:
return "REG_NONE";
}
}
}
}