Skip to content

Instantly share code, notes, and snippets.

View yemrekeskin's full-sized avatar
🎯
Focusing

yunus emre keskin yemrekeskin

🎯
Focusing
View GitHub Profile
@yemrekeskin
yemrekeskin / AppPoolController.Helper.cs
Created September 23, 2013 13:35
Helper.cs for AppPoolController Class
public class SystemCriticalException
: Exception
{
public SystemCriticalException() { }
public SystemCriticalException(string message)
: base(message) { }
public SystemCriticalException(string message, Exception inner)
: base(message, inner) { }
class Program
{
static void Main(string[] args)
{
// you can add with key-value logic your applications' configuration info
Registry.CurrentUser.SetValue("ADMIN_USER_PASSWORD", "12*23.CFGR|234");
Registry.LocalMachine.SetValue("MY_APP_PRODUCT_KEY", "SD34-5TGB-ER98-D95E");
Registry.ClassesRoot.SetValue("KEY", "VALUE");
Registry.Users.SetValue("USER_NAME", "DOMAIN\\KUBRA");
public static class RegistryConfigurator
{
private static RegistryKey baseRegistryKey = Registry.LocalMachine;
public static RegistryKey BaseRegistryKey
{
get { return baseRegistryKey; }
set { baseRegistryKey = value; }
}
private static string subKey = "SOFTWARE\\My-Application";
@yemrekeskin
yemrekeskin / Sample.UnhandledException.cs
Last active December 26, 2015 15:19
UnhandledException
// in console application
class Program
{
static void Main(string[] args)
{
AppDomain currentDomain = AppDomain.CurrentDomain;
currentDomain.UnhandledException += currentDomain_UnhandledException;
@yemrekeskin
yemrekeskin / Sample.Interpreter.DesignPattern.cs
Last active December 26, 2015 17:49
Implementation of the Interpreter design pattern in c#
public class Context
{
public string Value { get; set; }
public int DigitalValue { get; set; }
public Context(string Value)
{
this.Value = Value;
}
}
@yemrekeskin
yemrekeskin / Sample.Interpreter.DesignPattern.Client.cs
Created October 27, 2013 23:40
Implementation of the Interpreter design pattern in c# example of use
class Program
{
static void Main(string[] args)
{
string txt = "YUNUSEMREKESKIN";
Context context = new Context(txt);
HexParser parser = new HexParser(context);
parser.Parser();
@yemrekeskin
yemrekeskin / SampleEntityDesign.cs
Created November 8, 2013 14:10
Entity Designing
/// <summary>
/// Generates a sequential guid
/// Based on http://stackoverflow.com/questions/665417/sequential-guid-in-linq-to-sql
/// </summary>
/// <returns></returns>
public class GuidGenerator
{
public static Guid Generate()
{
var destinationArray = Guid.NewGuid().ToByteArray();
@yemrekeskin
yemrekeskin / CompileExecutable.cs
Created November 9, 2013 12:17
to compiler code files when you generated dynamically codes
class Program
{
static void Main(string[] args)
{
if (args.Length > 0)
{
// First parameter is the source file name.
if (File.Exists(args[0]))
{
CompileExecutable(args[0]);
@yemrekeskin
yemrekeskin / PagedList.cs
Created November 10, 2013 18:42
PagedList
class Program
{
static void Main(string[] args)
{
var productOperation = new ProductOperation();
var list1 = productOperation.GetPagedProductList(1, 5);
foreach (var item in list1)
Console.WriteLine(item.Id + " - " + item.Name);
@yemrekeskin
yemrekeskin / Sample.TemplateMethod.cs
Created January 6, 2014 13:03
Sample Template Method Design Pattern
class Program
{
static void Main(string[] args)
{
BaseProcessor reportProcessor = new ReportProcessor();
reportProcessor.ProcessorCompleted += reportProcessor_ProcessorCompleted;
reportProcessor.ProcessorStarting += reportProcessor_ProcessorStarting;
reportProcessor.ProcessorStarted += reportProcessor_ProcessorStarted;