SHARE
TWEET

File similarity tool

MaKiPL Jul 5th, 2015 205 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Threading.Tasks;
  3. using System.IO;
  4.  
  5. /*
  6. * MaKiPL
  7. */
  8. namespace ConsoleApplication1
  9. {
  10.     class Program
  11.     {
  12.         static void Main()  
  13.            
  14.         {
  15.             Console.Clear();
  16.             string p = Console.ReadLine();
  17.             past(p);
  18.         }
  19.  
  20.         static void past(string path)
  21.         {
  22.             path = path.Replace("\"", "");
  23.             Byte[] a = File.ReadAllBytes(path);
  24.             string ofd1 = Console.ReadLine();
  25.             ofd1 = ofd1.Replace("\"", "");
  26.             Byte[] b = File.ReadAllBytes(ofd1);
  27.             int count = 0;
  28.             for(int i = 0; i!=a.Length; i++)
  29.             {
  30.                 if (b.Length == i)
  31.                     break;
  32.                 else
  33.                 {
  34.                     if (a[i] == b[i])
  35.                         count++;
  36.                 }
  37.             }
  38.             Console.WriteLine(string.Format("Similarity: {0}%", ((float)count / a.Length) * 100));
  39.             Console.ReadKey();
  40.             Main();
  41.         }
  42.  
  43.        
  44.     }
  45. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top