我将如何解析这样的文本文件并进行编辑

时间:2012-08-15 20:41:01

标签: vb.net file parsing text edit

基本上我希望它在文本框中显示单独的数据。 编辑文本框时,也会在文本文件中对其进行编辑。 是否可以在vb.net中执行此操作? 如果是这样,我应该使用哪些方法? 文本文件的格式如下:

[1]
Name=Bulbasaur
InternalName=BULBASAUR
Type1=GRASS
Type2=POISON
BaseStats=45,49,49,45,65,65
GenderRate=FemaleOneEighth
GrowthRate=Parabolic
BaseEXP=64
EffortPoints=0,0,0,0,1,0
Rareness=45
Happiness=70
Abilities=OVERGROW
HiddenAbility=CHLOROPHYLL
Moves=1,TACKLE,3,GROWL,7,LEECHSEED,9,VINEWHIP,13,POISONPOWDER,13,SLEEPPOWDER,15,TAKEDOWN,19,RAZORLEAF,21,SWEETSCENT,25,GROWTH,27,DOUBLEEDGE,31,WORRYSEED,33,SYNTHESIS,37,SEEDBOMB
EggMoves=AMNESIA,CHARM,CURSE,ENDURE,GIGADRAIN,GRASSWHISTLE,INGRAIN,LEAFSTORM,MAGICALLEAF,NATUREPOWER,PETALDANCE,POWERWHIP,SKULLBASH,SLUDGE
Compatibility=1,7
StepsToHatch=5355
Height=0.7
Weight=6.9
Color=Green
Habitat=Grassland
Kind=Seed
Pokedex=Bulbasaur can be seen napping in bright sunlight. There is a seed on its back. By soaking up the sun's rays, the seed grows progressively larger.
BattlerPlayerY=0
BattlerEnemyY=25
BattlerAltitude=0
Evolutions=IVYSAUR,Level,16
[2]
Name=Ivysaur
InternalName=IVYSAUR
Type1=GRASS
Type2=POISON
BaseStats=60,62,63,60,80,80
GenderRate=FemaleOneEighth
GrowthRate=Parabolic
BaseEXP=141
EffortPoints=0,0,0,0,1,1
Rareness=45
Happiness=70
Abilities=OVERGROW
HiddenAbility=CHLOROPHYLL
Moves=1,TACKLE,1,GROWL,1,LEECHSEED,3,GROWL,7,LEECHSEED,9,VINEWHIP,13,POISONPOWDER,13,SLEEPPOWDER,15,TAKEDOWN,20,RAZORLEAF,23,SWEETSCENT,28,GROWTH,31,DOUBLEEDGE,36,WORRYSEED,39,SYNTHESIS,44,SOLARBEAM
EggMoves=
Compatibility=1,7
StepsToHatch=5355
Height=1.0
Weight=13.0
Color=Green
Habitat=Grassland
Kind=Seed
Pokedex=To support its bulb, Ivysaur's legs grow sturdy. If it spends more time lying in the sunlight, the bud will soon bloom into a large flower.
BattlerPlayerY=0
BattlerEnemyY=21
BattlerAltitude=0
Evolutions=VENUSAUR,Level,32

1 个答案:

答案 0 :(得分:2)

这看起来像一个INI文件。在这种情况下,您可以使用内置于Windows中的INI解析器。见GetPrivateProfileStringpinvoke sig)和WritePrivateProfileStringpinvoke sig