I need to edit the configuration file (exefilename.config) of an executable that is not the one from which the code runs. The XML file format is this:
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="XNet.XNetService.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
<section name="XNetService.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
</sectionGroup>
</configSections>
<applicationSettings>
<XNet.XNetService.Properties.Settings>
<setting name="DataSource" serializeAs="String">
<value>192.168.2.127</value>
</setting>
<setting name="DefaultPort" serializeAs="String">
<value>8085</value>
</setting>
<setting name="UserName" serializeAs="String">
<value>notiuser</value>
</setting>
<setting name="Password" serializeAs="String">
<value>6ITLet6k1HCOhgTmXI5C/1m1DrCQli8dIAKfdtP+o6w=</value>
</setting>
<setting name="Instance" serializeAs="String">
<value />
</setting>
<setting name="bindTo" serializeAs="String">
<value />
</setting>
</XNet.XNetService.Properties.Settings>
</applicationSettings>
I need to change the "DefaultPort" parameters, "DataSource" etc .. and adding new ones at the same level. How can I do? If the .config file was that of my executable, the situation would be much easier with a simple SettingsWriter, but in this case how can I do?