2004-11-25, 07:11 PM
im writing a new plugin which im trying to make it remember the directories last view (list, icon etc). ive decided to do it in an xml file like
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">
<dirviews>
 <D>
  <My_Videos>1</MY_VIDEOS>
  <Recordings>0</Recordings>
 </D>
</dirviews>
[/QUOTE]
so D:\MyVideos has the view associated with 1 and D:\Recordings has the view associated with 0. Â im having problems adding things that arent in the xmlfile already thou.
im using this code (from a plugin config i was using as blueprint)
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">
XmlDocument newDocument = new XmlDocument();
newDocument.LoadXml(newNodeXML);
XmlNode imported = DirectoryView.ImportNode(newDocument.DocumentElement.LastChild, true);
DirectoryView.DocumentElement.AppendChild(imported);
node = DirectoryView.SelectSingleNode(DirToNodeString(currentDirectory.Location));
[/QUOTE]
newNodeXml = a string for the new node eg "/dirviews/d/recordings"
DirectoryView is my xmldocument im using
but that code gives me xml file like
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">
<dirviews>
 <D>
  <My_Videos>1</MY_VIDEOS>
 </D>
 <D>
  <Recordings>0</Recordings>
 </D>
</dirviews>
[/QUOTE]
i figure the problem is in "AppendChild" and/or "LastChild", but i cant figure out how to fix this problem, if anyone knows what im doing wrong and how i can fix this, your help would be very much appreciated;
cheers in advance.
oh and if your interested heres info about the plugin and its current status.
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">
<dirviews>
 <D>
  <My_Videos>1</MY_VIDEOS>
  <Recordings>0</Recordings>
 </D>
</dirviews>
[/QUOTE]
so D:\MyVideos has the view associated with 1 and D:\Recordings has the view associated with 0. Â im having problems adding things that arent in the xmlfile already thou.
im using this code (from a plugin config i was using as blueprint)
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">
XmlDocument newDocument = new XmlDocument();
newDocument.LoadXml(newNodeXML);
XmlNode imported = DirectoryView.ImportNode(newDocument.DocumentElement.LastChild, true);
DirectoryView.DocumentElement.AppendChild(imported);
node = DirectoryView.SelectSingleNode(DirToNodeString(currentDirectory.Location));
[/QUOTE]
newNodeXml = a string for the new node eg "/dirviews/d/recordings"
DirectoryView is my xmldocument im using
but that code gives me xml file like
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">
<dirviews>
 <D>
  <My_Videos>1</MY_VIDEOS>
 </D>
 <D>
  <Recordings>0</Recordings>
 </D>
</dirviews>
[/QUOTE]
i figure the problem is in "AppendChild" and/or "LastChild", but i cant figure out how to fix this problem, if anyone knows what im doing wrong and how i can fix this, your help would be very much appreciated;
cheers in advance.
oh and if your interested heres info about the plugin and its current status.