Month: November 2016
OneOf -Discriminated unions for C#
Not the first one but simple and using a struct for OneOf impmementation: mcintyre321/OneOf: Easy to use F#-like discriminated unions for C#.
ZeroFormatter: Fastest C# Serializer and Infinitely Fast Deserializer for .NET, .NET Core and Unity
A C# serializer a la Cap’n Proto. Data is not really serialized and deserialized but a data wrapper is generated to dig into byte[] when possible. Deserialization is really quick but an time penalty occures on each access. Really efficient when only a small part of deserialized data are needed. You pay only for what you use.
No DSL (like .proto) is used but serialized type must permit subclassing properties acces. Each property must be virtual and a derived class is dynamically generated under the hood. A pre compiler exists for Unity.
ExtraConstraints help to add generic constraint supported by .Net and not by C#
ExtraConstraints use Fody’s way to add generic contraint:
Your Code
public class Sample { public void MethodWithDelegateConstraint<[DelegateConstraint] T> () {...} public void MethodWithTypeDelegateConstraint<[DelegateConstraint(typeof(Func<int>))] T> () {...} public void MethodWithEnumConstraint<[EnumConstraint] T>() {...} public void MethodWithTypeEnumConstraint<[EnumConstraint(typeof(ConsoleColor))] T>() {...} }
What gets compiled
public class Sample { public void MethodWithDelegateConstraint<T>() where T: Delegate {...} public void MethodWithTypeDelegateConstraint<T>() where T: Func<int> {...} public void MethodWithEnumConstraint<T>() where T: struct, Enum {...} public void MethodWithTypeEnumConstraint<T>() where T: struct, ConsoleColor {...} }
Source: Fody/ExtraConstraints: Facilitates adding constraints for Enum and Delegate to types and methods.
LongPath: a drop-in library to support long paths in .NET
Another library (AlphaFS: a descent System.IO for .Net) for supporting long path in .Net. This one use same API than System.IO to ease integration : peteraritchie/LongPath: drop-in library to support long paths in .NET.
“How to bind to data when the DataContext is not inherited”
Not the first time I forget about this usefull tricks when trying to Bind from an element no part of visual tree like Popup, Contextual menu or DataGrid column: [WPF] How to bind to data when the DataContext is not inherited » Thomas Levesque’s .NET blog.
ClearScript based runtime with Node-style require for .NET
ShipScript – ClearScript based runtime with Node-style require for .NET
Source: EdonGashi/ShipScript: ClearScript based runtime with Node-style require for .NET
WpfMaterialForms – Schema generated material dialogs in WPF
Bored of creating dialog layout for simple data entry? WpfMaterialForms can generate them from a simple DOM called Schema:
- CaptionSchema for setting caption,
- MultiSchema for multiple schema,
- StringSchema for string value in an editbox ,
- BooleanSchema for … boolean value through a switch,
- IntegerSchema for int value,
- DateSchema, TimeSchema for what is obvious,
- NumberRangeSchema for int value through a slider,
- CommandSchema for command handling (button click for example),
- ProgressSchema for handling progression (including multistep),
- SelectionSchema for selecting into a combobox,
- SelectionSchema for selecting a file through an OpenFileDialog.
Each Schema contains key (internal id), name, description, icon reference/visibility and validation/error mechanism and is in charge of creating its view (Schema acts as DataContext for this UserControl).
Default view exhibits a clear designe based on WPF/MahApps and MaterialDesignThemes.
Source: EdonGashi/WpfMaterialForms: Schema generated material dialogs in WPF
Stealth Cell Tower, how to spy on workers with a harmless printer
An open source BTS hidden into a printer: YateBTS, a bladeRF and a Raspberry Pi 3 ans some more easy to find stuff: Stealth Cell Tower, how to spy on workers with a harmless printer