View difference between Paste ID: TPH6zpTS and PNTYsR1q
SHOW: | | - or go back to the newest paste.
1-
using System;
1+
using SevenZip;
2-
using System.ComponentModel;
2+
using SevenZip.Compression.LZMA;
3-
using System.Drawing;
3+
using System.IO;
4-
using System.Windows.Forms;
4+
5
namespace LuaDecrypter
6
{
7
  internal class Decrypter
8-
  public class KeyPopup : Form
8+
9
    public const int JUNK_SIZE = 4;
10-
    private KeyValidator validator;
10+
    public const int PROPERTIES_SIZE = 5;
11-
    private IContainer components;
11+
12-
    private TextBox serial1;
12+
    public bool Decrypt(Stream inStream, Stream outStream, bool removeJunk = false, int junkSize = 4)
13-
    private TextBox serial2;
13+
14-
    private Label seperator1;
14+
      if (removeJunk)
15-
    private Label seperator2;
15+
        inStream.Seek((long) junkSize, SeekOrigin.Begin);
16-
    private TextBox serial3;
16+
      byte[] numArray = new byte[5];
17-
    private Button verifyButton;
17+
      if (inStream.Read(numArray, 0, 5) != 5)
18-
    private TextBox statusBox;
18+
        return false;
19
      Decoder decoder = new Decoder();
20-
    public KeyPopup(KeyValidator validator)
20+
      decoder.SetDecoderProperties(numArray);
21
      long outSize = 0L;
22-
      this.InitializeComponent();
22+
      for (int index = 0; index < 8; ++index)
23-
      this.validator = validator;
23+
24
        int num = inStream.ReadByte();
25
        if (num < 0)
26-
    private void SetStatus(string text)
26+
          return false;
27
        outSize |= (long) (byte) num << 8 * index;
28-
      if (this.statusBox.InvokeRequired)
28+
29-
        this.Invoke((Delegate) new KeyPopup.SetStatusCallback(this.SetStatus), new object[1]
29+
      long inSize = inStream.Length - inStream.Position;
30-
        {
30+
      decoder.Code(inStream, outStream, inSize, outSize, (ICodeProgress) null);
31-
          (object) text
31+
      return true;
32-
        });
32+
33-
      else
33+
34-
        this.statusBox.Text = text;
34+