Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Rappelz > Rappelz Private Server
You last visited: Today at 05:35

  • Please register to post and access all features, it's quick, easy and FREE!

 

Patcher for Rappelz Client

Reply
 
Old   #1

 
elite*gold: 20
Join Date: Mar 2009
Posts: 654
Received Thanks: 204
Patcher for Rappelz Client

Hey, im learning C# right now.

im almost done and im working on the patcher.
For some reason i want to stick with the idea to compare local and online hash and update files where the hash doesn't match.
A friend suggested that it would be easier to compare byte size.

Does anyone know if that would work? For whatever reason my brain thinks that comparing hash is the only option.



.Nexitis is offline  
Old   #2
 
elite*gold: 0
Join Date: Feb 2012
Posts: 167
Received Thanks: 18
Use this to make MD5 Byte hash

public string GetMd5HashFromFile(string path)
{
byte[] hash = MD5.Create().ComputeHash(File.ReadAllBytes(path));
string sHash = BitConverter.ToString(hash).Replace("-",string.Empty);
return sHash.ToLower();
}


Maks19973 is offline  
Thanks
1 User
Old   #3
 
elite*gold: 0
Join Date: Jul 2015
Posts: 245
Received Thanks: 301
No need to reinvent the wheel my friend, just check out my opensource git



And to compare files for updating I use the following

Code:
protected void compareFiles()
        {
            guiInstance.UpdateStatus(0, "Checking client files...");
            GUI.Instance.UpdateProgressMaximum(0, FileList.Count);

            for (; currentIndex < FileList.Count; ++currentIndex)
            {
                guiInstance.UpdateProgressValue(0, currentIndex);

                Structures.IndexEntry file = FileList[currentIndex];
                bool download = false;

                guiInstance.UpdateStatus(1, string.Format("Checking file: {0}", file.FileName));

                if (file.IsLegacy)
                {
                    if (!File.Exists(resourceFolder + file.FileName) || (Hash.GetSHA512Hash(resourceFolder + file.FileName) != file.FileHash))
                    {
                        download = true;
                    }
                }
                else
                {
                    DataCore.Structures.IndexEntry fileEntry = Core.GetEntry(ref index, file.FileName);

                    if (fileEntry != null)
                    {
                        string fileHash = Core.GetFileSHA512(settings.GetString("clientdirectory"), Core.GetID(fileEntry.Name), fileEntry.Offset, fileEntry.Length, GetFileExtension(fileEntry.Name));

                        if (file.FileHash != fileHash)
                        {
                            guiInstance.UpdateStatus(1, string.Format("File: {0} is depreciated!", file.FileName));
                            download = true;
                        }
                    }
                }

                if (download)
                {
                    GUI.Instance.UpdateStatus(1, string.Format("Downloading {0}...", FileList[currentIndex].FileName));
                    doUpdate();
                }
            }
        }
The above snippet is from my public open source launcher system called "" which you are more than welcome to use or use as an example.
SilentWisdom is offline  
Reply



« Previous Thread | Next Thread »



All times are GMT +1. The time now is 05:35.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Abuse
Copyright ©2017 elitepvpers All Rights Reserved.