Author: jbevain
Date: 2006-10-11 15:19:54 -0400 (Wed, 11 Oct 2006)
New Revision: 66565
Added:
trunk/cecil/lib/Mono.Cecil.Cil/DocumentHashAlgorithm.cs
trunk/cecil/lib/Mono.Cecil.Cil/DocumentLanguage.cs
trunk/cecil/lib/Mono.Cecil.Cil/DocumentLanguageVendor.cs
trunk/cecil/lib/Mono.Cecil.Cil/DocumentType.cs
trunk/cecil/lib/Mono.Cecil.Cil/GuidAttribute.cs
Modified:
trunk/cecil/lib/ChangeLog
trunk/cecil/lib/Mono.Cecil.Cil/Document.cs
trunk/cecil/lib/Mono.Cecil.csproj
trunk/cecil/lib/Mono.Cecil.dll.sources
trunk/cecil/lib/Mono.Cecil/SecurityDeclarationReader.cs
Log:
2006-10-11 Jb Evain <[EMAIL PROTECTED]>
* Mono.Cecil.Cil/Document.cs:
Complete a little bit.
Modified: trunk/cecil/lib/ChangeLog
===================================================================
--- trunk/cecil/lib/ChangeLog 2006-10-11 19:09:50 UTC (rev 66564)
+++ trunk/cecil/lib/ChangeLog 2006-10-11 19:19:54 UTC (rev 66565)
@@ -1,5 +1,8 @@
2006-10-11 Jb Evain <[EMAIL PROTECTED]>
+ * Mono.Cecil.Cil/Document.cs:
+ Complete a little bit.
+
* Mono.Cecil/SecurityDeclarationReader.cs:
Get rid of a lot of exceptions when creating the security
attribute.
Modified: trunk/cecil/lib/Mono.Cecil/SecurityDeclarationReader.cs
===================================================================
--- trunk/cecil/lib/Mono.Cecil/SecurityDeclarationReader.cs 2006-10-11
19:09:50 UTC (rev 66564)
+++ trunk/cecil/lib/Mono.Cecil/SecurityDeclarationReader.cs 2006-10-11
19:19:54 UTC (rev 66565)
@@ -107,7 +107,7 @@
}
#if !CF_1_0 && !CF_2_0
- private SSP.SecurityAttribute CreateSecurityAttribute
(SecurityAction action, BinaryReader br, byte[] permset, int pos, out int
start, bool resolve)
+ private SSP.SecurityAttribute CreateSecurityAttribute
(SecurityAction action, BinaryReader br, byte [] permset, int pos, out int
start, bool resolve)
{
string cname = SignatureReader.ReadUTF8String (permset,
pos, out start);
Type secattr = null;
Modified: trunk/cecil/lib/Mono.Cecil.Cil/Document.cs
===================================================================
--- trunk/cecil/lib/Mono.Cecil.Cil/Document.cs 2006-10-11 19:09:50 UTC (rev
66564)
+++ trunk/cecil/lib/Mono.Cecil.Cil/Document.cs 2006-10-11 19:19:54 UTC (rev
66565)
@@ -32,14 +32,47 @@
string m_url;
+ DocumentType m_type;
+ DocumentHashAlgorithm m_hashAlgorithm;
+ DocumentLanguage m_language;
+ DocumentLanguageVendor m_languageVendor;
+
+ byte [] m_hash;
+
public string Url {
get { return m_url; }
set { m_url = value; }
}
+ public DocumentType Type {
+ get { return m_type; }
+ set { m_type = value; }
+ }
+
+ public DocumentHashAlgorithm HashAlgorithm {
+ get { return m_hashAlgorithm; }
+ set { m_hashAlgorithm = value; }
+ }
+
+ public DocumentLanguage Language {
+ get { return m_language; }
+ set { m_language = value; }
+ }
+
+ public DocumentLanguageVendor LanguageVendor {
+ get { return m_languageVendor; }
+ set { m_languageVendor = value; }
+ }
+
+ public byte [] Hash {
+ get { return m_hash; }
+ set { m_hash = value; }
+ }
+
public Document (string url)
{
m_url = url;
+ m_hash = new byte [0];
}
}
}
Added: trunk/cecil/lib/Mono.Cecil.Cil/DocumentHashAlgorithm.cs
===================================================================
--- trunk/cecil/lib/Mono.Cecil.Cil/DocumentHashAlgorithm.cs 2006-10-11
19:09:50 UTC (rev 66564)
+++ trunk/cecil/lib/Mono.Cecil.Cil/DocumentHashAlgorithm.cs 2006-10-11
19:19:54 UTC (rev 66565)
@@ -0,0 +1,36 @@
+//
+// DocumentHashAlgorithm.cs
+//
+// Author:
+// Jb Evain ([EMAIL PROTECTED])
+//
+// (C) 2006 Jb Evain
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+namespace Mono.Cecil.Cil {
+
+ public enum DocumentHashAlgorithm {
+ [Guid (0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00)] None,
+ [Guid (0x406ea660, 0x64cf, 0x4c82, 0xb6, 0xf0, 0x42, 0xd4,
0x81, 0x72, 0xa7, 0x99)] MD5,
+ [Guid (0xff1816ec, 0xaa5e, 0x4d10, 0x87, 0xf7, 0x6f, 0x49,
0x63, 0x83, 0x34, 0x60)] SHA1
+ }
+}
Property changes on: trunk/cecil/lib/Mono.Cecil.Cil/DocumentHashAlgorithm.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/cecil/lib/Mono.Cecil.Cil/DocumentLanguage.cs
===================================================================
--- trunk/cecil/lib/Mono.Cecil.Cil/DocumentLanguage.cs 2006-10-11 19:09:50 UTC
(rev 66564)
+++ trunk/cecil/lib/Mono.Cecil.Cil/DocumentLanguage.cs 2006-10-11 19:19:54 UTC
(rev 66565)
@@ -0,0 +1,45 @@
+//
+// DocumentLanguage.cs
+//
+// Author:
+// Jb Evain ([EMAIL PROTECTED])
+//
+// (C) 2006 Jb Evain
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+namespace Mono.Cecil.Cil {
+
+ public enum DocumentLanguage {
+ [Guid (0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x0, 0x00, 0x00,
0x00, 0x00, 0x00)] None,
+ [Guid (0x63a08714, 0xfc37, 0x11d2, 0x90, 0x4c, 0x0, 0xc0, 0x4f,
0xa3, 0x02, 0xa1)] C,
+ [Guid (0x3a12d0b7, 0xc26c, 0x11d0, 0xb4, 0x42, 0x0, 0xa0, 0x24,
0x4a, 0x1d, 0xd2)] Cpp,
+ [Guid (0x3f5162f8, 0x07c6, 0x11d3, 0x90, 0x53, 0x0, 0xc0, 0x4f,
0xa3, 0x02, 0xa1)] CSharp,
+ [Guid (0x3a12d0b8, 0xc26c, 0x11d0, 0xb4, 0x42, 0x0, 0xa0, 0x24,
0x4a, 0x1d, 0xd2)] Basic,
+ [Guid (0x3a12d0b4, 0xc26c, 0x11d0, 0xb4, 0x42, 0x0, 0xa0, 0x24,
0x4a, 0x1d, 0xd2)] Java,
+ [Guid (0xaf046cd1, 0xd0e1, 0x11d2, 0x97, 0x7c, 0x0, 0xa0, 0xc9,
0xb4, 0xd5, 0xc)] Cobol,
+ [Guid (0xaf046cd2, 0xd0e1, 0x11d2, 0x97, 0x7c, 0x0, 0xa0, 0xc9,
0xb4, 0xd5, 0xc)] Pascal,
+ [Guid (0xaf046cd3, 0xd0e1, 0x11d2, 0x97, 0x7c, 0x0, 0xa0, 0xc9,
0xb4, 0xd5, 0xc)] CIL,
+ [Guid (0x3a12d0b6, 0xc26c, 0x11d0, 0xb4, 0x42, 0x0, 0xa0, 0x24,
0x4a, 0x1d, 0xd2)] JScript,
+ [Guid (0xd9b9f7b, 0x6611, 0x11d3, 0xbd, 0x2a, 0x0, 0x0, 0xf8,
0x8, 0x49, 0xbd)] SMC,
+ [Guid (0x4b35fde8, 0x07c6, 0x11d3, 0x90, 0x53, 0x0, 0xc0, 0x4f,
0xa3, 0x02, 0xa1)] MCpp
+ }
+}
Property changes on: trunk/cecil/lib/Mono.Cecil.Cil/DocumentLanguage.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/cecil/lib/Mono.Cecil.Cil/DocumentLanguageVendor.cs
===================================================================
--- trunk/cecil/lib/Mono.Cecil.Cil/DocumentLanguageVendor.cs 2006-10-11
19:09:50 UTC (rev 66564)
+++ trunk/cecil/lib/Mono.Cecil.Cil/DocumentLanguageVendor.cs 2006-10-11
19:19:54 UTC (rev 66565)
@@ -0,0 +1,35 @@
+//
+// DocumentLanguageVendor.cs
+//
+// Author:
+// Jb Evain ([EMAIL PROTECTED])
+//
+// (C) 2006 Jb Evain
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+namespace Mono.Cecil.Cil {
+
+ public enum DocumentLanguageVendor {
+ [Guid (0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00)] Other,
+ [Guid (0x994b45c4, 0xe6e9, 0x11d2, 0x90, 0x3f, 0x00, 0xc0,
0x4f, 0xa3, 0x02, 0xa1)] Microsoft
+ }
+}
Property changes on: trunk/cecil/lib/Mono.Cecil.Cil/DocumentLanguageVendor.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/cecil/lib/Mono.Cecil.Cil/DocumentType.cs
===================================================================
--- trunk/cecil/lib/Mono.Cecil.Cil/DocumentType.cs 2006-10-11 19:09:50 UTC
(rev 66564)
+++ trunk/cecil/lib/Mono.Cecil.Cil/DocumentType.cs 2006-10-11 19:19:54 UTC
(rev 66565)
@@ -0,0 +1,35 @@
+//
+// DocumentType.cs
+//
+// Author:
+// Jb Evain ([EMAIL PROTECTED])
+//
+// (C) 2006 Jb Evain
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+namespace Mono.Cecil.Cil {
+
+ public enum DocumentType {
+ [Guid (0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00)] Other,
+ [Guid (0x5a869d0b, 0x6611, 0x11d3, 0xbd, 0x2a, 0x00, 0x00,
0xf8, 0x08, 0x49, 0xbd)] Text
+ }
+}
Property changes on: trunk/cecil/lib/Mono.Cecil.Cil/DocumentType.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/cecil/lib/Mono.Cecil.Cil/GuidAttribute.cs
===================================================================
--- trunk/cecil/lib/Mono.Cecil.Cil/GuidAttribute.cs 2006-10-11 19:09:50 UTC
(rev 66564)
+++ trunk/cecil/lib/Mono.Cecil.Cil/GuidAttribute.cs 2006-10-11 19:19:54 UTC
(rev 66565)
@@ -0,0 +1,91 @@
+//
+// GuidAttribute.cs
+//
+// Author:
+// Jb Evain ([EMAIL PROTECTED])
+//
+// (C) 2006 Jb Evain
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+namespace Mono.Cecil.Cil {
+
+ using System;
+ using System.Reflection;
+
+ [AttributeUsage (AttributeTargets.Field)]
+ public class GuidAttribute : Attribute {
+
+ private Guid m_guid;
+
+ public Guid Guid {
+ get { return m_guid; }
+ }
+
+ GuidAttribute ()
+ {
+ m_guid = new Guid ();
+ }
+
+ public GuidAttribute (
+ uint a,
+ ushort b,
+ ushort c,
+ byte d,
+ byte e,
+ byte f,
+ byte g,
+ byte h,
+ byte i,
+ byte j,
+ byte k)
+ {
+ m_guid = new Guid (a, b, c, d, e, f, g, h, i, j, k);
+ }
+
+ public static int GetValueFromGuid (Guid id, Type enumeration)
+ {
+ foreach (FieldInfo fi in enumeration.GetFields
(BindingFlags.Static | BindingFlags.Public))
+ if (id == GetGuidAttribute (fi).Guid)
+ return (int) fi.GetValue (null);
+
+ return -1;
+ }
+
+ public static Guid GetGuidFromValue (int value, Type
enumeration)
+ {
+ foreach (FieldInfo fi in enumeration.GetFields
(BindingFlags.Static | BindingFlags.Public))
+ if (value == (int) fi.GetValue (null))
+ return GetGuidAttribute (fi).Guid;
+
+ return new Guid ();
+ }
+
+ static GuidAttribute GetGuidAttribute (FieldInfo fi)
+ {
+ GuidAttribute [] attributes = fi.GetCustomAttributes
(typeof (GuidAttribute), false) as GuidAttribute [];
+ if (attributes == null || attributes.Length != 1)
+ return new GuidAttribute ();
+
+ return attributes [0];
+ }
+ }
+}
Property changes on: trunk/cecil/lib/Mono.Cecil.Cil/GuidAttribute.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/cecil/lib/Mono.Cecil.csproj
===================================================================
--- trunk/cecil/lib/Mono.Cecil.csproj 2006-10-11 19:09:50 UTC (rev 66564)
+++ trunk/cecil/lib/Mono.Cecil.csproj 2006-10-11 19:19:54 UTC (rev 66565)
@@ -71,11 +71,16 @@
<Compile Include="Mono.Cecil.Cil\CilWorker.cs" />
<Compile Include="Mono.Cecil.Cil\CodeReader.cs" />
<Compile Include="Mono.Cecil.Cil\CodeWriter.cs" />
+ <Compile Include="Mono.Cecil.Cil\DocumentType.cs" />
<Compile Include="Mono.Cecil.Cil\Document.cs" />
+ <Compile Include="Mono.Cecil.Cil\DocumentHashAlgorithm.cs" />
+ <Compile Include="Mono.Cecil.Cil\DocumentLanguage.cs" />
+ <Compile Include="Mono.Cecil.Cil\DocumentLanguageVendor.cs" />
<Compile Include="Mono.Cecil.Cil\ExceptionHandler.cs" />
<Compile Include="Mono.Cecil.Cil\ExceptionHandlerCollection.cs" />
<Compile Include="Mono.Cecil.Cil\ExceptionHandlerType.cs" />
<Compile Include="Mono.Cecil.Cil\FlowControl.cs" />
+ <Compile Include="Mono.Cecil.Cil\GuidAttribute.cs" />
<Compile Include="Mono.Cecil.Cil\ICodeVisitable.cs" />
<Compile Include="Mono.Cecil.Cil\ICodeVisitor.cs" />
<Compile Include="Mono.Cecil.Cil\Instruction.cs" />
Modified: trunk/cecil/lib/Mono.Cecil.dll.sources
===================================================================
--- trunk/cecil/lib/Mono.Cecil.dll.sources 2006-10-11 19:09:50 UTC (rev
66564)
+++ trunk/cecil/lib/Mono.Cecil.dll.sources 2006-10-11 19:19:54 UTC (rev
66565)
@@ -227,10 +227,15 @@
./Mono.Cecil.Cil/CodeReader.cs
./Mono.Cecil.Cil/CodeWriter.cs
./Mono.Cecil.Cil/Document.cs
+./Mono.Cecil.Cil/DocumentHashAlgorithm.cs
+./Mono.Cecil.Cil/DocumentLanguage.cs
+./Mono.Cecil.Cil/DocumentLanguageVendor.cs
+./Mono.Cecil.Cil/DocumentType.cs
./Mono.Cecil.Cil/ExceptionHandler.cs
./Mono.Cecil.Cil/ExceptionHandlerCollection.cs
./Mono.Cecil.Cil/ExceptionHandlerType.cs
./Mono.Cecil.Cil/FlowControl.cs
+./Mono.Cecil.Cil/GuidAttribute.cs
./Mono.Cecil.Cil/ICodeVisitable.cs
./Mono.Cecil.Cil/ICodeVisitor.cs
./Mono.Cecil.Cil/Instruction.cs
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches