public bool load(IFile file) { if (file.exists()) { try { var libraries = new ArrayList <ProjectLibrary>(); var preprocessorSymbols = new HashSet <String>(); var outputPath = "bin"; var document = XmlHelper.load(new InputStreamReader(file.getContents())); var nodeList = document.getElementsByTagName("library"); int length = nodeList.getLength(); for (int i = 0; i < length; i++) { var e = (Element)nodeList.item(i); var lib = new ProjectLibrary(e.getAttribute("name")); var enabled = e.getAttribute("enabled"); lib.setEnabled(enabled.length() == 0 || !enabled.equals("false")); libraries.add(lib); } nodeList = document.getElementsByTagName("preprocessorSymbols"); if (nodeList.getLength() == 1) { foreach (var s in nodeList.item(0).getTextContent().split(";")) { preprocessorSymbols.add(s.trim()); } } nodeList = document.getElementsByTagName("outputPath"); if (nodeList.getLength() == 1) { outputPath = nodeList.item(0).getTextContent(); } this.Libraries = libraries; this.PreprocessorSymbols = preprocessorSymbols; this.OutputPath = outputPath; return(true); } catch (Exception e) { Environment.logException(e); } } this.Libraries = Query.empty <ProjectLibrary>(); this.PreprocessorSymbols = Query.empty <String>(); return(false); }
public bool load(IFile file) { if (file.exists()) { try { var libraries = new ArrayList<ProjectLibrary>(); var preprocessorSymbols = new HashSet<String>(); var outputPath = "bin"; var document = XmlHelper.load(new InputStreamReader(file.getContents())); var nodeList = document.getElementsByTagName("library"); int length = nodeList.getLength(); for (int i = 0; i < length; i++) { var e = (Element)nodeList.item(i); var lib = new ProjectLibrary(e.getAttribute("name")); var enabled = e.getAttribute("enabled"); lib.setEnabled(enabled.length() == 0 || !enabled.equals("false")); libraries.add(lib); } nodeList = document.getElementsByTagName("preprocessorSymbols"); if (nodeList.getLength() == 1) { foreach (var s in nodeList.item(0).getTextContent().split(";")) { preprocessorSymbols.add(s.trim()); } } nodeList = document.getElementsByTagName("outputPath"); if (nodeList.getLength() == 1) { outputPath = nodeList.item(0).getTextContent(); } this.Libraries = libraries; this.PreprocessorSymbols = preprocessorSymbols; this.OutputPath = outputPath; return true; } catch (Exception e) { Environment.logException(e); } } this.Libraries = Query.empty<ProjectLibrary>(); this.PreprocessorSymbols = Query.empty<String>(); return false; }