c# - How to monitor xml file for (add - edit - delete ) node(s) -
in solution have 2 projects (windows service , wpf mange service) , have sitting file (xml) service use ask :
i want know when user make change in xml file out restart service , know xml node(s) has changed
i have searched lot , found solution through filesystemwatcher
listens file system change notifications , raises events when directory, or file in directory, changes.
but how know xml node(s) has changed
thanks
i keep copy of original xml , run compare when filesystemwatcher triggers. have @ efficient algorithm comparing xml nodes suggestion on comparing xml nodes.
file watcher example
string folderlocation = system.configuration.configurationmanager.appsettings["folder_location"].tostring(); _watcher = new system.io.filesystemwatcher(); _watcher.path = folderlocation; _watcher.includesubdirectories = false; _watcher.notifyfilter = notifyfilters.size; _watcher.changed += new filesystemeventhandler(onfilechanged); _watcher.enableraisingevents = true; private void onfilechanged(object sender, filesystemeventargs e) { string file = e.fullpath; ...
Comments
Post a Comment