Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View jbevain's full-sized avatar

Jb Evain jbevain

View GitHub Profile
using System;
using Mono.Cecil;
class AssemblyRenamer
{
private static void Main(string[] args)
{
var file = args[0];
var newName = args[1];
@jbevain
jbevain / README.md
Last active November 16, 2023 12:11
pdb2mdb for Visual Studio 2015

The Visual Studio Tools for Unity are able to convert .NET debug symbol files (namely pdb files) to debug symbols files that are understood by Unity's scripting engine (namely .dll.mdb files) when importing both the .dll and the .pdb in the Assets folder.

If you prefer to handle the conversion yourself you need to call a tool named pdb2mdb on the .dll associated with the .pdb:

pdb2mdb MyLibrary.dll

Will produce a MyLibrary.dll.mdb usable on Unity if MyLibrary.pdb is present.

@jbevain
jbevain / TinySwitch.cs
Last active August 29, 2015 14:20
Switch opcode size analyser for CoreCLR #918
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Mono.Cecil;
using Mono.Cecil.Cil;
namespace TinySwitch
{
class Program
using System;
class Program
{
static void Main()
{
Console.WriteLine("Hello, CoreCLR!");
}
}
@jbevain
jbevain / test.rs
Last active August 29, 2015 14:13
#![feature(lang_items)]
#![allow(unstable)]
#![allow(non_camel_case_types)]
extern crate libc;
extern crate unicode;
mod w32 {
use libc::types::os::arch::extra::{HANDLE, LPCWSTR};
@jbevain
jbevain / gist:6e1744b5de9038daa403
Created December 10, 2014 14:24
Copies of Mono.Cecil.dll in Unity
C:\Program Files (x86)\Unity> find -name 'Mono.Cecil.dll'
./Editor/Data/Managed/Mono.Cecil.dll
./Editor/Data/Mono/lib/mono/2.0/Mono.Cecil.dll
./Editor/Data/Mono/lib/mono/unity/Mono.Cecil.dll
./Editor/Data/Mono/lib/mono/unity_web/Mono.Cecil.dll
./Editor/Data/MonoBleedingEdge/lib/mono/2.0/Mono.Cecil.dll
./Editor/Data/MonoBleedingEdge/lib/mono/3.5/Mono.Cecil.dll
./Editor/Data/MonoBleedingEdge/lib/mono/4.0/Mono.Cecil.dll
./Editor/Data/MonoBleedingEdge/lib/mono/gac/Mono.Cecil/0.9.4.0__0738eb9f132ed756/Mono.Cecil.dll
./Editor/Data/PlaybackEngines/flashsupport/BuildTools/cil2as/Mono.Cecil.dll
@jbevain
jbevain / NamespaceProjectHook.cs
Created November 26, 2014 13:16
Project Generation Hook to insert namespace in the project files
using System;
using UnityEngine;
using UnityEditor;
using SyntaxTree.VisualStudio.Unity.Bridge;
[InitializeOnLoad]
public class NamespaceProjectHook
{
@jbevain
jbevain / ReferenceRemovalProjectHook.cs
Created November 26, 2014 13:15
Project Generation Hook to remove references to Boo.Lang and UnityScript assemblies
using System;
using UnityEngine;
using UnityEditor;
using SyntaxTree.VisualStudio.Unity.Bridge;
[InitializeOnLoad]
public class ReferenceRemovalProjectHook
{
using System;
using System.Reflection;
using System.Reflection.Emit;
static class TypedRef
{
public static TClass RoundTrip<TClass>(TClass instance) where TClass : class
{
var method = new DynamicMethod("", typeof(TClass), new [] {typeof(TClass)}, true);
var il = method.GetILGenerator();
@jbevain
jbevain / gist:933a81871c55e716f208
Last active July 16, 2023 06:42
Allocating strings from unmanaged memory
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Reflection;
using System.Reflection.Emit;
using System.Text;
namespace StringPool
{