Skip to content

Commit

Permalink
Bump Mono.Cecil from 0.9.6.4 to 0.10.3 (#97)
Browse files Browse the repository at this point in the history
* Bump Mono.Cecil from 0.9.6.4 to 0.10.3

Bumps [Mono.Cecil](https://github.com/jbevain/cecil) from 0.9.6.4 to 0.10.3.
- [Release notes](https://github.com/jbevain/cecil/releases)
- [Commits](https://github.com/jbevain/cecil/commits/0.10.3)

Signed-off-by: dependabot[bot] <[email protected]>

* Patch for upgrading to Cecil 0.10.3:
#97 (comment)
  • Loading branch information
dependabot-preview[bot] authored and 3F committed May 28, 2019
1 parent 69a6e79 commit 6b33f4b
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 25 deletions.
7 changes: 4 additions & 3 deletions NSBin/NSBin.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoWarn>IDE1006</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
Expand All @@ -29,6 +30,7 @@
</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoWarn>IDE1006</NoWarn>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
Expand All @@ -37,9 +39,8 @@
<AssemblyOriginatorKeyFile>key.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="Mono.Cecil, Version=0.9.6.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
<HintPath>..\packages\Mono.Cecil.0.9.6.4\lib\net40\Mono.Cecil.dll</HintPath>
<Private>True</Private>
<Reference Include="Mono.Cecil, Version=0.10.3.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e, processorArchitecture=MSIL">
<HintPath>..\packages\Mono.Cecil.0.10.3\lib\net40\Mono.Cecil.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand Down
34 changes: 22 additions & 12 deletions NSBin/Rmod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ internal class Rmod: IDisposable
public const string DEFAULT_NS = "System.Runtime.InteropServices";
public const int NS_BUF_MAX = 0x01F4;

private string dll;
private readonly string dll;
private Ripper ripper;

public ISender Log
Expand Down Expand Up @@ -109,21 +109,17 @@ public Rmod(string dll, Encoding enc)

protected void makeViaCecil(string ns)
{
AssemblyDefinition asmdef = AssemblyDefinition.ReadAssembly(
AssemblyDefinition asmdef = AssemblyDefinition.ReadAssembly
(
ripper.BaseStream,
new ReaderParameters(ReadingMode.Immediate)
new ReaderParameters(ReadingMode.Immediate) { InMemory = true, ReadWrite = true }
);

foreach(TypeDefinition t in asmdef.MainModule.Types)
{
if(t.Namespace.StartsWith(IDNS, StringComparison.InvariantCulture)) {
t.Namespace = ns;
Log.send(this, $"cecil: NS property has been updated for {t.Name}.");
}
}
update(asmdef, ns);

ripper.BaseStream.SetLength(0);
asmdef.Write(ripper.BaseStream);
//ripper.BaseStream.SetLength(0); // 0.9.x
asmdef.Write(ripper.BaseStream); // https://github.com/3F/DllExport/pull/97#issuecomment-496319449
asmdef.Dispose(); // 0.10.x

using(var m = new Marker(_postfixToUpdated(dll)))
{
Expand All @@ -136,6 +132,20 @@ protected void makeViaCecil(string ns)
msgSuccess(ns);
}

protected void update(AssemblyDefinition asmdef, string ns)
{
foreach(TypeDefinition t in asmdef.MainModule.Types)
{
if(t.Namespace.StartsWith(IDNS, StringComparison.InvariantCulture))
{
t.Namespace = ns;
return;
}
}

throw new FileNotFoundException("IDNS sequence was not found.");
}

protected void make(string ns)
{
var ident = ripper.getBytesFrom(IDNS);
Expand Down
2 changes: 1 addition & 1 deletion NSBin/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Mono.Cecil" version="0.9.6.4" targetFramework="net40" />
<package id="Mono.Cecil" version="0.10.3" targetFramework="net40" />
</packages>
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,8 @@
<Reference Include="Microsoft.Build.Utilities.v4.0">
<Private>True</Private>
</Reference>
<Reference Include="Mono.Cecil, Version=0.9.6.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
<HintPath>..\packages\Mono.Cecil.0.9.6.4\lib\net40\Mono.Cecil.dll</HintPath>
<Private>True</Private>
<Reference Include="Mono.Cecil, Version=0.10.3.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e, processorArchitecture=MSIL">
<HintPath>..\packages\Mono.Cecil.0.10.3\lib\net40\Mono.Cecil.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand Down
2 changes: 1 addition & 1 deletion RGiesecke.DllExport.MSBuild/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Mono.Cecil" version="0.9.6.4" targetFramework="net40" />
<package id="Mono.Cecil" version="0.10.3" targetFramework="net40" />
</packages>
5 changes: 2 additions & 3 deletions RGiesecke.DllExport/RGiesecke.DllExport.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,8 @@
<Reference Include="Conari, Version=1.3.0.39650, Culture=neutral, PublicKeyToken=4bbd2ef743db151e, processorArchitecture=MSIL">
<HintPath>..\packages\Conari.1.3.0\lib\net40\Conari.dll</HintPath>
</Reference>
<Reference Include="Mono.Cecil, Version=0.9.6.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
<HintPath>..\packages\Mono.Cecil.0.9.6.4\lib\net40\Mono.Cecil.dll</HintPath>
<Private>True</Private>
<Reference Include="Mono.Cecil, Version=0.10.3.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e, processorArchitecture=MSIL">
<HintPath>..\packages\Mono.Cecil.0.10.3\lib\net40\Mono.Cecil.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand Down
2 changes: 1 addition & 1 deletion RGiesecke.DllExport/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Conari" version="1.3.0" targetFramework="net40" />
<package id="Mono.Cecil" version="0.9.6.4" targetFramework="net40" />
<package id="Mono.Cecil" version="0.10.3" targetFramework="net40" />
</packages>
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Copyright (c) 2016-2019 Denis Kuzmin < [email protected] > GitHub/3F
[![Latest-Release](https://img.shields.io/github/release/3F/DllExport.svg)](https://github.com/3F/DllExport/releases/latest)
[![License](https://img.shields.io/badge/License-MIT-74A5C2.svg)](https://github.com/3F/DllExport/blob/master/LICENSE)
[![coreclr_ILAsm](https://img.shields.io/badge/coreclr_ILAsm-v4.5.1-C8597A.svg)](https://www.nuget.org/packages/ILAsm/)
[![Cecil](https://img.shields.io/badge/Cecil-0.9.6.4-1182C3.svg)](https://github.com/jbevain/cecil)
[![Cecil](https://img.shields.io/badge/Cecil-0.10.3-1182C3.svg)](https://github.com/jbevain/cecil)
[![MvsSln](https://img.shields.io/badge/MvsSln-v2.1.0-865FC5.svg)](https://github.com/3F/MvsSln)
[![GetNuTool core](https://img.shields.io/badge/GetNuTool-v1.7-93C10B.svg)](https://github.com/3F/GetNuTool)
[![Conari](https://img.shields.io/badge/Conari-v1.3.0-8AA875.svg)](https://github.com/3F/Conari)
Expand Down

0 comments on commit 6b33f4b

Please sign in to comment.