Esempio n. 1
0
        public static void SaveConfiguration(BucketConfiguration bucketConfiguration)
        {
            string[] lines =
            {
                "[default]",
                $"aws_access_key_id = {bucketConfiguration.AccessKey}",
                $"aws_secret_access_key = {bucketConfiguration.SecretKey}",
                $"aws_region_name = {bucketConfiguration.Region}",
            };

            var filePath = Environment.ExpandEnvironmentVariables(parentPath);

            bool direxists  = Directory.Exists(filePath);
            bool fileexists = File.Exists(filePath + fileName);

            if (!direxists)
            {
                Directory.CreateDirectory(filePath);
            }

            if (!fileexists)
            {
                File.Create(filePath + fileName);
            }

            File.WriteAllLines((filePath + fileName), lines);
        }
Esempio n. 2
0
        private void btn_apply_Click(object sender, EventArgs e)
        {
            if (cbx_Region.SelectedItem != null & tbx_accessKey.Text != "" & tbx_secretKey.Text != "")
            {
                var configuration = new BucketConfiguration()
                {
                    Region    = ((RegionEndpoint)cbx_Region.SelectedItem).DisplayName,
                    SecretKey = tbx_secretKey.Text,
                    AccessKey = tbx_accessKey.Text,
                };

                AWSConfigurationManager.SaveConfiguration(configuration);

                MessageBox.Show("Configurations has been updated.", "Information", MessageBoxButtons.OK,
                                MessageBoxIcon.Information);

                this.DialogResult = DialogResult.OK;
            }
        }