Click here to Skip to main content
15,886,026 members
Articles / Programming Languages / MSIL

Assembly Manipulation and C# / VB.NET Code Injection

Rate me:
Please Sign up or sign in to vote.
4.95/5 (200 votes)
26 Apr 2013MIT5 min read 921.8K   25K   486  
Reflexil is an assembly editor and runs as a plug-in for Reflector or JustDecompile. Reflexil is able to manipulate IL code and save the modified assemblies to disk. Reflexil also supports "on-the-fly" C#/VB.NET code injection.
// this file was autogenerated by a tool.
using System;

namespace ICSharpCode.NRefactory.Parser.VB
{
	public static class Keywords
	{
		static readonly string[] keywordList = {
			"ADDHANDLER",
			"ADDRESSOF",
			"AGGREGATE",
			"ALIAS",
			"AND",
			"ANDALSO",
			"ANSI",
			"AS",
			"ASCENDING",
			"ASSEMBLY",
			"AUTO",
			"BINARY",
			"BOOLEAN",
			"BYREF",
			"BY",
			"BYTE",
			"BYVAL",
			"CALL",
			"CASE",
			"CATCH",
			"CBOOL",
			"CBYTE",
			"CCHAR",
			"CDATE",
			"CDBL",
			"CDEC",
			"CHAR",
			"CINT",
			"CLASS",
			"CLNG",
			"COBJ",
			"COMPARE",
			"CONST",
			"CONTINUE",
			"CSBYTE",
			"CSHORT",
			"CSNG",
			"CSTR",
			"CTYPE",
			"CUINT",
			"CULNG",
			"CUSHORT",
			"CUSTOM",
			"DATE",
			"DECIMAL",
			"DECLARE",
			"DEFAULT",
			"DELEGATE",
			"DESCENDING",
			"DIM",
			"DIRECTCAST",
			"DISTINCT",
			"DO",
			"DOUBLE",
			"EACH",
			"ELSE",
			"ELSEIF",
			"END",
			"ENDIF",
			"ENUM",
			"EQUALS",
			"ERASE",
			"ERROR",
			"EVENT",
			"EXIT",
			"EXPLICIT",
			"FALSE",
			"FINALLY",
			"FOR",
			"FRIEND",
			"FROM",
			"FUNCTION",
			"GET",
			"GETTYPE",
			"GLOBAL",
			"GOSUB",
			"GOTO",
			"GROUP",
			"HANDLES",
			"IF",
			"IMPLEMENTS",
			"IMPORTS",
			"IN",
			"INFER",
			"INHERITS",
			"INTEGER",
			"INTERFACE",
			"INTO",
			"IS",
			"ISNOT",
			"JOIN",
			"LET",
			"LIB",
			"LIKE",
			"LONG",
			"LOOP",
			"ME",
			"MOD",
			"MODULE",
			"MUSTINHERIT",
			"MUSTOVERRIDE",
			"MYBASE",
			"MYCLASS",
			"NAMESPACE",
			"NARROWING",
			"NEW",
			"NEXT",
			"NOT",
			"NOTHING",
			"NOTINHERITABLE",
			"NOTOVERRIDABLE",
			"OBJECT",
			"OF",
			"OFF",
			"ON",
			"OPERATOR",
			"OPTION",
			"OPTIONAL",
			"OR",
			"ORDER",
			"ORELSE",
			"OVERLOADS",
			"OVERRIDABLE",
			"OVERRIDES",
			"PARAMARRAY",
			"PARTIAL",
			"PRESERVE",
			"PRIVATE",
			"PROPERTY",
			"PROTECTED",
			"PUBLIC",
			"RAISEEVENT",
			"READONLY",
			"REDIM",
			"REM",
			"REMOVEHANDLER",
			"RESUME",
			"RETURN",
			"SBYTE",
			"SELECT",
			"SET",
			"SHADOWS",
			"SHARED",
			"SHORT",
			"SINGLE",
			"SKIP",
			"STATIC",
			"STEP",
			"STOP",
			"STRICT",
			"STRING",
			"STRUCTURE",
			"SUB",
			"SYNCLOCK",
			"TAKE",
			"TEXT",
			"THEN",
			"THROW",
			"TO",
			"TRUE",
			"TRY",
			"TRYCAST",
			"TYPEOF",
			"UINTEGER",
			"ULONG",
			"UNICODE",
			"UNTIL",
			"USHORT",
			"USING",
			"VARIANT",
			"WEND",
			"WHEN",
			"WHERE",
			"WHILE",
			"WIDENING",
			"WITH",
			"WITHEVENTS",
			"WRITEONLY",
			"XOR"
		};
		
		static LookupTable keywords = new LookupTable(false);
		
		static Keywords()
		{
			for (int i = 0; i < keywordList.Length; ++i) {
				keywords[keywordList[i]] = i + Tokens.AddHandler;
			}
		}
		
		public static int GetToken(string keyword)
		{
			return keywords[keyword];
		}
		
		public static bool IsNonIdentifierKeyword(string word)
		{
			int token = GetToken(word);
			if (token < 0)
				return false;
			return !Tokens.IdentifierTokens[token];
		}
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The MIT License


Written By
Software Developer (Senior) Microsoft
United States United States
Sebastien Lebreton is a Software Engineer at Microsoft.

He is particularly interested in optimization, reverse engineering and distributed objects technologies.

Comments and Discussions