Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Rappelz > Rappelz Private Server
You last visited: Today at 00:20

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

Advertisement



Patcher for Rappelz Client

Discussion on Patcher for Rappelz Client within the Rappelz Private Server forum part of the Rappelz category.

Reply
 
Old   #1

 
.Nexitis's Avatar
 
elite*gold: 20
Join Date: Mar 2009
Posts: 667
Received Thanks: 219
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 01/15/2017, 04:29   #2
 
elite*gold: 0
Join Date: Feb 2012
Posts: 286
Received Thanks: 30
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 01/15/2017, 19:58   #3
 
SilentWisdom's Avatar
 
elite*gold: 0
Join Date: Jul 2015
Posts: 476
Received Thanks: 632
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




All times are GMT +1. The time now is 00:20.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.