Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Apply a diff file to another file
#1
Hello, so I need to apply a diff file to another file, the application should read the diff file and apply it, I just don't know how. Just like a regular file patcher, but instead of downloading the file, it just changes the original to the newer version.

Thanks in advance
#2
Can't you just use the
Code:
My.Computer.FileSystem.MoveFile(sourceFileName ,destinationFileName ,overwrite)

Method? And set overwrite to true so it overwrites the new file.
My Blog | My Setup | My Videos | Have a wonderful day.
#3
A simple patcher is easy... What I want to do is an application that gets which files are different, reads the diff file for each one and applies it to the client files. This would avoid downloading a 1 MB file just because I changed a variable for example.
#4
Ah, so you want to actually get into the binary code and change it to what the new version should be? If so, I don't really think this is possible due to the fact that executables are compiled, and the source code is not directly editable.
My Blog | My Setup | My Videos | Have a wonderful day.
#5
That's why I need to edit it like an Hexadecimal editor, I read the offset and the new value from a file in a webserver and edit the file in the client's PC.
#6
Well, to read the contents of a file, you need to use this code:

Code:
IO.File.ReadAllBytes("file path here")

So you could use that to find where the differences are. And then I'm guessing you can just use a StreamWriter to write them all back into the file.
My Blog | My Setup | My Videos | Have a wonderful day.
#7
I'll try it. Thank you, like always, you have the answer!
#8
Heh, Well I'm here to help! Please report back with your findings!
My Blog | My Setup | My Videos | Have a wonderful day.
#9
Well, fortunately the patcher won't need to change files this way, so I'll do it in the "normal" way, thanks though. Btw, I have a new question, please check the new topics


Possibly Related Threads…
Thread Author Replies Views Last Post
  Help with PCX file. Worf 2 14,893 10-15-2014, 10:41 AM
Last Post: Worf
  Protecting a file Covert2String 4 16,300 05-10-2012, 12:01 AM
Last Post: Covert2String
  Reading XML file Covert2String 5 20,480 04-30-2012, 06:01 PM
Last Post: brandonio21
  Create a new file Covert2String 5 19,981 04-11-2012, 02:47 PM
Last Post: brandonio21

Forum Jump:


Users browsing this thread: 1 Guest(s)