Click here to Skip to main content
15,915,164 members
Home / Discussions / C#
   

C#

 
AnswerRe: how ot Windows Service Pin
Ravi Bhavnani2-Jul-06 4:57
professionalRavi Bhavnani2-Jul-06 4:57 
AnswerRe: how ot Windows Service Pin
Paul Conrad2-Jul-06 12:52
professionalPaul Conrad2-Jul-06 12:52 
QuestionCapturing video from webcam using .NET Pin
dmee1-Jul-06 20:33
dmee1-Jul-06 20:33 
AnswerRe: Capturing video from webcam using .NET Pin
Ed.Poore1-Jul-06 23:23
Ed.Poore1-Jul-06 23:23 
NewsRe: Capturing video from webcam using .NET Pin
LongRange.Shooter3-Jul-06 5:26
LongRange.Shooter3-Jul-06 5:26 
QuestionText file parsing Pin
Zeikcied1-Jul-06 19:17
Zeikcied1-Jul-06 19:17 
AnswerRe: Text file parsing Pin
tjvictor1-Jul-06 19:25
tjvictor1-Jul-06 19:25 
NewsRe: Text file parsing Pin
LongRange.Shooter3-Jul-06 5:35
LongRange.Shooter3-Jul-06 5:35 
There are a few processes you could look into for accomplishing this...but it depends on the design you want to do.

First you need to know the exact data you need to save and determine if you want to expose this data in a simple text file. (cheaters can hack a text file to death)

Then you need to determine if you can get all of the puzzle data into a single object. This helps drive your design.

Finally I find the best way to parse such data is to let the system do as much work as possible. This can easily be accomplished simply by using a binary serializer / deserializer to accomplish the task.

So the steps you would then follow -- if this looks good to you -- is as follows:

Define your object and all collections within that object.
Make certain that every class that makes up that puzzle object has the [Serializable] attribute added to the definition. Also make sure that your puzzle object consists of (hopefully) nothing but private data with getter/setter logic to encapsulate the data and expose the data to the serializer.

Next research what you need to do to get a BinarySerializer cooking (which isn't much) and you will also need System.IO to do your file stuff.

Then create your stream, create your serializer for your object type, then do a serializer.Serialize( stream, myPuzzleObject );

You will find your object is dumped into the filename the user defines if you use the FileDialog and you will find that when you do a serializer.Deserialize() that you have a fully populated puzzle object loaded. This is how I persist my Sudoku puzzles for my library displays, library adds, and current puzzle state saves.
GeneralRe: Text file parsing Pin
Zeikcied8-Jul-06 18:18
Zeikcied8-Jul-06 18:18 
NewsRe: Text file parsing Pin
LongRange.Shooter9-Jul-06 5:06
LongRange.Shooter9-Jul-06 5:06 
QuestionShow Form in Center Pin
foysal mamun1-Jul-06 18:25
foysal mamun1-Jul-06 18:25 
AnswerRe: Show Form in Center Pin
tjvictor1-Jul-06 19:15
tjvictor1-Jul-06 19:15 
GeneralRe: Show Form in Center Pin
tjvictor1-Jul-06 19:20
tjvictor1-Jul-06 19:20 
GeneralRe: Show Form in Center Pin
foysal mamun1-Jul-06 20:07
foysal mamun1-Jul-06 20:07 
AnswerRe: Show Form in Center Pin
Nader Elshehabi2-Jul-06 1:36
Nader Elshehabi2-Jul-06 1:36 
GeneralRe: Show Form in Center Pin
LongRange.Shooter3-Jul-06 5:37
LongRange.Shooter3-Jul-06 5:37 
QuestionDrag-Drop Images Pin
J.S.Lim1-Jul-06 17:00
J.S.Lim1-Jul-06 17:00 
AnswerRe: Drag-Drop Images Pin
mav.northwind2-Jul-06 0:17
mav.northwind2-Jul-06 0:17 
GeneralRe: Drag-Drop Images Pin
J.S.Lim2-Jul-06 1:43
J.S.Lim2-Jul-06 1:43 
GeneralRe: Drag-Drop Images Pin
mav.northwind2-Jul-06 2:20
mav.northwind2-Jul-06 2:20 
Questionhow to use dll as embedd resource ? Pin
hdv2121-Jul-06 15:01
hdv2121-Jul-06 15:01 
AnswerRe: how to use dll as embedd resource ? Pin
Ed.Poore1-Jul-06 23:29
Ed.Poore1-Jul-06 23:29 
QuestionMHT files and WebBrowser Control Pin
AngryC1-Jul-06 14:20
AngryC1-Jul-06 14:20 
AnswerRe: MHT files and WebBrowser Control Pin
led mike1-Jul-06 19:52
led mike1-Jul-06 19:52 
QuestionGetting a processes memory usage Pin
Anthony Mushrow1-Jul-06 14:12
professionalAnthony Mushrow1-Jul-06 14:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.