Reading dll.config (not app.config!) from a plugin module

You will need to load the x.dll.config (with the Configuration API) yourself. All the automatic file handling (including the .Settings) is all about machine.config/y.exe.config/user-settings. To open a named config file: Reference System.Configuration.dll assembly. Using System.Configuration Create code like: Configuration GetDllConfiguration(Assembly targetAsm) { var configFile = targetAsm.Location + “.config”; var map = new ExeConfigurationFileMap { ExeConfigFilename … Read more

ClickOnce and IsolatedStorage

You need to use application scoped, rather than domain scoped, isolated storage. This can be done by using one of IsolatedStorageFileStream’s overloaded constructors. Example: using System.IO; using System.IO.IsolatedStorage; … IsolatedStorageFile appScope = IsolatedStorageFile.GetUserStoreForApplication(); using(IsolatedStorageFileStream fs = new IsolatedStorageFileStream(“data.dat”, FileMode.OpenOrCreate, appScope)) { … However, now you will run into the issue of this code only working … Read more

Registry Watcher C#

WMI can sometimes be interesting to work with…I think I understand your question, so take a look at the code snippet below and let me know if it’s what you’re looking for. // ——————————————————————————————————————— // <copyright file=”Program.cs” company=””> // // </copyright> // <summary> // Defines the WmiChangeEventTester type. // </summary> // ——————————————————————————————————————— namespace WmiExample { … Read more

How to remove an xml element from file?

You could try something like this: string xmlInput = @”<Snippets> <Snippet name=””abc””> <SnippetCode> code goes here </SnippetCode> </Snippet> <Snippet name=””def””> <SnippetCode> code goes here </SnippetCode> </Snippet> </Snippets>”; // create the XML, load the contents XmlDocument doc = new XmlDocument(); doc.LoadXml(xmlInput); // find a node – here the one with name=”abc” XmlNode node = doc.SelectSingleNode(“/Snippets/Snippet[@name=”abc”]”); // … Read more