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
RegistryKey baseRegistryHklm; | |
RegistryKey baseRegistryHkcu; | |
if (Environment.Is64BitOperatingSystem) //Use OS not process... | |
{ | |
baseRegistryHklm = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64); | |
baseRegistryHkcu = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Registry64); | |
} | |
else | |
{ | |
baseRegistryHklm = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32); |
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
#Script for extractingn YAML of .html files. | |
#The extracted content is put in a directory YAMLS <websiteroot>/ignored/YAMLS | |
if(-Not (Test-Path (Join-Path $PSScriptRoot -ChildPath "ignored"))){ | |
throw "It is assumed that a directory ignored exists" | |
} | |
function ContainsYAML([string] $htmlFile){ | |
$lines = Get-Content $htmlFile | |
$lineCount = $lines.Length - 1 | |
$indices = (0 .. $lineCount) |
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
function GitLog | |
{ | |
git log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all | |
} |
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
TokenValidationParameters = new System.IdentityModel.Tokens.TokenValidationParameters | |
{ | |
// instead of using the default validation (validating against a single issuer value, as we do in line of business apps (single tenant apps)), | |
// we turn off validation | |
// | |
// NOTE: | |
// * In a multitenant scenario you can never validate against a fixed issuer string, as every tenant will send a different one. | |
// * If you don’t care about validating tenants, as is the case for apps giving access to 1st party resources, you just turn off validation. | |
// * If you do care about validating tenants, think of the case in which your app sells access to premium content and you want to limit access only to the tenant that paid a fee, | |
// you still need to turn off the default validation but you do need to add logic that compares the incoming issuer to a list of tenants that paid you, |
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
function Invoke-BatchFile | |
{ | |
param([string]$Path, [string]$Parameters) | |
$tempFile = [IO.Path]::GetTempFileName() | |
## Store the output of cmd.exe. We also ask cmd.exe to output | |
## the environment table after the batch file completes | |
cmd.exe /c " `"$Path`" $Parameters && set > `"$tempFile`" " |
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
Param ( [Parameter(Mandatory=$True)] [ValidateNotNull()] $imageSource, | |
[Parameter(Mandatory=$True)] [ValidateNotNull()] $imageTarget, | |
[Parameter(Mandatory=$true)][ValidateNotNull()] $quality ) | |
if (!(Test-Path $imageSource)){throw( "Cannot find the source image")} | |
if(!([System.IO.Path]::IsPathRooted($imageSource))){throw("please enter a full path for your source path")} | |
if(!([System.IO.Path]::IsPathRooted($imageTarget))){throw("please enter a full path for your target path";)} | |
if ($quality -lt 0 -or $quality -gt 100){throw( "quality must be between 0 and 100.")} | |
[void][System.Reflection.Assembly]::LoadWithPartialName("System.Drawing") |
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 interface IPlayerSearchViewModel | |
{ | |
string SearchPlayerText { get; set; } | |
ICollectionView DisplayedPlayers { get; } | |
} |
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 PlayerSearchViewModel : IPlayerSearchViewModel | |
{ | |
private readonly ICollectionView _view; | |
private string _textsearch; | |
public PlayerSearchViewModel(IPlayerProvider playerProvider) | |
{ | |
_view = CollectionViewSource.GetDefaultView(playerProvider.GetAllWorldCupPlayer()); | |
_view.Filter += (object item) => | |
{ |
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 interface ICollectionView<T> : IEnumerable<T>, ICollectionView | |
{ | |
IEnumerable<T> SourceCollectionGeneric { get; } | |
//Add here your "generic methods" e.g. | |
//e.g. Predicate<T> Filter {get;set;} etc. | |
} |
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 MyCollectionViewGeneric<T> : ICollectionView<T> | |
{ | |
private readonly ICollectionView _collectionView; | |
public MyCollectionViewGeneric(ICollectionView generic) | |
{ | |
_collectionView = generic; | |
} | |
private class MyEnumerator : IEnumerator<T> |