This file contains 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> | |
/// The deserialize to generic list. | |
/// </summary> | |
/// <param name="jsonString"> | |
/// The json string. | |
/// </param> | |
/// <typeparam name="TReturnType">Type of a list of type TItemType | |
/// </typeparam> | |
/// <typeparam name="TItemType">Type of generic argument to list | |
/// </typeparam> |
This file contains 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; | |
using System.Threading.Tasks; | |
namespace ConsoleForAnything | |
{ | |
public class Program | |
{ |
This file contains 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 StringBooleanConverter : JsonConverter | |
{ | |
public override bool CanConvert(Type objectType) | |
{ | |
return objectType == typeof(string) || objectType == typeof(bool); | |
} | |
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) | |
{ | |
byte proposedValue; |
This file contains 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; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
using System.Xml; | |
using System.Xml.Linq; | |
using System.Reflection; | |
using System.Text; | |
using System.Threading.Tasks; |
This file contains 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 DomainController | |
{ | |
public void CreateDomain() | |
{ | |
string pathToDlls = Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath); | |
Trace.WriteLine(AppDomain.CurrentDomain.FriendlyName); | |
AppDomainSetup domainSetup = new AppDomainSetup { }; | |
domainSetup.ApplicationBase = pathToDlls; | |
this.testDomain = AppDomain.CreateDomain(Guid.NewGuid().ToString(), null, domainSetup, this.GetPermissionSet()); |
This file contains 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
this.testDomain.Load(Assembly.GetExecutingAssembly().GetName()); | |
var instance = (CompilerService)this.testDomain.CreateInstanceAndUnwrap( | |
typeof(CompilerService).Assembly.FullName, | |
typeof(CompilerService).FullName); | |
return instance.CompileAndRunTestsInOtherDomain(args); |
This file contains 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 LogInjectionModule : Module { | |
protected override void AttachToComponentRegistration(IComponentRegistry registry, | |
IComponentRegistration registration) { | |
registration.Preparing += OnComponentPreparing; | |
var implementationType = registration.Activator.LimitType; | |
var injectors = BuildInjectors(implementationType).ToArray(); | |
if (!injectors.Any()) { | |
return; |
This file contains 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 DynamicParserJson | |
{ | |
public static object ConvertJTokenToObject(JToken token) | |
{ | |
if (token is JValue) | |
{ | |
return ((JValue)token).Value; | |
} | |
if (token is JObject) | |
{ |
This file contains 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 Program | |
{ | |
static void Main(string[] args) | |
{ | |
Bootstrapper.Configure(); | |
var container = Bootstrapper.Container; | |
var obj = container.Resolve<Program>(); | |
var newString = obj.UseMe(null); |
This file contains 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 DeviceMonitorSignaling | |
{ | |
readonly object _lockObj = new object(); | |
EventWaitHandle searchingHandle; | |
EventWaitHandle monitoringHandle; | |
bool _running; | |
bool _monitoring; | |
volatile Device device; |