Skip to content

Instantly share code, notes, and snippets.

View kRapaille's full-sized avatar

Kévin Rapaille kRapaille

View GitHub Profile
private void FileWatcherServiceOnFileCreated(object sender, FileCreatedEventArgs fileCreatedEventArgs)
{
var fullName = fileCreatedEventArgs.FullName;
var fileName = fileCreatedEventArgs.FileName;
var extension = fileCreatedEventArgs.Extension;
try
{
_imageManipulationService.ScaleAndSaveImage(fullName, fileName, extension, _targetResizedDirectory);
}
@kRapaille
kRapaille / FuckThatShit.cs
Created June 30, 2014 15:03
Fail when doing it 2 times on a same image.
// Based on : http://www.codeproject.com/Articles/2941/Resizing-a-Photographic-image-with-GDI-for-NET
private static void ScaleAndSaveImage(ImageResizeConfiguration config)
{
using (var fileStream = new FileStream(config.FilePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
using (var image = Image.FromStream(fileStream))
{
var sourceWidth = image.Width;
var sourceHeight = image.Height;
var destX = 0;
@kRapaille
kRapaille / Dynamicpropertyname.cs
Created May 16, 2014 12:25
Dynamic property name
using System;
using System.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace ConsoleApplication3
{
class Program
{
static void Main(string[] args)
@kRapaille
kRapaille / unrankedWins.cs
Created May 6, 2014 07:40
How to pull a person’s normal game wins using PortableLeagueAPI
var summoner = await leagueAPI.Summoner.GetSummonerByNameAsync("TuC Kiwii");
var summonerStats = await leagueAPI.Stats.GetPlayerStatsSummariesBySummonerIdAsync(summoner.SummonerId);
var summonerStats2 = await summoner.GetPlayerStatsSummariesAsync();
var normalStats = summonerStats2.FirstOrDefault(x => x.PlayerStatSummaryType == PlayerStatSummaryTypeEnum.Unranked);
if (normalStats != null)
{
using System.Threading;
Console.Beep(659, 125);
Console.Beep(659, 125);
Thread.Sleep(125);
Console.Beep(659, 125);
Thread.Sleep(167);
Console.Beep(523, 125);
Console.Beep(659, 125);
Thread.Sleep(125);
using System.Threading;
Console.Beep(658, 125);
Console.Beep(1320, 500);
Console.Beep(990, 250);
Console.Beep(1056, 250);
Console.Beep(1188, 250);
Console.Beep(1320, 125);
Console.Beep(1188, 125);
Console.Beep(1056, 250);