public bool loadFromFile(string fileName, PaintManagerUI manager = null) { if (manager != null && manager.hasPackageCache()) { MemoryStream cache = manager.getFileFromPackage(fileName); if (cache == null) { throw new Exception(""); } { StreamReader readerXML = new StreamReader(cache); int fileSize = (int)cache.Length; char[] buffer = new char[fileSize + sizeof(char)]; readerXML.Read(buffer, 0, fileSize); buffer[fileSize] = (char)0; readerXML.Close(); readerXML = null; parse(ref buffer, fileSize, ref mRootNode); buffer = null; } cache.Close(); cache.Dispose(); cache = null; return(true); } else if (manager != null && manager.getWorkingDir() != "") { fileName = manager.getWorkingDir() + fileName; } if (File.Exists(fileName) == false) { throw new Exception(""); } { FileStream fileXML = new FileStream(fileName, FileMode.Open); StreamReader sr = new StreamReader(fileXML); int fileSize = (int)fileXML.Length; char[] buffer = new char[fileSize + sizeof(char)]; sr.Read(buffer, 0, fileSize); buffer[fileSize] = (char)0; sr.Close(); sr.Dispose(); sr = null; fileXML = null; parse(ref buffer, fileSize, ref mRootNode); buffer = null; } return(true); }