Beispiel #1
0
        public void AdressReg(HttpMessage httpMessage)
        {
            if (!GetParam(httpMessage, "1", "adress1", out string adress1))
            {
                httpMessage.result = "command error! \nexample: AdressReg adress1 adress2 publicKey";
                return;
            }
            if (!GetParam(httpMessage, "2", "adress2", out string adress2))
            {
                httpMessage.result = "command error! \nexample: AdressReg adress1 adress2 publicKey";
                return;
            }
            if (!GetParam(httpMessage, "3", "publicKey", out string publicKey))
            {
                httpMessage.result = "command error! \nexample: AdressReg adress1 adress2 publicKey";
                return;
            }

            bool rel = Wallet.CheckPulblicKeyToAddress_Old_Java_V1(adress1, adress2, publicKey);

            if (rel)
            {
                var          tempPath     = System.IO.Directory.GetCurrentDirectory();
                var          DatabasePath = System.IO.Path.Combine(tempPath, "./Data/AdressReg.csv");
                FileStream   fs           = new FileStream(DatabasePath, System.IO.FileMode.Append, System.IO.FileAccess.Write);
                StreamWriter sw           = new StreamWriter(fs, System.Text.Encoding.UTF8);
                sw.WriteLine($"{adress1};{adress2};{publicKey}");
                sw.Close();
                fs.Close();
                httpMessage.result = "{\"success\":true}";
            }
        }