Skip to content

Instantly share code, notes, and snippets.

class Node : IComparable<Node>
{
public int H
{
get
{
return Math.Abs(X - TargetNode.Position.X) +
Math.Abs(Y - TargetNode.Position.Y);
}
}
class AStar
{
private static bool InBounds(int x, int y, bool[,] map)
{
if (x >= 0 && y >= 0 && y < map.GetLength(0) && x < map.GetLength(1))
return true;
return false;
}
@Jalalx
Jalalx / MessageBoxManager.cs
Last active December 25, 2015 10:49
Localize System MessageBox in C#
#pragma warning disable 0618
using System;
using System.Text;
using System.Runtime.InteropServices;
using System.Security.Permissions;
[assembly: SecurityPermission(SecurityAction.RequestMinimum, UnmanagedCode = true)]
namespace System.Windows.Forms
{
public class MessageBoxManager
@Jalalx
Jalalx / PersianDateExtensionMethods.cs
Last active October 11, 2016 13:02
Some persian extension methods
// source code orginaly from http://www.dotnettips.info/post/1244/
/*
Use as extension method:
var date1 = DateTime.Now.ToPesianDateString("yyyy/MM/dd");
var date2 = DateTime.Now.ToPeianDateString("dddd, dd MMMM,yyyy");
//Output:
//1391/12/13
//یکشنبه, 13 اسفند,1391
using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Web.Http.Dependencies;
using Ninject;
using Ninject.Syntax;
public class NinjectDependencyScope : IDependencyScope
{
private IResolutionRoot resolver;