View Entropy.cs
public static class Entropy
{
private static readonly int[] _map = new int[256];
private static bool _mapStatus;
static Entropy()
{
_map.Fill(0);
_mapStatus = false;
}
public static double GetEntropy(this char[] value)
View LinqHelper.cs
public static class LinqHelper
{
/// <summary>
/// Generates a sequence of character values within a specified range starting at
/// 'form' through 'to' with a given step value.
/// </summary>
public static IEnumerable<char> Range(char from, char to, char step = '\x0001')
{
var d = '\x0';
while (d < to)
View ProgressBarEx.cs
public class ProgressBarEx : PictureBox
{
public enum AniMode
{
Bounce,
LeftToRight
}
/// <summary>
/// Specifies how the bar is drawn either simple = standard or complex = including a graph at percent
/// </summary>
View StreamEx.cs
public static Dictionary<int, TimeSpan> BufferSizeTest()
{
const int NumberOfTasks = 10;
const int IterationsPerTask = 100;
const int SourceFileLength = 2 * 1024 * 1024;
var BufferSizes = new[] {4096, 80 * 1024, 1 * 1024 * 1024, 10 * 1024 * 1024};
const string sourcePath = @"s:\test\source.bin";
var sw = new Stopwatch();
var tasks = new Task[NumberOfTasks];
var testResults = new Dictionary<int, TimeSpan>();
View RenameFileList.cs
public static class RenameFileList
{
/// <summary>
/// Creates a new list of files with duplicates renamed.
/// </summary>
public static IEnumerable<SourceTarget> ProcessDuplicateNames(this IEnumerable<string> lst, string targetDirectory)
{
var NewFileList = new CHashSet<SourceTarget>();
var tfl = new CHashSet<string>();
foreach (var s in lst)
View ProcessTimeCalculator.cs
public class ProcessTimeCalculator
{
private readonly int _limit = 100;
public double CalculatingThreshold = 5;
public string ElapsedTime = "Calculating...";
public double ElapsedTimeInSeconds;
public bool IncludeMilliSeconds = false;
public bool IncludeSeconds = true;
public string RemainingTime = "Calculating...";
public double RemainingTimeInSeconds;
View ProcessTimer.cs
public class ProcessTimer
{
public enum TimerTypes
{
FormsTimer,
MediaTimer
}
private readonly Stopwatch _intervalTimer;
private readonly MMTimer _mmtimer;
private readonly Timer _fmtimer;
View CalculateItemsPerSecond.cs
public class CalculateItemsPerSecond
{
private readonly int _limit;
private bool _running;
private readonly Stopwatch _timer;
private LimitedList<double> rvlst;
public CalculateItemsPerSecond(int limit = 10)
{
_timer = new Stopwatch();
_limit = limit;
View SecureStringHelper.cs
public class SecureStringHelper : IDisposable
{
private readonly Encoding _encoding;
private readonly SecureString _secureString;
private byte[] _bytes;
private bool _disposed;
public SecureStringHelper(SecureString secureString)
: this(secureString, Encoding.Default)
{
}
View ByteToNumberConversion.cs
public static class ByteToNumberConversion
{
/// <summary>
/// Converts a specified byte position within the value array into a boolean value.
/// </summary>
[SecuritySafeCritical]
public static bool ToBoolean(this byte[] value, int startIndex = 0)
{
return value[startIndex] != 0;
}