I currently have a c# utility that runs a very long list of steps, for instance:
- copy a file from here to there i.e.: foreach(file in list) File.Copy ()
- create a bunch of directories foreach (dir in list) Directory.Create
- Loop into a list of directories and create a file. foreach (dir in list) File.Create()
- Take a know list of files and replace some text inside foreach (file in list) Execute ("replace.exe", text1, text2)
etc.
What I did was to take all these steps and create a bunch of methods in c# that do those steps. The advantage of that is, I get to check for each command I run, log any problems and so on. The downside of that is, it is hard coded.
I would like to (and I need to) move those steps out of the code, like in a configuration file or xml file and then read the commands one at a time and run them inside c#. In this way I still have the advantage of checking for return errors, creating logs, etc. but I don't have the actual list and commands hard coded.
I don't want to use a script (like Perl or batch) because I want to be able to monitor some of the steps I do. In other words, I really want to keep the actual execution inside my c# program but have the program being guided by the configuration file that I feed to it.
xml is quite flexible but I am not sure I can do all that with it. For instance how do I turn into xml something like:
list1 = {file1, file2};
list2 = {dir1,dir2,dir3};
foreach (file in list1)
File.Copy(file,dir2\\file);
File.Copy(file,dir3\\file);
Any ideas on what I could/should use to accomplish that?
Thanks Tony