From 3dc5023f7985fec0c99fa29a60d61bf9c02e8639 Mon Sep 17 00:00:00 2001 From: Matt Ward Date: Tue, 25 Oct 2005 19:35:13 +0000 Subject: [PATCH] Removing SharpAssembly. The AssemblyScout should be using code completion data from the ProjectContentRegistry and not SharpAssembly. git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@630 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../ICSharpCode.SharpAssembly.sln | 6 - .../Project/Configuration/AssemblyInfo.cs | 38 -- .../Project/Doc/README.txt | 29 - .../Project/ICSharpCode.SharpAssembly.csproj | 115 ---- .../Project/ICSharpCode.SharpAssembly.key | Bin 596 -> 0 bytes .../Project/Src/AssemblyMetadataTables.cs | 223 ------- .../Src/AssemblyNameNotFoundException.cs | 21 - .../Project/Src/AssemblyReader.cs | 294 --------- .../Project/Src/FusionNative.cs | 419 ------------- .../Project/Src/Metadata/AssemblyMetaData.cs | 118 ---- .../Project/Src/Metadata/MetadataTable.cs | 236 ------- .../Project/Src/Metadata/MethodBody.cs | 107 ---- .../Project/Src/Metadata/Rows/AbstractRow.cs | 148 ----- .../Project/Src/Metadata/Rows/Assembly.cs | 114 ---- .../Project/Src/Metadata/Rows/AssemblyOS.cs | 55 -- .../Src/Metadata/Rows/AssemblyProcessor.cs | 33 - .../Project/Src/Metadata/Rows/AssemblyRef.cs | 116 ---- .../Src/Metadata/Rows/AssemblyRefOS.cs | 63 -- .../Src/Metadata/Rows/AssemblyRefProcessor.cs | 43 -- .../Project/Src/Metadata/Rows/ClassLayout.cs | 54 -- .../Project/Src/Metadata/Rows/CodedIndex.cs | 24 - .../Project/Src/Metadata/Rows/Constant.cs | 57 -- .../Src/Metadata/Rows/CustomAttribute.cs | 55 -- .../Project/Src/Metadata/Rows/DeclSecurity.cs | 54 -- .../Project/Src/Metadata/Rows/ENCLog.cs | 43 -- .../Project/Src/Metadata/Rows/ENCMap.cs | 33 - .../Project/Src/Metadata/Rows/Event.cs | 57 -- .../Project/Src/Metadata/Rows/EventMap.cs | 44 -- .../Project/Src/Metadata/Rows/EventPtr.cs | 33 - .../Project/Src/Metadata/Rows/ExportedType.cs | 76 --- .../Project/Src/Metadata/Rows/Field.cs | 84 --- .../Project/Src/Metadata/Rows/FieldLayout.cs | 44 -- .../Project/Src/Metadata/Rows/FieldMarshal.cs | 44 -- .../Project/Src/Metadata/Rows/FieldPtr.cs | 33 - .../Project/Src/Metadata/Rows/FieldRVA.cs | 44 -- .../Project/Src/Metadata/Rows/File.cs | 56 -- .../Project/Src/Metadata/Rows/ImplMap.cs | 80 --- .../Src/Metadata/Rows/InterfaceImpl.cs | 45 -- .../Src/Metadata/Rows/ManifestResource.cs | 70 --- .../Project/Src/Metadata/Rows/MemberRef.cs | 54 -- .../Project/Src/Metadata/Rows/Method.cs | 142 ----- .../Project/Src/Metadata/Rows/MethodImpl.cs | 53 -- .../Project/Src/Metadata/Rows/MethodPtr.cs | 33 - .../Src/Metadata/Rows/MethodSemantics.cs | 63 -- .../Project/Src/Metadata/Rows/Module.cs | 74 --- .../Project/Src/Metadata/Rows/ModuleRef.cs | 33 - .../Project/Src/Metadata/Rows/NestedClass.cs | 43 -- .../Project/Src/Metadata/Rows/Param.cs | 67 -- .../Project/Src/Metadata/Rows/ParamPtr.cs | 33 - .../Project/Src/Metadata/Rows/Property.cs | 65 -- .../Project/Src/Metadata/Rows/PropertyMap.cs | 44 -- .../Project/Src/Metadata/Rows/PropertyPtr.cs | 33 - .../Src/Metadata/Rows/StandAloneSig.cs | 34 - .../Project/Src/Metadata/Rows/TypeDef.cs | 137 ---- .../Project/Src/Metadata/Rows/TypeRef.cs | 55 -- .../Project/Src/Metadata/Rows/TypeSpec.cs | 33 - .../Metadata/Signatures/CallingConventions.cs | 31 - .../Src/Metadata/Signatures/DataTypes.cs | 53 -- .../Project/Src/PE/CLIHeader.cs | 167 ----- .../Project/Src/PE/DataDirectories.cs | 356 ----------- .../Project/Src/PE/IAT.cs | 42 -- .../Project/Src/PE/ImportTable.cs | 34 - .../Project/Src/PE/NTSpecificFields.cs | 45 -- .../Project/Src/PE/NameTable.cs | 50 -- .../Project/Src/PE/PEFileHeader.cs | 145 ----- .../Project/Src/PE/SectionTable.cs | 215 ------- .../Project/Src/PE/StandardFields.cs | 46 -- .../Project/Src/PE/StreamHeader.cs | 66 -- .../Project/Src/SharpAssembly.cs | 583 ------------------ .../Project/Src/SharpAssemblyName.cs | 39 -- 70 files changed, 6076 deletions(-) delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/ICSharpCode.SharpAssembly.sln delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Configuration/AssemblyInfo.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Doc/README.txt delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/ICSharpCode.SharpAssembly.csproj delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/ICSharpCode.SharpAssembly.key delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/AssemblyMetadataTables.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/AssemblyNameNotFoundException.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/AssemblyReader.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/FusionNative.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/AssemblyMetaData.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/MetadataTable.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/MethodBody.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/AbstractRow.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/Assembly.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/AssemblyOS.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/AssemblyProcessor.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/AssemblyRef.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/AssemblyRefOS.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/AssemblyRefProcessor.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/ClassLayout.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/CodedIndex.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/Constant.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/CustomAttribute.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/DeclSecurity.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/ENCLog.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/ENCMap.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/Event.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/EventMap.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/EventPtr.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/ExportedType.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/Field.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/FieldLayout.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/FieldMarshal.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/FieldPtr.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/FieldRVA.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/File.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/ImplMap.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/InterfaceImpl.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/ManifestResource.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/MemberRef.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/Method.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/MethodImpl.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/MethodPtr.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/MethodSemantics.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/Module.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/ModuleRef.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/NestedClass.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/Param.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/ParamPtr.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/Property.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/PropertyMap.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/PropertyPtr.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/StandAloneSig.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/TypeDef.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/TypeRef.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/TypeSpec.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Signatures/CallingConventions.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Signatures/DataTypes.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/PE/CLIHeader.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/PE/DataDirectories.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/PE/IAT.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/PE/ImportTable.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/PE/NTSpecificFields.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/PE/NameTable.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/PE/PEFileHeader.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/PE/SectionTable.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/PE/StandardFields.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/PE/StreamHeader.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/SharpAssembly.cs delete mode 100644 src/Libraries/ICSharpCode.SharpAssembly/Project/Src/SharpAssemblyName.cs diff --git a/src/Libraries/ICSharpCode.SharpAssembly/ICSharpCode.SharpAssembly.sln b/src/Libraries/ICSharpCode.SharpAssembly/ICSharpCode.SharpAssembly.sln deleted file mode 100644 index 575fcbd1cf..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/ICSharpCode.SharpAssembly.sln +++ /dev/null @@ -1,6 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 9.00 -# SharpDevelop 2.0.0.568 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.SharpAssembly", "Project\ICSharpCode.SharpAssembly.csproj", "{C70406A5-25B5-4A2B-898A-B1338652F7F0}" -EndProject -Global -EndGlobal diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Configuration/AssemblyInfo.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Configuration/AssemblyInfo.cs deleted file mode 100644 index e53995fe9d..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Configuration/AssemblyInfo.cs +++ /dev/null @@ -1,38 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - -using System.Reflection; -using System.Runtime.CompilerServices; - -// Information about this assembly is defined by the following -// attributes. -// -// change them to the information which is associated with the assembly -// you compile. - -[assembly: AssemblyTitle("ICSharpCode.SharpAssembly")] -[assembly: AssemblyDescription("CLI Assembly Reader library")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("www.icsharpcode.net")] -[assembly: AssemblyProduct("")] -[assembly: AssemblyCopyright("(C) 2003 by Mike Krueger released as GPL")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// The assembly version has following format : -// -// Major.Minor.Build.Revision -// -// You can specify all values by your own or you can build default build and revision -// numbers with the '*' character (the default): - -[assembly: AssemblyVersion("1.1.0.2094")] - -// The following attributes specify the key for the sign of your assembly. See the -// .NET Framework documentation for more information about signing. -// This is not required, if you don't want signing let these attributes like they're. -[assembly: AssemblyDelaySign(false)] diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Doc/README.txt b/src/Libraries/ICSharpCode.SharpAssembly/Project/Doc/README.txt deleted file mode 100644 index de13527ac8..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Doc/README.txt +++ /dev/null @@ -1,29 +0,0 @@ -SharpAssembly 1.0 ------------------ - -This is the first release of my Assembly reading library. -I was tired of the System.Reflection capabilities (locking assemblies, -app domain troubles no access to method body IL stream etc.) therefore -I've decided to do it on my own. - -And here it is ... my first release of the library. I assume that you -should play a bit with it and read following docs: - -Tool Developers Guide/docs/Partition I Architecture.doc -Tool Developers Guide/docs/Partition II Metadata.doc -Tool Developers Guide/docs/Partition III CIL.doc - -These can be found inside the SDK distribution. - -Feel free to send comments/suggestions/code changes to: -mike@icsharpcode.net - -Building --------- -You need SharpDevelop to build this library. You can get it from: -www.icsharpcode.net/OpenSource/SD - -License -------- -Released under GNU LGPL see lgpl.txt for details -(or http://www.gnu.org/licenses/lgpl.html) diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/ICSharpCode.SharpAssembly.csproj b/src/Libraries/ICSharpCode.SharpAssembly/Project/ICSharpCode.SharpAssembly.csproj deleted file mode 100644 index cb91e92c35..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/ICSharpCode.SharpAssembly.csproj +++ /dev/null @@ -1,115 +0,0 @@ - - - Debug - AnyCPU - 2.0 - {C70406A5-25B5-4A2B-898A-B1338652F7F0} - NewProject - ICSharpCode.SharpAssembly - Library - 4 - False - False - OnSuccessfulBuild - None - False - Auto - 4194304 - AnyCPU - 4096 - True - ICSharpCode.SharpAssembly.key - False - File - - - false - True - False - True - ..\..\..\..\bin\ - true - - - False - True - False - True - ..\..\..\..\..\bin\ - True - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/ICSharpCode.SharpAssembly.key b/src/Libraries/ICSharpCode.SharpAssembly/Project/ICSharpCode.SharpAssembly.key deleted file mode 100644 index 37699a5473af0401005ed62593c82851d9039a05..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 596 zcmV-a0;~N80ssI2Bme+XQ$aES1ONa50097R#)c6@fV(6^x6Bp_z#%ncTn+32SacQ7 zpOsp{R2Qrohm`QAfgWRBDkJtU2u(oa>Xd>$zpE77YtHNsO4JfP!eZk-QyBRG|Ni+; zR_SlC4=DJGiU^%>9ka-`MUFvw5R2yHr!WocM4IYvZ1G%?TgZ^?Bp0M>k@;%LkN&4u z_lfXP6&5YTa)8M{9cTQd^gWi&$?O0wZsHvP8iIrVs`}wXR2d#)@_z0(Kl3&koOTPP zpd3R1tfTC8?iSmrvPgJ>QMyF!(p94x-hI!6!AThXv^)mp1L6rV`DRVExwOHM+52(i zRer5T~h^h?C);;W9v8Yvl9CDKG1KJ<37bdiay{A*YoKtp}U z+WBXF3z#Y?9`UlRXz@&hYvxmh#Tr>PVidez6ms_NyG{Vfe&_$-(w$$Q=MMGn8RSjI zxz}1;8r%{2asv@Mrr}?T9F)hAYu?}WK3u~CqaxbW1)snrU-xsBQxR-rPtn^nTG7??(gC?#5cKFImVTn7R57*RI-s?)UJObs$`eaR3H5Nkjf3p1|7KSAg$ zH^_Y&7PZsjld<+86It8>(FJzbz4TumfmF3X8L>sN8&xHbUC^C_a%*bHUskRc0qyDJ ig>MZ}XXh0$>u!Anm)0nKpu{ZYqM_8SWe=p`4B?&urXIBb diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/AssemblyMetadataTables.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/AssemblyMetadataTables.cs deleted file mode 100644 index 62846d4b62..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/AssemblyMetadataTables.cs +++ /dev/null @@ -1,223 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - -using System; -using ICSharpCode.SharpAssembly.Metadata; -using ICSharpCode.SharpAssembly.Metadata.Rows; -using MDRows = ICSharpCode.SharpAssembly.Metadata.Rows; - -namespace ICSharpCode.SharpAssembly.Assembly -{ - - /// - /// Contains shortcuts to commonly used tables - /// - public class MetadataTables : object { - - AssemblyReader reader; - - public MetadataTables(AssemblyReader Reader) { - reader = Reader; - } - - // Shortcuts for commonly used tables - - public MDRows.Assembly[] Assembly { - get { - return (MDRows.Assembly[])reader.MetadataTable.Tables[MDRows.Assembly.TABLE_ID]; - } - } - - public AssemblyRef[] AssemblyRef { - get { - return (AssemblyRef[])reader.MetadataTable.Tables[MDRows.AssemblyRef.TABLE_ID]; - } - } - - public ClassLayout[] ClassLayout { - get { - return (ClassLayout[])reader.MetadataTable.Tables[MDRows.ClassLayout.TABLE_ID]; - } - } - - public Constant[] Constant { - get { - return (Constant[])reader.MetadataTable.Tables[MDRows.Constant.TABLE_ID]; - } - } - - public CustomAttribute[] CustomAttribute { - get { - return (CustomAttribute[])reader.MetadataTable.Tables[MDRows.CustomAttribute.TABLE_ID]; - } - } - - public DeclSecurity[] DeclSecurity { - get { - return (DeclSecurity[])reader.MetadataTable.Tables[MDRows.DeclSecurity.TABLE_ID]; - } - } - - public Event[] Event { - get { - return (Event[])reader.MetadataTable.Tables[MDRows.Event.TABLE_ID]; - } - } - - public EventMap[] EventMap { - get { - return (EventMap[])reader.MetadataTable.Tables[MDRows.EventMap.TABLE_ID]; - } - } - - public EventPtr[] EventPtr { - get { - return (EventPtr[])reader.MetadataTable.Tables[MDRows.EventPtr.TABLE_ID]; - } - } - /* - public ExportedType[] ExportedType { - get { - return (ExportedType[])reader.MetadataTable.Tables[MDRows.ExportedType.TABLE_ID]; - } - } - */ - public Field[] Field { - get { - return (Field[])reader.MetadataTable.Tables[MDRows.Field.TABLE_ID]; - } - } - - public FieldLayout[] FieldLayout { - get { - return (FieldLayout[])reader.MetadataTable.Tables[MDRows.FieldLayout.TABLE_ID]; - } - } - /* - public FieldMarshal[] FieldMarshal { - get { - return (FieldMarshal[])reader.MetadataTable.Tables[MDRows.FieldMarshal.TABLE_ID]; - } - } - */ - public FieldRVA[] FieldRVA { - get { - return (FieldRVA[])reader.MetadataTable.Tables[MDRows.FieldRVA.TABLE_ID]; - } - } - - public MDRows.File[] File { - get { - return (MDRows.File[])reader.MetadataTable.Tables[MDRows.File.TABLE_ID]; - } - } - - public ImplMap[] ImplMap { - get { - return (ImplMap[])reader.MetadataTable.Tables[MDRows.ImplMap.TABLE_ID]; - } - } - - public InterfaceImpl[] InterfaceImpl { - get { - return (InterfaceImpl[])reader.MetadataTable.Tables[MDRows.InterfaceImpl.TABLE_ID]; - } - } - - public ManifestResource[] ManifestResource { - get { - return (ManifestResource[])reader.MetadataTable.Tables[MDRows.ManifestResource.TABLE_ID]; - } - } - - public MemberRef[] MemberRef { - get { - return (MemberRef[])reader.MetadataTable.Tables[MDRows.MemberRef.TABLE_ID]; - } - } - - public Method[] Method { - get { - return (Method[])reader.MetadataTable.Tables[MDRows.Method.TABLE_ID]; - } - } - - public MethodImpl[] MethodImpl { - get { - return (MethodImpl[])reader.MetadataTable.Tables[MDRows.MethodImpl.TABLE_ID]; - } - } - - public MethodSemantics[] MethodSemantics { - get { - return (MethodSemantics[])reader.MetadataTable.Tables[MDRows.MethodSemantics.TABLE_ID]; - } - } - /* - public MDRows.Module[] Module { - get { - return (MDRows.Module[])reader.MetadataTable.Tables[MDRows.MDRows.Module.TABLE_ID]; - } - } - - public ModuleRef[] ModuleRefTable { - get { - return (ModuleRef[])reader.MetadataTable.Tables[MDRows.ModuleRef.TABLE_ID]; - } - } - */ - public NestedClass[] NestedClass { - get { - return (NestedClass[])reader.MetadataTable.Tables[MDRows.NestedClass.TABLE_ID]; - } - } - - public Param[] Param { - get { - return (Param[])reader.MetadataTable.Tables[MDRows.Param.TABLE_ID]; - } - } - - public Property[] Property { - get { - return (Property[])reader.MetadataTable.Tables[MDRows.Property.TABLE_ID]; - } - } - - public PropertyMap[] PropertyMap { - get { - return (PropertyMap[])reader.MetadataTable.Tables[MDRows.PropertyMap.TABLE_ID]; - } - } - - public StandAloneSig[] StandAloneSig { - get { - return (StandAloneSig[])reader.MetadataTable.Tables[MDRows.StandAloneSig.TABLE_ID]; - } - } - - public TypeDef[] TypeDef { - get { - return (TypeDef[])reader.MetadataTable.Tables[MDRows.TypeDef.TABLE_ID]; - } - } - - public TypeRef[] TypeRef { - get { - return (TypeRef[])reader.MetadataTable.Tables[MDRows.TypeRef.TABLE_ID]; - } - } - - public TypeSpec[] TypeSpec { - get { - return (TypeSpec[])reader.MetadataTable.Tables[MDRows.TypeSpec.TABLE_ID]; - } - } - - - } -} diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/AssemblyNameNotFoundException.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/AssemblyNameNotFoundException.cs deleted file mode 100644 index 4243cd9ab7..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/AssemblyNameNotFoundException.cs +++ /dev/null @@ -1,21 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - -using System; - -namespace ICSharpCode.SharpAssembly.Assembly -{ - /// - /// Is thrown when the given assembly name could not be found. - /// - public class AssemblyNameNotFoundException : Exception - { - public AssemblyNameNotFoundException(string name) : base("Could not find assembly named " + name + " in the Global Assembly Cache.") - { - } - } -} diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/AssemblyReader.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/AssemblyReader.cs deleted file mode 100644 index f8551f1b16..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/AssemblyReader.cs +++ /dev/null @@ -1,294 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - -using System; -using System.Collections; -//using System.Collections.Specialized; -using System.Reflection; -using System.IO; -using ICSharpCode.SharpAssembly.Metadata.Rows; -using ICSharpCode.SharpAssembly.Metadata; -using ICSharpCode.SharpAssembly.PE; - -namespace ICSharpCode.SharpAssembly.Assembly { - - public class AssemblyReader - { - PEFileHeader header; - CLIHeader cliHeader; - SectionTable[] sections; - MetadataTable metadataTable = new MetadataTable(); - - byte[] stringHeap; - byte[] userStringHeap; - byte[] guidHeap; - byte[] blobHeap; - byte[] rawSectionData; - - string filename; - - public PEFileHeader PEHeader { - get { - return header; - } - } - - public CLIHeader CliHeader { - get { - return cliHeader; - } - } - - public string FileName { - get { - return filename; - } - } - - public MetadataTable MetadataTable { - get { - return metadataTable; - } - } - - public byte[] StringHeap { - get { - return stringHeap; - } - } - - public byte[] UserStringHeap { - get { - return userStringHeap; - } - } - - public byte[] GuidHeap { - get { - return guidHeap; - } - } - - public byte[] BlobHeap { - get { - return blobHeap; - } - } - - public byte[] RawSectionData { - get { - return rawSectionData; - } - } - - public static int GetCompressedInt(byte[] heap, ref uint index) - { - if (index < 0 || index >= heap.Length) { - return -1; - } - int first = heap[index++]; - switch (first & 0xC0) { - case 0xC0: - first &= ~0xC0; - return first << 24 | heap[index++] << 16 | heap[index++] << 8 | heap[index++]; - case 0x80: - first &= ~0x80; - return first << 8 | heap[index++]; - default: - return first; - } - } - - public int LoadBlob(ref uint index) - { - return GetCompressedInt(blobHeap, ref index); - } - - public byte[] GetBlobFromHeap(uint index) - { - if (index < 0 || index >= blobHeap.Length) { - return new byte[0]; - } - int length = LoadBlob(ref index); - - byte[] dest = new byte[length]; - Array.Copy(blobHeap, index, dest, 0, length); - - return dest; - } - - public string GetUserStringFromHeap(uint index) - { - if (index < 0 || index >= userStringHeap.Length) { - return ""; - } - - int length = GetCompressedInt(userStringHeap, ref index); - - return System.Text.Encoding.Unicode.GetString(userStringHeap, (int)index, length); - } - - public string GetStringFromHeap(uint index) - { - if (index < 0 || index >= stringHeap.Length) { - return ""; - } - - uint endIndex = index; - while (endIndex < stringHeap.Length && stringHeap[endIndex] != 0) { - ++endIndex; - } - - return System.Text.Encoding.UTF8.GetString(stringHeap, (int)index, (int)(endIndex - index)); - } - - public uint LookupRVA(uint address) - { - foreach (SectionTable section in sections) { - if (section.VirtualAddress <= address && address <= section.VirtualAddress + section.VirtualSize) { - return section.PointerToRawData + address - section.VirtualAddress; - } - } - return 0; - } - - public Stream OpenStream(uint rva) - { - uint offset = LookupRVA(rva); - MemoryStream ms = new MemoryStream(rawSectionData); - ms.Seek(offset, SeekOrigin.Begin); - return ms; - } - - public ICSharpCode.SharpAssembly.Metadata.Rows.MethodBody LoadMethodBody(uint rva) - { - BinaryReader binaryReader = new BinaryReader(OpenStream(rva)); - ICSharpCode.SharpAssembly.Metadata.Rows.MethodBody body = new ICSharpCode.SharpAssembly.Metadata.Rows.MethodBody(); - body.Load(binaryReader); - binaryReader.Close(); - return body; - } - - public void Load(string fileName) - { - Stream fs = System.IO.File.OpenRead(fileName); - fs.Seek(0x3c, SeekOrigin.Begin); - BinaryReader binaryReaderSO = new BinaryReader(fs); - long signature_offset = binaryReaderSO.ReadInt32(); - - fs.Seek(signature_offset, SeekOrigin.Begin); - - filename = fileName; - - BinaryReader binaryReader = new BinaryReader(fs); - - header = new PEFileHeader(); - header.LoadFrom(binaryReader); - - sections = new SectionTable[header.NumberOfSections]; - for (int i = 0; i < header.NumberOfSections; ++i) { - sections[i] = new SectionTable(); - sections[i].LoadFrom(binaryReader); - } - - uint rawDataSize = 0; - for (int i = 0; i < header.NumberOfSections; ++i) { - rawDataSize += sections[i].SizeOfRawData; - } - - // read all sections to a memory buffer and relocate all pointer in the sections - // to raw data indices in the buffer - rawSectionData = new byte[rawDataSize]; - int curOffset = 0; - for (int i = 0; i < header.NumberOfSections; ++i) { - fs.Seek((int)sections[i].PointerToRawData, SeekOrigin.Begin); - fs.Read(rawSectionData, curOffset, (int)sections[i].SizeOfRawData); - sections[i].PointerToRawData = (uint)curOffset; - curOffset += (int)sections[i].SizeOfRawData; - } - binaryReader.Close(); - binaryReaderSO.Close(); - fs.Close(); - - fs = new MemoryStream(rawSectionData); - binaryReader = new BinaryReader(fs); - - uint cliHeaderPos = LookupRVA(header.DataDirectories.CliHeader); - fs.Seek((int)cliHeaderPos, SeekOrigin.Begin); - cliHeader = new CLIHeader(); - cliHeader.LoadFrom(binaryReader); - - uint metaDataPos = LookupRVA(cliHeader.MetaData); - fs.Seek((int)metaDataPos, SeekOrigin.Begin); - AssemblyMetadata met = new AssemblyMetadata(); - met.LoadFrom(binaryReader); - - foreach (StreamHeader streamHeader in met.StreamHeaders) { - uint offset = LookupRVA(cliHeader.MetaData + streamHeader.Offset); - fs.Seek((int)offset, SeekOrigin.Begin); - switch (streamHeader.Name) { - case "#~": - case "#-": - metadataTable.LoadFrom(binaryReader); - break; - case "#Strings": - stringHeap = new byte[streamHeader.Size]; - fs.Read(stringHeap, 0, stringHeap.Length); - break; - case "#US": - userStringHeap = new byte[streamHeader.Size]; - fs.Read(userStringHeap, 0, userStringHeap.Length); - break; - case "#GUID": - guidHeap = new byte[streamHeader.Size]; - fs.Read(guidHeap, 0, guidHeap.Length); - break; - case "#Blob": - blobHeap = new byte[streamHeader.Size]; - fs.Read(blobHeap, 0, blobHeap.Length); - break; - } - } - - - } - - public int GetCodedIndexTable(CodedIndex index, ref uint val) - { - int bits = 0; - - switch (index) { - case CodedIndex.HasConstant: - case CodedIndex.TypeDefOrRef: - case CodedIndex.HasDeclSecurity: - case CodedIndex.Implementation: - case CodedIndex.ResolutionScope: - bits = 2; - break; - case CodedIndex.HasCustomAttribute: - bits = 5; - break; - case CodedIndex.HasFieldMarshall: - case CodedIndex.HasSemantics: - case CodedIndex.MethodDefOrRef: - case CodedIndex.MemberForwarded: - bits = 1; - break; - case CodedIndex.MemberRefParent: - case CodedIndex.CustomAttributeType: - bits = 3; - break; - } - - uint origval = val; - val = origval >> bits; - - return (int)(origval & ((int)Math.Pow(2, bits) - 1)); - } - - } -} diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/FusionNative.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/FusionNative.cs deleted file mode 100644 index f3537b6159..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/FusionNative.cs +++ /dev/null @@ -1,419 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - -using System; -using System.Text; -using System.Runtime.InteropServices; - -namespace MSjogren.Fusion.Native -{ - [Flags] - enum ASM_CACHE_FLAGS - { - ASM_CACHE_ZAP = 0x1, - ASM_CACHE_GAC = 0x2, - ASM_CACHE_DOWNLOAD = 0x4 - } - - [Flags] - enum ASM_DISPLAY_FLAGS - { - VERSION = 0x1, - CULTURE = 0x2, - PUBLIC_KEY_TOKEN = 0x4, - PUBLIC_KEY = 0x8, - CUSTOM = 0x10, - PROCESSORARCHITECTURE = 0x20, - LANGUAGEID = 0x40 - } - - [Flags] - enum ASM_CMP_FLAGS - { - NAME = 0x1, - MAJOR_VERSION = 0x2, - MINOR_VERSION = 0x4, - BUILD_NUMBER = 0x8, - REVISION_NUMBER = 0x10, - PUBLIC_KEY_TOKEN = 0x20, - CULTURE = 0x40, - CUSTOM = 0x80, - ALL = NAME | MAJOR_VERSION | MINOR_VERSION | - REVISION_NUMBER | BUILD_NUMBER | - PUBLIC_KEY_TOKEN | CULTURE | CUSTOM, - DEFAULT = 0x100 - } - - [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)] - struct FUSION_INSTALL_REFERENCE - { - public uint cbSize; - public uint dwFlags; - public Guid guidScheme; - public string szIdentifier; - public string szNonCannonicalData; - } - - [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)] - struct ASSEMBLY_INFO - { - public uint cbAssemblyInfo; - public uint dwAssemblyFlags; - public ulong uliAssemblySizeInKB; - public string pszCurrentAssemblyPathBuf; - public uint cchBuf; - } - - - [ - ComImport(), - Guid("E707DCDE-D1CD-11D2-BAB9-00C04F8ECEAE"), - InterfaceType(ComInterfaceType.InterfaceIsIUnknown) - ] - interface IAssemblyCache - { - [PreserveSig()] - int UninstallAssembly( - uint dwFlags, - [MarshalAs(UnmanagedType.LPWStr)] string pszAssemblyName, - [MarshalAs(UnmanagedType.LPArray)] FUSION_INSTALL_REFERENCE[] pRefData, - out uint pulDisposition); - - [PreserveSig()] - int QueryAssemblyInfo( - uint dwFlags, - [MarshalAs(UnmanagedType.LPWStr)] string pszAssemblyName, - ref ASSEMBLY_INFO pAsmInfo); - - [PreserveSig()] - int CreateAssemblyCacheItem( - uint dwFlags, - IntPtr pvReserved, - out IAssemblyCacheItem ppAsmItem, - [MarshalAs(UnmanagedType.LPWStr)] string pszAssemblyName); - - [PreserveSig()] - int CreateAssemblyScavenger( - [MarshalAs(UnmanagedType.IUnknown)] out object ppAsmScavenger); - - [PreserveSig()] - int InstallAssembly( - uint dwFlags, - [MarshalAs(UnmanagedType.LPWStr)] string pszManifestFilePath, - [MarshalAs(UnmanagedType.LPArray)] FUSION_INSTALL_REFERENCE[] pRefData); - } - - - [ - ComImport(), - Guid("9E3AAEB4-D1CD-11D2-BAB9-00C04F8ECEAE"), - InterfaceType(ComInterfaceType.InterfaceIsIUnknown) - ] - interface IAssemblyCacheItem - { - void CreateStream( - uint dwFlags, - [MarshalAs(UnmanagedType.LPWStr)] string pszStreamName, - uint dwFormat, - uint dwFormatFlags, - out UCOMIStream ppIStream, - ref long puliMaxSize); - - void Commit( - uint dwFlags, - out long pulDisposition); - - void AbortItem(); - } - - - enum ASM_NAME - { - PUBLIC_KEY = 0, // byte[] - PUBLIC_KEY_TOKEN, // byte[8] - HASH_VALUE, - NAME, // LPWSTR - MAJOR_VERSION, // ushort - MINOR_VERSION, // ushort - BUILD_NUMBER, // ushort - REVISION_NUMBER, // ushort - CULTURE, // LPWSTR - PROCESSOR_ID_ARRAY, - OSINFO_ARRAY, - HASH_ALGID, - ALIAS, - CODEBASE_URL, // LPWSTR - CODEBASE_LASTMOD, // FILETIME - NULL_PUBLIC_KEY, - NULL_PUBLIC_KEY_TOKEN, - CUSTOM, // LPWSTR; ZAP string for NGEN assemblies - NULL_CUSTOM, - MVID, // byte[16] / Guid - //MAX_PARAMS - } - - - [ - ComImport(), - Guid("CD193BC0-B4BC-11D2-9833-00C04FC31D2E"), - InterfaceType(ComInterfaceType.InterfaceIsIUnknown) - ] - interface IAssemblyName - { - [PreserveSig()] - int SetProperty( - ASM_NAME PropertyId, - IntPtr pvProperty, - uint cbProperty); - - [PreserveSig()] - int GetProperty( - ASM_NAME PropertyId, - IntPtr pvProperty, - ref uint pcbProperty); - - [PreserveSig()] - int Finalize(); - - [PreserveSig()] - int GetDisplayName( - [Out(), MarshalAs(UnmanagedType.LPWStr)] StringBuilder szDisplayName, - ref uint pccDisplayName, - ASM_DISPLAY_FLAGS dwDisplayFlags); - - [PreserveSig()] - int BindToObject( - ref Guid refIID, - [MarshalAs(UnmanagedType.IUnknown)] object pUnkSink, - [MarshalAs(UnmanagedType.IUnknown)] object pUnkContext, // IApplicationContext - [MarshalAs(UnmanagedType.LPWStr)] string szCodeBase, - long llFlags, - IntPtr pvReserved, - uint cbReserved, - out IntPtr ppv); - - [PreserveSig()] - int GetName( - ref uint lpcwBuffer, - [Out(), MarshalAs(UnmanagedType.LPWStr)] StringBuilder pwzName); - - [PreserveSig()] - int GetVersion( - out uint pdwVersionHi, - out uint pdwVersionLow); - - [PreserveSig()] - int IsEqual( - IAssemblyName pName, - ASM_CMP_FLAGS dwCmpFlags); - - [PreserveSig()] - int Clone( - out IAssemblyName pName); - } - - - [ - ComImport(), - Guid("21B8916C-F28E-11D2-A473-00C04F8EF448"), - InterfaceType(ComInterfaceType.InterfaceIsIUnknown) - ] - interface IAssemblyEnum - { - [PreserveSig()] - int GetNextAssembly( - IntPtr pvReserved, - out IAssemblyName ppName, - uint dwFlags); - - [PreserveSig()] - int Reset(); - - [PreserveSig()] - int Clone( - out IAssemblyEnum ppEnum); - } - - - [ - ComImport(), - Guid("1D23DF4D-A1E2-4B8B-93D6-6EA3DC285A54"), - InterfaceType(ComInterfaceType.InterfaceIsIUnknown) - ] - interface IHistoryReader - { - [PreserveSig()] - int GetFilePath( - [Out(), MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzFilePath, - ref uint pdwSize); - - [PreserveSig()] - int GetApplicationName( - [Out(), MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzAppName, - ref uint pdwSize); - - [PreserveSig()] - int GetEXEModulePath( - [Out(), MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzExePath, - ref uint pdwSize); - - void GetNumActivations( - out uint pdwNumActivations); - - void GetActivationDate( - uint dwIdx, // One-based! - out long /* FILETIME */ pftDate); - - [PreserveSig()] - int GetRunTimeVersion( - ref long /* FILETIME */ pftActivationDate, - [Out(), MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzRunTimeVersion, - ref uint pdwSize); - - void GetNumAssemblies( - ref long /* FILETIME */ pftActivationDate, - out uint pdwNumAsms); - - void GetHistoryAssembly( - ref long /* FILETIME */ pftActivationDate, - uint dwIdx, // One-based! - [MarshalAs(UnmanagedType.IUnknown)] out object ppHistAsm); - - } - - - [ - ComImport(), - Guid("582dac66-e678-449f-aba6-6faaec8a9394"), - InterfaceType(ComInterfaceType.InterfaceIsIUnknown) - ] - interface IInstallReferenceItem - { - [PreserveSig()] - int GetReference( - out IntPtr ppRefData, // FUSION_INSTALL_REFERENCE** - uint dwFlags, - IntPtr pvReserved); - } - - - [ - ComImport(), - Guid("56b1a988-7c0c-4aa2-8639-c3eb5a90226f"), - InterfaceType(ComInterfaceType.InterfaceIsIUnknown) - ] - interface IInstallReferenceEnum - { - [PreserveSig()] - int GetNextInstallReferenceItem( - out IInstallReferenceItem ppRefItem, - uint dwFlags, - IntPtr pvReserved); - } - - - - class FusionApi - { - // Install reference scheme identifiers - public static readonly Guid FUSION_REFCOUNT_UNINSTALL_SUBKEY_GUID = new Guid("8cedc215-ac4b-488b-93c0-a50a49cb2fb8"); - public static readonly Guid FUSION_REFCOUNT_FILEPATH_GUID = new Guid("b02f9d65-fb77-4f7a-afa5-b391309f11c9"); - public static readonly Guid FUSION_REFCOUNT_OPAQUE_STRING_GUID = new Guid("2ec93463-b0c3-45e1-8364-327e96aea856"); - public static readonly Guid FUSION_REFCOUNT_MSI_GUID = new Guid("25df0fc1-7f97-4070-add7-4b13bbfd7cb8"); - - const uint IASSEMBLYCACHE_INSTALL_FLAG_REFRESH = 0x00000001; - const uint IASSEMBLYCACHE_INSTALL_FLAG_FORCE_REFRESH = 0x00000002; - - const uint IASSEMBLYCACHE_UNINSTALL_DISPOSITION_UNINSTALLED = 1; - const uint IASSEMBLYCACHE_UNINSTALL_DISPOSITION_STILL_IN_USE = 2; - const uint IASSEMBLYCACHE_UNINSTALL_DISPOSITION_ALREADY_UNINSTALLED = 3; - const uint IASSEMBLYCACHE_UNINSTALL_DISPOSITION_DELETE_PENDING = 4; - const uint IASSEMBLYCACHE_UNINSTALL_DISPOSITION_HAS_INSTALL_REFERENCES = 5; - const uint IASSEMBLYCACHE_UNINSTALL_DISPOSITION_REFERENCE_NOT_FOUND = 6; - - - [DllImport("fusion.dll", CharSet=CharSet.Unicode, PreserveSig=false)] - public static extern void GetCachePath( - ASM_CACHE_FLAGS dwCacheFlags, - [MarshalAs(UnmanagedType.LPWStr)] StringBuilder pwzCachePath, - ref uint pcchPath); - - [DllImport("fusion.dll", PreserveSig=false)] - public static extern void CreateAssemblyCache( - out IAssemblyCache ppAsmCache, - uint dwReserved); - - [DllImport("fusion.dll", PreserveSig=false)] - public static extern void CreateAssemblyEnum( - out IAssemblyEnum ppEnum, - IntPtr pUnkReserved, - IAssemblyName pName, - ASM_CACHE_FLAGS dwFlags, - IntPtr pvReserved); - - [DllImport("fusion.dll", CharSet=CharSet.Unicode, PreserveSig=false)] - public static extern void CreateAssemblyNameObject( - out IAssemblyName ppName, - string szAssemblyName, - uint dwFlags, - IntPtr pvReserved); - - [DllImport("fusion.dll", PreserveSig=false)] - public static extern void CreateInstallReferenceEnum( - out IInstallReferenceEnum ppRefEnum, - IAssemblyName pName, - uint dwFlags, - IntPtr pvReserved); - - - [DllImport("fusion.dll", CharSet=CharSet.Unicode, PreserveSig=false)] - public static extern void CreateHistoryReader( - string wzFilePath, - out IHistoryReader ppHistReader); - - // Retrieves the path of the ApplicationHistory folder, typically - // Documents and Settings\\Local Settings\Application Data\ApplicationHistory - // containing .ini files that can be read with IHistoryReader. - // pwdSize appears to be the offset of the last backslash in the returned - // string after the call. - [DllImport("fusion.dll", CharSet=CharSet.Unicode, PreserveSig=false)] - public static extern void GetHistoryFileDirectory( - [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzDir, - ref uint pdwSize); - - [DllImport("fusion.dll", CharSet=CharSet.Unicode, PreserveSig=false)] - public static extern void LookupHistoryAssembly( - string pwzFilePath, - ref FILETIME pftActivationDate, - string pwzAsmName, - string pwzPublicKeyToken, - string wzCulture, - string pwzVerRef, - out IntPtr pHistAsm); // IHistoryAssembly - - [DllImport("fusion.dll", PreserveSig=false)] - public static extern void NukeDownloadedCache(); - - [DllImport("fusion.dll", PreserveSig=false)] - public static extern void CreateApplicationContext( - IAssemblyName pName, - out IntPtr ppCtx); // IApplicationContext - - - // - // Brings up the .NET Applicaion Restore wizard - // Returns S_OK, 0x80131075 (App not run) or 0x80131087 (Fix failed) - // - [DllImport("shfusion.dll", CharSet=CharSet.Unicode)] - public static extern uint PolicyManager( - IntPtr hWndParent, - string pwzFullyQualifiedAppPath, - string pwzAppName, - int dwFlags); - - } -} diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/AssemblyMetaData.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/AssemblyMetaData.cs deleted file mode 100644 index 49436f90c1..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/AssemblyMetaData.cs +++ /dev/null @@ -1,118 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - -using System; -using System.IO; -using ICSharpCode.SharpAssembly.PE; - -namespace ICSharpCode.SharpAssembly.Metadata -{ - - public class AssemblyMetadata - { - const uint MAGIC_SIGN = 0x424A5342; - ushort majorVersion; - ushort minorVersion; - uint reserved; - uint length; - string versionString; - ushort flags; - ushort numerOfStreams; - - StreamHeader[] streamHeaders; - - public ushort MajorVersion { - get { - return majorVersion; - } - set { - majorVersion = value; - } - } - public ushort MinorVersion { - get { - return minorVersion; - } - set { - minorVersion = value; - } - } - public uint Reserved { - get { - return reserved; - } - set { - reserved = value; - } - } - public uint Length { - get { - return length; - } - set { - length = value; - } - } - public string VersionString { - get { - return versionString; - } - set { - versionString = value; - } - } - public ushort Flags { - get { - return flags; - } - set { - flags = value; - } - } - public ushort NumerOfStreams { - get { - return numerOfStreams; - } - set { - numerOfStreams = value; - } - } - public StreamHeader[] StreamHeaders { - get { - return streamHeaders; - } - set { - streamHeaders = value; - } - } - - - public void LoadFrom(BinaryReader binaryReader) - { - uint signature = binaryReader.ReadUInt32(); - if (signature != MAGIC_SIGN) { - Console.WriteLine("WARNING signature != MAGIC_SIGN "); - } - - majorVersion = binaryReader.ReadUInt16(); - minorVersion = binaryReader.ReadUInt16(); - reserved = binaryReader.ReadUInt32(); - length = binaryReader.ReadUInt32(); - byte[] versionStringBytes = new byte[length]; - binaryReader.Read(versionStringBytes, 0, (int)length); - versionString = System.Text.Encoding.UTF8.GetString(versionStringBytes); - flags = binaryReader.ReadUInt16(); - numerOfStreams = binaryReader.ReadUInt16(); - streamHeaders = new StreamHeader[numerOfStreams]; - for (int i = 0; i < numerOfStreams; ++i) { - streamHeaders[i] = new StreamHeader(); - streamHeaders[i].LoadFrom(binaryReader); - } - - } - } -} diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/MetadataTable.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/MetadataTable.cs deleted file mode 100644 index d645f5b2da..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/MetadataTable.cs +++ /dev/null @@ -1,236 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - -using System; -using System.Reflection; -using System.Collections; -using System.IO; -using ICSharpCode.SharpAssembly.Metadata.Rows; -using MDRows = ICSharpCode.SharpAssembly.Metadata.Rows; - -namespace ICSharpCode.SharpAssembly.Metadata -{ - - public class MetadataTable - { - uint reserved; - byte majorVersion; - byte minorVersion; - byte heapSizes; - ulong valid; - ulong sorted; - uint[] rows; - - Hashtable tableIndices = new Hashtable(); - Hashtable tables = new Hashtable(); - - // map TABLE_ID to index in rows - public Hashtable TableIndices { - get { - return tableIndices; - } - } - - public Hashtable Tables { - get { - return tables; - } - } - - public uint Reserved { - get { - return reserved; - } - set { - reserved = value; - } - } - public byte MajorVersion { - get { - return majorVersion; - } - set { - majorVersion = value; - } - } - public byte MinorVersion { - get { - return minorVersion; - } - set { - minorVersion = value; - } - } - public byte HeapSizes { - get { - return heapSizes; - } - set { - heapSizes = value; - } - } - public ulong Valid { - get { - return valid; - } - set { - valid = value; - } - } - public ulong Sorted { - get { - return sorted; - } - set { - sorted = value; - } - } - public uint[] Rows { - get { - return rows; - } - set { - rows = value; - } - } - - public bool FourByteStringIndices { - get { - return (heapSizes & 1) == 1; - } - } - public bool FourByteGUIDIndices { - get { - return (heapSizes & 2) == 2; - } - } - public bool FourByteBlobIndices { - get { - return (heapSizes & 4) == 4; - } - } - - public AbstractRow[] LoadTable(BinaryReader binaryReader, Type tableType, uint count) - { - // rows start at 1, as the indices in the metadata do - AbstractRow[] array = (AbstractRow[])Array.CreateInstance(tableType, count+1); - for (int i = 1; i <= count; ++i) { - array[i] = (AbstractRow)tableType.Assembly.CreateInstance(tableType.FullName); - array[i].BinaryReader = binaryReader; - array[i].MetadataTable = this; - array[i].LoadRow(); - } - return array; - } - - public uint GetRowCount(int tableID) - { - object index = tableIndices[tableID]; - if (index is uint) { - return rows[(uint)index]; - } - return 0; - } - - public uint GetMultipleRowCount(params int[] tableID) - { - uint count = 0; - foreach (int id in tableID) { - object index = tableIndices[id]; - if (index != null) { - count += rows[(uint)index]; - } - } - return count; - } - - public uint GetMaxRowCount(params int[] tableID) - { - uint maxcount = 0; - foreach (int id in tableID) { - object index = tableIndices[id]; - if (index is uint) { - uint count = rows[(uint)index]; - if (count > maxcount) maxcount = count; - } - } - return maxcount; - } - - static int GetTableID(Type type) - { - return (int)type.InvokeMember("TABLE_ID", - BindingFlags.Static | - BindingFlags.Public | - BindingFlags.Instance | - BindingFlags.GetField, null, null, null); - } - - public void LoadFrom(BinaryReader binaryReader) - { - reserved = binaryReader.ReadUInt32(); - majorVersion = binaryReader.ReadByte(); - minorVersion = binaryReader.ReadByte(); - heapSizes = binaryReader.ReadByte(); - reserved = binaryReader.ReadByte(); - valid = binaryReader.ReadUInt64(); - sorted = binaryReader.ReadUInt64(); - rows = new uint[CalculateNumberOfRows()]; - for (int i = 0; i < rows.Length; ++i) { - rows[i] = binaryReader.ReadUInt32(); - } - - ArrayList types = new ArrayList(); -// ArrayList allTypes = new ArrayList(); - foreach (Type type in typeof(AbstractRow).Assembly.GetTypes()) { - if (type.IsSubclassOf(typeof(AbstractRow))) { -// allTypes.Add(type); - ulong tableBit = (ulong)1 << GetTableID(type); - if ((valid & tableBit) == tableBit) { - types.Add(type); - } - } - } -// allTypes.Sort(new TypeComparer()); -// foreach (Type type in allTypes) { -// Console.WriteLine(GetTableID(type) + " -- " + type.Name); -// } - - types.Sort(new TypeComparer()); - - for (int i = 0; i < types.Count; ++i) { - tableIndices[GetTableID((Type)types[i])] = (uint)i; - } - - foreach (Type type in types) { - int id = GetTableID(type); - Tables[id] = LoadTable(binaryReader, type, rows[(uint)tableIndices[id]]); - } - } - - int CalculateNumberOfRows() - { - int rows = 0; - ulong v = valid; - for (int i = 0; i < 64; ++i) { - rows += (int)(v & 1); - v /= 2; - } - return rows; - } - - class TypeComparer : IComparer - { - public int Compare(object o1, object o2) - { - return GetTableID((Type)o1).CompareTo(GetTableID((Type)o2)); - } - } - - - } -} diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/MethodBody.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/MethodBody.cs deleted file mode 100644 index 756fc5ae5f..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/MethodBody.cs +++ /dev/null @@ -1,107 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - -using System; -using System.IO; - -namespace ICSharpCode.SharpAssembly.Metadata.Rows -{ - - public class MethodBody - { - public const byte CorILMethod_Fat = 0x3; - public const byte CorILMethod_TinyFormat = 0x2; - public const byte CorILMethod_MoreSects = 0x8; - public const byte CorILMethod_InitLocals = 0x10; - - uint flags = 0; - uint headerSize = 0; - ushort maxStack = 8; - uint codeSize = 0; - uint localVarSigTok = 0; - - byte[] methodData; - - public uint Flags { - get { - return flags; - } - set { - flags = value; - } - } - public uint HeaderSize { - get { - return headerSize; - } - set { - headerSize = value; - } - } - public ushort MaxStack { - get { - return maxStack; - } - set { - maxStack = value; - } - } - public uint CodeSize { - get { - return codeSize; - } - set { - codeSize = value; - } - } - public uint LocalVarSigTok { - get { - return localVarSigTok; - } - set { - localVarSigTok = value; - } - } - public byte[] MethodData { - get { - return methodData; - } - set { - methodData = value; - } - } - - - public void Load(BinaryReader reader) - { - byte flagByte = reader.ReadByte(); - Console.Write("flagByte : " + flagByte.ToString("X")); - - switch (flagByte & 0x03) { - case CorILMethod_Fat: - byte nextByte = reader.ReadByte(); - Console.WriteLine(" nextByte : " + nextByte.ToString("X")); - - flags = (uint)(flagByte & ((nextByte & 0x0F) << 8)); - headerSize = (uint)(nextByte >> 4); - maxStack = reader.ReadUInt16(); - codeSize = reader.ReadUInt32(); - localVarSigTok = reader.ReadUInt32(); - // TODO : CorILMethod_MoreSects - break; - case CorILMethod_TinyFormat: - flags = (uint)flagByte & 0x03; - codeSize = (uint)flagByte >> 2; - break; - default: - throw new System.NotSupportedException("not supported method body flag " + flagByte); - } - methodData = new byte[codeSize]; - reader.Read(methodData, 0, (int)codeSize); - } - } -} diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/AbstractRow.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/AbstractRow.cs deleted file mode 100644 index 7d9b53e5db..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/AbstractRow.cs +++ /dev/null @@ -1,148 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - -using System; -using System.IO; - -namespace ICSharpCode.SharpAssembly.Metadata.Rows { - - public abstract class AbstractRow - { - protected BinaryReader binaryReader; - protected MetadataTable metadataTable; - - public BinaryReader BinaryReader { - get { - return binaryReader; - } - set { - binaryReader = value; - } - } - - public MetadataTable MetadataTable { - get { - return metadataTable; - } - set { - metadataTable = value; - } - } - - protected bool BaseIsFlagSet(uint flags, uint flag, uint flag_mask) - { - return ((flags & flag_mask) == flag); - } - - protected bool BaseIsFlagSet(uint flags, uint flag) - { - return ((flags & flag) == flag); - } - - protected uint ReadCodedIndex(CodedIndex codedIndex) - { - uint number = 0; - int bits = 0; - switch (codedIndex) { - case CodedIndex.TypeDefOrRef: - number = metadataTable.GetMaxRowCount(TypeDef.TABLE_ID, TypeRef.TABLE_ID, TypeSpec.TABLE_ID); - bits = 2; - break; - case CodedIndex.HasConstant: - number = metadataTable.GetMaxRowCount(Field.TABLE_ID, Param.TABLE_ID, Property.TABLE_ID); - bits = 2; - break; - case CodedIndex.HasCustomAttribute: - number = metadataTable.GetMaxRowCount(Method.TABLE_ID, Field.TABLE_ID, TypeRef.TABLE_ID, - TypeDef.TABLE_ID, Param.TABLE_ID, InterfaceImpl.TABLE_ID, - MemberRef.TABLE_ID, Module.TABLE_ID, DeclSecurity.TABLE_ID, - Property.TABLE_ID, Event.TABLE_ID, StandAloneSig.TABLE_ID, - ModuleRef.TABLE_ID, TypeSpec.TABLE_ID, Assembly.TABLE_ID, - AssemblyRef.TABLE_ID, File.TABLE_ID, ExportedType.TABLE_ID, - ManifestResource.TABLE_ID); - bits = 5; - break; - case CodedIndex.HasFieldMarshall: - number = metadataTable.GetMaxRowCount(Field.TABLE_ID, Param.TABLE_ID); - bits = 1; - break; - case CodedIndex.HasDeclSecurity: - number = metadataTable.GetMaxRowCount(TypeDef.TABLE_ID, Method.TABLE_ID, Assembly.TABLE_ID); - bits = 2; - break; - case CodedIndex.MemberRefParent: - number = metadataTable.GetMaxRowCount(TypeDef.TABLE_ID, TypeRef.TABLE_ID, ModuleRef.TABLE_ID, Method.TABLE_ID, TypeSpec.TABLE_ID); - bits = 3; - break; - case CodedIndex.HasSemantics: - number = metadataTable.GetMaxRowCount(Event.TABLE_ID, Property.TABLE_ID); - bits = 1; - break; - case CodedIndex.MethodDefOrRef: - number = metadataTable.GetMaxRowCount(Method.TABLE_ID, MemberRef.TABLE_ID); - bits = 1; - break; - case CodedIndex.MemberForwarded: - number = metadataTable.GetMaxRowCount(Field.TABLE_ID, Method.TABLE_ID); - bits = 1; - break; - case CodedIndex.Implementation: - number = metadataTable.GetMaxRowCount(File.TABLE_ID, AssemblyRef.TABLE_ID, ExportedType.TABLE_ID); - bits = 2; - break; - case CodedIndex.CustomAttributeType: - //number = metadataTable.GetMaxRowCount(TypeRef.TABLE_ID, TypeDef.TABLE_ID, Method.TABLE_ID, MemberRef.TABLE_ID/* TODO : , String ? */); - number = metadataTable.GetMaxRowCount(Method.TABLE_ID, MemberRef.TABLE_ID); - bits = 3; - break; - case CodedIndex.ResolutionScope: - number = metadataTable.GetMaxRowCount(Module.TABLE_ID, ModuleRef.TABLE_ID, AssemblyRef.TABLE_ID, TypeRef.TABLE_ID); - bits = 2; - break; - } - if (number > 1 << (16 - bits)) { - return binaryReader.ReadUInt32(); - } - return binaryReader.ReadUInt16(); - } - - protected uint ReadSimpleIndex(int tableID) - { - uint rowCount = metadataTable.GetRowCount(tableID); - if (rowCount >= (1 << 16)) { - return binaryReader.ReadUInt32(); - } - return binaryReader.ReadUInt16(); - } - - protected uint LoadStringIndex() - { - if (metadataTable.FourByteStringIndices) { - return binaryReader.ReadUInt32(); - } - return binaryReader.ReadUInt16(); - } - - protected uint LoadBlobIndex() - { - if (metadataTable.FourByteBlobIndices) { - return binaryReader.ReadUInt32(); - } - return binaryReader.ReadUInt16(); - } - - protected uint LoadGUIDIndex() - { - if (metadataTable.FourByteGUIDIndices) { - return binaryReader.ReadUInt32(); - } - return binaryReader.ReadUInt16(); - } - - public abstract void LoadRow(); - } -} diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/Assembly.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/Assembly.cs deleted file mode 100644 index 0c71f7c530..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/Assembly.cs +++ /dev/null @@ -1,114 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - -using System; -using System.IO; - -namespace ICSharpCode.SharpAssembly.Metadata.Rows { - - public class Assembly : AbstractRow - { - public static readonly int TABLE_ID = 0x20; - - uint hashAlgID; - ushort majorVersion; - ushort minorVersion; - ushort buildNumber; - ushort revisionNumber; - uint flags; - - uint publicKey; // index into the BLOB heap - uint name; // index into the string heap - uint culture; // index into the string heap - - public uint HashAlgID { - get { - return hashAlgID; - } - set { - hashAlgID = value; - } - } - public ushort MajorVersion { - get { - return majorVersion; - } - set { - majorVersion = value; - } - } - public ushort MinorVersion { - get { - return minorVersion; - } - set { - minorVersion = value; - } - } - public ushort BuildNumber { - get { - return buildNumber; - } - set { - buildNumber = value; - } - } - public ushort RevisionNumber { - get { - return revisionNumber; - } - set { - revisionNumber = value; - } - } - public uint Flags { - get { - return flags; - } - set { - flags = value; - } - } - public uint PublicKey { - get { - return publicKey; - } - set { - publicKey = value; - } - } - public uint Name { - get { - return name; - } - set { - name = value; - } - } - public uint Culture { - get { - return culture; - } - set { - culture = value; - } - } - - public override void LoadRow() - { - hashAlgID = binaryReader.ReadUInt32(); - majorVersion = binaryReader.ReadUInt16(); - minorVersion = binaryReader.ReadUInt16(); - buildNumber = binaryReader.ReadUInt16(); - revisionNumber = binaryReader.ReadUInt16(); - flags = binaryReader.ReadUInt32(); - publicKey = LoadBlobIndex(); - name = LoadStringIndex(); - culture = LoadStringIndex(); - } - } -} diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/AssemblyOS.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/AssemblyOS.cs deleted file mode 100644 index 52b07f471a..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/AssemblyOS.cs +++ /dev/null @@ -1,55 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - -using System; -using System.IO; - -namespace ICSharpCode.SharpAssembly.Metadata.Rows { - - public class AssemblyOS : AbstractRow - { - public static readonly int TABLE_ID = 0x22; - - - uint osPlatformID; - uint osMajorVersion; - uint osMinorVersion; - - public uint OSPlatformID { - get { - return osPlatformID; - } - set { - osPlatformID = value; - } - } - public uint OSMajorVersion { - get { - return osMajorVersion; - } - set { - osMajorVersion = value; - } - } - public uint OSMinorVersion { - get { - return osMinorVersion; - } - set { - osMinorVersion = value; - } - } - - - public override void LoadRow() - { - osPlatformID = binaryReader.ReadUInt32(); - osMajorVersion = binaryReader.ReadUInt32(); - osMinorVersion = binaryReader.ReadUInt32(); - } - } -} diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/AssemblyProcessor.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/AssemblyProcessor.cs deleted file mode 100644 index cb27adb345..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/AssemblyProcessor.cs +++ /dev/null @@ -1,33 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - -using System; -using System.IO; - -namespace ICSharpCode.SharpAssembly.Metadata.Rows { - - public class AssemblyProcessor : AbstractRow - { - public static readonly int TABLE_ID = 0x21; - - uint processor; - - public uint Processor { - get { - return processor; - } - set { - processor = value; - } - } - - public override void LoadRow() - { - processor = binaryReader.ReadUInt32(); - } - } -} diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/AssemblyRef.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/AssemblyRef.cs deleted file mode 100644 index e19373c5b5..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/AssemblyRef.cs +++ /dev/null @@ -1,116 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - -using System; -using System.IO; - -namespace ICSharpCode.SharpAssembly.Metadata.Rows { - - public class AssemblyRef : AbstractRow - { - public static readonly int TABLE_ID = 0x23; - - ushort major; - ushort minor; - ushort build; - ushort revision; - uint flags; - uint publicKeyOrToken; // index into Blob heap - uint name; // index into String heap - uint culture; // index into String heap - uint hashValue; // index into Blob heap - - public ushort Major { - get { - return major; - } - set { - major = value; - } - } - public ushort Minor { - get { - return minor; - } - set { - minor = value; - } - } - - public ushort Build { - get { - return build; - } - set { - build = value; - } - } - - public ushort Revision { - get { - return revision; - } - set { - revision = value; - } - } - - public uint Flags { - get { - return flags; - } - set { - flags = value; - } - } - public uint PublicKeyOrToken { - get { - return publicKeyOrToken; - } - set { - publicKeyOrToken = value; - } - } - public uint Name { - get { - return name; - } - set { - name = value; - } - } - public uint Culture { - get { - return culture; - } - set { - culture = value; - } - } - public uint HashValue { - get { - return hashValue; - } - set { - hashValue = value; - } - } - - public override void LoadRow() - { - major = binaryReader.ReadUInt16(); - minor = binaryReader.ReadUInt16(); - build = binaryReader.ReadUInt16(); - revision = binaryReader.ReadUInt16(); - flags = binaryReader.ReadUInt32(); - publicKeyOrToken = LoadBlobIndex(); - name = LoadStringIndex(); - culture = LoadStringIndex(); - hashValue = LoadBlobIndex(); - } - } -} diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/AssemblyRefOS.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/AssemblyRefOS.cs deleted file mode 100644 index a925e93b4b..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/AssemblyRefOS.cs +++ /dev/null @@ -1,63 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - -using System; -using System.IO; - -namespace ICSharpCode.SharpAssembly.Metadata.Rows { - - public class AssemblyRefOS : AbstractRow - { - public static readonly int TABLE_ID = 0x25; - - uint osPlatformID; - uint osMajorVersion; - uint osMinorVersion; - uint assemblyRefIndex; // index into the AssemblyRef table - - public uint OSPlatformID { - get { - return osPlatformID; - } - set { - osPlatformID = value; - } - } - public uint OSMajorVersion { - get { - return osMajorVersion; - } - set { - osMajorVersion = value; - } - } - public uint OSMinorVersion { - get { - return osMinorVersion; - } - set { - osMinorVersion = value; - } - } - public uint AssemblyRefIndex { - get { - return assemblyRefIndex; - } - set { - assemblyRefIndex = value; - } - } - - public override void LoadRow() - { - osPlatformID = binaryReader.ReadUInt32(); - osMajorVersion = binaryReader.ReadUInt32(); - osMinorVersion = binaryReader.ReadUInt32(); - assemblyRefIndex = ReadSimpleIndex(AssemblyRef.TABLE_ID); - } - } -} diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/AssemblyRefProcessor.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/AssemblyRefProcessor.cs deleted file mode 100644 index def376f222..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/AssemblyRefProcessor.cs +++ /dev/null @@ -1,43 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - -using System; -using System.IO; - -namespace ICSharpCode.SharpAssembly.Metadata.Rows { - - public class AssemblyRefProcessor : AbstractRow - { - public static readonly int TABLE_ID = 0x24; - - uint processor; - uint assemblyRefIndex; // index into the AssemblyRef table - - public uint Processor { - get { - return processor; - } - set { - processor = value; - } - } - public uint AssemblyRefIndex { - get { - return assemblyRefIndex; - } - set { - assemblyRefIndex = value; - } - } - - public override void LoadRow() - { - processor = binaryReader.ReadUInt32(); - assemblyRefIndex = ReadSimpleIndex(AssemblyRef.TABLE_ID); - } - } -} diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/ClassLayout.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/ClassLayout.cs deleted file mode 100644 index 947a409435..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/ClassLayout.cs +++ /dev/null @@ -1,54 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - -using System; -using System.IO; - -namespace ICSharpCode.SharpAssembly.Metadata.Rows { - - public class ClassLayout : AbstractRow - { - public static readonly int TABLE_ID = 0x0F; - - ushort packingSize; - uint classSize; - uint parent; // index into TypeDef table - - public ushort PackingSize { - get { - return packingSize; - } - set { - packingSize = value; - } - } - public uint ClassSize { - get { - return classSize; - } - set { - classSize = value; - } - } - public uint Parent { - get { - return parent; - } - set { - parent = value; - } - } - - - public override void LoadRow() - { - packingSize = binaryReader.ReadUInt16(); - classSize = binaryReader.ReadUInt32(); - parent = ReadSimpleIndex(TypeDef.TABLE_ID); - } - } -} diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/CodedIndex.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/CodedIndex.cs deleted file mode 100644 index c2fe7de8ab..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/CodedIndex.cs +++ /dev/null @@ -1,24 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - -namespace ICSharpCode.SharpAssembly.Metadata.Rows { - - public enum CodedIndex { - TypeDefOrRef, - HasConstant, - HasCustomAttribute, - HasFieldMarshall, - HasDeclSecurity, - MemberRefParent, - HasSemantics, - MethodDefOrRef, - MemberForwarded, - Implementation, - CustomAttributeType, - ResolutionScope - } -} diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/Constant.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/Constant.cs deleted file mode 100644 index 3e34ef2d30..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/Constant.cs +++ /dev/null @@ -1,57 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - -using System; -using System.IO; - -namespace ICSharpCode.SharpAssembly.Metadata.Rows { - - public class Constant : AbstractRow - { - public static readonly int TABLE_ID = 0x0B; - - byte type; // a 1 byte constant, followed by a 1-byte padding zero - uint parent; // index into the Param or Field or Property table; more precisely, a HasConst coded index - uint val; // index into Blob heap - - public byte Type { - get { - return type; - } - set { - type = value; - } - } - public uint Parent { - get { - return parent; - } - set { - parent = value; - } - } - public uint Val { - get { - return val; - } - set { - val = value; - } - } - - public override void LoadRow() - { - type = binaryReader.ReadByte(); - byte paddingZero = binaryReader.ReadByte(); -// if (paddingZero != 0) { -// Console.WriteLine("padding zero != 0"); -// } - parent = ReadCodedIndex(CodedIndex.HasConstant); - val = LoadBlobIndex(); - } - } -} diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/CustomAttribute.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/CustomAttribute.cs deleted file mode 100644 index c29e9ab1c8..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/CustomAttribute.cs +++ /dev/null @@ -1,55 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - -using System; -using System.IO; - -namespace ICSharpCode.SharpAssembly.Metadata.Rows { - - public class CustomAttribute : AbstractRow - { - public static readonly int TABLE_ID = 0x0C; - - uint parent; // index into any metadata table, except the CustomAttribute table itself; more precisely, a HasCustomAttribute coded index - uint type; // index into the Method or MemberRef table; more precisely, a CustomAttributeType coded index - uint val; // index into Blob heap - - public uint Parent { - get { - return parent; - } - set { - parent = value; - } - } - - public uint Type { - get { - return type; - } - set { - type = value; - } - } - - public uint Val { - get { - return val; - } - set { - val = value; - } - } - - public override void LoadRow() - { - parent = ReadCodedIndex(CodedIndex.HasCustomAttribute); - type = ReadCodedIndex(CodedIndex.CustomAttributeType); - val = LoadBlobIndex(); - } - } -} diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/DeclSecurity.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/DeclSecurity.cs deleted file mode 100644 index 02e064a674..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/DeclSecurity.cs +++ /dev/null @@ -1,54 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - -using System; -using System.IO; - -namespace ICSharpCode.SharpAssembly.Metadata.Rows { - - public class DeclSecurity : AbstractRow - { - public static readonly int TABLE_ID = 0x0E; - - - ushort action; - uint parent; // index into the TypeDef, Method or Assembly table; more precisely, a HasDeclSecurity coded index - uint permissionSet; // index into Blob heap - - public ushort Action { - get { - return action; - } - set { - action = value; - } - } - public uint Parent { - get { - return parent; - } - set { - parent = value; - } - } - public uint PermissionSet { - get { - return permissionSet; - } - set { - permissionSet = value; - } - } - - public override void LoadRow() - { - action = binaryReader.ReadUInt16(); - parent = ReadCodedIndex(CodedIndex.HasDeclSecurity); - permissionSet = LoadBlobIndex(); - } - } -} diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/ENCLog.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/ENCLog.cs deleted file mode 100644 index 9ac75dd21d..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/ENCLog.cs +++ /dev/null @@ -1,43 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - -using System; -using System.IO; - -namespace ICSharpCode.SharpAssembly.Metadata.Rows { - - public class ENCLog : AbstractRow - { - public static readonly int TABLE_ID = 0x1E; - - uint token; - uint funcCode; - - public uint Token { - get { - return token; - } - set { - token = value; - } - } - public uint FuncCode { - get { - return funcCode; - } - set { - funcCode = value; - } - } - - public override void LoadRow() - { - token = binaryReader.ReadUInt32(); - funcCode = binaryReader.ReadUInt32(); - } - } -} diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/ENCMap.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/ENCMap.cs deleted file mode 100644 index 2137a7e7c0..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/ENCMap.cs +++ /dev/null @@ -1,33 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - -using System; -using System.IO; - -namespace ICSharpCode.SharpAssembly.Metadata.Rows { - - public class ENCMap : AbstractRow - { - public static readonly int TABLE_ID = 0x1F; - - uint token; - - public uint Token { - get { - return token; - } - set { - token = value; - } - } - - public override void LoadRow() - { - token = binaryReader.ReadUInt32(); - } - } -} diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/Event.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/Event.cs deleted file mode 100644 index 18b5a74b95..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/Event.cs +++ /dev/null @@ -1,57 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - -using System; -using System.IO; - -namespace ICSharpCode.SharpAssembly.Metadata.Rows { - - public class Event : AbstractRow - { - public static readonly int TABLE_ID = 0x14; - - public static readonly ushort FLAG_SPECIALNAME = 0x0200; - public static readonly ushort FLAG_RTSPECIALNAME = 0x0400; - - ushort eventFlags; - uint name; // index into String heap - uint eventType; // index into TypeDef, TypeRef or TypeSpec tables; more precisely, a TypeDefOrRef coded index - - public ushort EventFlags { - get { - return eventFlags; - } - set { - eventFlags = value; - } - } - - public uint Name { - get { - return name; - } - set { - name = value; - } - } - public uint EventType { - get { - return eventType; - } - set { - eventType = value; - } - } - - public override void LoadRow() - { - eventFlags = binaryReader.ReadUInt16(); - name = LoadStringIndex(); - eventType = ReadCodedIndex(CodedIndex.TypeDefOrRef); - } - } -} diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/EventMap.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/EventMap.cs deleted file mode 100644 index f06114cfd8..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/EventMap.cs +++ /dev/null @@ -1,44 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - - -using System; -using System.IO; - -namespace ICSharpCode.SharpAssembly.Metadata.Rows { - - public class EventMap : AbstractRow - { - public static readonly int TABLE_ID = 0x12; - - uint parent; // index into the TypeDef table - uint eventList; // index into Event table - - public uint Parent { - get { - return parent; - } - set { - parent = value; - } - } - public uint EventList { - get { - return eventList; - } - set { - eventList = value; - } - } - - public override void LoadRow() - { - parent = ReadSimpleIndex(TypeDef.TABLE_ID); - eventList = ReadSimpleIndex(Event.TABLE_ID); - } - } -} diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/EventPtr.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/EventPtr.cs deleted file mode 100644 index 5bf287a673..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/EventPtr.cs +++ /dev/null @@ -1,33 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - -using System; -using System.IO; - -namespace ICSharpCode.SharpAssembly.Metadata.Rows { - - public class EventPtr : AbstractRow - { - public static readonly int TABLE_ID = 19; - - uint eventPtr; - - public uint Event { - get { - return eventPtr; - } - set { - eventPtr = value; - } - } - - public override void LoadRow() - { - eventPtr = ReadSimpleIndex(ICSharpCode.SharpAssembly.Metadata.Rows.Event.TABLE_ID); - } - } -} diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/ExportedType.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/ExportedType.cs deleted file mode 100644 index c07472155e..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/ExportedType.cs +++ /dev/null @@ -1,76 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - -using System; -using System.IO; - -namespace ICSharpCode.SharpAssembly.Metadata.Rows { - - public class ExportedType : AbstractRow - { - public static readonly int TABLE_ID = 0x27; - - uint flags; - uint typeDefId; // 4 byte index into a TypeDef table of another module in this Assembly - uint typeName; // index into the String heap - uint typeNamespace; // index into the String heap - uint implementation; // index see 21.14 - - public uint Flags { - get { - return flags; - } - set { - flags = value; - } - } - public uint TypeDefId { - get { - return typeDefId; - } - set { - typeDefId = value; - } - } - public uint TypeName { - get { - return typeName; - } - set { - typeName = value; - } - } - public uint TypeNamespace { - get { - return typeNamespace; - } - set { - typeNamespace = value; - } - } - public uint Implementation { - get { - return implementation; - } - set { - implementation = value; - } - } - - - public override void LoadRow() - { - flags = binaryReader.ReadUInt32(); - typeDefId = binaryReader.ReadUInt32(); - typeName = LoadStringIndex(); - typeNamespace = LoadStringIndex(); - - // todo 32 bit indices ? - implementation = binaryReader.ReadUInt16(); - } - } -} diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/Field.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/Field.cs deleted file mode 100644 index ec55a420fe..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/Field.cs +++ /dev/null @@ -1,84 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - -using System; -using System.IO; - -namespace ICSharpCode.SharpAssembly.Metadata.Rows { - - public class Field : AbstractRow - { - public static readonly int TABLE_ID = 0x04; - - public static readonly ushort FLAG_FIELDACCESSMASK = 0x0007; - public static readonly ushort FLAG_COMPILERCONTROLLED = 0x0000; - public static readonly ushort FLAG_PRIVATE = 0x0001; - public static readonly ushort FLAG_FAMANDASSEM = 0x0002; - public static readonly ushort FLAG_ASSEMBLY = 0x0003; - public static readonly ushort FLAG_FAMILY = 0x0004; - public static readonly ushort FLAG_FAMORASSEM = 0x0005; - public static readonly ushort FLAG_PUBLIC = 0x0006; - public static readonly ushort FLAG_STATIC = 0x0010; - public static readonly ushort FLAG_INITONLY = 0x0020; - public static readonly ushort FLAG_LITERAL = 0x0040; - public static readonly ushort FLAG_NOTSERIALIZED = 0x0080; - public static readonly ushort FLAG_SPECIALNAME = 0x0200; - public static readonly ushort FLAG_PINVOKEIMPL = 0x2000; - public static readonly ushort FLAG_RTSPECIALNAME = 0x0400; - public static readonly ushort FLAG_HASFIELDMARSHAL = 0x1000; - public static readonly ushort FLAG_HASDEFAULT = 0x8000; - public static readonly ushort FLAG_HASFIELDRVA = 0x0100; - - ushort flags; - uint name; // index into String heap - uint signature; // index into Blob heap - - public ushort Flags { - get { - return flags; - } - set { - flags = value; - } - } - - public uint Name { - get { - return name; - } - set { - name = value; - } - } - - public uint Signature { - get { - return signature; - } - set { - signature = value; - } - } - - public bool IsFlagSet(uint flag) - { - return base.BaseIsFlagSet(this.flags, flag); - } - - public bool IsMaskedFlagSet(uint flag, uint flag_mask) - { - return base.BaseIsFlagSet(this.flags, flag, flag_mask); - } - - public override void LoadRow() - { - flags = binaryReader.ReadUInt16(); - name = LoadStringIndex(); - signature = LoadBlobIndex(); - } - } -} diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/FieldLayout.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/FieldLayout.cs deleted file mode 100644 index f688db17f2..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/FieldLayout.cs +++ /dev/null @@ -1,44 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - -using System; -using System.IO; - -namespace ICSharpCode.SharpAssembly.Metadata.Rows { - - public class FieldLayout : AbstractRow - { - public static readonly int TABLE_ID = 0x10; - - - uint offset; - uint field; // index into the field table - - public uint Offset { - get { - return offset; - } - set { - offset = value; - } - } - public uint FieldIndex { - get { - return field; - } - set { - field = value; - } - } - - public override void LoadRow() - { - offset = binaryReader.ReadUInt32(); - field = ReadSimpleIndex(Field.TABLE_ID); - } - } -} diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/FieldMarshal.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/FieldMarshal.cs deleted file mode 100644 index a6f0d42d2a..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/FieldMarshal.cs +++ /dev/null @@ -1,44 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - -using System; -using System.IO; - -namespace ICSharpCode.SharpAssembly.Metadata.Rows { - - public class FieldMarshal : AbstractRow - { - public static readonly int TABLE_ID = 0x0D; - - uint parent; // index into Field or Param table; more precisely, a HasFieldMarshal coded index - uint nativeType; // index into the Blob heap - - public uint Parent { - get { - return parent; - } - set { - parent = value; - } - - } - public uint NativeType { - get { - return nativeType; - } - set { - nativeType = value; - } - } - - public override void LoadRow() - { - parent = ReadCodedIndex(CodedIndex.HasFieldMarshall); - nativeType = LoadBlobIndex(); - } - } -} diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/FieldPtr.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/FieldPtr.cs deleted file mode 100644 index f17a276c72..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/FieldPtr.cs +++ /dev/null @@ -1,33 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - -using System; -using System.IO; - -namespace ICSharpCode.SharpAssembly.Metadata.Rows { - - public class FieldPtr : AbstractRow - { - public static readonly int TABLE_ID = 0x03; - - uint field; - - public uint Field { - get { - return field; - } - set { - field = value; - } - } - - public override void LoadRow() - { - field = ReadSimpleIndex(ICSharpCode.SharpAssembly.Metadata.Rows.Field.TABLE_ID); - } - } -} diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/FieldRVA.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/FieldRVA.cs deleted file mode 100644 index b3733e04e4..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/FieldRVA.cs +++ /dev/null @@ -1,44 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - -using System; -using System.IO; - -namespace ICSharpCode.SharpAssembly.Metadata.Rows { - - public class FieldRVA : AbstractRow - { - public static readonly int TABLE_ID = 0x1D; - - uint rva; - uint field; // index into Field table - - public uint RVA { - get { - return rva; - } - set { - rva = value; - } - } - - public uint FieldIndex { - get { - return field; - } - set { - field = value; - } - } - - public override void LoadRow() - { - rva = binaryReader.ReadUInt32(); - field = ReadSimpleIndex(Field.TABLE_ID); - } - } -} diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/File.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/File.cs deleted file mode 100644 index 3b1fbc53eb..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/File.cs +++ /dev/null @@ -1,56 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - -using System; -using System.IO; - -namespace ICSharpCode.SharpAssembly.Metadata.Rows { - - public class File : AbstractRow - { - public static readonly int TABLE_ID = 0x26; - - public static readonly uint FLAG_CONTAINSMETADATA = 0x0000; - public static readonly uint FLAG_CONTAINSNOMETADATA = 0x0001; - - uint flags; - uint name; // index into String heap - uint hashValue; // index into Blob heap - - public uint Flags { - get { - return flags; - } - set { - flags = value; - } - } - public uint Name { - get { - return name; - } - set { - name = value; - } - } - public uint HashValue { - get { - return hashValue; - } - set { - hashValue = value; - } - } - - public override void LoadRow() - { - flags = binaryReader.ReadUInt32(); - name = LoadStringIndex(); - hashValue = LoadBlobIndex(); - } - } -} diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/ImplMap.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/ImplMap.cs deleted file mode 100644 index 1dca6198a2..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/ImplMap.cs +++ /dev/null @@ -1,80 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - -using System; -using System.IO; - -namespace ICSharpCode.SharpAssembly.Metadata.Rows { - - public class ImplMap : AbstractRow - { - public static readonly int TABLE_ID = 0x1C; - - public static readonly ushort FLAG_NOMANGLE = 0x0001; - public static readonly ushort FLAG_CHARSETMASK = 0x0006; - public static readonly ushort FLAG_CHARSETNOTSPEC = 0x0000; - public static readonly ushort FLAG_CHARSETANSI = 0x0002; - public static readonly ushort FLAG_CHARSETUNICODE = 0x0004; - public static readonly ushort FLAG_CHARSETAUTO = 0x0006; - public static readonly ushort FLAG_SUPPORTSLASTERROR = 0x0040; - public static readonly ushort FLAG_CALLCONVMASK = 0x0700; - public static readonly ushort FLAG_CALLCONVWINAPI = 0x0100; - public static readonly ushort FLAG_CALLCONVCDECL = 0x0200; - public static readonly ushort FLAG_CALLCONVSTDCALL = 0x0300; - public static readonly ushort FLAG_CALLCONVTHISCALL = 0x0400; - public static readonly ushort FLAG_CALLCONVFASTCALL = 0x0500; - - ushort mappingFlags; - uint memberForwarded; // index into the Field or Method table; more precisely, a MemberForwarded coded index. - uint importName; // index into the String heap - uint importScope; // index into the ModuleRef table - - public ushort MappingFlags { - get { - return mappingFlags; - } - set { - mappingFlags = value; - } - } - - public uint MemberForwarded { - get { - return memberForwarded; - } - set { - memberForwarded = value; - } - } - - public uint ImportName { - get { - return importName; - } - set { - importName = value; - } - } - - public uint ImportScope { - get { - return importScope; - } - set { - importScope = value; - } - } - - public override void LoadRow() - { - mappingFlags = binaryReader.ReadUInt16(); - memberForwarded = ReadCodedIndex(CodedIndex.MemberForwarded); - importName = LoadStringIndex(); - importScope = ReadSimpleIndex(ModuleRef.TABLE_ID); - } - } -} diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/InterfaceImpl.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/InterfaceImpl.cs deleted file mode 100644 index 5e70e83a54..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/InterfaceImpl.cs +++ /dev/null @@ -1,45 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - -using System; -using System.IO; - -namespace ICSharpCode.SharpAssembly.Metadata.Rows { - - public class InterfaceImpl : AbstractRow - { - public static readonly int TABLE_ID = 0x09; - - uint myClass; // index into the TypeDef table - uint myInterface; // index into the TypeDef, TypeRef or TypeSpec table; more precisely, a TypeDefOrRef coded index - - public uint Class { - get { - return myClass; - } - set { - myClass = value; - } - } - - public uint Interface { - get { - return myInterface; - } - set { - myInterface = value; - } - } - - - public override void LoadRow() - { - myClass = ReadSimpleIndex(TypeDef.TABLE_ID); - myInterface = ReadCodedIndex(CodedIndex.TypeDefOrRef); - } - } -} diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/ManifestResource.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/ManifestResource.cs deleted file mode 100644 index 5f445fa931..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/ManifestResource.cs +++ /dev/null @@ -1,70 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - -using System; -using System.IO; - -namespace ICSharpCode.SharpAssembly.Metadata.Rows { - - public class ManifestResource : AbstractRow - { - public static readonly int TABLE_ID = 0x28; - - public static readonly uint FLAG_VISIBILITYMASK = 0x0007; - public static readonly uint FLAG_PUBLIC = 0x0001; - public static readonly uint FLAG_PRIVATE = 0x0002; - - uint offset; - uint flags; - uint name; // index into String heap - uint implementation; // index into File table, or AssemblyRef table, or null; more precisely, an Implementation coded index - - public uint Offset { - get { - return offset; - } - set { - offset = value; - } - } - - public uint Flags { - get { - return flags; - } - set { - flags = value; - } - } - - public uint Name { - get { - return name; - } - set { - name = value; - } - } - - public uint Implementation { - get { - return implementation; - } - set { - implementation = value; - } - } - - public override void LoadRow() - { - offset = binaryReader.ReadUInt32(); - flags = binaryReader.ReadUInt32(); - name = LoadStringIndex(); - implementation = ReadCodedIndex(CodedIndex.Implementation); - } - } -} diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/MemberRef.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/MemberRef.cs deleted file mode 100644 index 3731f8f9e4..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/MemberRef.cs +++ /dev/null @@ -1,54 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - -using System; -using System.IO; - -namespace ICSharpCode.SharpAssembly.Metadata.Rows { - - public class MemberRef : AbstractRow - { - public static readonly int TABLE_ID = 0x0A; - - uint myClass; // index into the TypeRef, ModuleRef, Method, TypeSpec or TypeDef tables; more precisely, a MemberRefParent coded index - uint name; // index into String heap - uint signature; // index into Blob heap - - public uint Class { - get { - return myClass; - } - set { - myClass = value; - } - } - public uint Name { - get { - return name; - } - set { - name = value; - } - } - public uint Signature { - get { - return signature; - } - set { - signature = value; - } - } - - - public override void LoadRow() - { - myClass = ReadCodedIndex(CodedIndex.MemberRefParent); - name = LoadStringIndex(); - signature = LoadBlobIndex(); - } - } -} diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/Method.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/Method.cs deleted file mode 100644 index ddd69b95c4..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/Method.cs +++ /dev/null @@ -1,142 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - -using System; -using System.IO; - -namespace ICSharpCode.SharpAssembly.Metadata.Rows { - - public class Method : AbstractRow - { - public static readonly int TABLE_ID = 0x06; - - public static readonly ushort FLAG_MEMBERACCESSMASK = 0X0007; - public static readonly ushort FLAG_COMPILERCONTROLLED = 0X0000; - public static readonly ushort FLAG_PRIVATE = 0X0001; - public static readonly ushort FLAG_FAMANDASSEM = 0X0002; - public static readonly ushort FLAG_ASSEM = 0X0003; - public static readonly ushort FLAG_FAMILY = 0X0004; - public static readonly ushort FLAG_FAMORASSEM = 0X0005; - public static readonly ushort FLAG_PUBLIC = 0X0006; - public static readonly ushort FLAG_STATIC = 0X0010; - public static readonly ushort FLAG_FINAL = 0X0020; - public static readonly ushort FLAG_VIRTUAL = 0X0040; - public static readonly ushort FLAG_HIDEBYSIG = 0X0080; - public static readonly ushort FLAG_VTABLELAYOUTMASK = 0X0100; - public static readonly ushort FLAG_REUSESLOT = 0X0000; - public static readonly ushort FLAG_NEWSLOT = 0X0100; - public static readonly ushort FLAG_ABSTRACT = 0X0400; - public static readonly ushort FLAG_SPECIALNAME = 0X0800; - public static readonly ushort FLAG_PINVOKEIMPL = 0X2000; - public static readonly ushort FLAG_UNMANAGEDEXPORT = 0X0008; - public static readonly ushort FLAG_RTSPECIALNAME = 0X1000; - public static readonly ushort FLAG_HASSECURITY = 0X4000; - public static readonly ushort FLAG_REQUIRESECOBJECT = 0X8000; - - public static readonly ushort IMPLFLAG_CODETYPEMASK = 0X0003; - public static readonly ushort IMPLFLAG_IL = 0X0000; - public static readonly ushort IMPLFLAG_NATIVE = 0X0001; - public static readonly ushort IMPLFLAG_OPTIL = 0X0002; - public static readonly ushort IMPLFLAG_RUNTIME = 0X0003; - public static readonly ushort IMPLFLAG_MANAGEDMASK = 0X0004; - public static readonly ushort IMPLFLAG_UNMANAGED = 0X0004; - public static readonly ushort IMPLFLAG_MANAGED = 0X0000; - public static readonly ushort IMPLFLAG_FORWARDREF = 0X0010; - public static readonly ushort IMPLFLAG_PRESERVESIG = 0X0080; - public static readonly ushort IMPLFLAG_INTERNALCALL = 0X1000; - public static readonly ushort IMPLFLAG_SYNCHRONIZED = 0X0020; - public static readonly ushort IMPLFLAG_NOINLINING = 0X0008; - public static readonly ushort IMPLFLAG_MAXMETHODIMPLVAL = 0XFFFF; - - uint rva; - ushort implFlags; - ushort flags; - uint name; // index into String heap - uint signature; // index into Blob heap - uint paramList; // index into Param table - - public uint RVA { - get { - return rva; - } - set { - rva = value; - } - } - - public ushort ImplFlags { - get { - return implFlags; - } - set { - implFlags = value; - } - } - - public ushort Flags { - get { - return flags; - } - set { - flags = value; - } - } - - public uint Name { - get { - return name; - } - set { - name = value; - } - } - - public uint Signature { - get { - return signature; - } - set { - signature = value; - } - } - - public uint ParamList { - get { - return paramList; - } - set { - paramList = value; - } - } - - public bool IsFlagSet(uint flag) - { - return base.BaseIsFlagSet(this.flags, flag); - } - - public bool IsMaskedFlagSet(uint flag, uint flag_mask) - { - return base.BaseIsFlagSet(this.flags, flag, flag_mask); - } - - public bool IsImplFlagSet(uint flag) - { - return base.BaseIsFlagSet(this.implFlags, flag); - } - - public override void LoadRow() - { - rva = binaryReader.ReadUInt32(); - implFlags = binaryReader.ReadUInt16(); - flags = binaryReader.ReadUInt16(); - name = LoadStringIndex(); - signature = LoadBlobIndex(); - - paramList = ReadSimpleIndex(Param.TABLE_ID); - } - } -} diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/MethodImpl.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/MethodImpl.cs deleted file mode 100644 index 7d8929a68f..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/MethodImpl.cs +++ /dev/null @@ -1,53 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - -using System; -using System.IO; - -namespace ICSharpCode.SharpAssembly.Metadata.Rows { - - public class MethodImpl : AbstractRow - { - public static readonly int TABLE_ID = 0x19; - - uint myClass; // index into TypeDef table - uint methodBody; // index into Method or MemberRef table; more precisely, a MethodDefOrRef coded index - uint methodDeclaration; // index into Method or MemberRef table; more precisely, a MethodDefOrRef coded index - - public uint MyClass { - get { - return myClass; - } - set { - myClass = value; - } - } - public uint MethodBody { - get { - return methodBody; - } - set { - methodBody = value; - } - } - public uint MethodDeclaration { - get { - return methodDeclaration; - } - set { - methodDeclaration = value; - } - } - - public override void LoadRow() - { - myClass = ReadSimpleIndex(TypeDef.TABLE_ID); - methodBody = ReadCodedIndex(CodedIndex.MethodDefOrRef); - methodDeclaration = ReadCodedIndex(CodedIndex.MethodDefOrRef); - } - } -} diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/MethodPtr.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/MethodPtr.cs deleted file mode 100644 index b435d1a164..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/MethodPtr.cs +++ /dev/null @@ -1,33 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - -using System; -using System.IO; - -namespace ICSharpCode.SharpAssembly.Metadata.Rows { - - public class MethodPtr : AbstractRow - { - public static readonly int TABLE_ID = 0x05; - - uint method; - - public uint Method { - get { - return method; - } - set { - method = value; - } - } - - public override void LoadRow() - { - method = ReadSimpleIndex(ICSharpCode.SharpAssembly.Metadata.Rows.Method.TABLE_ID); - } - } -} diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/MethodSemantics.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/MethodSemantics.cs deleted file mode 100644 index e18819faff..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/MethodSemantics.cs +++ /dev/null @@ -1,63 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - -using System; -using System.IO; - -namespace ICSharpCode.SharpAssembly.Metadata.Rows { - - public class MethodSemantics : AbstractRow - { - public static readonly int TABLE_ID = 0x18; - - public static readonly ushort SEM_SETTER = 0x0001; - public static readonly ushort SEM_GETTER = 0x0002; - public static readonly ushort SEM_OTHER = 0x0004; - public static readonly ushort SEM_ADDON = 0x0008; - public static readonly ushort SEM_REMOVEON = 0x0010; - public static readonly ushort SEM_FIRE = 0x0020; - - ushort semantics; - uint method; // index into the Method table - uint association; // index into the Event or Property table; more precisely, a HasSemantics coded index - - public ushort Semantics { - get { - return semantics; - } - set { - semantics = value; - } - } - - public uint Method { - get { - return method; - } - set { - method = value; - } - } - - public uint Association { - get { - return association; - } - set { - association = value; - } - } - - - public override void LoadRow() - { - semantics = binaryReader.ReadUInt16(); - method = ReadSimpleIndex(ICSharpCode.SharpAssembly.Metadata.Rows.Method.TABLE_ID); - association = ReadCodedIndex(CodedIndex.HasSemantics); - } - } -} diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/Module.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/Module.cs deleted file mode 100644 index 9cbc7b5b5a..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/Module.cs +++ /dev/null @@ -1,74 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - -using System; -using System.IO; - -namespace ICSharpCode.SharpAssembly.Metadata.Rows { - - public class Module : AbstractRow - { - public static readonly int TABLE_ID = 0x00; - - ushort generation; - uint name; // index into String heap - uint mvid; // index into Guid heap - uint encid; // index into Guid heap, reserved, shall be zero - uint encbaseid; // index into Guid heap, reserved, shall be zero - - public ushort Generation { - get { - return generation; - } - set { - generation = value; - } - } - public uint Name { - get { - return name; - } - set { - name = value; - } - } - public uint Mvid { - get { - return mvid; - } - set { - mvid = value; - } - } - public uint Encid { - get { - return encid; - } - set { - encid = value; - } - } - public uint Encbaseid { - get { - return encbaseid; - } - set { - encbaseid = value; - } - } - - - public override void LoadRow() - { - generation = binaryReader.ReadUInt16(); - name = LoadStringIndex(); - mvid = LoadGUIDIndex(); - encid = LoadGUIDIndex(); - encbaseid = LoadGUIDIndex(); - } - } -} diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/ModuleRef.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/ModuleRef.cs deleted file mode 100644 index 77463433a8..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/ModuleRef.cs +++ /dev/null @@ -1,33 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - -using System; -using System.IO; - -namespace ICSharpCode.SharpAssembly.Metadata.Rows { - - public class ModuleRef : AbstractRow - { - public static readonly int TABLE_ID = 0x1A; - - uint name; // index into String heap - - public uint Name { - get { - return name; - } - set { - name = value; - } - } - - public override void LoadRow() - { - name = LoadStringIndex(); - } - } -} diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/NestedClass.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/NestedClass.cs deleted file mode 100644 index c2ba62a77c..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/NestedClass.cs +++ /dev/null @@ -1,43 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - -using System; -using System.IO; - -namespace ICSharpCode.SharpAssembly.Metadata.Rows { - - public class NestedClass : AbstractRow - { - public static readonly int TABLE_ID = 0x29; - - uint nestedClass; // index into the TypeDef table - uint enclosingClass; // index into the TypeDef table - - public uint NestedClassIndex { - get { - return nestedClass; - } - set { - nestedClass = value; - } - } - public uint EnclosingClass { - get { - return enclosingClass; - } - set { - enclosingClass = value; - } - } - - public override void LoadRow() - { - nestedClass = ReadSimpleIndex(TypeDef.TABLE_ID); - enclosingClass = ReadSimpleIndex(TypeDef.TABLE_ID); - } - } -} diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/Param.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/Param.cs deleted file mode 100644 index bfe1916a5d..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/Param.cs +++ /dev/null @@ -1,67 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - -using System; -using System.IO; - -namespace ICSharpCode.SharpAssembly.Metadata.Rows { - - public class Param : AbstractRow - { - public static readonly int TABLE_ID = 0x08; - - public static readonly ushort FLAG_IN = 0x0001; - public static readonly ushort FLAG_OUT = 0x0002; - public static readonly ushort FLAG_OPTIONAL = 0x0004; - public static readonly ushort FLAG_HASDEFAULT = 0x1000; - public static readonly ushort FLAG_HASFIELDMARSHAL = 0x2000; - public static readonly ushort FLAG_UNUSED = 0xcfe0; - - ushort flags; - ushort sequence; - uint name; // index into String heap - - public ushort Flags { - get { - return flags; - } - set { - flags = value; - } - } - - public ushort Sequence { - get { - return sequence; - } - set { - sequence = value; - } - } - - public uint Name { - get { - return name; - } - set { - name = value; - } - } - - public bool IsFlagSet(uint flag) - { - return base.BaseIsFlagSet(this.flags, flag); - } - - public override void LoadRow() - { - flags = binaryReader.ReadUInt16(); - sequence = binaryReader.ReadUInt16(); - name = LoadStringIndex(); - } - } -} diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/ParamPtr.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/ParamPtr.cs deleted file mode 100644 index 2d3b65b0d5..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/ParamPtr.cs +++ /dev/null @@ -1,33 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - -using System; -using System.IO; - -namespace ICSharpCode.SharpAssembly.Metadata.Rows { - - public class ParamPtr : AbstractRow - { - public static readonly int TABLE_ID = 0x07; - - uint param; - - public uint Param { - get { - return param; - } - set { - param = value; - } - } - - public override void LoadRow() - { - param = ReadSimpleIndex(ICSharpCode.SharpAssembly.Metadata.Rows.Param.TABLE_ID); - } - } -} diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/Property.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/Property.cs deleted file mode 100644 index 26ccb546c4..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/Property.cs +++ /dev/null @@ -1,65 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - -using System; -using System.IO; - -namespace ICSharpCode.SharpAssembly.Metadata.Rows { - - public class Property : AbstractRow - { - public static readonly int TABLE_ID = 0x17; - - public static readonly ushort FLAG_SPECIALNAME = 0x0200; - public static readonly ushort FLAG_RTSPECIALNAME = 0x0400; - public static readonly ushort FLAG_HASDEFAULT = 0x1000; - public static readonly ushort FLAG_UNUSED = 0xe9ff; - - ushort flags; - uint name; // index into String heap - uint type; // index into Blob heap - - public ushort Flags { - get { - return flags; - } - set { - flags = value; - } - } - - public uint Name { - get { - return name; - } - set { - name = value; - } - } - - public uint Type { - get { - return type; - } - set { - type = value; - } - } - - public bool IsFlagSet(uint flag) - { - return base.BaseIsFlagSet(this.flags, flag); - } - - public override void LoadRow() - { - flags = binaryReader.ReadUInt16(); - name = LoadStringIndex(); - type = LoadBlobIndex(); - } - } -} diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/PropertyMap.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/PropertyMap.cs deleted file mode 100644 index 48f93b6c52..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/PropertyMap.cs +++ /dev/null @@ -1,44 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - -using System; -using System.IO; - -namespace ICSharpCode.SharpAssembly.Metadata.Rows { - - public class PropertyMap : AbstractRow - { - public static readonly int TABLE_ID = 0x15; - - uint parent; // index into the TypeDef table - uint propertyList; // index into Property table - - public uint Parent { - get { - return parent; - } - set { - parent = value; - } - } - public uint PropertyList { - get { - return propertyList; - } - set { - propertyList = value; - } - } - - - public override void LoadRow() - { - parent = ReadSimpleIndex(TypeDef.TABLE_ID); - propertyList = ReadSimpleIndex(Property.TABLE_ID); - } - } -} diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/PropertyPtr.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/PropertyPtr.cs deleted file mode 100644 index 8c5ba72a76..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/PropertyPtr.cs +++ /dev/null @@ -1,33 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - -using System; -using System.IO; - -namespace ICSharpCode.SharpAssembly.Metadata.Rows { - - public class PropertyPtr : AbstractRow - { - public static readonly int TABLE_ID = 22; - - uint property; - - public uint Property { - get { - return property; - } - set { - property = value; - } - } - - public override void LoadRow() - { - property = ReadSimpleIndex(ICSharpCode.SharpAssembly.Metadata.Rows.Property.TABLE_ID); - } - } -} diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/StandAloneSig.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/StandAloneSig.cs deleted file mode 100644 index 465f00fbbc..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/StandAloneSig.cs +++ /dev/null @@ -1,34 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - -using System; -using System.IO; - -namespace ICSharpCode.SharpAssembly.Metadata.Rows { - - public class StandAloneSig : AbstractRow - { - public static readonly int TABLE_ID = 0x11; - - uint signature; // index into the Blob heap - - public uint Signature { - get { - return signature; - } - set { - signature = value; - } - } - - - public override void LoadRow() - { - signature = LoadBlobIndex(); - } - } -} diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/TypeDef.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/TypeDef.cs deleted file mode 100644 index f58a036369..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/TypeDef.cs +++ /dev/null @@ -1,137 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - -using System; -using System.IO; - -namespace ICSharpCode.SharpAssembly.Metadata.Rows { - - public class TypeDef : AbstractRow - { - public static readonly int TABLE_ID = 0x02; - - // Visibility attributes - public static readonly uint FLAG_VISIBILITYMASK = 0x00000007; - public static readonly uint FLAG_NOTPUBLIC = 0x00000000; - public static readonly uint FLAG_PUBLIC = 0x00000001; - public static readonly uint FLAG_NESTEDPUBLIC = 0x00000002; - public static readonly uint FLAG_NESTEDPRIVATE = 0x00000003; - public static readonly uint FLAG_NESTEDFAMILY = 0x00000004; - public static readonly uint FLAG_NESTEDASSEMBLY = 0x00000005; - public static readonly uint FLAG_NESTEDFAMANDASSEM = 0x00000006; - public static readonly uint FLAG_NESTEDFAMORASSEM = 0x00000007; - - //Class layout attributes - public static readonly uint FLAG_LAYOUTMASK = 0x00000018; - public static readonly uint FLAG_AUTOLAYOUT = 0x00000000; - public static readonly uint FLAG_SEQUENTIALLAYOUT = 0x00000008; - public static readonly uint FLAG_EXPLICITLAYOUT = 0x00000010; - - //Class semantics attributes - public static readonly uint FLAG_CLASSSEMANTICSMASK = 0x00000020; - public static readonly uint FLAG_CLASS = 0x00000000; - public static readonly uint FLAG_INTERFACE = 0x00000020; - - // Special semantics in addition to class semantics - public static readonly uint FLAG_ABSTRACT = 0x00000080; - public static readonly uint FLAG_SEALED = 0x00000100; - public static readonly uint FLAG_SPECIALNAME = 0x00000400; - - // Implementation Attributes - public static readonly uint FLAG_IMPORT = 0x00001000; - public static readonly uint FLAG_SERIALIZABLE = 0x00002000; - - //String formatting Attributes - public static readonly uint FLAG_STRINGFORMATMASK = 0x00030000; - public static readonly uint FLAG_ANSICLASS = 0x00000000; - public static readonly uint FLAG_UNICODECLASS = 0x00010000; - public static readonly uint FLAG_AUTOCLASS = 0x00020000; - - //Class Initialization Attributes - public static readonly uint FLAG_BEFOREFIELDINIT = 0x00100000; - - //Additional Flags - public static readonly uint FLAG_RTSPECIALNAME = 0x00000800; - public static readonly uint FLAG_HASSECURITY = 0x00040000; - - uint flags; - uint name; - uint nSpace; - uint extends; // index into TypeDef, TypeRef or TypeSpec table; more precisely, a TypeDefOrRef coded index - uint fieldList; // index into Field table; it marks the first of a continguous run of Fields owned by this Type - uint methodList; // index into Method table; it marks the first of a continguous run of Methods owned by this Type - - public uint Flags { - get { - return flags; - } - set { - flags = value; - } - } - public uint Name { - get { - return name; - } - set { - name = value; - } - } - public uint NSpace { - get { - return nSpace; - } - set { - nSpace = value; - } - } - public uint Extends { - get { - return extends; - } - set { - extends = value; - } - } - public uint FieldList { - get { - return fieldList; - } - set { - fieldList = value; - } - } - public uint MethodList { - get { - return methodList; - } - set { - methodList = value; - } - } - - public bool IsFlagSet(uint flag) - { - return base.BaseIsFlagSet(this.flags, flag); - } - - public bool IsMaskedFlagSet(uint flag, uint flag_mask) - { - return base.BaseIsFlagSet(this.flags, flag, flag_mask); - } - - public override void LoadRow() - { - flags = binaryReader.ReadUInt32(); - name = LoadStringIndex(); - nSpace = LoadStringIndex(); - extends = ReadCodedIndex(CodedIndex.TypeDefOrRef); - fieldList = ReadSimpleIndex(Field.TABLE_ID); - methodList = ReadSimpleIndex(Method.TABLE_ID); - } - } -} diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/TypeRef.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/TypeRef.cs deleted file mode 100644 index 09ce6bec41..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/TypeRef.cs +++ /dev/null @@ -1,55 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - -using System; -using System.IO; - -namespace ICSharpCode.SharpAssembly.Metadata.Rows { - - public class TypeRef : AbstractRow - { - public static readonly int TABLE_ID = 0x01; - - uint resolutionScope; // index into Module, ModuleRef, AssemblyRef or TypeRef tables, or null; more precisely, a ResolutionScope coded index - uint name; - uint nspace; - - public uint ResolutionScope { - get { - return resolutionScope; - } - set { - resolutionScope = value; - } - } - - public uint Name { - get { - return name; - } - set { - name = value; - } - } - - public uint Nspace { - get { - return nspace; - } - set { - nspace = value; - } - } - - public override void LoadRow() - { - resolutionScope = ReadCodedIndex(CodedIndex.ResolutionScope); - name = LoadStringIndex(); - nspace = LoadStringIndex(); - } - } -} diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/TypeSpec.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/TypeSpec.cs deleted file mode 100644 index 1bbdac4fa8..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Rows/TypeSpec.cs +++ /dev/null @@ -1,33 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - -using System; -using System.IO; - -namespace ICSharpCode.SharpAssembly.Metadata.Rows { - - public class TypeSpec : AbstractRow - { - public static readonly int TABLE_ID = 0x1B; - - uint signature; // index into the Blob heap - - public uint Signature { - get { - return signature; - } - set { - signature = value; - } - } - - public override void LoadRow() - { - signature = LoadBlobIndex(); - } - } -} diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Signatures/CallingConventions.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Signatures/CallingConventions.cs deleted file mode 100644 index 2079ac48b3..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Signatures/CallingConventions.cs +++ /dev/null @@ -1,31 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - -using System; -using System.IO; - -namespace ICSharpCode.SharpAssembly.Metadata -{ - public enum CallingConvention : uint - { - Default = 0x00, - - Cdecl = 0x01, - Stdcall = 0x02, - Thiscall = 0x03, - Fastcall = 0x04, - - VarArg = 0x05, - Field = 0x06, - LocalSig = 0x07, - Property = 0x08, - UnMngd = 0x09, - - HasThis = 0x20, - ExplicitThis = 0x40 - } -} diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Signatures/DataTypes.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Signatures/DataTypes.cs deleted file mode 100644 index 5c082e2474..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/Metadata/Signatures/DataTypes.cs +++ /dev/null @@ -1,53 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - -using System; -using System.IO; - -namespace ICSharpCode.SharpAssembly.Metadata -{ - public enum DataType - { - End = 0x00, - Void = 0x01, - Boolean = 0x02, - Char = 0x03, - SByte = 0x04, - Byte = 0x05, - Int16 = 0x06, - UInt16 = 0x07, - Int32 = 0x08, - UInt32 = 0x09, - Int64 = 0x0A, - UInt64 = 0x0B, - Single = 0x0C, - Double = 0x0D, - - String = 0x0E, - Ptr = 0x0F, - ByRef = 0x10, - ValueType = 0x11, - Class = 0x12, - Array = 0x14, - - TypeReference = 0x16, - IntPtr = 0x18, - UIntPtr = 0x19, - FnPtr = 0x1B, - Object = 0x1C, - SZArray = 0x1D, - - CModReq = 0x1F, - CModOpt = 0x20, - Internal = 0x21, - - Modifier = 0x40, - Sentinel = 0x41, - Pinned = 0x45 - - } -} diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/PE/CLIHeader.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/PE/CLIHeader.cs deleted file mode 100644 index 36c9a9dcd9..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/PE/CLIHeader.cs +++ /dev/null @@ -1,167 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - -using System; -using System.IO; - -namespace ICSharpCode.SharpAssembly.PE { - - public class CLIHeader - { - uint cb; - ushort majorRuntimeVersion; - ushort minorRuntimeVersion; - uint metaData; - uint metaDataSize; - uint flags; - uint entryPointToken; - uint resources; - uint resourcesSize; - ulong strongNameSignature; - ulong codeManagerTable; - ulong vTableFixups; - ulong exportAddressTableJumps; - ulong managedNativeHeader; - - const uint COMIMAGE_FLAGS_ILONLY = 0x01; - const uint COMIMAGE_FLAGS_32BITREQUIRED = 0x02; - const uint COMIMAGE_FLAGS_STRONGNAMESIGNED = 0x08; - const uint COMIMAGE_FLAGS_TRACKDEBUGDATA = 0x010000; - - public uint Cb { - get { - return cb; - } - set { - cb = value; - } - } - public ushort MajorRuntimeVersion { - get { - return majorRuntimeVersion; - } - set { - majorRuntimeVersion = value; - } - } - public ushort MinorRuntimeVersion { - get { - return minorRuntimeVersion; - } - set { - minorRuntimeVersion = value; - } - } - public uint MetaData { - get { - return metaData; - } - set { - metaData = value; - } - } - public uint MetaDataSize { - get { - return metaDataSize; - } - set { - metaDataSize = value; - } - } - public uint Flags { - get { - return flags; - } - set { - flags = value; - } - } - public uint EntryPointToken { - get { - return entryPointToken; - } - set { - entryPointToken = value; - } - } - public uint Resources { - get { - return resources; - } - set { - resources = value; - } - } - public uint ResourcesSize { - get { - return resourcesSize; - } - set { - resourcesSize = value; - } - } - public ulong StrongNameSignature { - get { - return strongNameSignature; - } - set { - strongNameSignature = value; - } - } - public ulong CodeManagerTable { - get { - return codeManagerTable; - } - set { - codeManagerTable = value; - } - } - public ulong VTableFixups { - get { - return vTableFixups; - } - set { - vTableFixups = value; - } - } - public ulong ExportAddressTableJumps { - get { - return exportAddressTableJumps; - } - set { - exportAddressTableJumps = value; - } - } - public ulong ManagedNativeHeader { - get { - return managedNativeHeader; - } - set { - managedNativeHeader = value; - } - } - - - public void LoadFrom(BinaryReader binaryReader) - { - cb = binaryReader.ReadUInt32(); - majorRuntimeVersion = binaryReader.ReadUInt16(); - minorRuntimeVersion = binaryReader.ReadUInt16(); - metaData = binaryReader.ReadUInt32(); - metaDataSize = binaryReader.ReadUInt32(); - flags = binaryReader.ReadUInt32(); - entryPointToken = binaryReader.ReadUInt32(); - resources = binaryReader.ReadUInt32(); - resourcesSize = binaryReader.ReadUInt32(); - strongNameSignature = binaryReader.ReadUInt64(); - codeManagerTable = binaryReader.ReadUInt64(); - vTableFixups = binaryReader.ReadUInt64(); - exportAddressTableJumps = binaryReader.ReadUInt64(); - managedNativeHeader = binaryReader.ReadUInt64(); - } - } -} diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/PE/DataDirectories.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/PE/DataDirectories.cs deleted file mode 100644 index 05b5195052..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/PE/DataDirectories.cs +++ /dev/null @@ -1,356 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - -using System; -using System.IO; - -namespace ICSharpCode.SharpAssembly.PE { - - public class DataDirectories - { - uint exportTable; - uint exportTableSize; - uint importTable; - uint importTableSize; - uint resourceTable; - uint resourceTableSize; - uint exceptionTable; - uint exceptionTableSize; - uint certificateTable; - uint certificateTableSize; - uint baseRelocationTable; - uint baseRelocationTableSize; - uint debugTable; - uint debugTableSize; - uint copyrightTable; - uint copyrightTableSize; - uint globalPtr; - uint globalPtrSize; - uint tlsTable; - uint tlsTableSize; - uint loadConfigTable; - uint loadConfigTableSize; - uint boundImport; - uint boundImportSize; - uint iAT; - uint iATSize; - uint delayImportDescriptor; - uint delayImportDescriptorSize; - uint cliHeader; - uint cliHeaderSize; - uint reserved; - uint reservedSize; - - public uint ExportTable { - get { - return exportTable; - } - set { - exportTable = value; - } - } - public uint ExportTableSize { - get { - return exportTableSize; - } - set { - exportTableSize = value; - } - } - public uint ImportTable { - get { - return importTable; - } - set { - importTable = value; - } - } - public uint ImportTableSize { - get { - return importTableSize; - } - set { - importTableSize = value; - } - } - public uint ResourceTable { - get { - return resourceTable; - } - set { - resourceTable = value; - } - } - public uint ResourceTableSize { - get { - return resourceTableSize; - } - set { - resourceTableSize = value; - } - } - public uint ExceptionTable { - get { - return exceptionTable; - } - set { - exceptionTable = value; - } - } - public uint ExceptionTableSize { - get { - return exceptionTableSize; - } - set { - exceptionTableSize = value; - } - } - public uint CertificateTable { - get { - return certificateTable; - } - set { - certificateTable = value; - } - } - public uint CertificateTableSize { - get { - return certificateTableSize; - } - set { - certificateTableSize = value; - } - } - public uint BaseRelocationTable { - get { - return baseRelocationTable; - } - set { - baseRelocationTable = value; - } - } - public uint BaseRelocationTableSize { - get { - return baseRelocationTableSize; - } - set { - baseRelocationTableSize = value; - } - } - public uint DebugTable { - get { - return debugTable; - } - set { - debugTable = value; - } - } - public uint DebugTableSize { - get { - return debugTableSize; - } - set { - debugTableSize = value; - } - } - public uint CopyrightTable { - get { - return copyrightTable; - } - set { - copyrightTable = value; - } - } - public uint CopyrightTableSize { - get { - return copyrightTableSize; - } - set { - copyrightTableSize = value; - } - } - public uint GlobalPtr { - get { - return globalPtr; - } - set { - globalPtr = value; - } - } - public uint GlobalPtrSize { - get { - return globalPtrSize; - } - set { - globalPtrSize = value; - } - } - public uint TlsTable { - get { - return tlsTable; - } - set { - tlsTable = value; - } - } - public uint TlsTableSize { - get { - return tlsTableSize; - } - set { - tlsTableSize = value; - } - } - public uint LoadConfigTable { - get { - return loadConfigTable; - } - set { - loadConfigTable = value; - } - } - public uint LoadConfigTableSize { - get { - return loadConfigTableSize; - } - set { - loadConfigTableSize = value; - } - } - public uint BoundImport { - get { - return boundImport; - } - set { - boundImport = value; - } - } - public uint BoundImportSize { - get { - return boundImportSize; - } - set { - boundImportSize = value; - } - } - public uint IAT { - get { - return iAT; - } - set { - iAT = value; - } - } - public uint IATSize { - get { - return iATSize; - } - set { - iATSize = value; - } - } - public uint DelayImportDescriptor { - get { - return delayImportDescriptor; - } - set { - delayImportDescriptor = value; - } - } - public uint DelayImportDescriptorSize { - get { - return delayImportDescriptorSize; - } - set { - delayImportDescriptorSize = value; - } - } - public uint CliHeader { - get { - return cliHeader; - } - set { - cliHeader = value; - } - } - public uint CliHeaderSize { - get { - return cliHeaderSize; - } - set { - cliHeaderSize = value; - } - } - public uint Reserved { - get { - return reserved; - } - set { - reserved = value; - } - } - public uint ReservedSize { - get { - return reservedSize; - } - set { - reservedSize = value; - } - } - - public void LoadFrom(BinaryReader binaryReader) - { - exportTable = binaryReader.ReadUInt32(); - exportTableSize = binaryReader.ReadUInt32(); - - importTable = binaryReader.ReadUInt32(); - importTableSize = binaryReader.ReadUInt32(); - - resourceTable = binaryReader.ReadUInt32(); - resourceTableSize = binaryReader.ReadUInt32(); - - exceptionTable = binaryReader.ReadUInt32(); - exceptionTableSize = binaryReader.ReadUInt32(); - - certificateTable = binaryReader.ReadUInt32(); - certificateTableSize = binaryReader.ReadUInt32(); - - baseRelocationTable = binaryReader.ReadUInt32(); - baseRelocationTableSize = binaryReader.ReadUInt32(); - - debugTable = binaryReader.ReadUInt32(); - debugTableSize = binaryReader.ReadUInt32(); - - copyrightTable = binaryReader.ReadUInt32(); - copyrightTableSize = binaryReader.ReadUInt32(); - - globalPtr = binaryReader.ReadUInt32(); - globalPtrSize = binaryReader.ReadUInt32(); - - tlsTable = binaryReader.ReadUInt32(); - tlsTableSize = binaryReader.ReadUInt32(); - - loadConfigTable = binaryReader.ReadUInt32(); - loadConfigTableSize = binaryReader.ReadUInt32(); - - boundImport = binaryReader.ReadUInt32(); - boundImportSize = binaryReader.ReadUInt32(); - - iAT = binaryReader.ReadUInt32(); - iATSize = binaryReader.ReadUInt32(); - - delayImportDescriptor = binaryReader.ReadUInt32(); - delayImportDescriptorSize = binaryReader.ReadUInt32(); - - cliHeader = binaryReader.ReadUInt32(); - cliHeaderSize = binaryReader.ReadUInt32(); - - reserved = binaryReader.ReadUInt32(); - reservedSize = binaryReader.ReadUInt32(); - } - } -} diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/PE/IAT.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/PE/IAT.cs deleted file mode 100644 index 9519c1e293..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/PE/IAT.cs +++ /dev/null @@ -1,42 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - -using System; -using System.IO; - -namespace ICSharpCode.SharpAssembly.PE { - - public class IAT - { - uint nameTableRVA; - uint empty; - - public uint NameTableRVA { - get { - return nameTableRVA; - } - set { - nameTableRVA = value; - } - } - public uint Empty { - get { - return empty; - } - set { - empty = value; - } - } - - - public void LoadFrom(BinaryReader binaryReader) - { - nameTableRVA = binaryReader.ReadUInt32(); - empty = binaryReader.ReadUInt32(); - } - } -} diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/PE/ImportTable.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/PE/ImportTable.cs deleted file mode 100644 index 2f97966595..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/PE/ImportTable.cs +++ /dev/null @@ -1,34 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - -using System; -using System.IO; - -namespace ICSharpCode.SharpAssembly.PE { - - public class ImportTable - { - const int UNUSED_SIZE = 20; - - uint importLookupTable = 0; - uint dateTimeStamp = 0; - uint forwarderChain = 0; - uint importTableName = 0; - uint importAddressTable = 0; - byte[] unused = new byte[UNUSED_SIZE]; - - public void LoadFrom(BinaryReader binaryReader) - { - importLookupTable = binaryReader.ReadUInt32(); - dateTimeStamp = binaryReader.ReadUInt32(); - forwarderChain = binaryReader.ReadUInt32(); - importTableName = binaryReader.ReadUInt32(); - importAddressTable = binaryReader.ReadUInt32(); - binaryReader.Read(unused, 0, UNUSED_SIZE); - } - } -} diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/PE/NTSpecificFields.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/PE/NTSpecificFields.cs deleted file mode 100644 index c4678eecc2..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/PE/NTSpecificFields.cs +++ /dev/null @@ -1,45 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - -using System; -using System.IO; - -namespace ICSharpCode.SharpAssembly.PE { - - public class NTSpecificFields - { - const uint IMAGE_BASE = 0x400000; - const uint SECTION_ALIGNMENT = 0x2000; - -// uint fileAlignment; // either 0x200 or 0x1000 -// ushort osMajor; -// ushort osMinor; -// ushort userMajor; -// ushort userMinor; -// ushort subSysMajor; -// ushort subSysMinor; -// uint reserved; -// uint imageSize; -// uint headerSize; -// uint fileChecksum; -// ushort subSystem; -// ushort dllFlags; -// uint stackReserveSize; -// uint stackCommitSize; -// uint heapReserveSize; -// uint heapCommitSize; -// uint loaderFlags; -// uint numberOfDataDirectories; - - public void LoadFrom(BinaryReader binaryReader) - { - // TODO - byte[] buffer = new byte[68]; - binaryReader.Read(buffer, 0, 68); - } - } -} diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/PE/NameTable.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/PE/NameTable.cs deleted file mode 100644 index a5e31c1208..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/PE/NameTable.cs +++ /dev/null @@ -1,50 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - -using System; -using System.IO; - -namespace ICSharpCode.SharpAssembly.PE { - - public class NameTable - { - ushort hint; - string name; - - public ushort Hint { - get { - return hint; - } - set { - hint = value; - } - } - - public string Name { - get { - return name; - } - set { - name = value; - } - } - - - - public void LoadFrom(BinaryReader binaryReader) - { - hint = binaryReader.ReadUInt16(); - - name = String.Empty; - byte b = binaryReader.ReadByte(); - while (b != 0) { - name += (char)b; - b = binaryReader.ReadByte(); - } - } - } -} diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/PE/PEFileHeader.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/PE/PEFileHeader.cs deleted file mode 100644 index 50381f8100..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/PE/PEFileHeader.cs +++ /dev/null @@ -1,145 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - -using System; -using System.Diagnostics; -using System.IO; - -namespace ICSharpCode.SharpAssembly.PE { - - public class PEFileHeader - { - const ushort machineSign = 0x14C; - const ushort IMAGE_FILE_DLL = 0x2000; - - ushort numberOfSections; - uint time; - uint ptrToSymbolTable; - uint numerOfSymbols; - ushort optionalHeaderSize; - ushort characteristics; - - // optional header: - StandardFields standardFields = new StandardFields(); - NTSpecificFields ntSpecificFields = new NTSpecificFields(); - DataDirectories dataDirectories = new DataDirectories(); - - public ushort NumberOfSections { - get { - return numberOfSections; - } - set { - numberOfSections = value; - } - } - - public uint Time { - get { - return time; - } - set { - time = value; - } - } - - public uint PtrToSymbolTable { - get { - return ptrToSymbolTable; - } - set { - ptrToSymbolTable = value; - } - } - - public uint NumerOfSymbols { - get { - return numerOfSymbols; - } - set { - numerOfSymbols = value; - } - } - - public ushort OptionalHeaderSize { - get { - return optionalHeaderSize; - } - set { - optionalHeaderSize = value; - } - } - - public bool IsDLL { - get { - return (characteristics & IMAGE_FILE_DLL) == IMAGE_FILE_DLL; - } - set { - if (value) { - characteristics |= IMAGE_FILE_DLL; - } else { - characteristics = (ushort)(characteristics & ~IMAGE_FILE_DLL); - } - } - } - - public StandardFields StandardFields { - get { - return standardFields; - } - } - - public NTSpecificFields NtSpecificFields { - get { - return ntSpecificFields; - } - } - - public DataDirectories DataDirectories { - get { - return dataDirectories; - } - } - - - public void LoadFrom(BinaryReader binaryReader) - { - // pe signature (always PE\0\0) - byte[] signature = new byte[4]; - binaryReader.Read(signature, 0, 4); - if (signature[0] != (byte)'P' && signature[1] != (byte)'E' && signature[2] != 0 && signature[3] != 0) { - Console.WriteLine("NO PE FILE"); - return; - } - ushort machine = binaryReader.ReadUInt16(); - - if (machine != machineSign) { - Console.WriteLine("Wrong machine : " + machineSign); - return; - } - - numberOfSections = binaryReader.ReadUInt16(); - time = binaryReader.ReadUInt32(); - - ptrToSymbolTable = binaryReader.ReadUInt32(); - if (ptrToSymbolTable != 0) { - Console.WriteLine("warning: ptrToSymbolTable != 0"); - } - - numerOfSymbols = binaryReader.ReadUInt32(); - if (numerOfSymbols != 0) { - Console.WriteLine("warning: numerOfSymbols != 0"); - } - - optionalHeaderSize = binaryReader.ReadUInt16(); - characteristics = binaryReader.ReadUInt16(); - - standardFields.LoadFrom(binaryReader); - ntSpecificFields.LoadFrom(binaryReader); - dataDirectories.LoadFrom(binaryReader); - } - } -} diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/PE/SectionTable.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/PE/SectionTable.cs deleted file mode 100644 index c7da0ddb4c..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/PE/SectionTable.cs +++ /dev/null @@ -1,215 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - -using System; -using System.IO; - -namespace ICSharpCode.SharpAssembly.PE { - - public class SectionTable - { - const int NAME_LEN = 8; - - const uint IMAGE_SCN_CNT_CODE = 0x20; - const uint IMAGE_SCN_CNT_INITIALIZED_DATA = 0x40; - const uint IMAGE_SCN_CNT_UNINITIALIZED_DATA = 0x80; - const uint IMAGE_SCN_MEM_EXECUTE = 0x20000000; - const uint IMAGE_SCN_MEM_READ = 0x40000000; - const uint IMAGE_SCN_MEM_WRITE = 0x80000000; - - byte[] name = new byte[NAME_LEN]; - uint virtualSize = 0; - uint virtualAddress = 0; - uint sizeOfRawData = 0; - uint pointerToRawData = 0; - uint pointerToRelocations = 0; - uint pointerToLinenumbers = 0; - uint numberOfRelocations = 0; - uint numberOfLinenumbers = 0; - uint characteristics = 0; - - public string Name { - get { - return System.Text.Encoding.ASCII.GetString(name); - } - set { - byte[] nameBytes = System.Text.Encoding.ASCII.GetBytes(value); - name = new byte[NAME_LEN]; - for (int i = 0; i < NAME_LEN; ++i) { - name[i] = 0; - } - Array.Copy(nameBytes, 0, name, 0, Math.Min(NAME_LEN, nameBytes.Length)); - } - } - - - public uint VirtualSize { - get { - return virtualSize; - } - set { - virtualSize = value; - } - } - - public uint VirtualAddress { - get { - return virtualAddress; - } - set { - virtualAddress = value; - } - } - - public uint SizeOfRawData { - get { - return sizeOfRawData; - } - set { - sizeOfRawData = value; - } - } - - public uint PointerToRawData { - get { - return pointerToRawData; - } - set { - pointerToRawData = value; - } - } - - public uint PointerToRelocations { - get { - return pointerToRelocations; - } - set { - pointerToRelocations = value; - } - } - - public uint PointerToLinenumbers { - get { - return pointerToLinenumbers; - } - set { - pointerToLinenumbers = value; - } - } - - public uint NumberOfRelocations { - get { - return numberOfRelocations; - } - set { - numberOfRelocations = value; - } - } - - public uint NumberOfLinenumbers { - get { - return numberOfLinenumbers; - } - set { - numberOfLinenumbers = value; - } - } - - // characteristics - public bool ContainsExecutableCode { - get { - return (characteristics & IMAGE_SCN_CNT_CODE) == IMAGE_SCN_CNT_CODE; - } - set { - if (value) { - characteristics |= IMAGE_SCN_CNT_CODE; - } else { - characteristics &= ~IMAGE_SCN_CNT_CODE; - } - } - } - - public bool ContainsInitializedData { - get { - return (characteristics & IMAGE_SCN_CNT_INITIALIZED_DATA) == IMAGE_SCN_CNT_INITIALIZED_DATA; - } - set { - if (value) { - characteristics |= IMAGE_SCN_CNT_INITIALIZED_DATA; - } else { - characteristics &= ~IMAGE_SCN_CNT_INITIALIZED_DATA; - } - } - } - - public bool ContainsUninitializedData { - get { - return (characteristics & IMAGE_SCN_CNT_UNINITIALIZED_DATA) == IMAGE_SCN_CNT_UNINITIALIZED_DATA; - } - set { - if (value) { - characteristics |= IMAGE_SCN_CNT_UNINITIALIZED_DATA; - } else { - characteristics &= ~IMAGE_SCN_CNT_UNINITIALIZED_DATA; - } - } - } - - public bool SectionCanBeExecutedAsCode { - get { - return (characteristics & IMAGE_SCN_MEM_EXECUTE) == IMAGE_SCN_MEM_EXECUTE; - } - set { - if (value) { - characteristics |= IMAGE_SCN_MEM_EXECUTE; - } else { - characteristics &= ~IMAGE_SCN_MEM_EXECUTE; - } - } - } - - public bool SectionCanBeRead { - get { - return (characteristics & IMAGE_SCN_MEM_READ) == IMAGE_SCN_MEM_READ; - } - set { - if (value) { - characteristics |= IMAGE_SCN_MEM_READ; - } else { - characteristics &= ~IMAGE_SCN_MEM_READ; - } - } - } - - public bool SectionCanWrittenTo { - get { - return (characteristics & IMAGE_SCN_MEM_WRITE) == IMAGE_SCN_MEM_WRITE; - } - set { - if (value) { - characteristics |= IMAGE_SCN_MEM_WRITE; - } else { - characteristics &= ~IMAGE_SCN_MEM_WRITE; - } - } - } - - public void LoadFrom(BinaryReader binaryReader) - { - binaryReader.Read(name, 0, NAME_LEN); - virtualSize = binaryReader.ReadUInt32(); - virtualAddress = binaryReader.ReadUInt32(); - sizeOfRawData = binaryReader.ReadUInt32(); - pointerToRawData = binaryReader.ReadUInt32(); - pointerToRelocations = binaryReader.ReadUInt32(); - pointerToLinenumbers = binaryReader.ReadUInt32(); - numberOfRelocations = binaryReader.ReadUInt16(); - numberOfLinenumbers = binaryReader.ReadUInt16(); - characteristics = binaryReader.ReadUInt32(); - } - } -} diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/PE/StandardFields.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/PE/StandardFields.cs deleted file mode 100644 index 225c6103e7..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/PE/StandardFields.cs +++ /dev/null @@ -1,46 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - -using System; -using System.Diagnostics; -using System.IO; - -namespace ICSharpCode.SharpAssembly.PE { - - public class StandardFields - { - const ushort MAGIC = 0x10B; - - byte lMajor; - byte lMinor; - uint codeSize; - uint initializedDataSize; - uint uninitializedDataSize; - uint entryPointRVA; - uint baseOfCode; - uint baseOfData; - - public void LoadFrom(BinaryReader binaryReader) - { - ushort magic = binaryReader.ReadUInt16(); - if (magic != MAGIC) { - Console.WriteLine("Warning OptionalHeader.StandardFields != " + MAGIC + " was " + magic); - } - lMajor = binaryReader.ReadByte(); - Debug.Assert(lMajor == 6 || lMajor == 7); - lMinor = binaryReader.ReadByte(); - Debug.Assert(lMinor == 0 || lMinor == 10); - codeSize = binaryReader.ReadUInt32(); - initializedDataSize = binaryReader.ReadUInt32(); - uninitializedDataSize = binaryReader.ReadUInt32(); - entryPointRVA = binaryReader.ReadUInt32(); - baseOfCode = binaryReader.ReadUInt32(); - baseOfData = binaryReader.ReadUInt32(); - } - } - -} diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/PE/StreamHeader.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/PE/StreamHeader.cs deleted file mode 100644 index c947487fb2..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/PE/StreamHeader.cs +++ /dev/null @@ -1,66 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - - -using System; -using System.IO; - -namespace ICSharpCode.SharpAssembly.PE { - - public class StreamHeader - { - uint offset; - uint size; - string name; - - public uint Offset { - get { - return offset; - } - set { - offset = value; - } - } - - public uint Size { - get { - return size; - } - set { - size = value; - } - } - - public string Name { - get { - return name; - } - set { - name = value; - } - } - - public void LoadFrom(BinaryReader binaryReader) - { - offset = binaryReader.ReadUInt32(); - size = binaryReader.ReadUInt32(); - int bytesRead = 1; - byte b = binaryReader.ReadByte(); - while (b != 0) { - name += (char)b; - b = binaryReader.ReadByte(); - ++bytesRead; - } - // name is filled to 4 byte blocks - int filler = bytesRead % 4 == 0 ? 0 : 4 - (bytesRead % 4); - for (int i = 0; i < filler; ++i) { - binaryReader.ReadByte(); - } - - } - } -} diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/SharpAssembly.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/SharpAssembly.cs deleted file mode 100644 index c8e5af2087..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/SharpAssembly.cs +++ /dev/null @@ -1,583 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - -using System; -using System.IO; -using System.Collections; -using System.Windows.Forms; -using ICSharpCode.SharpAssembly.Assembly; -using ICSharpCode.SharpAssembly.Metadata; -using ICSharpCode.SharpAssembly.Metadata.Rows; -using Rows = ICSharpCode.SharpAssembly.Metadata.Rows; -using MSjogren.Fusion.Native; -using System.Runtime.InteropServices; -using Microsoft.Win32; - -namespace ICSharpCode.SharpAssembly.Assembly -{ - public class SharpAssembly - { - // #Assembly maintains a "reference pool" that avoids loading assemblies twice - // This is similar to what the Reflection API does, but - // the assembly files are not locked because they are not opened permanently - // so the locking problem is solved - static Hashtable fullNamePool = new Hashtable(); - static Hashtable shortNamePool = new Hashtable(); - - static IAssemblyCache assemblyCache; - - // initialize; load mscorlib (important, but HACK) - static SharpAssembly() { - Console.WriteLine("#Assembly: Initializing"); - Console.WriteLine("#Assembly: Creating assembly cache."); - FusionApi.CreateAssemblyCache(out assemblyCache, 0); - - Console.WriteLine("#Assembly: Loading mscorlib."); - string mscorlibasm = typeof(System.Object).Assembly.Location; - SharpAssembly mscorlib = LoadFrom(mscorlibasm); // the constructor adds the assembly to the pool - Console.WriteLine("#Assembly: Initialized"); - } - - Hashtable references = new Hashtable(); - - public static SharpAssembly LoadFrom(string filename) - { - return LoadFrom(filename, false); - } - - public static SharpAssembly LoadFrom(string filename, bool fromGAC) - { - // lock the assembly object in case that the preload thread is conflicting with another - lock (typeof(SharpAssembly)) { - AssemblyReader read = new AssemblyReader(); - read.Load(filename); - - SharpAssembly asm = new SharpAssembly(read, fromGAC); - asm.LoadReferences(); - asm.LoadNestedTypeTable(); - asm.LoadAttributeTable(); - asm.LoadFieldConstants(); - - return asm; - } - } - - public static SharpAssembly Load(string name, string lookInDir) - { - if (name.IndexOf(',') == -1) { - if (shortNamePool.ContainsKey(name)) { - return (SharpAssembly)shortNamePool[name]; - } - } else { - if (fullNamePool.ContainsKey(name)) { - return (SharpAssembly)fullNamePool[name]; - } - } - - bool fromGAC = false; - - string filename = GetAssemblyLocation(name); - string[] nameParts = name.Split(','); - - if (filename != "") { - fromGAC = true; - } else { - string possibleFilename = Path.Combine(lookInDir, nameParts[0] + ".dll"); - if (System.IO.File.Exists(possibleFilename)) filename = possibleFilename; - } - - // HACK : try loading mscorlib from 1.0 sdk - if (filename == "" && name == "mscorlib, Version=1.0.3300.0, Culture=neutral") { - RegistryKey regKey = Registry.LocalMachine.CreateSubKey("SOFTWARE\\Microsoft\\.NETFramework"); - string cmd = (string)regKey.GetValue("InstallRoot"); - if (cmd != null) { - string possFilename = Path.Combine(cmd, "v1.0.3705\\mscorlib.dll"); - if (System.IO.File.Exists(possFilename)) filename = possFilename; - } - } - - if (filename == "") throw new AssemblyNameNotFoundException(name); - - return LoadFrom(filename, fromGAC); - } - - public static SharpAssembly Load(string name) - { - return Load(name, Environment.CurrentDirectory); - } - - public static SharpAssembly Load(SharpAssemblyName name) - { - return Load(name.FullName, Environment.CurrentDirectory); - } - - private static string GetAssemblyLocation(string assemblyName) - { - ASSEMBLY_INFO info = new ASSEMBLY_INFO(); - - assemblyCache.QueryAssemblyInfo(3, assemblyName, ref info); - if (info.cchBuf != 0) - { - info.pszCurrentAssemblyPathBuf = new string(new char[info.cchBuf]); - assemblyCache.QueryAssemblyInfo(3, assemblyName, ref info); - return info.pszCurrentAssemblyPathBuf; - } - return ""; - - } - - internal SharpAssembly(AssemblyReader Reader, bool FromGac) - { - reader = Reader; - tables = new MetadataTables(reader); - - // cache Name object - internalName = GetAssemblyName(); - fromGAC = FromGac; - - fullNamePool[this.FullName] = this; - if (!shortNamePool.ContainsKey(this.Name)) { - shortNamePool[this.Name] = this; - } - } - - - AssemblyReader reader; - MetadataTables tables; - - public AssemblyReader Reader { - get { - return reader; - } - } - - public string Location { - get { - return reader.FileName; - } - } - - public MetadataTables Tables { - get { - return tables; - } - } - - public string[] GetManifestResourceNames() - { - if (Tables.ManifestResource == null) return new string[0]; - string[] ret = new string[Tables.ManifestResource.GetUpperBound(0)]; - - for (int i = 0; i <= ret.GetUpperBound(0); ++i) { - ret[i] = reader.GetStringFromHeap(Tables.ManifestResource[i+1].Name); - } - - return ret; - } - - public int GetManifestResourceSize(string name) - { - if (Tables.ManifestResource == null) return 0; - - for (int i = 1; i <= Tables.ManifestResource.GetUpperBound(0); ++i) { - if (reader.GetStringFromHeap(Tables.ManifestResource[i].Name) == name) { - if (Tables.ManifestResource[i].Implementation != 0) { // not in current file - throw new System.NotImplementedException("resource in different file"); - } - try { - Stream fs = new System.IO.MemoryStream(reader.RawSectionData); - fs.Seek(reader.LookupRVA(reader.CliHeader.Resources) + Tables.ManifestResource[i].Offset, SeekOrigin.Begin); - BinaryReader binaryReader = new BinaryReader(fs); - - int size = (int)binaryReader.ReadUInt32(); - return size; - } catch { - return 0; - } - } - } - - return 0; - } - - public byte[] GetManifestResource(string name) - { - if (Tables.ManifestResource == null) return new byte[0]; - - for (int i = 1; i <= Tables.ManifestResource.GetUpperBound(0); ++i) { - if (reader.GetStringFromHeap(Tables.ManifestResource[i].Name) == name) { - if (Tables.ManifestResource[i].Implementation != 0) { // not in current file - throw new System.NotImplementedException("resource in different file"); - } - try { - Stream fs = new System.IO.MemoryStream(reader.RawSectionData); - fs.Seek(reader.LookupRVA(reader.CliHeader.Resources) + Tables.ManifestResource[i].Offset, SeekOrigin.Begin); - BinaryReader binaryReader = new BinaryReader(fs); - - int size = (int)binaryReader.ReadUInt32(); - return binaryReader.ReadBytes(size); - } catch { - return new byte[0]; - } - - } - } - - return new byte[0]; - - } - - private void LoadReferences() - { - // load references - SharpAssemblyName[] names = GetReferencedAssemblies(); - - foreach(SharpAssemblyName name in names) { - try { - if (fullNamePool.ContainsKey(name.FullName)) { - references.Add((int)name.RefId, fullNamePool[name.FullName]); - } else { - references.Add((int)name.RefId, Load(name)); - } - } catch { - Console.WriteLine("LoadReferences: Error loading reference " + name.FullName); - } - } - } - - public SharpAssemblyName[] GetReferencedAssemblies() - { - if (Tables.AssemblyRef == null) return new SharpAssemblyName[0]; - SharpAssemblyName[] ret = new SharpAssemblyName[Tables.AssemblyRef.GetUpperBound(0)]; - - for (int i = 1; i <= Tables.AssemblyRef.GetUpperBound(0); ++i) { - AssemblyRef aref = Tables.AssemblyRef[i]; - ret[i-1] = new SharpAssemblyName(); - ret[i-1].Name = reader.GetStringFromHeap(aref.Name); - ret[i-1].Version = new Version(aref.Major, aref.Minor, aref.Build, aref.Revision); - ret[i-1].Culture = reader.GetStringFromHeap(aref.Culture); - ret[i-1].Flags = aref.Flags; - ret[i-1].PublicKey = reader.GetBlobFromHeap(aref.PublicKeyOrToken); - ret[i-1].RefId = i; - } - - return ret; - } - - public SharpAssembly GetReference(int index) - { - if (!references.ContainsKey((int)index)) { - Console.Write("GetReference: No such assembly ref index: " + index + " in assembly " + Name); - Console.WriteLine("; ReferenceCount = " + references.Count); - foreach (DictionaryEntry de in references) { - Console.Write (de.Key.GetType().ToString() + " "); - } - } - return (SharpAssembly)references[(int)index]; - } - - public SharpAssembly GetReference(string name) - { - bool fullName = false; - if (name.IndexOf(',') != -1) fullName = true; - - foreach(DictionaryEntry de in references) { - SharpAssembly assembly = (SharpAssembly)de.Value; - string compare = (fullName ? assembly.FullName : assembly.Name); - if (compare == name) return (SharpAssembly)de.Value; - } - return null; - } - - public SharpAssembly GetRefAssemblyFor(uint typeRefIndex) - { - if (Tables.TypeRef == null) return null; - - uint val = Tables.TypeRef[typeRefIndex].ResolutionScope; - int table = reader.GetCodedIndexTable(CodedIndex.ResolutionScope, ref val); - - switch (table) { - case 2: // AssemblyRef - return GetReference((int)val); - case 3: // TypeRef -- nested type - return GetRefAssemblyFor(val); - case 0: - Console.WriteLine("GetRefAssemblyFor: Unsupported ResolutionScope [Module]"); - return null; - case 1: - Console.WriteLine("GetRefAssemblyFor: Unsupported ResolutionScope [ModuleRef]"); - return null; - default: // other token - not supported - Console.WriteLine("GetRefAssemblyFor: Unsupported ResolutionScope [" + table + "] for assembly " + Name); - return null; - } - } - - public SharpAssemblyName GetAssemblyName() - { - SharpAssemblyName name = new SharpAssemblyName(); - - if (Tables.Assembly == null) return name; - - Rows.Assembly arow = Tables.Assembly[1]; - - name.Name = reader.GetStringFromHeap(arow.Name); - name.Version = new Version(arow.MajorVersion, arow.MinorVersion, arow.BuildNumber, arow.RevisionNumber); - name.Culture = reader.GetStringFromHeap(arow.Culture); - name.Flags = arow.Flags; - name.PublicKey = reader.GetBlobFromHeap(arow.PublicKey); - - return name; - } - - public static SharpAssemblyName GetAssemblyName(AssemblyReader asm) - { - SharpAssemblyName name = new SharpAssemblyName(); - - if ((Rows.Assembly[])asm.MetadataTable.Tables[Rows.Assembly.TABLE_ID] == null) return name; - - Rows.Assembly arow = ((Rows.Assembly[])asm.MetadataTable.Tables[Rows.Assembly.TABLE_ID])[1]; - - name.Name = asm.GetStringFromHeap(arow.Name); - name.Version = new Version(arow.MajorVersion, arow.MinorVersion, arow.BuildNumber, arow.RevisionNumber); - name.Culture = asm.GetStringFromHeap(arow.Culture); - name.Flags = arow.Flags; - name.PublicKey = asm.GetBlobFromHeap(arow.PublicKey); - - return name; - } - - public static SharpAssemblyName GetNameOfReference(AssemblyReader asm, uint AsmRefIndex) - { - SharpAssemblyName name = new SharpAssemblyName(); - - if ((AssemblyRef[])asm.MetadataTable.Tables[AssemblyRef.TABLE_ID] == null) return name; - - AssemblyRef aref = ((AssemblyRef[])asm.MetadataTable.Tables[AssemblyRef.TABLE_ID])[AsmRefIndex]; - - name.Name = asm.GetStringFromHeap(aref.Name); - name.Version = new Version(aref.Major, aref.Minor, aref.Build, aref.Revision); - name.Culture = asm.GetStringFromHeap(aref.Culture); - name.Flags = aref.Flags; - name.PublicKey = asm.GetBlobFromHeap(aref.PublicKeyOrToken); - - return name; - } - - SharpAssemblyName internalName = new SharpAssemblyName(); - - public string Name { - get { - return internalName.Name; - } - } - - public string FullName { - get { - return internalName.FullName; - } - } - - void DebugMessage(string msg, Exception e) - { - MessageBox.Show(msg + "\n\n" + e.ToString()); - } - - uint[] nestedType; - - void LoadNestedTypeTable() - { - if (Tables.TypeDef == null) { - nestedType = new uint[0]; - } - - nestedType = new uint[Tables.TypeDef.GetUpperBound(0) + 1]; - - if (Tables.NestedClass == null) { - return; - } - - for (uint i = 1; i <= Tables.NestedClass.GetUpperBound(0); ++i) { - nestedType[Tables.NestedClass[i].NestedClassIndex] = Tables.NestedClass[i].EnclosingClass; - } - } - - public uint GetNestedTypeParent(uint index) - { - try { - return nestedType[index]; - } catch { - return 0; // not nested! - } - } - - // to store objects that are associated with TypeDef/TypeRef items - Hashtable typeRefObjects = new Hashtable(); - Hashtable typeDefObjects = new Hashtable(); - - public Hashtable TypeRefObjects { - get { - return typeRefObjects; - } - } - - public Hashtable TypeDefObjects { - get { - return typeDefObjects; - } - } - - bool fromGAC; - - public bool FromGAC { - get { - return fromGAC; - } - } - - Hashtable constantTable = new Hashtable(); - - public Hashtable FieldConstantTable { - get { - return constantTable; - } - } - - void LoadFieldConstants() - { - if (Tables.Constant == null) return; - - for (uint i = 1; i <= Tables.Constant.GetUpperBound(0); ++i) { - uint cst = Tables.Constant[i].Parent; - int tbl = reader.GetCodedIndexTable(CodedIndex.HasConstant, ref cst); - if (tbl != 0) continue; - - constantTable[cst] = Tables.Constant[i]; - } - } - - // to store attribute definitions - CustomAttributeTable attributes = new CustomAttributeTable(); - - public CustomAttributeTable Attributes { - get { - return attributes; - } - } - - void LoadAttributeTable() - { - CustomAttribute[] attrTable = Tables.CustomAttribute; - if (attrTable == null) return; - - uint pval = 0; - int table = 0; - - for (uint i = 1; i <= attrTable.GetUpperBound(0); ++i) { - pval = attrTable[i].Parent; - table = reader.GetCodedIndexTable(CodedIndex.HasCustomAttribute, ref pval); - - Hashtable hashtable; - - switch(table) { - case 0: hashtable = attributes.Method; break; - case 1: hashtable = attributes.Field; break; - case 2: hashtable = attributes.TypeRef; break; - case 3: hashtable = attributes.TypeDef; break; - case 4: hashtable = attributes.Param; break; - case 9: hashtable = attributes.Property; break; - case 10: hashtable = attributes.Event; break; - case 14: hashtable = attributes.Assembly; break; - default: - continue; - } - - AddAttribute(hashtable, pval, new SharpCustomAttribute(this, attrTable[i].Type, attrTable[i].Val)); - } - } - - void AddAttribute(Hashtable table, uint index, object attribute) - { - if (table[index] == null) { - table[index] = new ArrayList(); - } - - ArrayList list = (ArrayList)table[index]; - - list.Add(attribute); - } - } - - public class SharpCustomAttribute - { - uint memberIndex; - bool isMemberRef = false; - uint valueIndex; - SharpAssembly assembly; - - public SharpCustomAttribute(SharpAssembly Assembly, uint TypeIndex, uint ValueIndex) - { - assembly = Assembly; - valueIndex = ValueIndex; - - memberIndex = TypeIndex; - int table = assembly.Reader.GetCodedIndexTable(CodedIndex.CustomAttributeType, ref memberIndex); - - if (table == 3) isMemberRef = true; - } - - public uint MemberIndex { - get { - return memberIndex; - } - } - - public uint ValueIndex { - get { - return valueIndex; - } - } - - public bool IsMemberRef { - get { - return isMemberRef; - } - } - - public override string ToString() - { - return "CustomAttribute: Index " + memberIndex + " (IsMemberRef: " + isMemberRef + ") -> " + valueIndex; - } - } - - public class CustomAttributeTable - { - public Hashtable Method; - public Hashtable Field; - public Hashtable TypeRef; - public Hashtable TypeDef; - public Hashtable Param; - public Hashtable Property; - public Hashtable Event; - public Hashtable Assembly; - - public CustomAttributeTable() - { - Method = new Hashtable(); - Field = new Hashtable(); - TypeRef = new Hashtable(); - TypeDef = new Hashtable(); - Param = new Hashtable(); - Property = new Hashtable(); - Event = new Hashtable(); - Assembly = new Hashtable(); - } - } - -} - - diff --git a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/SharpAssemblyName.cs b/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/SharpAssemblyName.cs deleted file mode 100644 index 2e79f3a36b..0000000000 --- a/src/Libraries/ICSharpCode.SharpAssembly/Project/Src/SharpAssemblyName.cs +++ /dev/null @@ -1,39 +0,0 @@ -// -// 2002-2005 AlphaSierraPapa -// GNU General Public License -// -// $Revision$ -// - -using System; -using ICSharpCode.SharpAssembly.Metadata; -using ICSharpCode.SharpAssembly.Metadata.Rows; - -namespace ICSharpCode.SharpAssembly.Assembly -{ - /// - /// imitates Reflection.AssemblyName, but has less functionality - /// - public class SharpAssemblyName : object - { - public string Name; - public uint Flags; - public string Culture; - public Version Version; - public byte[] PublicKey; - public int RefId; - - public string FullName { - get { - string cult = (Culture == "" ? "neutral" : Culture); - - return Name + ", Version=" + Version.ToString() + ", Culture=" + cult; - // + ", PublicKeyToken=" + PublicKey.ToString(); - } - } - - public SharpAssemblyName() - { - } - } -}