示例#1
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            Host.Host     = txtHost.Text;
            Host.Port     = int.Parse(txtPort.Text);
            Host.UserName = txtUser.Text;
            DSMAuthentication method = null;

            Host.SynoReportHome = chkSynoReportHome.Checked ? txtSynoReportHome.Text : string.Empty;
            if (Validate())
            {
                method = Host.UpdateAuthenticationMethod(DSMAuthenticationMethod.None, chkAuthNone.Checked);

                method = Host.UpdateAuthenticationMethod(DSMAuthenticationMethod.KeyboardInteractive, chkKeyBoardInteractive.Checked);
                if (method != null)
                {
                    method.UserName = Host.UserName;
                }

                method = Host.UpdateAuthenticationMethod(DSMAuthenticationMethod.Password, chkPassword.Checked);
                if (method != null)
                {
                    method.UserName = Host.UserName;
                    method.Password = txtPassword.Text;
                }

                method = Host.UpdateAuthenticationMethod(DSMAuthenticationMethod.PrivateKeyFile, chkKeyFiles.Checked);
                if (method != null)
                {
                    method.UserName = Host.UserName;
                }
            }
            else
            {
                ;
            }

            Hide();
        }
示例#2
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (chkSynoReportHome.Checked)
            {
                if (ValidateHomePath())
                {
                    if (!txtSynoReportHome.Text.EndsWith("/"))
                    {
                        txtSynoReportHome.Text += "/";
                    }

                    if (Host.SynoReportHome.Equals(txtSynoReportHome.Text) == false && txtSynoReportHome.Text.EndsWith("/synoreport/"))
                    {
                        if (MessageBox.Show(string.Format("Are you sure your Storage Analyzer reports can be found in '{0}'?", txtSynoReportHome.Text + "synoreport/"),
                                            "Please confirm path",
                                            MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                        {
                            return;
                        }
                    }
                }
            }

            Host.KeepDsmFilesCustom = chkKeep.Checked;
            Host.KeepDsmCount       = int.Parse(txtKeep.Text);
            Host.KeepAllDsmFiles    = optAnalyzerDbKeep.Checked;

            Host.Host     = txtHost.Text;
            Host.Port     = int.Parse(txtPort.Text);
            Host.UserName = txtUser.Text;
            DSMAuthentication method = null;

            Host.SynoReportHome = chkSynoReportHome.Checked ? txtSynoReportHome.Text : string.Empty;
            if (Validate())
            {
                method = Host.UpdateAuthenticationMethod(DSMAuthenticationMethod.None, chkAuthNone.Checked);

                method = Host.UpdateAuthenticationMethod(DSMAuthenticationMethod.KeyboardInteractive, chkKeyBoardInteractive.Checked);

                method = Host.UpdateAuthenticationMethod(DSMAuthenticationMethod.Password, chkPassword.Checked);
                if (method != null)
                {
                    method.Password = txtPassword.Text;
                }

                method = Host.UpdateAuthenticationMethod(DSMAuthenticationMethod.PrivateKeyFile, chkKeyFiles.Checked);
                if (method != null)
                {
                    method.AuthenticationKeys.Items.Clear();

                    foreach (ListViewItem k in listView1.Items)
                    {
                        var kf = new DSMAuthenticationKeyFile()
                        {
                            FileName = k.Text
                        };
                        method.AuthenticationKeys.Items.Add(kf);
                    }
                }
            }
            else
            {
                ;
            }

            Hide();
        }