String Search Woes Continue

G

Guest

I am trying to find if a string exists in a file. If it doesn’t, it should return a “-1†and I’ll make my decision based on that

Here is a sniplet of the text file

game
name mapp
description "Mappy (US)
year 198
manufacturer "Namco
history "\nMappy (c) 03/1983 Namco. \n\n- TRIVIA: \n\nLicensed to Bally Midway for US manufacture and distribution. (03/1983) \n\n- SERIES: \n\n1. Mappy \n2. Hopping Mappy \n\n0.26 [Aaron Giles, Mirko Buffoni] \n\nBugs: \n- \"000\" is displayed on the highscore. If you get more than 30000 pts, it is displayed normally. This happens whether there are \"hiscore.dat\", hi file and cfg file or not. mappy37b4gre Fujix \n- In Mappy (both versions, mappy and mappyjp), if you insert at least 2 credits, start a 1-player game, and then press 1-player Start any time during the game action (including the beginning intro), a new 1-player game is started. mappy37b8gre The tECHIDNA V \n\nWIP: \n- 0.59: Rename zip (mappyjp) to (mappyj). \n- 28th June 1999: Manuel Abadia fixed the custom IO chip reset bugs in the Mappy driver. \n- 0.29: Aaron Giles made some Video drawing optimization to Mappy, plus test mode now works both in Mappy and Dig Dug 2. \n- 0.27: Aaron Giles did a major rewrite of his Super Pac man and Mappy drivers: - support for Dig Dug 2 and Pac & Pal - High score save in all games - 100% colors and sound samples (in Super Pac man the siren clicks a bit, but neither I nor jrok can figure it out; the sample data *is* correct) - better sound playback frequency (was missing some high bits!) - arcade accurate frequency calculation (thanks to jrok!) - removed all palette hacks; everything is clean - added loop optimizations for speed - video now properly displayed, including high priority characters \n- 0.26a: Super Pac Man and Mappy have correct pitch now (thanks Aaron and Satoh). \n- 0.26: Added support for Mappy. Aaron Giles also added sound support and very close arcade colors. \n\nOther Emulators: \n* HiVE \n* Retrocade \n\nRecommended Games: \nMappy - Namco Classics Vol.1 (Original/Arrangement) \nHopping Mappy \nCheeky Mouse \nMouse Trap \nMacho Mouse \nFunny Mouse \nMouser \n\nCategory: Platform \n\nRecommended Games (2): \nMappy - Namco Classics Vol.1 (Original/Arrangement) \nSpace Panic \nDonkey Kong \nCrazy Kong \nDonkey Kong Junior \nDonkey Kong 3 \nLogger \nFrogger \nKangaroo \nPonpoko \nSpringer \nArabian \nCongo Bongo \nDr. Micro \nHopper Robo \nJump Coaster \nMouser \nRoc'n Rope \nSuper Glob \nFlicky \nIce Climber \nIce Climber Dual \nJumping Jack \nLode Runner \nLode Runner II - The Bungeling Strikes Back \nLode Runner III - Majin No Fukkatsu \nLode Runner IV - Teikoku Karano Dasshutsu \nLode Runner - The Dig Fight \nPandora's Palace \nPeter Pack-Rat \nSon Son \nVs. Wrecking Crew \nBaluba-louk no Densetsu \nPsychic 5 \n\nRomset: 53 kb / 11 files / 27.7 zip \n
rom ( name mp1-6.4c size 256 crc 50765082 sha1 f578e14f15783acb2073644db4a2f0d196cc0957 region proms offs 20
rom ( name mp1-7.5k size 256 crc 5396bd78 sha1 2e387e5d8b8cab005f67f821b4db65d0ae8bd362 region proms offs 120
rom ( name mp1-3.3m size 256 crc 16a9166a sha1 847cbaf7c88616576c410177e066ae1d792ac0ba region sound1 offs 0
chip ( type cpu name M6809 clock 1536000
chip ( type cpu name M6809 clock 1536000
chip ( type audio name Namco_15XX
video ( screen raster orientation vertical x 224 y 288 aspectx 3 aspecty 4 freq 60.606060
sound ( channels 1
input ( players 2 control joy8way buttons 1 coins 2
dipswitch ( name "Cabinet" entry "Upright" default "Upright" entry "Cocktail"
dipswitch ( name "Service Mode"
dipswitch ( name "Difficulty" entry "Rank A" default "Rank A" entry "Rank B" entry "Rank C" entry "Rank D" entry "Rank E" entry "Rank F" entry "Rank G" entry "Rank H"
driver ( status good color good sound good palettesize 32


Bear in mind that this is only one section. There are about 2700 of these sections in the file. It’s about 26MB in size

In this example I want to search for the string “name mappyâ€. After that I want to go to the line that begins with “videoâ€, “video ( screen raster orientation vertical x 224 y 288 aspectx 3â€. Then after I find that line I want to see if either the string “vertical†or “horizontal†exist on that line. I will then create my logic based on which string exists. There may be some sort of character that begins the “name mappy†and “video†lines. When I open the file in Wordpad is seems like there is a TAB there

I have tried working with the streamreader for about 6 or 8 hours. I just can’t seem to get it quite right.

Help me out here guys,
John
 
A

Armin Zingler

jcouse said:
I am trying to find if a string exists in a file. If it doesn’t, it
should return a “-1†and I’ll make my decision based on that.

Here is a sniplet of the text file:

[...]

I have tried working with the streamreader for about 6 or 8 hours. I
just can’t seem to get it quite right.

I'd get the documentation of the file format, then write a parser to analyze
the file, then examine the analyze result to get the information you need.


--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html
 
G

Guest

It was 2 or 3 pages down and I was afraid it would \n't get seen. I'm not sure what type of front end you MVP's are using to read the posts and just didn't know if it would get spotted. I apologize if I have broken any forum rules or etiquette.

Sorry,
John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top