Skip to content

Instantly share code, notes, and snippets.

@AlexArchive
AlexArchive / RunescapeClient
Created July 9, 2013 10:35
Old School Runescape Client Without HTML Menu
internal sealed class RunescapeClient : WebBrowser
{
private const string RUNESCAPE_CLIENT_URL = "http://oldschool33.runescape.com/j1";
internal RunescapeClient()
{
ScrollBarsEnabled = false;
ScriptErrorsSuppressed = true;
IsWebBrowserContextMenuEnabled = false;
AllowWebBrowserDrop = false;
public static class DebuggingExtensions
{
public static string ToStringAutomatic<T>(this T obj)
{
const string Seperator = ", ";
const BindingFlags BindingFlags = BindingFlags.Instance | BindingFlags.Public;
var objProperties =
from property in obj.GetType().GetProperties(BindingFlags)
where property.CanRead
@AlexArchive
AlexArchive / Program.il
Created July 17, 2013 14:52
Demo: Basic Branching in MSIL
.assembly extern mscorlib {}
.assembly Test
{
.ver 1:0:1:0
}
.module test.exe
.method static void main() cil managed
{
@AlexArchive
AlexArchive / Program.il
Created July 17, 2013 15:03
Demo: Basic For Loop in MSIL
.assembly extern mscorlib {}
.assembly Test
{
.ver 1:0:1:0
}
.module test.exe
.method static void main() cil managed
{
@AlexArchive
AlexArchive / Program.il
Created July 17, 2013 16:40
Demo: Using Methods in IL
.assembly extern mscorlib {}
.assembly Test
{
.ver 1:0:1:0
}
.module test.exe
.method static void main() cil managed
{
using Microsoft.CSharp;
using Microsoft.VisualBasic;
using System;
using System.CodeDom;
using System.CodeDom.Compiler;
using System.IO;
using System.Reflection;
using System.Text;
namespace Code
@AlexArchive
AlexArchive / Program.cs
Created July 19, 2013 00:38
Demo: Basic Usage of DynamicMethod to Omit Opcodes
public sealed class Program
{
static void Main(string[] args)
{
var result = Math.AddNumbers(10, 20);
Console.WriteLine(result);
Console.ReadKey();
}
}
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Linq.Expressions;
using System.Runtime.InteropServices;
namespace Code
{
@AlexArchive
AlexArchive / AutomaticIterator.cs
Created July 20, 2013 00:17
ForEach Extension Method
public static class AutomaticIterator
{
public static void ForEach<T>(this IEnumerable<T> iterable, Action<T> action)
{
var iterator = iterable.GetEnumerator();
using (iterator)
{
while (iterator.MoveNext())
{
action(iterator.Current);
@AlexArchive
AlexArchive / SettingsBase.cs
Last active December 20, 2015 03:59
Settings Base Class
public abstract class SettingsBase<T> where T : SettingsBase<T>, new()
{
protected virtual string SavePath
{
get
{
return BuildDefaultSavePath();
}
}