Beispiel #1
0
        private void BtnAddPackage_Click(object sender, EventArgs e)
        {
            if (TxtInputProjPath.Text == String.Empty || TxtOutputPackagePath.Text == String.Empty || TxtPackageVer.Text == String.Empty)
            {
                MessageBox.Show(this, "Please fill up all the fields", "Add Package", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            try
            {
                NugetPackageSettings settings = new NugetPackageSettings()
                {
                    InputProjPath     = TxtInputProjPath.Text,
                    OutputPackagePath = TxtOutputPackagePath.Text,
                    PackageVer        = TxtPackageVer.Text
                };

                string k = Path.GetFileNameWithoutExtension(TxtInputProjPath.Text);


                Settings.Packages.TryAdd(k, settings);
                Settings.Save(frmMain.SettingsFullPath);

                MessageBox.Show(this, "The package has been added to the list", "Add Package", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, $"An error occurred adding the package due to:\r\n{ex.Message}", "Add Package", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #2
0
        private void BtnTestPackage_Click(object sender, EventArgs e)
        {
            if (TxtInputProjPath.Text == String.Empty || TxtOutputPackagePath.Text == String.Empty || TxtPackageVer.Text == String.Empty)
            {
                MessageBox.Show(this, "Please fill up all the fields", "Add Package", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            try
            {
                NugetPackageSettings settings = new NugetPackageSettings()
                {
                    InputProjPath     = TxtInputProjPath.Text,
                    OutputPackagePath = TxtOutputPackagePath.Text,
                    PackageVer        = TxtPackageVer.Text
                };

                builder.Build(settings);
                MessageBox.Show(this, "The package has been tested and compiled", "Add Package", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, $"An error occurred building the package due to:\r\n{ex.Message}", "Add Package", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }