Browse Source

Fix "Unhandled exception when installing packed addin with incorrect .addin file" (http://community.sharpdevelop.net/forums/t/11807.aspx)

pull/1/head
Daniel Grunwald 15 years ago
parent
commit
748caff645
  1. 28
      src/Main/Core/Project/Src/AddInTree/AddIn/AddIn.cs

28
src/Main/Core/Project/Src/AddInTree/AddIn/AddIn.cs

@ -267,22 +267,26 @@ namespace ICSharpCode.Core
public static AddIn Load(TextReader textReader, string hintPath) public static AddIn Load(TextReader textReader, string hintPath)
{ {
AddIn addIn = new AddIn(); try {
using (XmlTextReader reader = new XmlTextReader(textReader)) { AddIn addIn = new AddIn();
while (reader.Read()){ using (XmlTextReader reader = new XmlTextReader(textReader)) {
if (reader.IsStartElement()) { while (reader.Read()){
switch (reader.LocalName) { if (reader.IsStartElement()) {
case "AddIn": switch (reader.LocalName) {
addIn.properties = Properties.ReadFromAttributes(reader); case "AddIn":
SetupAddIn(reader, addIn, hintPath); addIn.properties = Properties.ReadFromAttributes(reader);
break; SetupAddIn(reader, addIn, hintPath);
default: break;
throw new AddInLoadException("Unknown add-in file."); default:
throw new AddInLoadException("Unknown add-in file.");
}
} }
} }
} }
return addIn;
} catch (XmlException ex) {
throw new AddInLoadException(ex.Message, ex);
} }
return addIn;
} }
public static AddIn Load(string fileName) public static AddIn Load(string fileName)

Loading…
Cancel
Save