diff options
author | Lluis Sanchez <lluis@novell.com> | 2010-03-30 14:12:36 +0400 |
---|---|---|
committer | Lluis Sanchez <lluis@novell.com> | 2010-03-30 14:12:36 +0400 |
commit | fe0994050cb83d4815a33786a4dc368a8a36d27f (patch) | |
tree | 43534269681ec9c25f54d514d77ad3812e81d33a | |
parent | dbb5c3ab0c608d00c499ae69194180e81745c855 (diff) |
* Mono.Addins.Serialization/BinaryXmlReader.cs: Properly detect EOF.
* Mono.Addins/Addin.cs: If a file is corrupted and can't be read,
delete it so that it can be properly regenerated.
svn path=/trunk/mono-addins/; revision=154438
-rw-r--r-- | Mono.Addins/ChangeLog | 8 | ||||
-rw-r--r-- | Mono.Addins/Mono.Addins.Serialization/BinaryXmlReader.cs | 3 | ||||
-rw-r--r-- | Mono.Addins/Mono.Addins/Addin.cs | 11 |
3 files changed, 20 insertions, 2 deletions
diff --git a/Mono.Addins/ChangeLog b/Mono.Addins/ChangeLog index 01c3bd7..8d8e7d8 100644 --- a/Mono.Addins/ChangeLog +++ b/Mono.Addins/ChangeLog @@ -1,5 +1,13 @@ 2010-03-30 Lluis Sanchez Gual <lluis@novell.com> + * Mono.Addins.Serialization/BinaryXmlReader.cs: Properly + detect EOF. + + * Mono.Addins/Addin.cs: If a file is corrupted and can't be + read, delete it so that it can be properly regenerated. + +2010-03-30 Lluis Sanchez Gual <lluis@novell.com> + * Mono.Addins.csproj: csc doesn't like iso-2. 2010-03-29 Lluis Sanchez Gual <lluis@novell.com> diff --git a/Mono.Addins/Mono.Addins.Serialization/BinaryXmlReader.cs b/Mono.Addins/Mono.Addins.Serialization/BinaryXmlReader.cs index 7fd5650..9200059 100644 --- a/Mono.Addins/Mono.Addins.Serialization/BinaryXmlReader.cs +++ b/Mono.Addins/Mono.Addins.Serialization/BinaryXmlReader.cs @@ -38,6 +38,7 @@ namespace Mono.Addins.Serialization { BinaryReader reader; + internal const byte TagEndOfFile = 0; internal const byte TagBeginElement = 1; internal const byte TagEndElement = 2; internal const byte TagValue = 4; @@ -81,7 +82,7 @@ namespace Mono.Addins.Serialization { int b = reader.BaseStream.ReadByte (); if (b == -1) { - currentType = TagBeginElement; + currentType = TagEndOfFile; return; } currentType = (byte) b; diff --git a/Mono.Addins/Mono.Addins/Addin.cs b/Mono.Addins/Mono.Addins/Addin.cs index 5790e06..47c62e1 100644 --- a/Mono.Addins/Mono.Addins/Addin.cs +++ b/Mono.Addins/Mono.Addins/Addin.cs @@ -148,8 +148,17 @@ namespace Mono.Addins AddinDescription m; database.ReadAddinDescription (new ConsoleProgressStatus (true), configFile, out m); - if (m == null) + if (m == null) { + try { + if (File.Exists (configFile)) { + // The file is corrupted. Remove it. + File.Delete (configFile); + } + } catch { + // Ignore + } throw new InvalidOperationException ("Could not read add-in description"); + } if (addin == null) { addin = AddinInfo.ReadFromDescription (m); sourceFile = m.AddinFile; |