Jump to content

Open Source CRC Patcher


Recommended Posts

  • Contributor
6 minutes ago, GoldCash said:

So i use domain name http://something/patcher and than i can see what in the web but patcher dont work

Maybe your site have a redirect from http to https or something. In that case, use https link in the patcher.

Edited by TMP4
Link to comment
Share on other sites

  • Contributor
20 minutes ago, GoldCash said:

Dont work 😕

Give me your link in DM and I'll have a look.

Edit: @GoldCash Your patchlist.txt is wrong, you have to remove the D:/Client/ from every line.

Also when I first opened the link, it said website unavailable for like 5 second then Chrome refreshed. I'm sure there are some protection / pre-filter enabled in your webserver. I never used LiteSpeed so can't tell more.

Edited by TMP4
Link to comment
Share on other sites

  • Premium
5 hours ago, GoldCash said:

So i use domain name http://something/patcher and than i can see what in the web but patcher dont work

Are u using a free storage just for test? Cuz this will not work 😄 I tried with a lot of free cloud storage, but nothing worked. I bought a cloud storage for 1year (cost me 12€) and it worked instantly. 😄
 

Spoiler

Sry for my bad english.

 

Ulthar

Link to comment
Share on other sites

Just now, Ulthar said:

Are u using a free storage just for test? Cuz this will not work 😄 I tried with a lot of free cloud storage, but nothing worked. I bought a cloud storage for 1year (cost me 12€) and it worked instantly. 😄
 

  Reveal hidden contents

Sry for my bad english.

 

No i have hosting website

Link to comment
Share on other sites

  • 9 months later...
  • 4 months later...
On 11/13/2015 at 2:59 AM, wezt said:

Hi, try to change crc hash to md5, it helped me.

 

  Reveal hidden contents

 

In Common.cs

Add this in begging of the file:

using System.Security.Cryptography;

and after:

        public static string GetHash(string Name)
        {
            if (Name == string.Empty)
                return string.Empty;

            CRC crc = new CRC();

            string Hash = string.Empty;

            using (FileStream fileStream = File.Open(Name, FileMode.Open))
            {
                foreach (byte b in crc.ComputeHash(fileStream))
                {
                    Hash += b.ToString("x2").ToLower();
                }
            }

            return Hash;
        }

add:

        public static string CalculateMD5Hash(string Name)
        {
            if (Name == string.Empty)
                return null;

            MD5 md5 = System.Security.Cryptography.MD5.Create();

            string Hash = string.Empty;

            try
            {
                using (FileStream fileStream = File.Open(Name, FileMode.Open, FileAccess.Read, FileShare.Read))
                {
                    foreach (byte b in md5.ComputeHash(fileStream))
                    {
                        Hash += b.ToString("x2").ToLower();
                    }
                }
            }
            catch
            {
                MessageBox.Show("Can't open: " + Name);
            }

            return Hash;
        }

In FileChecker.cs find:

if (!File.Exists(file.Name) || Common.GetHash(file.Name) != file.Hash)

and replace with:

if (!File.Exists(file.Name) || Common.CalculateMD5Hash(file.Name) != file.Hash)

After these changes you'll have MD5 Patcher :)

PS: Atm I'm experiencing some problems with progress bar, will add solution if I'll find it.

 

 

 

 

Also I'd like to share php script which generate patchlist.txt (probably will be useful for someone):

  Hide contents

 

<?php
/*
Usage: Upload this file to the web-server, in folder with patchlist.txt and open it in browser.
Note: I recommend to protect this file from public usage with password (put file in folder, change output file and directory path and and use .htaccess)
*/
function list_directory($dir) {
	$file_list = array();
	$stack[] = $dir;

	while ($stack) {
		$current_dir = array_pop($stack);
		if ($dh = opendir($current_dir)) {
			while (($file = readdir($dh)) !== false) {
				if ($file !== '.' AND $file !== '..') {
					$current_file = "{$current_dir}/{$file}";
					$report = array();
					if (is_file($current_file)) {
						$file_list[] = "{$current_dir}/{$file}";
					} elseif (is_dir($current_file)) {
						$stack[] = $current_file;
						$file_list[] = "{$current_dir}/{$file}/";
					}
				}
			}
		}
	}

	return $file_list;
}

$files = list_directory('.'); // Path to directory with files
sort($files, SORT_NATURAL | SORT_FLAG_CASE);
$line = "";
foreach($files as $file)
{
	$hash = hash_file( 'crc32b', $file );
	$size = filesize($file);

	if($hash == "00000000" || preg_match("/patchlist/", $file))
		continue;

	$file_n = preg_replace("/^../","",$file);
	echo $file_n . " " . $hash . " " . $size . "<br>";
	$line .= $file_n . " " . $hash . " " . $size . "\r\n";
}

$handle = fopen("patchlist.txt", "w+"); // Path to output file
fwrite($handle, $line);
fclose($handle);
?>

 

Best Regards

Hi, I've done as indicated.
After creating the patch list and using the patcher, everything downloads perfectly.

If I close the patcher and open it up again, somehow it checks for the files and then redownloads all the files...

anyone knows how to fix this?

Edited by anton96
Link to comment
Share on other sites

  • 6 months later...
  • 5 months later...
  • 3 months later...

Announcements



  • Similar Content

  • Activity

    1. 5

      Effect weapons

    2. 3

      Crystal Metinstone

    3. 3

      Feeding game source to LLM

    4. 113

      Ulthar SF V2 (TMP4 Base)

    5. 3

      Feeding game source to LLM

    6. 0

      Target Information System

    7. 3

      Feeding game source to LLM

    8. 2

      anti exp explanation pls

  • Recently Browsing

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.