Author: jbevain
Date: 2007-06-05 10:15:34 -0400 (Tue, 05 Jun 2007)
New Revision: 78631
Modified:
trunk/cecil/lib/ChangeLog
trunk/cecil/lib/Mono.Cecil/AssemblyNameReference.cs
Log:
2007-06-05 Jb Evain <[EMAIL PROTECTED]>
* Mono.Cecil/AssemblyNameReference.cs:
Cache the fullname when possible.
Modified: trunk/cecil/lib/ChangeLog
===================================================================
--- trunk/cecil/lib/ChangeLog 2007-06-05 13:48:51 UTC (rev 78630)
+++ trunk/cecil/lib/ChangeLog 2007-06-05 14:15:34 UTC (rev 78631)
@@ -1,3 +1,8 @@
+2007-06-05 Jb Evain <[EMAIL PROTECTED]>
+
+ * Mono.Cecil/AssemblyNameReference.cs:
+ Cache the fullname when possible.
+
2007-05-31 Jb Evain <[EMAIL PROTECTED]>
* Mono.Cecil/ModuleDefinition.cs:
Modified: trunk/cecil/lib/Mono.Cecil/AssemblyNameReference.cs
===================================================================
--- trunk/cecil/lib/Mono.Cecil/AssemblyNameReference.cs 2007-06-05 13:48:51 UTC
(rev 78630)
+++ trunk/cecil/lib/Mono.Cecil/AssemblyNameReference.cs 2007-06-05 14:15:34 UTC
(rev 78631)
@@ -49,19 +49,31 @@
MetadataToken m_token;
IDictionary m_annotations;
+ bool m_fullNameDiscarded = true;
+ string m_fullName;
+
public string Name {
get { return m_name; }
- set { m_name = value; }
+ set {
+ m_name = value;
+ m_fullNameDiscarded = true;
+ }
}
public string Culture {
get { return m_culture; }
- set { m_culture = value; }
+ set {
+ m_culture = value;
+ m_fullNameDiscarded = true;
+ }
}
public Version Version {
get { return m_version; }
- set { m_version = value; }
+ set {
+ m_version = value;
+ m_fullNameDiscarded = true;
+ }
}
public AssemblyFlags Flags {
@@ -74,6 +86,7 @@
set {
m_publicKey = value;
m_publicKeyToken = null;
+ m_fullNameDiscarded = true;
}
}
@@ -81,7 +94,7 @@
get {
#if !CF_1_0
if ((m_publicKeyToken == null ||
m_publicKeyToken.Length == 0) && (m_publicKey != null && m_publicKey.Length >
0)) {
- HashAlgorithm ha = null;
+ HashAlgorithm ha;
switch (m_hashAlgo) {
case AssemblyHashAlgorithm.Reserved:
ha = MD5.Create (); break;
@@ -89,7 +102,7 @@
// None default to SHA1
ha = SHA1.Create (); break;
}
- byte[] hash = ha.ComputeHash
(m_publicKey);
+ byte [] hash = ha.ComputeHash
(m_publicKey);
// we need the last 8 bytes in reverse
order
m_publicKeyToken = new byte [8];
Array.Copy (hash, (hash.Length - 8),
m_publicKeyToken, 0, 8);
@@ -98,11 +111,17 @@
#endif
return m_publicKeyToken;
}
- set { m_publicKeyToken = value; }
+ set {
+ m_publicKeyToken = value;
+ m_fullNameDiscarded = true;
+ }
}
public string FullName {
get {
+ if (m_fullName != null && !m_fullNameDiscarded)
+ return m_fullName;
+
StringBuilder sb = new StringBuilder ();
string sep = ", ";
sb.Append (m_name);
@@ -123,7 +142,9 @@
} else {
sb.Append ("null");
}
- return sb.ToString ();
+ m_fullName = sb.ToString ();
+ m_fullNameDiscarded = false;
+ return m_fullName;
}
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches