c# - Multiple Importer/Exporter Methods with Different Parameters -
I have two exporting methods (planning to be more) that essentially take my phantom definition from my phantom manufacturer , And export it in a PNG file and XML file that describes PNG. Right now, I have filled these two methods in my Sprite category for testing, but they are not really there. So I thought that if I have made an interface for exporters and importers, then it would be good if there is a class for every type of importer / exporter, right?
The problem now is that my two methods are the same parameter, so I can not use an interface very easily.
The first exporter is a "organized" exporter, and it exports the frames in a way that humans can easily follow, no restrictions. It just takes the definition of the phantom, and the file name (with no extension) then produces the pair of files.
The second exporter is a better pack exporter and will take the same parameter plus maximum width and height It is not optimal right now, it does not change the size of the frames and it just fits the next slot which fits that there may be additional options which I have not yet thought of for this method.
XML is similar to existing exporters, but PNG is different. Some time down the road, I also like other types of meta-data exporters, such as JSON.
Both of the current exporters follow this method:
- Create a bitmap object with that size < Li> Set up, and start typing my XML file <
- Write a bunch of meta data that is not yet related to the frame
- Repeat through each sequence (this
- For each frame:
- Find out where the frame will go (
different ) - Write information about the frame in which the sprite sheet position and amp; Above the size
- Draw the frame in the output bitmap on the place & amp;
- Save and close the files
I can provide a link to the code request.
(I added "importer" for this question because I would like to add these exporters one day to importers)
I have to keep these exporters related to my phantom class and how to relate them. ? "post-text" itemprop = "text">
I think if you have only some basic features in some base export class like
addSprite or
saveToFile < / Code> are all shared among the export sections. After that you can create some other classes that they receive and they have specific functions to save the parameters, something like this:
class base supported {public abstract zero addSprite (bitmap texture) ); Public abstract bull export (string target); }; Class Exporter A: Base Exporter {Public Override Zero AddSprite (...) {...}; Public Override Bull Export (...) {...}; } Class ExporterB: baseExporter {public override zero addSprite (...) {...}; Public Override Zero Setmex Decimments (at MaxHight, IntexWindath) {...}; Public Override Bull Export (...) {...}; } Class Exporter: Base Exporter {Public Override Zero AddSprite (...) {...}; Public Override Zero Setmex Decimments (at MaxHight, IntexWindath) {...}; Public override zero addMetaData (string some data) {...}; Public Override Bull Export (...) {...}; }
- Find out where the frame will go (
- For each frame:
Comments
Post a Comment