Ejemplo n.º 1
0
        private async void buttonSave_Click(object sender, EventArgs e)
        {
            dataManager.SetValue(DataManager.Category.ObjectStorage, DataManager.Key.Endpoint, textBoxObjectStorageEndPoint.Text.Trim());
            dataManager.SetValue(DataManager.Category.ObjectStorage, DataManager.Key.Bucket, textBoxBucketName.Text.Trim());
            if (dataManager.GetValue(DataManager.Category.Login, DataManager.Key.IsSaveKeyYn).Equals("Y", StringComparison.OrdinalIgnoreCase))
            {
                logClientConfig.SetValue(LogClient.Category.Api, LogClient.Key.AccessKey, textBoxAccessKey.Text.Trim());
                logClientConfig.SetValue(LogClient.Category.Api, LogClient.Key.SecretKey, textBoxSecretKey.Text.Trim());
            }
            else
            {
                logClientConfig.SetValue(LogClient.Category.Api, LogClient.Key.AccessKey, "");
                logClientConfig.SetValue(LogClient.Category.Api, LogClient.Key.SecretKey, "");
            }
            ObjectStorage o = new ObjectStorage(textBoxAccessKey.Text, textBoxSecretKey.Text, textBoxObjectStorageEndPoint.Text);

            if (!await o.IsExistsBucket(textBoxBucketName.Text.Trim()))
            {
                buttonCreateBucket.PerformClick();
            }

            dataManager.SaveUserData();
            logClientConfig.SaveLogClientData();
            logClientConfig.SetValue(LogClient.Category.Api, LogClient.Key.AccessKey, textBoxAccessKey.Text.Trim());
            logClientConfig.SetValue(LogClient.Category.Api, LogClient.Key.SecretKey, textBoxSecretKey.Text.Trim());
            Close();
        }
Ejemplo n.º 2
0
        private void buttonSave_Click(object sender, EventArgs e)
        {
            if (radioButtonLocalKey.Checked)
            {
                GetCryptionKey = "Local";
                logClientConfig.SetValue(LogClient.Category.Encryption, LogClient.Key.LocalCryptionKey, textBoxKey.Text.Trim());
            }
            else // (radioButtonNcpKms.Checked)
            {
                GetCryptionKey = "NcpKms";
                logClientConfig.SetValue(LogClient.Category.Encryption, LogClient.Key.LocalCryptionKey, "");
            }


            logClientConfig.SetValue(LogClient.Category.Encryption, LogClient.Key.GetCryptionKey, GetCryptionKey);
            logClientConfig.SetValue(LogClient.Category.Encryption, LogClient.Key.KeyTag, textBoxKeyTag.Text.Trim());
            logClientConfig.SetValue(LogClient.Category.Encryption, LogClient.Key.Ciphertext, textBoxCiphertext.Text.Trim());

            logClientConfig.SaveLogClientData();
            textBoxKey.Text = "";
            Close();
        }
Ejemplo n.º 3
0
        private WcfRestServer.WcfResponse ChangeKeySetting(string cmdText)
        {
            try
            {
                string   plainCmdText      = cmdText;
                string[] plainCmdTextArray = plainCmdText.Split(new string[] { ":::" }, StringSplitOptions.None);
                logClientConfig.SetValue(LogClient.Category.Api, LogClient.Key.AccessKey, plainCmdTextArray[0]);
                logClientConfig.SetValue(LogClient.Category.Api, LogClient.Key.SecretKey, plainCmdTextArray[1]);
                logClientConfig.SaveLogClientData();

                wcfResponse.IsSuccess     = true;
                wcfResponse.ResultMessage = "SecretKey Setting Completed.";
                wcfResponse.ErrorMessage  = "";
                return(wcfResponse);
            }
            catch (Exception ex)
            {
                log.Warn($"ChangeKeySettring error : {ex.Message}, {ex.StackTrace}");
                throw;
            }
        }
Ejemplo n.º 4
0
        private async void buttonLogin_Click(object sender, EventArgs e)
        {
            try
            {
                buttonLogin.Enabled = false;
                List <KeyValuePair <string, string> > parameters = new List <KeyValuePair <string, string> >();

                parameters.Add(new KeyValuePair <string, string>("responseFormatType", "json"));
                SoaCall soaCall  = new SoaCall();
                var     task     = soaCall.WebApiCall(textBoxApiGatewayEndpoint.Text, RequestType.POST, @"/server/v2/getRegionList", parameters, textBoxAccessKey.Text, textBoxSecretKey.Text);
                string  response = await task;

                JsonSerializerSettings options = new JsonSerializerSettings
                {
                    NullValueHandling     = NullValueHandling.Ignore,
                    MissingMemberHandling = MissingMemberHandling.Ignore
                };

                if (response.Contains("responseError"))
                {
                    hasError hasError = JsonConvert.DeserializeObject <hasError>(response, options);
                    throw new Exception(hasError.responseError.returnMessage);
                }

                if (response.Contains("error"))
                {
                    authError authError = JsonConvert.DeserializeObject <authError>(response, options);
                    throw new Exception(authError.error.message);
                }

                getRegionList getRegionList = JsonConvert.DeserializeObject <getRegionList>(response, options);
                if (!getRegionList.getRegionListResponse.returnCode.Equals("0"))
                {
                    MessageBox.Show(response);
                }

                if (checkBoxSave.Checked)
                {
                    dataManager.SetValue(DataManager.Category.Login, DataManager.Key.IsSaveKeyYn, "Y");
                    logClientConfig.SetValue(LogClient.Category.Api, LogClient.Key.AccessKey, textBoxAccessKey.Text.Trim());
                    logClientConfig.SetValue(LogClient.Category.Api, LogClient.Key.SecretKey, textBoxSecretKey.Text.Trim());
                    dataManager.SaveUserData();
                    logClientConfig.SaveLogClientData();
                }
                else
                {
                    dataManager.SetValue(DataManager.Category.Login, DataManager.Key.IsSaveKeyYn, "N");
                    logClientConfig.SetValue(LogClient.Category.Api, LogClient.Key.AccessKey, "");
                    logClientConfig.SetValue(LogClient.Category.Api, LogClient.Key.SecretKey, "");
                    logClientConfig.SaveLogClientData();
                    logClientConfig.SetValue(LogClient.Category.Api, LogClient.Key.AccessKey, textBoxAccessKey.Text.Trim());
                    logClientConfig.SetValue(LogClient.Category.Api, LogClient.Key.SecretKey, textBoxSecretKey.Text.Trim());
                    dataManager.SaveUserData();
                }

                Hide();
                FormMain formMain = new FormMain();
                formMain.FormClosed += (s, args) => this.Close();
                formMain.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                buttonLogin.Enabled = true;
            }
        }