[Help]Search a file for item
Hello i want to search config_mp.cfg file from mw2 and find this piece:r_fullscreen "0" and able to save the file again with r_fullscreen "1" i know the part of saving and loading file etc. But how can i search a file for that item?
[php]Using sRead as new io.streamreader("path")
Dim full as string = sRead.ReadToEnd
full = full.replace("old", "new")
end using[/php]
[php]Using sWrite as new io.streamwriter("path")
sWrite.write(full)
end using
[/php]
[php]If full.contains("bla") then
end if[/php]
i coudn't get it what i understood u want to search for a file named with config_mp.cgf
in mw2 folder and find in it's text r_fullscreen "0" and replace it with r_fullscreen "1" then save it is't right?
if so
Dim S As String = Nothing
Dim Mw2Config_mpcfgLocation As String = Nothing 'replace nothing with the location of config_mp.cfg
S = My.Computer.FileSystem.ReadAllText(Mw2Config_mpcfg Location)
S = S.Replace("0", "1")
System.IO.File.WriteAllText(Mw2Config_mpcfgLocatio n, S)
this get all text of config_***.cgf to s declared string then it replaces 0 in it with one
if i'm wrong please tell me what you want