Skip to content

Instantly share code, notes, and snippets.

@derofim
Created April 27, 2017 22:08
Show Gist options
  • Select an option

  • Save derofim/02e3749fa5dc1c7150bb699b84ebde0c to your computer and use it in GitHub Desktop.

Select an option

Save derofim/02e3749fa5dc1c7150bb699b84ebde0c to your computer and use it in GitHub Desktop.
Rain World
@derofim

derofim commented Apr 28, 2017

Copy link
Copy Markdown
Author
private static string WorldCheckSum()
{
	string text = string.Empty;
	text += WorldChecksumController.ReadText("default alignments.txt");
	text += WorldChecksumController.ReadText("Gates" + Path.DirectorySeparatorChar + "locks.txt");
	string[] array = File.ReadAllLines(string.Concat(new object[]
	{
		Custom.RootFolderDirectory(),
		"World",
		Path.DirectorySeparatorChar,
		"Regions",
		Path.DirectorySeparatorChar,
		"regions.txt"
	}));
	for (int i = 0; i < array.Length; i++)
	{
		text += WorldChecksumController.ReadText(string.Concat(new object[]
		{
			"Regions",
			Path.DirectorySeparatorChar,
			array[i],
			Path.DirectorySeparatorChar,
			"Properties.txt"
		}));
		text += WorldChecksumController.ReadText(string.Concat(new object[]
		{
			"Regions",
			Path.DirectorySeparatorChar,
			array[i],
			Path.DirectorySeparatorChar,
			"world_",
			array[i],
			".txt"
		}));
	}
	return Custom.Md5Sum(text);
}```

@derofim

derofim commented Apr 28, 2017

Copy link
Copy Markdown
Author
protected string[] GetProgLines()
{
	if (File.Exists(this.saveFilePath))
	{
		string text = File.ReadAllText(this.saveFilePath);
		string b = text.Substring(0, 32);
		text = text.Substring(32, text.Length - 32);
		if (Custom.Md5Sum(text) == b)
		{
			Debug.Log("Checksum CORRECT!");
		}
		else
		{
			Debug.Log("Checksum WRONG!");
			this.gameTinkeredWith = true;
		}
		return Regex.Split(text, "<progDivA>");
	}
	return new string[0];
}

@derofim

derofim commented Apr 28, 2017

Copy link
Copy Markdown
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment