//private static string GetHWID()
        //{
        //    var mbs = new ManagementObjectSearcher("Select ProcessorId From Win32_processor");
        //    ManagementObjectCollection mbsList = mbs.Get();
        //    string id = "";
        //    foreach (ManagementObject mo in mbsList)
        //    {
        //        id = mo["ProcessorId"].ToString();
        //        break;
        //    }

        //    MD5 md5 = new MD5CryptoServiceProvider();
        //    byte[] checkSum = md5.ComputeHash(Encoding.UTF8.GetBytes(id));
        //    string result = BitConverter.ToString(checkSum).Replace("-", String.Empty);

        //    return result;
        //}

        private void MainForm_Load(object sender, EventArgs e)
        {
            //string site = "https://dark-game-tested.000webhostapp.com/hwid.txt";

            //HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(site);
            //HttpWebResponse resp = (HttpWebResponse)req.GetResponse();

            //using (StreamReader stream = new StreamReader(resp.GetResponseStream(), Encoding.UTF8))
            //{
            //    // MessageBox.Show(stream.ReadToEnd());
            //    Clipboard.SetText(GetHWID());

            //    if (!Regex.IsMatch(stream.ReadToEnd(), GetHWID()))
            //    {
            //        MessageBox.Show("Забыл купить программу? Солнышко, я напомнил.");
            //        Close();
            //    }
            //}
            CreateFileTxt("setting/account.txt");

            if (connectToSteam())
            {
                while (!_clientUser.BLoggedOn())
                {
                    var diagRes = MessageBox.Show("Вы не вошли в Steam-аккаунт", "DLC for Steam", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error);
                    if (diagRes == DialogResult.Cancel)
                    {
                        Environment.Exit(1);
                    }
                    else
                    {
                        if (!connectToSteam())
                        {
                            MessageBox.Show("Отсутствует подключение к Steam.", "Fatal error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            Environment.Exit(1);
                        }
                    }
                }

                panelMain.Visible    = true;
                panelLoading.Visible = false;

                _cdKeyList    = new List <string>();
                ActiveControl = lbl_KeyCount;
                txtKeys.Text  = $"Enter your keys here\n\n{Utils.GetRandomCDKey()}\n{Utils.GetRandomCDKey()}\n{Utils.GetRandomCDKey()}\n{Utils.GetRandomCDKey()}";

                _callbackBwg = new BackgroundWorker()
                {
                    WorkerSupportsCancellation = true
                };
                _callbackBwg.DoWork             += _callbacks_DoWork;
                _callbackBwg.RunWorkerCompleted += _callbacks_RunWorkerCompleted;

                _purchaseBwg = new BackgroundWorker()
                {
                    WorkerSupportsCancellation = true
                };
                _purchaseBwg.DoWork += _purchaseBwg_DoWork;
            }
        }
        private void MainForm_Load(object sender, EventArgs e)
        {
            if (connectToSteam())
            {
                while (!_clientUser.BLoggedOn())
                {
                    var diagRes = MessageBox.Show("Not logged on Steam.", "Steam Bulk Activator", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error);
                    if (diagRes == DialogResult.Cancel)
                    {
                        Environment.Exit(1);
                    }
                    else
                    {
                        if (!connectToSteam())
                        {
                            MessageBox.Show("Unable to connect to Steam.", "Fatal error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            Environment.Exit(1);
                        }
                    }
                }

                panelMain.Visible    = true;
                panelLoading.Visible = false;

                _cdKeyList    = new List <string>();
                ActiveControl = lbl_KeyCount;
                txtKeys.Text  = $"Enter your keys here\n\n{Utils.GetRandomCDKey()}\n{Utils.GetRandomCDKey()}\n{Utils.GetRandomCDKey()}\n{Utils.GetRandomCDKey()}";

                _callbackBwg = new BackgroundWorker()
                {
                    WorkerSupportsCancellation = true
                };
                _callbackBwg.DoWork             += _callbacks_DoWork;
                _callbackBwg.RunWorkerCompleted += _callbacks_RunWorkerCompleted;

                _purchaseBwg = new BackgroundWorker()
                {
                    WorkerSupportsCancellation = true
                };
                _purchaseBwg.DoWork += _purchaseBwg_DoWork;
            }
        }
Exemple #3
0
        static void Main(string[] args)
        {
            string keysPath   = null;
            string logPath    = null;
            bool   dangerMode = false;

            _cdKeyList = new List <string>();

            // Parse Args
            var result = Parser.Default.ParseArguments <Options>(args)
                         .WithParsed(options =>
            {
                keysPath   = options.path;
                logPath    = options.logpath;
                dangerMode = options.danger;
            })
                         .WithNotParsed(errors =>
            {
                foreach (Error err in errors)
                {
                    Console.WriteLine(err);
                }
                System.Environment.Exit(160);
            });

            if (logPath != null && logPath != "")
            {
                FileStream   ostrm;
                StreamWriter writer;
                TextWriter   oldOut = Console.Out;
                try
                {
                    ostrm  = new FileStream(logPath + "\\" + DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss") + ".txt", FileMode.OpenOrCreate, FileAccess.Write);
                    writer = new StreamWriter(ostrm);
                    Console.SetOut(writer);
                }
                catch (Exception e)
                {
                    Console.WriteLine("Cannot open log file for writing");
                    Console.WriteLine(e.Message);
                    return;
                }
            }

            // Attempt to load key file.
            StreamReader sr;

            try
            {
                sr      = new StreamReader(keysPath, Encoding.UTF8);
                txtKeys = sr.ReadToEnd();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                System.Environment.Exit(0);
            }

            addKeysToList();

            if (_cdKeyList.Count > 30 && !dangerMode)
            {
                Console.WriteLine("Your key file had {0} lines. Attempting to activate over 30 keys at once risks rate-limiting.\nEnable --danger to bypass.", _cdKeyList.Count);
                System.Environment.Exit(0);
            }

            if (_cdKeyList.Count <= 0)
            {
                Console.WriteLine("There were no valid keys found.");
                System.Environment.Exit(0);
            }

            // Check Steam is running.
            if (ConnectToSteam())
            {
                if (!_clientUser.BLoggedOn())
                {
                    Console.WriteLine("Fatal: Not Logged into steam.");
                    Environment.Exit(0);
                }
                _callbackBwg = new BackgroundWorker()
                {
                    WorkerSupportsCancellation = true
                };
                _callbackBwg.DoWork             += _callbacks_DoWork;
                _callbackBwg.RunWorkerCompleted += _callbacks_RunWorkerCompleted;

                _purchaseBwg = new BackgroundWorker()
                {
                    WorkerSupportsCancellation = true
                };
                _purchaseBwg.DoWork += _purchaseBwg_DoWork;

                registerKeys();

                while (!_result.Completed)
                {
                    Thread.Sleep(250);
                }

                Console.WriteLine(_result.GetResults());

                Environment.Exit(0);
            }
        }