Skip to content

Instantly share code, notes, and snippets.

View harryremon's full-sized avatar

Remon Kamel harryremon

  • Codec
  • Dublin, Ireland
View GitHub Profile
@harryremon
harryremon / InstallAPK.bat
Created October 23, 2021 16:26
Windows 11 WSA APK Open With
@echo off
echo.
echo -----------------------------------------
echo *** APK Installer for Windows 11 ***
echo -----------------------------------------
echo.
echo APK File Path is %1
echo.
adb connect 127.0.0.1:<PORT>
echo.
@harryremon
harryremon / ReverseAttributes.cs
Last active January 23, 2018 22:28
Support reversing "MapTo" Attributes in Automapper (Adding them to the destination as well as source).
public static class Extensions
{
public static IMappingExpression<TSource, TDestination> ReverseAttributes<TSource, TDestination>(this IMappingExpression<TSource, TDestination> config)
{
foreach (var property in typeof(TDestination).GetProperties().Where(prop => prop.IsDefined(typeof(MapToAttribute), false)))
{
var matchingName = ((MapToAttribute)property.GetCustomAttributes(typeof(MapToAttribute), false)
.FirstOrDefault())?.MatchingName;
config.ForMember(property.Name, val => val.MapFrom(matchingName));
}