This file contains hidden or 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.Drawing; | |
namespace PetaPoco | |
{ | |
/// <summary> | |
/// Specifies a persistent property value converter. | |
/// </summary> | |
[AttributeUsage(AttributeTargets.Property)] |
This file contains hidden or 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.Text.RegularExpressions; | |
namespace Arci.Windows.Forms | |
{ | |
public class MultiLinkLabel : System.Windows.Forms.LinkLabel | |
{ | |
protected override void OnTextChanged(EventArgs e) | |
{ | |
CreateLinks(); |
This file contains hidden or 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 static UInt64 ReverseUInt64(UInt64 x, int bits = 1) | |
{ | |
UInt64 b = 0; | |
UInt64 mask = 0; | |
for (int i = 0; i < bits; i++) | |
{ | |
mask = (mask << 1) | 0x1; | |
} | |
for (int i = 0; i < 64 / bits; i++) | |
{ |
This file contains hidden or 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
select distinct | |
net_transport, | |
client_net_address, | |
hostname, | |
program_name, | |
db.name as database_name, | |
sp.loginame | |
from master.sys.dm_exec_connections ec | |
inner join master.dbo.sysprocesses sp | |
on sp.spid = ec.session_id |
This file contains hidden or 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; | |
namespace MyCollections | |
{ | |
/// <summary> | |
/// Represents a strongly typed list of disposable objects that can be accessed by index. | |
/// Provides methods to search, sort, and manipulate lists and disposes all contained objects. |
This file contains hidden or 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; | |
namespace Arci.WindowsCE | |
{ | |
/// <summary> | |
/// NTP service controller | |
/// </summary> | |
public static class TimeService | |
{ |
This file contains hidden or 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 class ColorValueConverter : ValueConverter | |
{ | |
public override Type StorageType { get { return typeof(Int32); } } | |
public override object ConvertToStorageType(object value) | |
{ | |
if (!(value is Color)) return null; | |
return ((Color)value).ToArgb() & 0x00FFFFFF; | |
} | |
public override object ConvertFromStorageType(object value) | |
{ |
This file contains hidden or 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 class TimeSpanValueConverter : ValueConverter | |
{ | |
public override Type StorageType { get { return typeof(Int32); } } | |
public override object ConvertToStorageType(object value) | |
{ | |
if (!(value is TimeSpan)) return null; | |
return Convert.ToInt32(Math.Truncate(((TimeSpan)value).TotalSeconds)); | |
} | |
public override object ConvertFromStorageType(object value) | |
{ |
This file contains hidden or 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.Drawing; | |
using System.Drawing.Imaging; | |
using System.Linq; | |
using System.Runtime.InteropServices; | |
using System.Text; | |
namespace ImageHelper | |
{ |
This file contains hidden or 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
/// <summary> | |
/// Read password from console | |
/// </summary> | |
/// <param name="prompt">Password prompt</param> | |
/// <param name="mask">Password mask char, usually '*'</param> | |
/// <returns>Password</returns> | |
public static string ReadPassword(string prompt, char mask) | |
{ | |
Stack<String> pwdStack = new Stack<String>(); | |
if (!String.IsNullOrEmpty(prompt)) |
NewerOlder