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 static void UseKeepAlive(this TcpClient client, ulong time = 2000, ulong interval = 500) | |
{ | |
if (client == null) | |
return; | |
// "consts" to help understand calculations | |
const int bytesperlong = 4; // 32 / 8 | |
const int bitsperbyte = 8; | |
try | |
{ |
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
// For WPF you need the following Assemblies | |
// PresentationCore | |
// PresentationFramework | |
// WindowsBase | |
// WindowsFormsIntegration | |
// For Forms | |
// System.Windows.Forms | |
// create this in the main thread for your Forms application | |
internal static Control MainThreadInvokerControl; |
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 static class Extentions | |
{ | |
public static bool In<T>(this T value, params T[] args) where T : IComparable | |
{ | |
foreach (T arg in args) | |
if (arg.Equals(value)) | |
return true; | |
return false; | |
} | |
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 static class Extentions | |
{ | |
public static bool IsAssigned(this object value) | |
{ | |
return value != null; | |
} | |
} |
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
// Command xCommand = new CommandHandler(() => DoX()); | |
class CommandHandler : ICommand | |
{ | |
private Action m_Action; | |
public CommandHandler(Action action) | |
{ |
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
// http://x.x.x.x:port/swagger/ui/index.html | |
public class Startup | |
{ | |
public Startup(IHostingEnvironment env) | |
{ | |
var builder = new ConfigurationBuilder() | |
.SetBasePath(env.ContentRootPath) | |
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) |
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
Windows C:\Users\[YourUsername]\.nuget\packages | |
macOS /Users/[YourUsername]/.nuget/packages |
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 static class TasksExtensions | |
{ | |
public static Task AsTask(this CancellationTokenSource cancellationTokenSource) | |
{ | |
return Task.Delay(-1, cancellationTokenSource.Token); | |
} | |
} |
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 static class TasksExtensions | |
{ | |
public static Task AsTask(this CancellationTokenSource cancellationTokenSource, int delay= -1) | |
{ | |
return Task.Delay(delay, cancellationTokenSource.Token); | |
} | |
} |
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
# cake.build | |
**/tools/** | |
!**/tools/packages.config | |
tools/** | |
!tools/packages.config |