main: Cleaned up unused code and fixed transfers
This commit is contained in:
parent
6c3fc72cf5
commit
91150a2b07
119
FireWalletLite/DomainForm.Designer.cs
generated
119
FireWalletLite/DomainForm.Designer.cs
generated
@ -29,43 +29,22 @@
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DomainForm));
|
||||
groupBoxInfo = new GroupBox();
|
||||
labelInfo = new Label();
|
||||
labelName = new Label();
|
||||
buttonExplorer = new Button();
|
||||
buttonRenew = new Button();
|
||||
buttonTransfer = new Button();
|
||||
groupBoxManage = new GroupBox();
|
||||
labelTransfer = new Label();
|
||||
textBoxTransferAddress = new TextBox();
|
||||
buttonCancel = new Button();
|
||||
buttonFinalize = new Button();
|
||||
groupBoxDNS = new GroupBox();
|
||||
panelDNS = new Panel();
|
||||
groupBoxInfo.SuspendLayout();
|
||||
groupBoxSign = new GroupBox();
|
||||
textBoxSignMessage = new TextBox();
|
||||
labelSignMessage = new Label();
|
||||
groupBoxManage.SuspendLayout();
|
||||
groupBoxDNS.SuspendLayout();
|
||||
groupBoxSign.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// groupBoxInfo
|
||||
//
|
||||
groupBoxInfo.Controls.Add(labelInfo);
|
||||
groupBoxInfo.Font = new Font("Segoe UI", 14F, FontStyle.Regular, GraphicsUnit.Point);
|
||||
groupBoxInfo.Location = new Point(12, 52);
|
||||
groupBoxInfo.Name = "groupBoxInfo";
|
||||
groupBoxInfo.Size = new Size(280, 163);
|
||||
groupBoxInfo.TabIndex = 0;
|
||||
groupBoxInfo.TabStop = false;
|
||||
groupBoxInfo.Text = "Info";
|
||||
//
|
||||
// labelInfo
|
||||
//
|
||||
labelInfo.AutoSize = true;
|
||||
labelInfo.Location = new Point(6, 28);
|
||||
labelInfo.Name = "labelInfo";
|
||||
labelInfo.Size = new Size(45, 25);
|
||||
labelInfo.TabIndex = 0;
|
||||
labelInfo.Text = "Info";
|
||||
//
|
||||
// labelName
|
||||
//
|
||||
labelName.AutoSize = true;
|
||||
@ -94,7 +73,7 @@
|
||||
buttonRenew.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point);
|
||||
buttonRenew.Location = new Point(6, 31);
|
||||
buttonRenew.Name = "buttonRenew";
|
||||
buttonRenew.Size = new Size(89, 30);
|
||||
buttonRenew.Size = new Size(141, 30);
|
||||
buttonRenew.TabIndex = 1;
|
||||
buttonRenew.Text = "Renew";
|
||||
buttonRenew.UseVisualStyleBackColor = true;
|
||||
@ -104,7 +83,7 @@
|
||||
//
|
||||
buttonTransfer.FlatStyle = FlatStyle.Flat;
|
||||
buttonTransfer.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point);
|
||||
buttonTransfer.Location = new Point(375, 67);
|
||||
buttonTransfer.Location = new Point(655, 70);
|
||||
buttonTransfer.Name = "buttonTransfer";
|
||||
buttonTransfer.Size = new Size(89, 30);
|
||||
buttonTransfer.TabIndex = 1;
|
||||
@ -114,33 +93,43 @@
|
||||
//
|
||||
// groupBoxManage
|
||||
//
|
||||
groupBoxManage.Controls.Add(labelTransfer);
|
||||
groupBoxManage.Controls.Add(textBoxTransferAddress);
|
||||
groupBoxManage.Controls.Add(buttonRenew);
|
||||
groupBoxManage.Controls.Add(buttonCancel);
|
||||
groupBoxManage.Controls.Add(buttonFinalize);
|
||||
groupBoxManage.Controls.Add(buttonTransfer);
|
||||
groupBoxManage.Font = new Font("Segoe UI", 14F, FontStyle.Regular, GraphicsUnit.Point);
|
||||
groupBoxManage.Location = new Point(298, 52);
|
||||
groupBoxManage.Location = new Point(12, 52);
|
||||
groupBoxManage.Name = "groupBoxManage";
|
||||
groupBoxManage.Size = new Size(470, 163);
|
||||
groupBoxManage.Size = new Size(756, 136);
|
||||
groupBoxManage.TabIndex = 2;
|
||||
groupBoxManage.TabStop = false;
|
||||
groupBoxManage.Text = "Manage";
|
||||
//
|
||||
// labelTransfer
|
||||
//
|
||||
labelTransfer.AutoSize = true;
|
||||
labelTransfer.Location = new Point(6, 72);
|
||||
labelTransfer.Name = "labelTransfer";
|
||||
labelTransfer.Size = new Size(83, 25);
|
||||
labelTransfer.TabIndex = 3;
|
||||
labelTransfer.Text = "Transfer:";
|
||||
//
|
||||
// textBoxTransferAddress
|
||||
//
|
||||
textBoxTransferAddress.Location = new Point(6, 66);
|
||||
textBoxTransferAddress.Location = new Point(95, 68);
|
||||
textBoxTransferAddress.Name = "textBoxTransferAddress";
|
||||
textBoxTransferAddress.Size = new Size(363, 32);
|
||||
textBoxTransferAddress.Size = new Size(554, 32);
|
||||
textBoxTransferAddress.TabIndex = 2;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.FlatStyle = FlatStyle.Flat;
|
||||
buttonCancel.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point);
|
||||
buttonCancel.Location = new Point(6, 67);
|
||||
buttonCancel.Location = new Point(242, 70);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(89, 30);
|
||||
buttonCancel.Size = new Size(141, 30);
|
||||
buttonCancel.TabIndex = 1;
|
||||
buttonCancel.Text = "Cancel";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
@ -151,44 +140,53 @@
|
||||
//
|
||||
buttonFinalize.FlatStyle = FlatStyle.Flat;
|
||||
buttonFinalize.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point);
|
||||
buttonFinalize.Location = new Point(6, 67);
|
||||
buttonFinalize.Location = new Point(95, 70);
|
||||
buttonFinalize.Name = "buttonFinalize";
|
||||
buttonFinalize.Size = new Size(89, 30);
|
||||
buttonFinalize.Size = new Size(141, 30);
|
||||
buttonFinalize.TabIndex = 1;
|
||||
buttonFinalize.Text = "Finalize";
|
||||
buttonFinalize.UseVisualStyleBackColor = true;
|
||||
buttonFinalize.Visible = false;
|
||||
buttonFinalize.Click += buttonFinalize_Click;
|
||||
//
|
||||
// groupBoxDNS
|
||||
// groupBoxSign
|
||||
//
|
||||
groupBoxDNS.Controls.Add(panelDNS);
|
||||
groupBoxDNS.Location = new Point(12, 221);
|
||||
groupBoxDNS.Name = "groupBoxDNS";
|
||||
groupBoxDNS.Size = new Size(756, 224);
|
||||
groupBoxDNS.TabIndex = 3;
|
||||
groupBoxDNS.TabStop = false;
|
||||
groupBoxDNS.Text = "DNS";
|
||||
groupBoxSign.Controls.Add(textBoxSignMessage);
|
||||
groupBoxSign.Controls.Add(labelSignMessage);
|
||||
groupBoxSign.Font = new Font("Segoe UI", 14F, FontStyle.Regular, GraphicsUnit.Point);
|
||||
groupBoxSign.Location = new Point(12, 194);
|
||||
groupBoxSign.Name = "groupBoxSign";
|
||||
groupBoxSign.Size = new Size(756, 257);
|
||||
groupBoxSign.TabIndex = 3;
|
||||
groupBoxSign.TabStop = false;
|
||||
groupBoxSign.Text = "Sign";
|
||||
//
|
||||
// panelDNS
|
||||
// textBoxSignMessage
|
||||
//
|
||||
panelDNS.AutoSize = true;
|
||||
panelDNS.Dock = DockStyle.Fill;
|
||||
panelDNS.Location = new Point(3, 19);
|
||||
panelDNS.Name = "panelDNS";
|
||||
panelDNS.Size = new Size(750, 202);
|
||||
panelDNS.TabIndex = 0;
|
||||
textBoxSignMessage.Location = new Point(6, 56);
|
||||
textBoxSignMessage.Multiline = true;
|
||||
textBoxSignMessage.Name = "textBoxSignMessage";
|
||||
textBoxSignMessage.Size = new Size(744, 195);
|
||||
textBoxSignMessage.TabIndex = 1;
|
||||
//
|
||||
// labelSignMessage
|
||||
//
|
||||
labelSignMessage.AutoSize = true;
|
||||
labelSignMessage.Location = new Point(6, 28);
|
||||
labelSignMessage.Name = "labelSignMessage";
|
||||
labelSignMessage.Size = new Size(90, 25);
|
||||
labelSignMessage.TabIndex = 0;
|
||||
labelSignMessage.Text = "Message:";
|
||||
//
|
||||
// DomainForm
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(780, 457);
|
||||
Controls.Add(groupBoxDNS);
|
||||
Controls.Add(groupBoxSign);
|
||||
Controls.Add(groupBoxManage);
|
||||
Controls.Add(buttonExplorer);
|
||||
Controls.Add(labelName);
|
||||
Controls.Add(groupBoxInfo);
|
||||
FormBorderStyle = FormBorderStyle.Fixed3D;
|
||||
Icon = (Icon)resources.GetObject("$this.Icon");
|
||||
MaximizeBox = false;
|
||||
@ -197,29 +195,26 @@
|
||||
ShowInTaskbar = false;
|
||||
Text = "DomainsForm";
|
||||
Load += DomainForm_Load;
|
||||
groupBoxInfo.ResumeLayout(false);
|
||||
groupBoxInfo.PerformLayout();
|
||||
groupBoxManage.ResumeLayout(false);
|
||||
groupBoxManage.PerformLayout();
|
||||
groupBoxDNS.ResumeLayout(false);
|
||||
groupBoxDNS.PerformLayout();
|
||||
groupBoxSign.ResumeLayout(false);
|
||||
groupBoxSign.PerformLayout();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private GroupBox groupBoxInfo;
|
||||
private Label labelName;
|
||||
private Button buttonExplorer;
|
||||
private Label labelInfo;
|
||||
private Button buttonRenew;
|
||||
private Button buttonTransfer;
|
||||
private GroupBox groupBoxManage;
|
||||
private TextBox textBoxTransferAddress;
|
||||
private Button buttonFinalize;
|
||||
private Button buttonCancel;
|
||||
private GroupBox groupBoxDNS;
|
||||
private Panel panelDNS;
|
||||
private Label labelTransfer;
|
||||
private GroupBox groupBoxSign;
|
||||
private TextBox textBoxSignMessage;
|
||||
private Label labelSignMessage;
|
||||
}
|
||||
}
|
@ -6,17 +6,17 @@ namespace FireWalletLite
|
||||
{
|
||||
public partial class DomainForm : Form
|
||||
{
|
||||
private MainForm main;
|
||||
private string domain;
|
||||
private MainForm Main;
|
||||
private string Domain;
|
||||
public DomainForm(MainForm main, string domain)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.main = main;
|
||||
this.domain = domain;
|
||||
this.Text = domain + "/";
|
||||
this.Main = main;
|
||||
this.Domain = domain;
|
||||
Text = domain + "/";
|
||||
// Theme form
|
||||
this.BackColor = ColorTranslator.FromHtml(main.Theme["background"]);
|
||||
this.ForeColor = ColorTranslator.FromHtml(main.Theme["foreground"]);
|
||||
BackColor = ColorTranslator.FromHtml(main.Theme["background"]);
|
||||
ForeColor = ColorTranslator.FromHtml(main.Theme["foreground"]);
|
||||
foreach (Control control in Controls)
|
||||
{
|
||||
main.ThemeControl(control);
|
||||
@ -28,105 +28,45 @@ namespace FireWalletLite
|
||||
{
|
||||
ProcessStartInfo psi = new ProcessStartInfo
|
||||
{
|
||||
FileName = main.DomainExplorer + domain,
|
||||
FileName = Main.DomainExplorer + Domain,
|
||||
UseShellExecute = true
|
||||
};
|
||||
Process.Start(psi);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private async void GetName()
|
||||
{
|
||||
try
|
||||
{
|
||||
string content = "{\"method\": \"getnameinfo\", \"params\": [\"" + domain + "\"]}";
|
||||
string response = await main.APIPost("", false, content);
|
||||
JObject jObject = JObject.Parse(response);
|
||||
// Get block height
|
||||
string Nodeinfo = await main.APIGet("", false);
|
||||
JObject jObjectInfo = JObject.Parse(Nodeinfo);
|
||||
JObject chain = (JObject)jObjectInfo["chain"];
|
||||
int height = Convert.ToInt32(chain["height"]);
|
||||
|
||||
labelInfo.Text = "";
|
||||
if (jObject.ContainsKey("result"))
|
||||
{
|
||||
JObject result = (JObject)jObject["result"];
|
||||
JObject start = (JObject)result["start"];
|
||||
if (start["reserved"].ToString().ToLower() == "true") labelInfo.Text = "Reserved for ICANN domain owner\n";
|
||||
if (result.ContainsKey("info"))
|
||||
{
|
||||
try
|
||||
{
|
||||
JObject info = (JObject)result["info"];
|
||||
string state = info["state"].ToString();
|
||||
JObject stats = (JObject)info["stats"];
|
||||
|
||||
if (info["transfer"].ToString() != "0")
|
||||
{
|
||||
labelInfo.Text += "Transferring\n";
|
||||
int TransferEnd = Convert.ToInt32(stats["transferLockupEnd"].ToString());
|
||||
textBoxTransferAddress.Hide();
|
||||
buttonTransfer.Hide();
|
||||
if (height >= TransferEnd)
|
||||
{
|
||||
buttonFinalize.Show();
|
||||
}
|
||||
else
|
||||
{
|
||||
labelInfo.Text += "Finalize in " + (TransferEnd - height).ToString() + " blocks\n";
|
||||
buttonCancel.Show();
|
||||
}
|
||||
}
|
||||
|
||||
if (state == "CLOSED")
|
||||
{
|
||||
string expires = "Expires in ~" + stats["daysUntilExpire"].ToString() + " days\n";
|
||||
labelInfo.Text += expires;
|
||||
}
|
||||
else labelInfo.Text += state + "\n";
|
||||
|
||||
|
||||
// Get DNS if the domain isn't in auction
|
||||
if (state == "CLOSED") GetDNS();
|
||||
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// No info -> Domain not in wallet
|
||||
labelInfo.Text = "No info in node";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
labelInfo.Text = "Error getting Name";
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
main.AddLog(ex.Message);
|
||||
}
|
||||
|
||||
|
||||
if (!main.Domains.Contains(domain))
|
||||
{
|
||||
groupBoxManage.Hide();
|
||||
}
|
||||
}
|
||||
|
||||
private void DomainForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
GetName();
|
||||
if (!File.Exists(Main.dir + "domains.json")) return;
|
||||
|
||||
JArray domains = JArray.Parse(File.ReadAllText(Main.dir + "domains.json"));
|
||||
foreach (JObject domain in domains)
|
||||
{
|
||||
if (domain["name"].ToString() == Domain)
|
||||
{
|
||||
if (domain.ContainsKey("status"))
|
||||
{
|
||||
switch (domain["status"].ToString())
|
||||
{
|
||||
case "transferring":
|
||||
buttonFinalize.Visible = true;
|
||||
buttonCancel.Visible = true;
|
||||
buttonTransfer.Visible = false;
|
||||
textBoxTransferAddress.Visible = false;
|
||||
break;
|
||||
case "closed":
|
||||
buttonCancel.Visible = false;
|
||||
buttonFinalize.Visible = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async void buttonRenew_Click(object sender, EventArgs e)
|
||||
{
|
||||
string content = "{\"method\": \"renew\", \"params\": [\"" + domain + "\"]}";
|
||||
string response = await main.APIPost("", true, content);
|
||||
string content = "{\"method\": \"renew\", \"params\": [\"" + Domain + "\"]}";
|
||||
string response = await Main.APIPost("", true, content);
|
||||
if (response == "Error")
|
||||
{
|
||||
NotifyForm notify = new NotifyForm("Error renewing domain");
|
||||
@ -137,12 +77,12 @@ namespace FireWalletLite
|
||||
JObject jObject = JObject.Parse(response);
|
||||
if (jObject.ContainsKey("result"))
|
||||
{
|
||||
main.AddLog(jObject["result"].ToString());
|
||||
Main.AddLog(jObject["result"].ToString());
|
||||
JObject result = (JObject)jObject["result"];
|
||||
if (result.ContainsKey("txid"))
|
||||
{
|
||||
string txid = result["txid"].ToString();
|
||||
NotifyForm notify = new NotifyForm("Renewed domain", "Explorer", main.TXExplorer + txid);
|
||||
NotifyForm notify = new NotifyForm("Renewed domain", "Explorer", Main.TXExplorer + txid);
|
||||
notify.ShowDialog();
|
||||
notify.Dispose();
|
||||
}
|
||||
@ -158,14 +98,14 @@ namespace FireWalletLite
|
||||
NotifyForm notify = new NotifyForm("Error renewing domain");
|
||||
notify.ShowDialog();
|
||||
notify.Dispose();
|
||||
main.AddLog(jObject.ToString());
|
||||
Main.AddLog(jObject.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
private async void buttonTransfer_Click(object sender, EventArgs e)
|
||||
{
|
||||
string address = textBoxTransferAddress.Text;
|
||||
bool valid = await main.ValidAddress(address);
|
||||
bool valid = await Main.ValidAddress(address);
|
||||
if (!valid)
|
||||
{
|
||||
NotifyForm notify = new NotifyForm("Invalid address");
|
||||
@ -173,8 +113,9 @@ namespace FireWalletLite
|
||||
notify.Dispose();
|
||||
return;
|
||||
}
|
||||
string content = "{\"method\": \"transfer\", \"params\": [\"" + domain + "\", \"" + address + "\"]}";
|
||||
string response = await main.APIPost("", true, content);
|
||||
string path = "wallet/" + Main.Account + "/transfer";
|
||||
string content = "{\"passphrase\": \"" + Main.Password + "\", \"name\": \"" + Domain + "\", \"broadcast\": true, \"sign\": true, \"address\": \"" + address + "\"}";
|
||||
string response = await Main.APIPost(path, true, content);
|
||||
if (response == "Error")
|
||||
{
|
||||
NotifyForm notify = new NotifyForm("Error transferring domain");
|
||||
@ -183,209 +124,118 @@ namespace FireWalletLite
|
||||
return;
|
||||
}
|
||||
JObject jObject = JObject.Parse(response);
|
||||
if (jObject.ContainsKey("result"))
|
||||
if (jObject.ContainsKey("hash"))
|
||||
{
|
||||
main.AddLog(jObject["result"].ToString());
|
||||
JObject result = (JObject)jObject["result"];
|
||||
if (result.ContainsKey("txid"))
|
||||
{
|
||||
string txid = result["txid"].ToString();
|
||||
NotifyForm notify = new NotifyForm("Renewed domain", "Explorer", main.TXExplorer + txid);
|
||||
string txid = jObject["hash"].ToString();
|
||||
NotifyForm notify = new NotifyForm("Transferred domain", "Explorer", Main.TXExplorer + txid);
|
||||
notify.ShowDialog();
|
||||
notify.Dispose();
|
||||
AddDomainInfo("transferring");
|
||||
}
|
||||
else
|
||||
{
|
||||
NotifyForm notify = new NotifyForm("Error renewing domain");
|
||||
NotifyForm notify = new NotifyForm("Error transferring domain");
|
||||
notify.ShowDialog();
|
||||
notify.Dispose();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NotifyForm notify = new NotifyForm("Error renewing domain");
|
||||
notify.ShowDialog();
|
||||
notify.Dispose();
|
||||
main.AddLog(jObject.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonFinalize_Click(object sender, EventArgs e)
|
||||
{
|
||||
string content = "{\"method\": \"finalize\", \"params\": [\"" + domain + "\"]}";
|
||||
string response = main.APIPost("", true, content).Result;
|
||||
string path = "wallet/" + Main.Account + "/finalize";
|
||||
string content = "{\"passphrase\": \"" + Main.Password + "\", \"name\": \"" + Domain + "\", \"broadcast\": true, \"sign\": true}";
|
||||
string response = Main.APIPost(path, true, content).Result;
|
||||
if (response == "Error")
|
||||
{
|
||||
NotifyForm notify = new NotifyForm("Error finalizing tranfer");
|
||||
NotifyForm notify = new NotifyForm("Error finalizing transfer");
|
||||
notify.ShowDialog();
|
||||
notify.Dispose();
|
||||
return;
|
||||
}
|
||||
JObject jObject = JObject.Parse(response);
|
||||
if (jObject.ContainsKey("result"))
|
||||
if (jObject.ContainsKey("hash"))
|
||||
{
|
||||
main.AddLog(jObject["result"].ToString());
|
||||
JObject result = (JObject)jObject["result"];
|
||||
if (result.ContainsKey("txid"))
|
||||
{
|
||||
string txid = result["txid"].ToString();
|
||||
NotifyForm notify = new NotifyForm("Finalized tranfer", "Explorer", main.TXExplorer + txid);
|
||||
string txid = jObject["hash"].ToString();
|
||||
NotifyForm notify = new NotifyForm("Finalized domain", "Explorer", Main.TXExplorer + txid);
|
||||
notify.ShowDialog();
|
||||
notify.Dispose();
|
||||
AddDomainInfo("closed");
|
||||
}
|
||||
else
|
||||
{
|
||||
NotifyForm notify = new NotifyForm("Error finalizing tranfer");
|
||||
NotifyForm notify = new NotifyForm("Error finalizing domain");
|
||||
notify.ShowDialog();
|
||||
notify.Dispose();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NotifyForm notify = new NotifyForm("Error finalizing tranfer");
|
||||
notify.ShowDialog();
|
||||
notify.Dispose();
|
||||
main.AddLog(jObject.ToString());
|
||||
}
|
||||
}
|
||||
private void buttonCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
string content = "{\"method\": \"cancel\", \"params\": [\"" + domain + "\"]}";
|
||||
string response = main.APIPost("", true, content).Result;
|
||||
string path = "wallet/" + Main.Account + "/cancel";
|
||||
string content = "{\"passphrase\": \"" + Main.Password + "\", \"name\": \"" + Domain + "\", \"broadcast\": true, \"sign\": true}";
|
||||
string response = Main.APIPost(path, true, content).Result;
|
||||
if (response == "Error")
|
||||
{
|
||||
NotifyForm notify = new NotifyForm("Error cancelling tranfer");
|
||||
NotifyForm notify = new NotifyForm("Error cancelling transfer");
|
||||
notify.ShowDialog();
|
||||
notify.Dispose();
|
||||
return;
|
||||
}
|
||||
JObject jObject = JObject.Parse(response);
|
||||
if (jObject.ContainsKey("result"))
|
||||
if (jObject.ContainsKey("hash"))
|
||||
{
|
||||
main.AddLog(jObject["result"].ToString());
|
||||
JObject result = (JObject)jObject["result"];
|
||||
if (result.ContainsKey("txid"))
|
||||
{
|
||||
string txid = result["txid"].ToString();
|
||||
NotifyForm notify = new NotifyForm("Cancelled tranfer", "Explorer", main.TXExplorer + txid);
|
||||
string txid = jObject["hash"].ToString();
|
||||
NotifyForm notify = new NotifyForm("Canceled transfer", "Explorer", Main.TXExplorer + txid);
|
||||
notify.ShowDialog();
|
||||
notify.Dispose();
|
||||
AddDomainInfo("closed");
|
||||
}
|
||||
else
|
||||
{
|
||||
NotifyForm notify = new NotifyForm("Error cancelling tranfer");
|
||||
NotifyForm notify = new NotifyForm("Error cancelling transfer");
|
||||
notify.ShowDialog();
|
||||
notify.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
private void AddDomainInfo(string status)
|
||||
{
|
||||
if (File.Exists(Main.dir + "domains.json"))
|
||||
{
|
||||
bool found = false;
|
||||
JArray domains = JArray.Parse(File.ReadAllText(Main.dir + "domains.json"));
|
||||
foreach (JObject domain in domains)
|
||||
{
|
||||
if (domain["name"].ToString() == Domain)
|
||||
{
|
||||
found = true;
|
||||
if (domain.ContainsKey("status"))
|
||||
{
|
||||
domain["status"] = status;
|
||||
}
|
||||
else
|
||||
{
|
||||
NotifyForm notify = new NotifyForm("Error cancelling tranfer");
|
||||
notify.ShowDialog();
|
||||
notify.Dispose();
|
||||
main.AddLog(jObject.ToString());
|
||||
domain.Add("status", status);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Get DNS records for domain. Not implemented yet
|
||||
private async void GetDNS()
|
||||
if (!found)
|
||||
{
|
||||
// Get DNS records
|
||||
string contentDNS = "{\"method\": \"getnameresource\", \"params\": [\"" + domain + "\"]}";
|
||||
string responseDNS = await main.APIPost("", false, contentDNS);
|
||||
JObject jObjectDNS = JObject.Parse(responseDNS);
|
||||
|
||||
if (jObjectDNS["result"].ToString() == "")
|
||||
{
|
||||
// Not registered
|
||||
groupBoxDNS.Visible = false;
|
||||
return;
|
||||
JObject domain = new JObject();
|
||||
domain["name"] = Domain;
|
||||
domain["status"] = status;
|
||||
domains.Add(domain);
|
||||
}
|
||||
|
||||
JObject result = (JObject)jObjectDNS["result"];
|
||||
JArray records = (JArray)result["records"];
|
||||
// For each record
|
||||
int i = 0;
|
||||
foreach (JObject record in records)
|
||||
{
|
||||
Panel DNSPanel = new Panel();
|
||||
// Count for scroll width
|
||||
DNSPanel.Width = panelDNS.Width - SystemInformation.VerticalScrollBarWidth - 2;
|
||||
DNSPanel.Height = 60;
|
||||
DNSPanel.BorderStyle = BorderStyle.FixedSingle;
|
||||
DNSPanel.Top = 62 * i;
|
||||
|
||||
Label DNSType = new Label();
|
||||
DNSType.Text = record["type"].ToString();
|
||||
DNSType.Location = new System.Drawing.Point(10, 10);
|
||||
DNSType.AutoSize = true;
|
||||
DNSType.Font = new Font(DNSType.Font.FontFamily, 11.0f, FontStyle.Bold);
|
||||
DNSPanel.Controls.Add(DNSType);
|
||||
|
||||
|
||||
switch (DNSType.Text)
|
||||
{
|
||||
case "NS":
|
||||
Label DNSNS = new Label();
|
||||
DNSNS.Text = record["ns"].ToString();
|
||||
DNSNS.Location = new System.Drawing.Point(10, 30);
|
||||
DNSNS.AutoSize = true;
|
||||
DNSPanel.Controls.Add(DNSNS);
|
||||
break;
|
||||
case "GLUE4":
|
||||
case "GLUE6":
|
||||
Label DNSNS1 = new Label();
|
||||
DNSNS1.Text = record["ns"].ToString();
|
||||
DNSNS1.Location = new System.Drawing.Point(10, 30);
|
||||
DNSNS1.AutoSize = true;
|
||||
DNSPanel.Controls.Add(DNSNS1);
|
||||
Label address = new Label();
|
||||
address.Text = record["address"].ToString();
|
||||
address.Location = new System.Drawing.Point(DNSNS1.Left + DNSNS1.Width + 20, 30);
|
||||
address.AutoSize = true;
|
||||
DNSPanel.Controls.Add(address);
|
||||
break;
|
||||
case "DS":
|
||||
Label keyTag = new Label();
|
||||
keyTag.Text = record["keyTag"].ToString();
|
||||
keyTag.Location = new System.Drawing.Point(10, 30);
|
||||
keyTag.AutoSize = true;
|
||||
DNSPanel.Controls.Add(keyTag);
|
||||
Label algorithm = new Label();
|
||||
algorithm.Text = record["algorithm"].ToString();
|
||||
algorithm.Location = new System.Drawing.Point(keyTag.Left + keyTag.Width + 10, 30);
|
||||
algorithm.AutoSize = true;
|
||||
DNSPanel.Controls.Add(algorithm);
|
||||
Label digestType = new Label();
|
||||
digestType.Text = record["digestType"].ToString();
|
||||
digestType.Location = new System.Drawing.Point(algorithm.Left + algorithm.Width + 10, 30);
|
||||
digestType.AutoSize = true;
|
||||
DNSPanel.Controls.Add(digestType);
|
||||
Label digest = new Label();
|
||||
digest.Text = record["digest"].ToString();
|
||||
digest.Location = new System.Drawing.Point(digestType.Left + digestType.Width + 10, 30);
|
||||
digest.AutoSize = true;
|
||||
DNSPanel.Controls.Add(digest);
|
||||
break;
|
||||
case "TXT":
|
||||
JArray txts = (JArray)record["txt"];
|
||||
int j = 0;
|
||||
foreach (string txt in txts)
|
||||
{
|
||||
Label DNSTXT = new Label();
|
||||
DNSTXT.Text = txt;
|
||||
DNSTXT.Location = new System.Drawing.Point(10, 30 + (j * 20));
|
||||
DNSTXT.AutoSize = true;
|
||||
DNSPanel.Controls.Add(DNSTXT);
|
||||
DNSPanel.Height = 60 + (j * 20);
|
||||
j++;
|
||||
File.WriteAllText(Main.dir + "domains.json", domains.ToString());
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
panelDNS.Controls.Add(DNSPanel);
|
||||
i++;
|
||||
else
|
||||
{
|
||||
JArray domains = new JArray();
|
||||
JObject domain = new JObject();
|
||||
domain["name"] = Domain;
|
||||
domain["status"] = status;
|
||||
domains.Add(domain);
|
||||
File.WriteAllText(Main.dir + "domains.json", domains.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using FireWallet;
|
||||
using FireWallet;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace FireWalletLite
|
||||
|
@ -1,5 +1,4 @@
|
||||
using System.Diagnostics;
|
||||
using System.Net;
|
||||
using System.Text.RegularExpressions;
|
||||
using FireWallet;
|
||||
|
||||
@ -9,7 +8,7 @@ namespace FireWalletLite
|
||||
{
|
||||
#region Constants
|
||||
MainForm mainForm = new MainForm();
|
||||
bool hideScreen = true;
|
||||
bool hideScreen = false;
|
||||
Process HSDProcess;
|
||||
#endregion
|
||||
|
||||
|
@ -1,10 +1,6 @@
|
||||
using System.Data;
|
||||
using System.Diagnostics;
|
||||
using System.DirectoryServices.ActiveDirectory;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Diagnostics;
|
||||
using FireWallet;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using static QRCoder.PayloadGenerator;
|
||||
|
||||
namespace FireWalletLite
|
||||
{
|
||||
@ -35,8 +31,8 @@ namespace FireWalletLite
|
||||
public Dictionary<string, string> Theme { get; set; }
|
||||
HttpClient httpClient = new HttpClient();
|
||||
Decimal Balance { get; set; }
|
||||
String Account = "primary";
|
||||
String Password { get; set; }
|
||||
public String Account = "primary";
|
||||
public String Password { get; set; }
|
||||
#endregion
|
||||
public MainForm()
|
||||
{
|
||||
@ -247,7 +243,6 @@ namespace FireWalletLite
|
||||
string port = "1203";
|
||||
if (wallet) port = port + "9";
|
||||
else port = port + "7";
|
||||
|
||||
HttpRequestMessage req = new HttpRequestMessage(HttpMethod.Post, "http://" + ip + ":" + port + "/" + path);
|
||||
//req.Headers.Add("Authorization", "Basic " + Convert.ToBase64String(System.Text.ASCIIEncoding.ASCII.GetBytes("x:" + key)));
|
||||
req.Content = new StringContent(content);
|
||||
|
@ -1,15 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security.Policy;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace FireWallet
|
||||
{
|
||||
|
@ -1,13 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using QRCoder;
|
||||
using QRCoder;
|
||||
|
||||
namespace FireWalletLite
|
||||
{
|
||||
|
@ -1,13 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using FireWallet;
|
||||
using FireWallet;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace FireWalletLite
|
||||
|
Loading…
Reference in New Issue
Block a user