P
Peter Webb
I have written a specialised drawing application. I want the user to be able
to load or save a few drawings, which I will implement as an add to
favourites/ load favourites button. The quantity of data is low - a typical
drawing could be completely recreated with a few hundred bytes of data. It
doesn't really need a delete function, at least not within the app. The
program is distributed through the standard .Net 2 facility ("OneClick" ?).
I need advice on a few levels, as to the general approach to be used.
Firstly, how to extract the data. I have a variable number of instantiations
of a "drawn object" class, and a couple of classes that relate to the
drawing environment. Obviously I could create some file structure which had
the environment variables written out first, then the number of drawn
objects classes, then the variables that I need from each drawn object
class, etc. However I can't believe that C# doesn't provide a far more
flexible structure. Would XML help? It would be quite attractive if drawing
files from older versions could be loaded from newer versions, which may
have different properties implemented - is there a method which makes this
work, at least for the scenario where fields are only added in later
versions, and never deleted?
Secondly, where to store the data. I know that I can open a file and read or
write to it, but I am hoping for some higher level construct for a few
reasons. Firstly, I currently have sample drawings derived from hard coded
data in my C# source. I would like them to be stored as favourites. I guess
I could set up the save file location the first time the program is run (by
checking if the file exists and creating if it doesn't), but in general I
would like to avoid the complexity of the program or the user setting a save
file location. (And where do I store the file path itself - what am I
supposed to do?). Does the .NET 2 environment provide a scratchpad directory
that I can directly read and write without specifying a file path? Could I
store my data in the Registry? Or use a cookie (though its a Forms app) or
(gasp) a .ini file? What the easiest way/place to store perhaps 1 Kbyte of
data in aggregate?
I really just need a pointer to the approach to use ...
Thanks
Peter Webb
to load or save a few drawings, which I will implement as an add to
favourites/ load favourites button. The quantity of data is low - a typical
drawing could be completely recreated with a few hundred bytes of data. It
doesn't really need a delete function, at least not within the app. The
program is distributed through the standard .Net 2 facility ("OneClick" ?).
I need advice on a few levels, as to the general approach to be used.
Firstly, how to extract the data. I have a variable number of instantiations
of a "drawn object" class, and a couple of classes that relate to the
drawing environment. Obviously I could create some file structure which had
the environment variables written out first, then the number of drawn
objects classes, then the variables that I need from each drawn object
class, etc. However I can't believe that C# doesn't provide a far more
flexible structure. Would XML help? It would be quite attractive if drawing
files from older versions could be loaded from newer versions, which may
have different properties implemented - is there a method which makes this
work, at least for the scenario where fields are only added in later
versions, and never deleted?
Secondly, where to store the data. I know that I can open a file and read or
write to it, but I am hoping for some higher level construct for a few
reasons. Firstly, I currently have sample drawings derived from hard coded
data in my C# source. I would like them to be stored as favourites. I guess
I could set up the save file location the first time the program is run (by
checking if the file exists and creating if it doesn't), but in general I
would like to avoid the complexity of the program or the user setting a save
file location. (And where do I store the file path itself - what am I
supposed to do?). Does the .NET 2 environment provide a scratchpad directory
that I can directly read and write without specifying a file path? Could I
store my data in the Registry? Or use a cookie (though its a Forms app) or
(gasp) a .ini file? What the easiest way/place to store perhaps 1 Kbyte of
data in aggregate?
I really just need a pointer to the approach to use ...
Thanks
Peter Webb