Beispiel #1
0
        private void buttonBuckets_BucketExists_Click(object sender, EventArgs e)
        {
            bool   bExists       = false;
            string strBucketName = textBoxBuckets_BucketName.Text.Trim();

            if (strBucketName == String.Empty)
            {
                MessageBox.Show("There needs to be Bucket Name", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            cS3BucketOperations = new c_S3BucketOperations(strBucketName);
            try
            {
                bExists = cS3BucketOperations.bDoesBucketExist();
            }
            catch (Exception ex1)
            {
                textBoxMessages.Text = textBoxMessages.Text + Environment.NewLine + ex1.Message;
            }
            if (bExists == true)
            {
                textBoxMessages.Text = textBoxMessages.Text + Environment.NewLine + "Bucket " + cS3BucketOperations.strBucketName + " Exists...";
            }
            else
            {
                textBoxMessages.Text = textBoxMessages.Text + Environment.NewLine + "Bucket " + cS3BucketOperations.strBucketName + " does not Exist...";
            }
        }
Beispiel #2
0
        private void buttonBuckets_CreateBucket_Click(object sender, EventArgs e)
        {
            string strBucketName = textBoxBuckets_BucketName.Text.Trim();

            if (strBucketName == String.Empty)
            {
                MessageBox.Show("There needs to be Bucket Name", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            cS3BucketOperations = new c_S3BucketOperations(strBucketName);
            string strResult = String.Empty;

            try
            {
                if (cS3BucketOperations.bDoesBucketExist() == true)
                {
                    MessageBox.Show("Bucket  " + strBucketName + " already exists.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                if (DialogResult.Yes != (MessageBox.Show("Are you sure you want to make Bucket " + strBucketName + "?", "Continue?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning)))
                {
                    return;
                }

                cS3BucketOperations.CreateBucket(out strResult);
            }
            catch (Exception Exb1)
            {
                textBoxMessages.AppendText("\r\n" + Exb1.Message);
            }
            textBoxMessages.AppendText("\r\n" + strResult);
        }
Beispiel #3
0
        private void buttonBuckets_DeleteBucket_Click(object sender, EventArgs e)
        {
            string strBucketName = textBoxBuckets_BucketName.Text.Trim();

            if (strBucketName == String.Empty)
            {
                MessageBox.Show("There needs to be Bucket Name", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            cS3BucketOperations = new c_S3BucketOperations(strBucketName);
            string strError = String.Empty;

            try
            {
                if (cS3BucketOperations.bDoesBucketExist() == false)
                {
                    MessageBox.Show("Bucket  " + strBucketName + " was not found.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                if (DialogResult.Yes != (MessageBox.Show("Are you sure you want to delete the Bucket " + strBucketName + "?", "Continue?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning)))
                {
                    return;
                }

                cS3BucketOperations.DeleteObjectNonVersionedBucket(out strError);
            }
            catch (Exception Exb1)
            {
                textBoxMessages.AppendText("\r\n" + Exb1.Message);
            }
            if (strError != "")
            {
                textBoxMessages.AppendText(strError);
            }
            else
            {
                textBoxMessages.AppendText("\r\nBucket:" + strBucketName + " Deleted.");
            }
        }