Okay so I've got a delegate called "InstructionRun " (just a simple void with no parameters), and a class called "Instructio n" which contains a delegate InstructionRun object as a member variable, as well as a method called "Run" which just calls the InstructionRun object's current functionality. There is also a byte in this class called "code".
Another class ("Instructions" ) has a static array of Instruction objects. It also has a static method whose purpose is to initialize all the Instruction objects.
And then somewhere else are a bunch of static void() methods that will be stored into the "InstructionRun " object for each Instruction object in the array.
My predicament is that I would like something like a simple text file or database to provide me with the data for this Instruction array. I want it to have a bunch of pairs, my "code" byte and then my static void() method. However, I would not want to resort to any of the following:
1) Not using a data file and just putting hundreds of "new Instruction()" lines to fill the array. I hate mass blocks like that when the design could change and then I have to change hundreds of those lines. I want something like a simple text file to just match up "code"s with functionality.
2) Putting the method's actual name in the data file, and then using reflection to read it during runtime and match it up with a method. Just seems sluggish and icky.
Please help out! If I wasn't clear on something, I can explain more.
Another class ("Instructions" ) has a static array of Instruction objects. It also has a static method whose purpose is to initialize all the Instruction objects.
And then somewhere else are a bunch of static void() methods that will be stored into the "InstructionRun " object for each Instruction object in the array.
My predicament is that I would like something like a simple text file or database to provide me with the data for this Instruction array. I want it to have a bunch of pairs, my "code" byte and then my static void() method. However, I would not want to resort to any of the following:
1) Not using a data file and just putting hundreds of "new Instruction()" lines to fill the array. I hate mass blocks like that when the design could change and then I have to change hundreds of those lines. I want something like a simple text file to just match up "code"s with functionality.
2) Putting the method's actual name in the data file, and then using reflection to read it during runtime and match it up with a method. Just seems sluggish and icky.
Please help out! If I wasn't clear on something, I can explain more.
Comment