home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
MediaPortal 1
Development
General Development (no feature request here!)
Guidelines for storing/reading config info?
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="waeberd" data-source="post: 17536" data-attributes="member: 10343"><p>Hi kaburke,</p><p></p><p>you need two different objects, one for reading (xmlreader) and one for writing (xmlwriter).</p><p></p><p>One example:</p><p></p><p>Reading (you did that already, I guess):</p><p></p><p>[code] void LoadSettings()</p><p> {</p><p> using (Xml xmlreader = new Xml("MediaPortal.xml"))</p><p> {</p><p> string curText = (string) xmlreader.GetValue("myprograms", "viewby");</p><p> [... etcetcetc ...]</p><p> }</p><p> }</p><p>[/code]</p><p></p><p>Writing:</p><p>[code]</p><p> void SaveSettings()</p><p> {</p><p> using (Xml xmlwriter = new Xml("MediaPortal.xml"))</p><p> {</p><p> switch ((View) mapSettings.ViewAs)</p><p> {</p><p> case View.VIEW_AS_LIST:</p><p> xmlwriter.SetValue("myprograms", "viewby", "list");</p><p> break;</p><p> case View.VIEW_AS_ICONS:</p><p> xmlwriter.SetValue("myprograms", "viewby", "icons");</p><p> break;</p><p> case View.VIEW_AS_LARGEICONS:</p><p> xmlwriter.SetValue("myprograms", "viewby", "largeicons");</p><p> break;</p><p> case View.VIEW_AS_FILMSTRIP:</p><p> xmlwriter.SetValue("myprograms", "viewby", "filmstrip");</p><p> break;</p><p> }</p><p> [... etcetcetc ...]</p><p> }</p><p> }</p><p>[/code]</p><p></p><p>Regards,</p><p></p><p>Daniel</p></blockquote><p></p>
[QUOTE="waeberd, post: 17536, member: 10343"] Hi kaburke, you need two different objects, one for reading (xmlreader) and one for writing (xmlwriter). One example: Reading (you did that already, I guess): [code] void LoadSettings() { using (Xml xmlreader = new Xml("MediaPortal.xml")) { string curText = (string) xmlreader.GetValue("myprograms", "viewby"); [... etcetcetc ...] } } [/code] Writing: [code] void SaveSettings() { using (Xml xmlwriter = new Xml("MediaPortal.xml")) { switch ((View) mapSettings.ViewAs) { case View.VIEW_AS_LIST: xmlwriter.SetValue("myprograms", "viewby", "list"); break; case View.VIEW_AS_ICONS: xmlwriter.SetValue("myprograms", "viewby", "icons"); break; case View.VIEW_AS_LARGEICONS: xmlwriter.SetValue("myprograms", "viewby", "largeicons"); break; case View.VIEW_AS_FILMSTRIP: xmlwriter.SetValue("myprograms", "viewby", "filmstrip"); break; } [... etcetcetc ...] } } [/code] Regards, Daniel [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
Development
General Development (no feature request here!)
Guidelines for storing/reading config info?
Contact us
RSS
Top
Bottom