trainer help

Posts 1–3 of 3 · Page 1 of 1
trainer help
I am trying to make my first program that actually does something in vb.
It is a mw2 stats patcher. I want to move a .stat file to the game directory.
  • 1) How do I contain the .stat file in the program?

  • 2) How do I tell vb to use that file, from with in the program.


Most people can do this in a second but im too noob (started vb programing 3 months ago). If you want the source so far pm me.
Code:
Dim stream as New FileStream("c:\mw2\gamesaves\gamesave.stat", FileMode.Create, FileAccess.Write)
Dim stat as new StreamWriter(stream)
stat.BaseStream.Seek(0,SeekOrigin.End)
stat.WriteLine("xxxxxxxxxxxx")
stat.WriteLine("yyysyaysdy")
stat.Close()

Then to change the location and name of the new file just change "c:\mw2\gamesaves\gamesave.stat" to whatever.

writing lines: just add another "stat.WriteLine("yourtexthere") " to the application AFTER basestream.seek and stat.close.

thank me, learned this somewhere I forget lol


EDIT: moving file:

Code:
System.IO.File.Move("c:\file.stat","C:\mw2\gamesaves\gamesave.stat")
btw, imports system.io infront of all this including class headers.
@Hawk_ why noone ever dispose streams correctly
To include it in your project, add it to the project resources. Then to remove it from the resources again:

[highlight=vb.net]
IO.File.WriteAllBytes("C:\MW2\something.stat", My.Resources.ResourceName)
[/highlight]

That will write all the bytes to create a new file at that location. If there is already a file with that name and extension at the specified location, it will overwrite it without asking for confirmation.
Posts 1–3 of 3 · Page 1 of 1
This thread is closed for replies.

Tags for this Thread

None

Talk with us