Пример #1
0
 private void ButReject_Click(object sender, EventArgs e)
 {
     try
     {
         if (RegistName.Text.Trim().Equals(""))
         {
             MessageBox.Show("用户名不能为空!", "提示");
             RegistName.Focus();
         }
         else if (PassWord.Text.Trim().Equals(""))
         {
             MessageBox.Show("密码不能为空!", "提示");
             PassWord.Focus();
         }
         else if (UserName(RegistName.Text.Trim()))
         {
             MessageBox.Show("用户名已经存在!", "提示");
             ClearAll();
         }
         else
         {
             string sqlStr = "insert user_info (userName, userPwd, roles) values('" + RegistName.Text.Trim() + "','" + PassWord.Text.Trim() + "','" + RolesBox.Text.Trim() + "')";
             if (DBconn.PDData(sqlStr))
             {
                 MessageBox.Show("用户" + RegistName.Text.Trim() + "注册成功!");
             }
             this.Close();
         }
     }catch (Exception ex)            {
         DBconn.conn.Close();
         MessageBox.Show(ex.Message);
         ClearAll();
     }
 }
Пример #2
0
        public string ReadFile([FromBody] RegistName registname)
        {
            AssetTypesRegisterer.RegisterTypes();
            Process process = new Process();
            string  arg     = registname.nickname;//argumenrt

            ProcessStartInfo psinfo = new ProcessStartInfo()
            {
                FileName               = "/usr/local/bin/ReadKeyFile.sh",
                UseShellExecute        = false,
                RedirectStandardOutput = true,
                CreateNoWindow         = true,
                Arguments              = "\t" + arg,
            };
            Process p = Process.Start(psinfo);

            p.WaitForExit();
            string privatekey = p.StandardOutput.ReadToEnd();

            privatekey = privatekey.Substring(0, privatekey.Length - 1);
            p.Close();

            WAction walletservice = new WAction();
            KeyPair privatekey1   = walletservice.GetKeyPair(privatekey);

            if (privatekey1 == null)
            {
                // comment:プライベートキーが正しく取得できませんでした!
                getkeypair getkeypair = new getkeypair();
                getkeypair.PrivateKey = string.Empty;
                getkeypair.PublicKey  = string.Empty;
                string resultjson = JsonSerializer.Serialize(getkeypair);
                return(resultjson);
            }
            Address mypublickey = Inputjudgement1(privatekey1);

            if (mypublickey == null)
            {
                //comment:パブリックキーに変換できませんでした!
                getkeypair getkeypair = new getkeypair();
                getkeypair.PrivateKey = string.Empty;
                getkeypair.PublicKey  = string.Empty;
                string resultjson = JsonSerializer.Serialize(getkeypair);
                return(resultjson);
            }
            string ParsePublicKey = Convert.ToString(mypublickey);

            getkeypair keypair = new getkeypair();

            keypair.PrivateKey = privatekey;
            keypair.PublicKey  = ParsePublicKey;
            string keypairjson = JsonSerializer.Serialize(keypair);

            return(keypairjson);
        }