public static ObjectWrapper ReadObject(ObjectReader reader, XmlElement elem) { string className = elem.GetAttribute("class"); ClassDescriptor klass; if (reader.Format == FileFormat.Native) { klass = Registry.LookupClassByName(className); } else { klass = Registry.LookupClassByCName(className); } if (klass == null) { ErrorWidget we = new ErrorWidget(className, elem.GetAttribute("id")); ErrorWidgetWrapper wrap = (ErrorWidgetWrapper)Create(reader.Project, we); wrap.Read(reader, elem); return(wrap); } if (!klass.SupportsGtkVersion(reader.Project.TargetGtkVersion)) { ErrorWidget we = new ErrorWidget(className, klass.TargetGtkVersion, reader.Project.TargetGtkVersion, elem.GetAttribute("id")); ErrorWidgetWrapper wrap = (ErrorWidgetWrapper)Create(reader.Project, we); wrap.Read(reader, elem); return(wrap); } ObjectWrapper wrapper = klass.CreateWrapper(); wrapper.classDescriptor = klass; wrapper.proj = reader.Project; return(ReadObject(reader, elem, wrapper)); }
public static ObjectWrapper ReadObject(ObjectReader reader, XmlElement elem) { string className = elem.GetAttribute("class"); ClassDescriptor klass; if (reader.Format == FileFormat.Native) { klass = Registry.LookupClassByName(className); } else { klass = Registry.LookupClassByCName(className); } if (klass == null) { ErrorWidget we = new ErrorWidget(className, elem.GetAttribute("id")); ErrorWidgetWrapper wrap = (ErrorWidgetWrapper)Create(reader.Project, we); wrap.Read(reader, elem); return(wrap); } if (!klass.SupportsGtkVersion(reader.Project.TargetGtkVersion)) { ErrorWidget we = new ErrorWidget(className, klass.TargetGtkVersion, reader.Project.TargetGtkVersion, elem.GetAttribute("id")); ErrorWidgetWrapper wrap = (ErrorWidgetWrapper)Create(reader.Project, we); wrap.Read(reader, elem); return(wrap); } ObjectWrapper wrapper = klass.CreateWrapper(); wrapper.classDescriptor = klass; wrapper.proj = reader.Project; try { wrapper.OnBeginRead(reader.Format); wrapper.Read(reader, elem); } catch (Exception ex) { Console.WriteLine(ex); ErrorWidget we = new ErrorWidget(ex, elem.GetAttribute("id")); ErrorWidgetWrapper wrap = (ErrorWidgetWrapper)Create(reader.Project, we); wrap.Read(reader, elem); return(wrap); } finally { wrapper.OnEndRead(reader.Format); } return(wrapper); }
public static ObjectWrapper ReadObject(ObjectReader reader, XmlElement elem, ObjectWrapper wrapper) { try { wrapper.OnBeginRead(reader.Format); wrapper.Read(reader, elem); return(wrapper); } catch (Exception ex) { Console.WriteLine(ex); ErrorWidget we = new ErrorWidget(ex, elem.GetAttribute("id")); ErrorWidgetWrapper wrap = (ErrorWidgetWrapper)Create(reader.Project, we); wrap.Read(reader, elem); return(wrap); } finally { wrapper.OnEndRead(reader.Format); } }