Skip to content
This repository has been archived by the owner on Jan 14, 2021. It is now read-only.

Commit

Permalink
Adapt to new Cecil version
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Egli authored and marek-safar committed Feb 16, 2017
1 parent a92e04f commit cf38054
Show file tree
Hide file tree
Showing 13 changed files with 70 additions and 38 deletions.
2 changes: 1 addition & 1 deletion MoMA.Analyzer/Analysis/CheckPInvokes.cs
Expand Up @@ -37,7 +37,7 @@ public CheckPInvokes ()

public void FindPInvokesInAssembly (string assembly)
{
AssemblyDefinition ad = AssemblyFactory.GetAssembly (assembly);
AssemblyDefinition ad = AssemblyDefinition.ReadAssembly (assembly);

//Gets all types of the MainModule of the assembly
foreach (TypeDefinition type in ad.MainModule.Types) {
Expand Down
4 changes: 2 additions & 2 deletions MoMA.Analyzer/AssemblyAnalyzer.cs
Expand Up @@ -215,7 +215,7 @@ public ScanningCompletedEventArgs Analyze ()
public static bool IsValidAssembly (string assembly)
{
try {
AssemblyFactory.GetAssembly (assembly);
AssemblyDefinition.ReadAssembly (assembly);
return true;
} catch {
return false;
Expand Down Expand Up @@ -254,7 +254,7 @@ private void AddAssemblyToReport (AssemblyScannedEventArgs e)

private void AnalyzeAssembly (string assembly)
{
AssemblyDefinition ad = AssemblyFactory.GetAssembly (assembly);
AssemblyDefinition ad = AssemblyDefinition.ReadAssembly (assembly);

assembly_version = ad.Name.Version;
AssemblyRuntime = ad.Runtime.ToString ();
Expand Down
2 changes: 1 addition & 1 deletion MoMA.Analyzer/Methods/MethodExtractor.cs
Expand Up @@ -35,7 +35,7 @@ public class MethodExtractor
// Leave any of the SortedList parameters null that you aren't interested in
public static void ExtractFromAssembly (string assembly, SortedList<string, Method> allMethods, SortedList<string, Method> throwsNotImplementedMethods, SortedList<string, Method> monoTodoMethods)
{
AssemblyDefinition ad = AssemblyFactory.GetAssembly (assembly);
AssemblyDefinition ad = AssemblyDefinition.ReadAssembly (assembly);

//Gets all types of the MainModule of the assembly
foreach (TypeDefinition type in ad.MainModule.Types) {
Expand Down
31 changes: 22 additions & 9 deletions MoMA.Analyzer/MoMA.Analyzer.csproj
@@ -1,4 +1,5 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="14.0">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
Expand All @@ -11,10 +12,9 @@
<AssemblyName>MoMA.Analyzer</AssemblyName>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>2.0</OldToolsVersion>
<OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>moma.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
Expand All @@ -36,18 +36,30 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="ICSharpCode.SharpZipLib, Version=2.84.0.0, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\Program Files\Mono-1.2\lib\mono\2.0\ICSharpCode.SharpZipLib.dll</HintPath>
<Reference Include="Mono.Cecil, Version=0.9.6.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
<HintPath>..\packages\Mono.Cecil.0.9.6.1\lib\net40\Mono.Cecil.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Mono.Cecil, Version=0.6.8.8607, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\Mono\class\Mono.Cecil\bin\Release\Mono.Cecil.dll</HintPath>
<Reference Include="Mono.Cecil.Mdb, Version=0.9.6.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
<HintPath>..\packages\Mono.Cecil.0.9.6.1\lib\net40\Mono.Cecil.Mdb.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Mono.Cecil.Pdb, Version=0.9.6.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
<HintPath>..\packages\Mono.Cecil.0.9.6.1\lib\net40\Mono.Cecil.Pdb.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Mono.Cecil.Rocks, Version=0.9.6.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
<HintPath>..\packages\Mono.Cecil.0.9.6.1\lib\net40\Mono.Cecil.Rocks.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.EnterpriseServices" />
<Reference Include="System.Web.Services" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="ICSharpCode.SharpZipLib">
<HintPath>..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Analysis\BaseChecker.cs" />
Expand Down Expand Up @@ -88,6 +100,7 @@
</ItemGroup>
<ItemGroup>
<None Include="Web References\MoMAWebService\MoMASubmit.wsdl" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<None Include="moma.snk" />
Expand Down
20 changes: 10 additions & 10 deletions MoMA.Analyzer/Web References/MoMAWebService/Reference.cs
@@ -1,29 +1,29 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.1433
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

//
// This source code was auto-generated by Microsoft.VSDesigner, Version 2.0.50727.1433.
// This source code was auto-generated by Microsoft.VSDesigner, Version 4.0.30319.42000.
//
#pragma warning disable 1591

namespace MoMA.Analyzer.MoMAWebService {
using System.Diagnostics;
using System;
using System.Web.Services;
using System.ComponentModel;
using System.Diagnostics;
using System.Web.Services.Protocols;
using System;
using System.Xml.Serialization;
using System.ComponentModel;


/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.1433")]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.6.1038.0")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Web.Services.WebServiceBindingAttribute(Name="MoMASubmitSoap", Namespace="http://mono-project.com/MoMASubmit/")]
Expand Down Expand Up @@ -153,11 +153,11 @@ public partial class MoMASubmit : System.Web.Services.Protocols.SoapHttpClientPr
}

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.1433")]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.6.1038.0")]
public delegate void SubmitResultsCompletedEventHandler(object sender, SubmitResultsCompletedEventArgs e);

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.1433")]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.6.1038.0")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class SubmitResultsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
Expand All @@ -179,11 +179,11 @@ public partial class SubmitResultsCompletedEventArgs : System.ComponentModel.Asy
}

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.1433")]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.6.1038.0")]
public delegate void GetLatestDefinitionsVersionCompletedEventHandler(object sender, GetLatestDefinitionsVersionCompletedEventArgs e);

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.1433")]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.6.1038.0")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class GetLatestDefinitionsVersionCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
Expand Down
5 changes: 5 additions & 0 deletions MoMA.Analyzer/packages.config
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Mono.Cecil" version="0.9.6.1" targetFramework="net40" />
<package id="SharpZipLib" version="0.86.0" targetFramework="net45" />
</packages>
5 changes: 3 additions & 2 deletions MoMA.csproj
@@ -1,4 +1,5 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="14.0">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
Expand All @@ -12,7 +13,7 @@
<ApplicationIcon>moma.ico</ApplicationIcon>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>2.0</OldToolsVersion>
<OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<StartupObject>MoMA.Program</StartupObject>
Expand Down
3 changes: 2 additions & 1 deletion MoMA.csproj.user
@@ -1,4 +1,5 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="14.0">
<PropertyGroup>
<ProjectView>ShowAllFiles</ProjectView>
</PropertyGroup>
Expand Down
6 changes: 4 additions & 2 deletions MoMA.sln
@@ -1,6 +1,8 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25123.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{EFB1C06D-B954-441C-8720-F4AA9E4C33F6}"
ProjectSection(SolutionItems) = preProject
MoMASubmitWebService\MoMASubmit.asmx = MoMASubmitWebService\MoMASubmit.asmx
Expand Down
8 changes: 4 additions & 4 deletions MoMAExtractor/AssemblyManager.cs
Expand Up @@ -7,10 +7,10 @@ namespace MoMAExtractor
{
static class AssemblyManager
{
private static string mono_20 = @"C:\Program Files (x86)\Mono-2.10\lib\mono\2.0";
private static string mono_30 = @"C:\Program Files (x86)\Mono-2.10\lib\mono\3.0";
private static string mono_35 = @"C:\Program Files (x86)\Mono-2.10\lib\mono\3.5";
private static string mono_40 = @"C:\Program Files (x86)\Mono-2.10\lib\mono\4.0";
private static string mono_20 = @"C:\Program Files (x86)\Mono\lib\mono\2.0";
private static string mono_30 = @"C:\Program Files (x86)\Mono\lib\mono\3.0";
private static string mono_35 = @"C:\Program Files (x86)\Mono\lib\mono\3.5";
private static string mono_40 = @"C:\Program Files (x86)\Mono\lib\mono\4.0";
private static string mono_droid = @"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoDroid\v2.0";

private static string net_20 = @"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727";
Expand Down
5 changes: 3 additions & 2 deletions MoMAExtractor/MoMAExtractor.csproj
@@ -1,4 +1,5 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="14.0">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
Expand All @@ -11,7 +12,7 @@
<AssemblyName>MoMAExtractor</AssemblyName>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>2.0</OldToolsVersion>
<OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<PublishUrl>publish\</PublishUrl>
Expand Down
4 changes: 2 additions & 2 deletions MoMAExtractor/Summary.cs
Expand Up @@ -25,8 +25,8 @@ static void Main0 (string[] args)
string output_path = Path.GetDirectoryName (Application.ExecutablePath);

// Get the assemblies we want to examine
List<string> mono_assemblies = AssemblyManager.GetAssemblies (true, use_20, use_30, use_35, use_design, mwf_only);
List<string> ms_assemblies = AssemblyManager.GetAssemblies (false, use_20, use_30, use_35, use_design, mwf_only);
List<string> mono_assemblies = AssemblyManager.GetAssemblies (true, use_20, use_30, use_35, false, false, use_design, mwf_only);
List<string> ms_assemblies = AssemblyManager.GetAssemblies (false, use_20, use_30, use_35, false, false, use_design, mwf_only);

StreamWriter sw = new StreamWriter (Path.Combine (output_path, "summary.txt"));

Expand Down
13 changes: 11 additions & 2 deletions Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit cf38054

Please sign in to comment.