mercredi 8 juin 2016

Which design pattern to use for file manipulation

I have a pattern structure file that I read line by line. for example

START
COMMAND START
SET PROGRAMNAME = MYPROGRAM
SET USERNAME = HOMER
SET PASSWORD = SIMPSON
SET MESSAGE = HELLO WORLD!
COMMAND END
END

If I modify the file , eg message to "Dunkin's Donut" then the file will look like

START
COMMAND START
SET PROGRAMNAME = MYPROGRAM
SET USERNAME = HOMER
SET PASSWORD = SIMPSON
SET MESSAGE = Dunkin's Donut
COMMAND END
END

Is there any design pattern that I can use to read and manipulate this file? I was thinking of Command pattern, but I'm not sure if it's the right one.

Thank you.

Aucun commentaire:

Enregistrer un commentaire