コード例 #1
0
        private void btnSaveSelection_Click(object sender, EventArgs e)
        {
            if ((txt_MachineName.Text == "." || txt_InstanceName.Text == "*") && UserChoice[Res.Feature] == "AS")
            {
                MessageBox.Show("For Analysis Service, you must specify server and instance name!");
                return;
            }

            SaveFileDialog saveFileDialog1 = new SaveFileDialog();

            saveFileDialog1.Filter           = "zip files (*.zip)|*.zip|All files (*.*)|*.*";
            saveFileDialog1.FilterIndex      = 1;
            saveFileDialog1.RestoreDirectory = true;
            string DestFullFileName = txt_OutputFolder.Text + @"\pssd.zip";

            saveFileDialog1.FileName = DestFullFileName;

            if (saveFileDialog1.ShowDialog(this) == DialogResult.OK)
            {
                DestFullFileName = saveFileDialog1.FileName;
                string filename_only = Path.GetFileName(DestFullFileName);

                PackageMgr pckMgr = new PackageMgr(this.UserChoice, DestFullFileName);

                //create a zip file
                pckMgr.MakeZip();

                //if we should create an email, get the hash then create the email
                if (Globals.UserPreferences.CreateEmailChecked == true)
                {
                    //create a SHA hash for the zip file
                    string hashStr;

                    var success = pckMgr.ComputeFileHash(DestFullFileName, out hashStr);

                    //if file hash is successful, pop up email instructions to user; else tell user this failed
                    if (success == true && !hashStr.StartsWith("Failed to create hash"))
                    {
                        pckMgr.PrepareEmail(hashStr, filename_only);
                    }
                    else
                    {
                        MessageBox.Show(hashStr, "Failed file hash", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                } //end email
            }     //end SaveSelection
        }
コード例 #2
0
        private void btnSaveSelection_Click(object sender, EventArgs e)
        {
            if ((txt_MachineName.Text == "." || txt_InstanceName.Text == "*") && UserChoice[Res.Feature] == "AS")
            {
                MessageBox.Show("For Analysis Service, you must specify server and instance name!");
                return;
            }

            SaveFileDialog saveFileDialog1 = new SaveFileDialog();

            saveFileDialog1.Filter           = "exe files (*.exe)|*.exe|All files (*.*)|*.*";
            saveFileDialog1.FilterIndex      = 2;
            saveFileDialog1.RestoreDirectory = true;
            string DestFullFileName = txt_OutputFolder.Text + @"\pssd.zip";

            saveFileDialog1.FileName = DestFullFileName;

            if (saveFileDialog1.ShowDialog(this) == DialogResult.OK)
            {
                DestFullFileName = saveFileDialog1.FileName;
                PackageMgr pckMgr = new PackageMgr(this.UserChoice, DestFullFileName);
                pckMgr.MakeZip();
            }
        }