Skip to content

Commit 98e69b4

Browse files
author
denikson
committed
Fixed typo
1 parent be41c02 commit 98e69b4

21 files changed

+2381
-2381
lines changed

LICENSE

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
The MIT License (MIT)
2-
3-
Copyright (c) 2015 Geoffrey "denikson" Horsington
4-
5-
Permission is hereby granted, free of charge, to any person obtaining a copy
6-
of this software and associated documentation files (the "Software"), to deal
7-
in the Software without restriction, including without limitation the rights
8-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9-
copies of the Software, and to permit persons to whom the Software is
10-
furnished to do so, subject to the following conditions:
11-
12-
The above copyright notice and this permission notice shall be included in all
13-
copies or substantial portions of the Software.
14-
15-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2015 Geoffrey "denikson" Horsington
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121
SOFTWARE.

Migration/migrationguide.tex

Lines changed: 411 additions & 411 deletions
Large diffs are not rendered by default.
Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
1-
using System;
2-
using System.IO;
3-
4-
namespace Mono.Cecil.Inject
5-
{
6-
/// <summary>
7-
/// Class for assembly loading methods.
8-
/// </summary>
9-
public static class AssemblyLoader
10-
{
11-
/// <summary>
12-
/// Loads an assembly from the specified path.
13-
/// </summary>
14-
/// <param name="path">Path to the assembly. Can be either relative (to the executing assembly directory) or absolute.</param>
15-
/// <returns>An instance of <see cref="AssemblyDefinition" /> of the loaded assembly.</returns>
16-
public static AssemblyDefinition LoadAssembly(string path)
17-
{
18-
AssemblyDefinition result;
19-
20-
if (!File.Exists(path))
21-
throw new FileNotFoundException($"Missing DLL: {path}");
22-
using (Stream s = File.OpenRead(path))
23-
{
24-
result = AssemblyDefinition.ReadAssembly(s);
25-
}
26-
if (result == null)
27-
throw new NullReferenceException($"Failed to read assembly {path}");
28-
return result;
29-
}
30-
}
1+
using System;
2+
using System.IO;
3+
4+
namespace Mono.Cecil.Inject
5+
{
6+
/// <summary>
7+
/// Class for assembly loading methods.
8+
/// </summary>
9+
public static class AssemblyLoader
10+
{
11+
/// <summary>
12+
/// Loads an assembly from the specified path.
13+
/// </summary>
14+
/// <param name="path">Path to the assembly. Can be either relative (to the executing assembly directory) or absolute.</param>
15+
/// <returns>An instance of <see cref="AssemblyDefinition" /> of the loaded assembly.</returns>
16+
public static AssemblyDefinition LoadAssembly(string path)
17+
{
18+
AssemblyDefinition result;
19+
20+
if (!File.Exists(path))
21+
throw new FileNotFoundException($"Missing DLL: {path}");
22+
using (Stream s = File.OpenRead(path))
23+
{
24+
result = AssemblyDefinition.ReadAssembly(s);
25+
}
26+
if (result == null)
27+
throw new NullReferenceException($"Failed to read assembly {path}");
28+
return result;
29+
}
30+
}
3131
}
Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,52 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
5-
namespace Mono.Cecil.Inject
6-
{
7-
/// <summary>
8-
/// Miscellaneous methods for processing enumerable collections.
9-
/// </summary>
10-
public static class CollectionUtils
11-
{
12-
/// <summary>
13-
/// Runs the specified function for each element.
14-
/// </summary>
15-
/// <typeparam name="T">Type of the elements in the enumerable.</typeparam>
16-
/// <param name="self">Reference to the sequence that contains the elements.</param>
17-
/// <param name="action">Action to apply to each element.</param>
18-
public static void ForEach<T>(this IEnumerable<T> self, Action<T> action)
19-
{
20-
foreach (T var in self)
21-
{
22-
action(var);
23-
}
24-
}
25-
26-
/// <summary>
27-
/// Gets a range of elements.
28-
/// </summary>
29-
/// <param name="self">Refrence to the sequence which to get the values from.</param>
30-
/// <param name="start">The index of the first element to pick.</param>
31-
/// <param name="end">The end of the last element to pick.</param>
32-
/// <typeparam name="T">Type of the sequence.</typeparam>
33-
/// <returns>A new instance of <see cref="IEnumerable{T}" /> that containes the selected elements.</returns>
34-
public static IEnumerable<T> Range<T>(this IEnumerable<T> self, int start, int end)
35-
{
36-
return self.Where((e, i) => start <= i && i <= end);
37-
}
38-
39-
/// <summary>
40-
/// Gets a range of elements starting from a specified element.
41-
/// </summary>
42-
/// <typeparam name="T">Type of the sequence.</typeparam>
43-
/// <param name="self">Refrence to the sequence which to get the values from.</param>
44-
/// <param name="start">The index of the first element to pick.</param>
45-
/// <param name="count">The total number of elements to select.</param>
46-
/// <returns>A new instance of <see cref="IEnumerable{T}" /> that containes the selected elements.</returns>
47-
public static IEnumerable<T> Slice<T>(this IEnumerable<T> self, int start, int count)
48-
{
49-
return self.Where((e, i) => start <= i && i < start + count);
50-
}
51-
}
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
5+
namespace Mono.Cecil.Inject
6+
{
7+
/// <summary>
8+
/// Miscellaneous methods for processing enumerable collections.
9+
/// </summary>
10+
public static class CollectionUtils
11+
{
12+
/// <summary>
13+
/// Runs the specified function for each element.
14+
/// </summary>
15+
/// <typeparam name="T">Type of the elements in the enumerable.</typeparam>
16+
/// <param name="self">Reference to the sequence that contains the elements.</param>
17+
/// <param name="action">Action to apply to each element.</param>
18+
public static void ForEach<T>(this IEnumerable<T> self, Action<T> action)
19+
{
20+
foreach (T var in self)
21+
{
22+
action(var);
23+
}
24+
}
25+
26+
/// <summary>
27+
/// Gets a range of elements.
28+
/// </summary>
29+
/// <param name="self">Refrence to the sequence which to get the values from.</param>
30+
/// <param name="start">The index of the first element to pick.</param>
31+
/// <param name="end">The end of the last element to pick.</param>
32+
/// <typeparam name="T">Type of the sequence.</typeparam>
33+
/// <returns>A new instance of <see cref="IEnumerable{T}" /> that containes the selected elements.</returns>
34+
public static IEnumerable<T> Range<T>(this IEnumerable<T> self, int start, int end)
35+
{
36+
return self.Where((e, i) => start <= i && i <= end);
37+
}
38+
39+
/// <summary>
40+
/// Gets a range of elements starting from a specified element.
41+
/// </summary>
42+
/// <typeparam name="T">Type of the sequence.</typeparam>
43+
/// <param name="self">Refrence to the sequence which to get the values from.</param>
44+
/// <param name="start">The index of the first element to pick.</param>
45+
/// <param name="count">The total number of elements to select.</param>
46+
/// <returns>A new instance of <see cref="IEnumerable{T}" /> that containes the selected elements.</returns>
47+
public static IEnumerable<T> Slice<T>(this IEnumerable<T> self, int start, int count)
48+
{
49+
return self.Where((e, i) => start <= i && i < start + count);
50+
}
51+
}
5252
}

Mono.Cecil.Inject/Exceptions.cs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
using System;
2-
3-
namespace Mono.Cecil.Inject
4-
{
5-
/// <summary>
6-
/// An exception thrown when there is an issue when attempting to link the target method with the injection method.
7-
/// </summary>
8-
public class InjectionDefinitionException : Exception
9-
{
10-
/// <summary>
11-
/// Initialises the exception with a message.
12-
/// </summary>
13-
/// <param name="message">Message to display.</param>
14-
public InjectionDefinitionException(string message) : base(message) {}
15-
}
1+
using System;
2+
3+
namespace Mono.Cecil.Inject
4+
{
5+
/// <summary>
6+
/// An exception thrown when there is an issue when attempting to link the target method with the injection method.
7+
/// </summary>
8+
public class InjectionDefinitionException : Exception
9+
{
10+
/// <summary>
11+
/// Initialises the exception with a message.
12+
/// </summary>
13+
/// <param name="message">Message to display.</param>
14+
public InjectionDefinitionException(string message) : base(message) {}
15+
}
1616
}

Mono.Cecil.Inject/ILUtils.cs

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,43 @@
1-
using Mono.Cecil.Cil;
2-
3-
namespace Mono.Cecil.Inject
4-
{
5-
/// <summary>
6-
/// Miscellaneous utilities used by the injector.
7-
/// </summary>
8-
public static class ILUtils
9-
{
10-
/// <summary>
11-
/// Creates a new IL instruction that is a copy of the provided one. Does not link the new instruction to a method.
12-
/// </summary>
13-
/// <param name="ins">Instruction to copy.</param>
14-
/// <returns>A copy of the provided IL instruction.</returns>
15-
public static Instruction CopyInstruction(Instruction ins)
16-
{
17-
Instruction result;
18-
if (ins.Operand == null)
19-
result = Instruction.Create(ins.OpCode);
20-
else
21-
{
22-
result =
23-
(Instruction)
24-
typeof (Instruction).GetMethod("Create", new[] {typeof (OpCode), ins.Operand.GetType()})
25-
.Invoke(null, new[] {ins.OpCode, ins.Operand});
26-
}
27-
return result;
28-
}
29-
30-
/// <summary>
31-
/// Replaces the insturction with another by replacing the opcode and the operand.
32-
/// Unlike <see cref="ILProcessor.Replace" />, preserves the references to the original instruction (which branches
33-
/// might use, for instance).
34-
/// </summary>
35-
/// <param name="original">The instruction to replace.</param>
36-
/// <param name="newIns">The instruction to replace with.</param>
37-
public static void ReplaceInstruction(Instruction original, Instruction newIns)
38-
{
39-
original.OpCode = newIns.OpCode;
40-
original.Operand = newIns.Operand;
41-
}
42-
}
1+
using Mono.Cecil.Cil;
2+
3+
namespace Mono.Cecil.Inject
4+
{
5+
/// <summary>
6+
/// Miscellaneous utilities used by the injector.
7+
/// </summary>
8+
public static class ILUtils
9+
{
10+
/// <summary>
11+
/// Creates a new IL instruction that is a copy of the provided one. Does not link the new instruction to a method.
12+
/// </summary>
13+
/// <param name="ins">Instruction to copy.</param>
14+
/// <returns>A copy of the provided IL instruction.</returns>
15+
public static Instruction CopyInstruction(Instruction ins)
16+
{
17+
Instruction result;
18+
if (ins.Operand == null)
19+
result = Instruction.Create(ins.OpCode);
20+
else
21+
{
22+
result =
23+
(Instruction)
24+
typeof (Instruction).GetMethod("Create", new[] {typeof (OpCode), ins.Operand.GetType()})
25+
.Invoke(null, new[] {ins.OpCode, ins.Operand});
26+
}
27+
return result;
28+
}
29+
30+
/// <summary>
31+
/// Replaces the insturction with another by replacing the opcode and the operand.
32+
/// Unlike <see cref="ILProcessor.Replace" />, preserves the references to the original instruction (which branches
33+
/// might use, for instance).
34+
/// </summary>
35+
/// <param name="original">The instruction to replace.</param>
36+
/// <param name="newIns">The instruction to replace with.</param>
37+
public static void ReplaceInstruction(Instruction original, Instruction newIns)
38+
{
39+
original.OpCode = newIns.OpCode;
40+
original.Operand = newIns.Operand;
41+
}
42+
}
4343
}

0 commit comments

Comments
 (0)