Advertisement
mkv

unfuck moons

mkv
Sep 10th, 2014
317
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.70 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using System.IO;
  10. using System.Text.RegularExpressions;
  11.  
  12. namespace encfix
  13. {
  14.     public partial class Form1 : Form
  15.     {
  16.         public Form1()
  17.         {
  18.             InitializeComponent();
  19.         }
  20.  
  21.         private void Form1_Load(object sender, EventArgs e)
  22.         {
  23.             Timer t = new Timer();
  24.             t.Interval = 100;
  25.             t.Start();
  26.             t.Tick += delegate(object oa, EventArgs ob)
  27.             {
  28.                 t.Stop();
  29.                 StringBuilder ret = new StringBuilder();
  30.                 Regex r = new Regex("[\x3041-\x3096\x30a0-\x30ff]");
  31.                 Regex l = new Regex("[a-z]");
  32.                 byte[] file = File.ReadAllBytes(@"c:\users\ed\gdc.html");
  33.                 int filea = 0x6348;
  34.                 int fileb = 0x6374;
  35.                 byte[] org = new byte[fileb - filea];
  36.                 Array.Copy(file, filea, org, 0, fileb - filea);
  37.                 var encs = new List<Encoding>();
  38.                 var eis = Encoding.GetEncodings();
  39.                 foreach (EncodingInfo ei in eis)
  40.                 {
  41.                     bool add = true;
  42.                     foreach (Encoding enc in encs)
  43.                     {
  44.                         if (ei.CodePage == enc.CodePage)
  45.                         {
  46.                             add = false;
  47.                         }
  48.                     }
  49.                     if (add) encs.Add(ei.GetEncoding());
  50.                 }
  51.                 progressBar1.Maximum = progressBar2.Maximum = encs.Count + 1;
  52.                 progressBar1.Value = progressBar2.Value = 0;
  53.                 foreach (var a in encs) //sorry
  54.                 {
  55.                     progressBar1.Value += 2;
  56.                     progressBar1.Value -= 1;
  57.                     progressBar2.Value = 0;
  58.                     Application.DoEvents();
  59.                     try
  60.                     {
  61.                         string va = a.GetString(org);
  62.                         foreach (var b in encs) //sorry
  63.                         {
  64.                             try
  65.                             {
  66.                                 byte[] vb = b.GetBytes(va);
  67.                                 foreach (var c in encs) //sorry
  68.                                 {
  69.                                     try
  70.                                     {
  71.                                         string vc = c.GetString(vb);
  72.                                         if (r.IsMatch(vc) && !l.IsMatch(vc))
  73.                                         {
  74.                                             var v = vc.GroupBy(x => x).OrderByDescending(x => x.Count()).First();
  75.                                             if (v.Count() < vc.Length / 3 && vc.Length < 20)
  76.                                             {
  77.                                                 //MessageBox.Show(vc);
  78.                                                 ret.AppendFormat("{0}  {1}  {2}  {3}\n", a.WebName, b.WebName, c.WebName, vc);
  79.                                             }
  80.                                         }
  81.                                     }
  82.                                     catch { }
  83.                                 }
  84.                             }
  85.                             catch { }
  86.                         }
  87.                     }
  88.                     catch { }
  89.                 }
  90.                 //MessageBox.Show(ret.ToString());
  91.                 System.IO.File.WriteAllText("result", ret.ToString(), Encoding.UTF8);
  92.                 progressBar1.Value = progressBar2.Value = 0;
  93.             };
  94.         }
  95.     }
  96. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement