Advertisement
Guest User

CrossMapMaker [@ImShotZz]

a guest
Dec 15th, 2018
384
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.96 KB | None | 0 0
  1. // made by @ImShotZz
  2.  
  3. using System;
  4. using System.IO;
  5.  
  6. namespace CrossMapMaker
  7. {
  8.     class Program
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             Console.WriteLine("== CrossMapMaker [@ImShotZz] ==");
  13.  
  14.             string current_path = Directory.GetCurrentDirectory();
  15.             string crossmap_path = current_path + "\\crossmap.txt";
  16.             string crosstable_path = current_path + "\\crosstable.txt";
  17.             string output_path = current_path + "\\new_crossmap.txt";
  18.  
  19.             Console.WriteLine("crossmap: [" + crossmap_path + "]");
  20.             Console.WriteLine("crosstable: [" + crosstable_path + "]\n");
  21.  
  22.             if (File.Exists(output_path))
  23.             {
  24.                 Console.WriteLine("[" + output_path + "] already exists!");
  25.                 Console.ReadKey();
  26.                 return;
  27.             }
  28.             TextWriter file = new StreamWriter(output_path);
  29.  
  30.             string[] crossmap = System.IO.File.ReadAllLines(crossmap_path);
  31.             string[] crosstable = System.IO.File.ReadAllLines(crosstable_path);
  32.  
  33.             int hashes_fixed = 0;
  34.             foreach(string original_map in crossmap)
  35.             {
  36.                 string[] orginal_hash = original_map.Split('=');
  37.  
  38.                 foreach(string new_map in crosstable)
  39.                 {
  40.                     string[] new_hash = new_map.Split('=');
  41.                     if(orginal_hash[1] == new_hash[0])
  42.                     {
  43.                         // match found
  44.                         string output = orginal_hash[0] + ", " + new_hash[1] + ",";
  45.                         file.WriteLine(output);
  46.  
  47.                         hashes_fixed++;
  48.                     }
  49.                 }
  50.             }
  51.  
  52.             Console.WriteLine("Fixed [" + hashes_fixed + "] hashes!\n");
  53.             Console.WriteLine("Success! new crossmap is located at [" + output_path + "]");
  54.             Console.ReadKey();
  55.  
  56.             file.Close();
  57.         }
  58.     }
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement