Design solution for a data editing program

Karlovsky120

New member
Joined
Jan 3, 2016
Messages
3
Programming Experience
1-3
I have been writing a player editor for a game called 7 Days to die, if you've ever heard of it.

I have just successfully finished writing the part of the code that reads the binary data from a save file (*.ttp) and stores it a class structure relatively similar to the one in the game source. What I'm now faced with is how to present that data to the user in a readable way.

I know how to make an interface, I'm just not sure to approach the transformation of the data. Should I create a new set of classes and methods that enable them to communicate? Should I just add methods to existing classes that transform the data?
Should I do something else?

What is the design rule here? When you're making a program that edits data in a way that data wasn't meant to be edited?
 
It really depends on how heavily architected your project is. If you were using WPF and MVVM then the classes you have would be the model and you'd then create a view model to facilitate presentation of that data to the user. A beginner-level WinForms app will just have one set of classes (if that even) to represent the data at all levels. The first question to ask yourself is whether the data as it is to be presented to the user is a different shape than it is as it's represented internally. If the answer is "yes" then you should almost certainly create a separate set of presentation classes. If the answer is "no" then could might be able to get away without doing so, although many projects will require separate classes even if the shape is exactly the same.
 
I've been thinking about it and this is what I came up with. I have a class that contains all the data as private fields and has methods read() and write() that are used to read and write data from the file.

This classes would also have get and set methods for each field (or more fields per method (out ref), why I didn't went with properties) which transform data into readable (and editable) format and transforms it back prior to saving.

Set and get methods would be used by windows.forms classes such as texboxs and similar, depending on the data type.

Does that sound good?
 
Back
Top Bottom