[Monodevelop-patches-list] r2440 - in trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor: . Services

John Luke <jluke@cfl.rr.com> jluke at mono-cvs.ximian.com
Sat Apr 9 20:24:28 EDT 2005


Author: jluke
Date: 2005-04-09 20:24:28 -0400 (Sat, 09 Apr 2005)
New Revision: 2440

Modified:
   trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/ChangeLog
   trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Services/SourceViewService.cs
Log:
catch XmlException


Modified: trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/ChangeLog
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/ChangeLog	2005-04-09 10:32:43 UTC (rev 2439)
+++ trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/ChangeLog	2005-04-10 00:24:28 UTC (rev 2440)
@@ -1,3 +1,8 @@
+2005-04-09  John Luke  <john.luke at gmail.com>
+
+	* Services/SourceViewService.cs: catch XmlException
+	while restoring style/color prefs
+
 2005-04-06  John Luke  <john.luke at gmail.com>
 
 	* Services/SourceViewService.cs: dont serialize

Modified: trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Services/SourceViewService.cs
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Services/SourceViewService.cs	2005-04-09 10:32:43 UTC (rev 2439)
+++ trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Services/SourceViewService.cs	2005-04-10 00:24:28 UTC (rev 2440)
@@ -47,31 +47,36 @@
 			XmlTextReader reader = new XmlTextReader (file);
 			SourceLanguage lang = null;
 
-			while (reader.Read ()) {
-				if (reader.IsStartElement ()) {
-					switch (reader.Name) {
-						case "SourceTag":
-							string name = reader.GetAttribute ("name");
-							SourceTagStyle sts = lang.GetTagStyle (name);
-							sts.Bold = bool.Parse (reader.GetAttribute ("bold"));
-							sts.Italic = bool.Parse (reader.GetAttribute ("italic"));
-							sts.Underline = bool.Parse (reader.GetAttribute ("underline"));
-							sts.Strikethrough = bool.Parse (reader.GetAttribute ("strikethrough"));
-							sts.IsDefault = false;
-							ParseColor (reader.GetAttribute ("foreground"), ref sts.Foreground);
-							ParseColor (reader.GetAttribute ("background"), ref sts.Background);
-							lang.SetTagStyle (name, sts);
-							Runtime.LoggingService.InfoFormat ("Overrode style {0} {1}", lang.Name, name);
-							break;
-						case "SourceLanguage":
-							lang = FindLanguage (reader.GetAttribute ("name"));
-							break;
-						case "SyntaxHighlighting":
-						default:
-							break;
+			try {
+				while (reader.Read ()) {
+					if (reader.IsStartElement ()) {
+						switch (reader.Name) {
+							case "SourceTag":
+								string name = reader.GetAttribute ("name");
+								SourceTagStyle sts = lang.GetTagStyle (name);
+								sts.Bold = bool.Parse (reader.GetAttribute ("bold"));
+								sts.Italic = bool.Parse (reader.GetAttribute ("italic"));
+								sts.Underline = bool.Parse (reader.GetAttribute ("underline"));
+								sts.Strikethrough = bool.Parse (reader.GetAttribute ("strikethrough"));
+								sts.IsDefault = false;
+								ParseColor (reader.GetAttribute ("foreground"), ref sts.Foreground);
+								ParseColor (reader.GetAttribute ("background"), ref sts.Background);
+								lang.SetTagStyle (name, sts);
+								Runtime.LoggingService.InfoFormat ("Overrode style {0} {1}", lang.Name, name);
+								break;
+							case "SourceLanguage":
+								lang = FindLanguage (reader.GetAttribute ("name"));
+								break;
+							case "SyntaxHighlighting":
+							default:
+								break;
+						}
 					}
 				}
 			}
+			catch (XmlException e) {
+				Runtime.LoggingService.Warn (e.ToString ());
+			}
 			reader.Close ();
 		}
 




More information about the Monodevelop-patches-list mailing list