public void AddFile(string name, long offset, long cursorOffset, int cursorDigit, string layout, int focusedArea) { string path = Path.GetFullPath(name); SessionFileInfo sfi = new SessionFileInfo(path, offset, cursorOffset, cursorDigit, layout, focusedArea); files.Add(sfi); }
public void Load(string path) { XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(path); XmlNodeList fileList = xmlDoc.GetElementsByTagName("file"); foreach(XmlNode fileNode in fileList) { XmlNodeList childNodes = fileNode.ChildNodes; SessionFileInfo sfi = new SessionFileInfo(); foreach(XmlNode node in childNodes) { switch (node.Name) { case "path": sfi.Path = node.InnerText; break; case "offset": sfi.Offset = Convert.ToInt64(node.InnerText); break; case "cursoroffset": sfi.CursorOffset = Convert.ToInt64(node.InnerText); break; case "cursordigit": sfi.CursorDigit = Convert.ToInt32(node.InnerText); break; case "layout": sfi.Layout = node.InnerText; break; case "focusedarea": sfi.FocusedArea = Convert.ToInt32(node.InnerText); break; default: break; } } files.Add(sfi); } XmlNodeList heightList = xmlDoc.GetElementsByTagName("windowheight"); foreach(XmlNode heightNode in heightList) { windowHeight = Convert.ToInt32(heightNode.InnerText); } XmlNodeList widthList = xmlDoc.GetElementsByTagName("windowwidth"); foreach(XmlNode widthNode in widthList) { windowWidth = Convert.ToInt32(widthNode.InnerText); } XmlNodeList activeList = xmlDoc.GetElementsByTagName("activefile"); foreach(XmlNode activeNode in activeList) { activeFile = activeNode.InnerText; } }