public bool BackUpList(String location) { xmlWriter w = new xmlWriter(); xmlRegistry xmlReg = new xmlRegistry(); try { w.open(location); foreach (var strRegistrySection in BackUpKeys) { if (xmlRegistry.keyExists(strRegistrySection)) { xmlElement wroot = new xmlElement(xmlRegistry.XML_ROOT); wroot.write(w, 1, false, true); xmlReg.saveAsXml(w, false, strRegistrySection, ""); wroot.writeClosingTag(w, -1, false, true); } } } catch (Exception ex) { ErrorMessage = ex.Message; return(false); } finally { w.close(); } return(true); }