https://github.com/71/insider
[No longer maintained] Easily weave .NET assemblies from the inside, using Mono.Cecil and Reflection.
https://github.com/71/insider
Last synced: 4 months ago
JSON representation
[No longer maintained] Easily weave .NET assemblies from the inside, using Mono.Cecil and Reflection.
- Host: GitHub
- URL: https://github.com/71/insider
- Owner: 71
- License: mit
- Created: 2016-10-29T16:57:10.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-08-03T15:14:34.000Z (almost 9 years ago)
- Last Synced: 2025-06-20T06:47:35.425Z (about 1 year ago)
- Language: C#
- Homepage:
- Size: 78.1 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Insider
Insider uses [MSBuild](https://github.com/Microsoft/msbuild) and [Mono.Cecil](https://github.com/jbevain/cecil) to weave assemblies (although the former is optional).
Unlike other programs that do the same thing, however, Insider changes things from the _inside_.
# Warning
Insider has been superseded by [Cometary](https://github.com/6A/Cometary), please check it out instead.
-------
# Old documentation
## One-minute guide
```csharp
using System;
using Insider;
using Mono.Cecil;
using Mono.Cecil.Cil;
///
/// Forces all calls to ldc.i4 to load 2
/// instead of 1.
///
class OneToTwoAttribute : MethodWeaverAttribute
{
public override void Apply(MethodDefinition method)
{
foreach (var instr in method.Body.Instructions)
{
if (instr.OpCode == OpCodes.Ldc_I4 && instr.Operand.Equals(1))
instr.Operand = 2;
}
}
}
class Program
{
[OneToTwo]
static void Main(string[] args)
{
int result = 1 + 1;
if (result == 2)
Console.Error.WriteLine("1+1 equals " + result + ", duh.");
}
}
```
## How to install
#### `Install-Package Insider`
Currently compatible and tested on .NET 4.6 and above.