Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using System.IO;
- using System.Text.RegularExpressions;
- namespace encfix
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- Timer t = new Timer();
- t.Interval = 100;
- t.Start();
- t.Tick += delegate(object oa, EventArgs ob)
- {
- t.Stop();
- StringBuilder ret = new StringBuilder();
- Regex r = new Regex("[\x3041-\x3096\x30a0-\x30ff]");
- Regex l = new Regex("[a-z]");
- byte[] file = File.ReadAllBytes(@"c:\users\ed\gdc.html");
- int filea = 0x6348;
- int fileb = 0x6374;
- byte[] org = new byte[fileb - filea];
- Array.Copy(file, filea, org, 0, fileb - filea);
- var encs = new List<Encoding>();
- var eis = Encoding.GetEncodings();
- foreach (EncodingInfo ei in eis)
- {
- bool add = true;
- foreach (Encoding enc in encs)
- {
- if (ei.CodePage == enc.CodePage)
- {
- add = false;
- }
- }
- if (add) encs.Add(ei.GetEncoding());
- }
- progressBar1.Maximum = progressBar2.Maximum = encs.Count + 1;
- progressBar1.Value = progressBar2.Value = 0;
- foreach (var a in encs) //sorry
- {
- progressBar1.Value += 2;
- progressBar1.Value -= 1;
- progressBar2.Value = 0;
- Application.DoEvents();
- try
- {
- string va = a.GetString(org);
- foreach (var b in encs) //sorry
- {
- try
- {
- byte[] vb = b.GetBytes(va);
- foreach (var c in encs) //sorry
- {
- try
- {
- string vc = c.GetString(vb);
- if (r.IsMatch(vc) && !l.IsMatch(vc))
- {
- var v = vc.GroupBy(x => x).OrderByDescending(x => x.Count()).First();
- if (v.Count() < vc.Length / 3 && vc.Length < 20)
- {
- //MessageBox.Show(vc);
- ret.AppendFormat("{0} {1} {2} {3}\n", a.WebName, b.WebName, c.WebName, vc);
- }
- }
- }
- catch { }
- }
- }
- catch { }
- }
- }
- catch { }
- }
- //MessageBox.Show(ret.ToString());
- System.IO.File.WriteAllText("result", ret.ToString(), Encoding.UTF8);
- progressBar1.Value = progressBar2.Value = 0;
- };
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement