Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
how do i compair 2 .txt files and if there the same then do nothing but if 1.txt number is higher then 2.txt then do nothing but it 2.txt is higher then copy files. I'm tring to build an updater for my program. And i have all of it done but the compairing of the 2 versions files.
  • *Experts*
Posted

If you want to check the current version and compare it then you dont need to store it in the file, you can access it by:

Application.ProductVersion

But if you do it this way be sure to update the AssemblyInfo file with the current version, version info is on the bottom of the file if you use the vs.net generated AssemblyInfo file. AssebmlyInfo file is automatically generated by VS.NET when creating a project.

 

With this you can read the file with the newest version and then compare the result of the reading with Application.ProductVersion.

  • *Experts*
Posted

Lets say this is how you read the file with the version, im assuming its only one line long and there is only version info there:

Dim reader As New IO.StreamReader("path to the version file")
dim currentversion as string = reader.ReadLine()
If currentversion = Application.ProductVersion Then
    'current version on the client is the same as the newest one
Else
    'version is not the same, needs update
End If

And also this is assuming that you write the file file the client downloaded using Application.ProductVersion so they have the same format.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...