Advertisement
Brandan

Replace HDR

Jun 18th, 2012
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.76 KB | None | 0 0
  1. private void ReplaceMapsHDR(byte players)
  2. {
  3.     if (Panel4.Visible == false) {
  4.         return;
  5.     }
  6.     string populousin = null;
  7.     populousin = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Bullfrog Productions Ltd\\Populous: The Beginning", "InstallPath", "");
  8.     try {
  9.         foreach (string fileFullPath in Directory.GetFiles(populousin + "\\levels")) {
  10.             string file = Path.GetFileName(fileFullPath);
  11.             if (Path.GetExtension(file.ToLower()) == ".hdr") {
  12.                 if (file.Replace("levl20", null).Replace(".hdr", null) <= 25 == false) {
  13.                     BinaryWriter writer = new BinaryWriter(new FileStream(populousin + "\\levels\\" + file, FileMode.Open));
  14.                     writer.BaseStream.Position = 88;
  15.                     writer.Write(players);
  16.                     writer.Close();
  17.                 }
  18.             }
  19.         }
  20.     } catch {
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement