mirror of
https://github.com/Nathanwoodburn/FireWallet.git
synced 2024-11-24 08:08:14 +11:00
batching: Finished first version
This commit is contained in:
parent
4f46c81765
commit
de14b98c6f
@ -1,14 +1,6 @@
|
|||||||
using System;
|
using System.Data;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
using Newtonsoft.Json.Linq;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
using Microsoft.VisualBasic.Devices;
|
|
||||||
using Point = System.Drawing.Point;
|
using Point = System.Drawing.Point;
|
||||||
|
|
||||||
namespace FireWallet
|
namespace FireWallet
|
||||||
@ -55,7 +47,19 @@ namespace FireWallet
|
|||||||
deleteTX.Width = 25;
|
deleteTX.Width = 25;
|
||||||
deleteTX.Height = 25;
|
deleteTX.Height = 25;
|
||||||
deleteTX.TextAlign = ContentAlignment.MiddleCenter;
|
deleteTX.TextAlign = ContentAlignment.MiddleCenter;
|
||||||
deleteTX.Click += (sender, e) => { panelTXs.Controls.Remove(tx); FixSpacing(); };
|
deleteTX.Click += (sender, e) => {
|
||||||
|
panelTXs.Controls.Remove(tx);
|
||||||
|
FixSpacing();
|
||||||
|
List<Batch> temp = new List<Batch>();
|
||||||
|
foreach (Batch batch in batches)
|
||||||
|
{
|
||||||
|
if (batch.domain != domain && batch.method != operation)
|
||||||
|
{
|
||||||
|
temp.Add(batch);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
batches = temp.ToArray();
|
||||||
|
};
|
||||||
deleteTX.FlatStyle = FlatStyle.Flat;
|
deleteTX.FlatStyle = FlatStyle.Flat;
|
||||||
deleteTX.Font = new Font(deleteTX.Font.FontFamily, 9F, FontStyle.Bold);
|
deleteTX.Font = new Font(deleteTX.Font.FontFamily, 9F, FontStyle.Bold);
|
||||||
tx.Controls.Add(deleteTX);
|
tx.Controls.Add(deleteTX);
|
||||||
@ -65,7 +69,11 @@ namespace FireWallet
|
|||||||
}
|
}
|
||||||
public void AddBatch(string domain, string operation, decimal bid, decimal lockup)
|
public void AddBatch(string domain, string operation, decimal bid, decimal lockup)
|
||||||
{
|
{
|
||||||
if (operation != "BID") return;
|
if (operation != "BID")
|
||||||
|
{
|
||||||
|
AddBatch(domain, operation);
|
||||||
|
return;
|
||||||
|
}
|
||||||
batches = batches.Concat(new Batch[] { new Batch(domain, operation, bid, lockup) }).ToArray();
|
batches = batches.Concat(new Batch[] { new Batch(domain, operation, bid, lockup) }).ToArray();
|
||||||
Panel tx = new Panel();
|
Panel tx = new Panel();
|
||||||
tx.Left = 0;
|
tx.Left = 0;
|
||||||
@ -102,7 +110,19 @@ namespace FireWallet
|
|||||||
deleteTX.Width = 25;
|
deleteTX.Width = 25;
|
||||||
deleteTX.Height = 25;
|
deleteTX.Height = 25;
|
||||||
deleteTX.TextAlign = ContentAlignment.MiddleCenter;
|
deleteTX.TextAlign = ContentAlignment.MiddleCenter;
|
||||||
deleteTX.Click += (sender, e) => { panelTXs.Controls.Remove(tx); FixSpacing(); };
|
deleteTX.Click += (sender, e) => {
|
||||||
|
panelTXs.Controls.Remove(tx);
|
||||||
|
FixSpacing();
|
||||||
|
List<Batch> temp = new List<Batch>();
|
||||||
|
foreach (Batch batch in batches)
|
||||||
|
{
|
||||||
|
if (batch.domain != domain && batch.method != operation)
|
||||||
|
{
|
||||||
|
temp.Add(batch);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
batches = temp.ToArray();
|
||||||
|
};
|
||||||
deleteTX.FlatStyle = FlatStyle.Flat;
|
deleteTX.FlatStyle = FlatStyle.Flat;
|
||||||
deleteTX.Font = new Font(deleteTX.Font.FontFamily, 9F, FontStyle.Bold);
|
deleteTX.Font = new Font(deleteTX.Font.FontFamily, 9F, FontStyle.Bold);
|
||||||
tx.Controls.Add(deleteTX);
|
tx.Controls.Add(deleteTX);
|
||||||
@ -318,10 +338,40 @@ namespace FireWallet
|
|||||||
AddLog("Batch Cancelled");
|
AddLog("Batch Cancelled");
|
||||||
this.Close();
|
this.Close();
|
||||||
}
|
}
|
||||||
|
HttpClient httpClient = new HttpClient();
|
||||||
private void buttonSend_Click(object sender, EventArgs e)
|
private async void buttonSend_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
MessageBox.Show("Send to do");
|
string batchTX = "[" +string.Join(", ", batches.Select(batch => batch.ToString())) + "]";
|
||||||
|
string content = "{\"method\": \"sendbatch\",\"params\":[ " + batchTX + "]}";
|
||||||
|
string responce = await APIPost("",true,content);
|
||||||
|
|
||||||
|
if (responce == "Error")
|
||||||
|
{
|
||||||
|
AddLog("Error sending batch");
|
||||||
|
NotifyForm notifyForm = new NotifyForm("Error sending batch");
|
||||||
|
notifyForm.ShowDialog();
|
||||||
|
notifyForm.Dispose();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
JObject jObject = JObject.Parse(responce);
|
||||||
|
if (jObject["error"].ToString() != "")
|
||||||
|
{
|
||||||
|
AddLog("Error: ");
|
||||||
|
AddLog(jObject["error"].ToString());
|
||||||
|
NotifyForm notifyForm = new NotifyForm("Error: \n" + jObject["error"].ToString());
|
||||||
|
notifyForm.ShowDialog();
|
||||||
|
notifyForm.Dispose();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
JObject result = JObject.Parse(jObject["result"].ToString());
|
||||||
|
string hash = result["hash"].ToString();
|
||||||
|
AddLog("Batch sent with hash: " + hash);
|
||||||
|
NotifyForm notifyForm2 = new NotifyForm("Batch sent\nThis might take a while to mine.", "Explorer", mainForm.userSettings["explorer-tx"]+hash);
|
||||||
|
notifyForm2.ShowDialog();
|
||||||
|
notifyForm2.Dispose();
|
||||||
|
this.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void BatchForm_FormClosing(object sender, FormClosingEventArgs e)
|
private void BatchForm_FormClosing(object sender, FormClosingEventArgs e)
|
||||||
@ -339,7 +389,7 @@ namespace FireWallet
|
|||||||
StreamWriter sw = new StreamWriter(saveFileDialog.FileName);
|
StreamWriter sw = new StreamWriter(saveFileDialog.FileName);
|
||||||
foreach (Batch b in batches)
|
foreach (Batch b in batches)
|
||||||
{
|
{
|
||||||
sw.WriteLine(b.domain + "," + b.operation + "," + b.bid + "," + b.lockup);
|
sw.WriteLine(b.domain + "," + b.method + "," + b.bid + "," + b.lockup);
|
||||||
}
|
}
|
||||||
sw.Dispose();
|
sw.Dispose();
|
||||||
}
|
}
|
||||||
@ -348,7 +398,7 @@ namespace FireWallet
|
|||||||
private void buttonImport_Click(object sender, EventArgs e)
|
private void buttonImport_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
OpenFileDialog openFileDialog = new OpenFileDialog();
|
OpenFileDialog openFileDialog = new OpenFileDialog();
|
||||||
openFileDialog.Filter = "CSV File|*.csv";
|
openFileDialog.Filter = "CSV File|*.csv|TXT File|*.txt";
|
||||||
openFileDialog.Title = "Open Batch";
|
openFileDialog.Title = "Open Batch";
|
||||||
if (openFileDialog.ShowDialog() == DialogResult.OK)
|
if (openFileDialog.ShowDialog() == DialogResult.OK)
|
||||||
{
|
{
|
||||||
@ -358,49 +408,118 @@ namespace FireWallet
|
|||||||
while ((line = sr.ReadLine()) != null)
|
while ((line = sr.ReadLine()) != null)
|
||||||
{
|
{
|
||||||
string[] split = line.Split(',');
|
string[] split = line.Split(',');
|
||||||
if (split.Length == 2)
|
try
|
||||||
{
|
{
|
||||||
AddBatch(split[0], split[1]);
|
if (split.Length == 2)
|
||||||
}
|
|
||||||
else if (split.Length == 4)
|
|
||||||
{
|
|
||||||
AddBatch(split[0], split[1], Convert.ToDecimal(split[2]), Convert.ToDecimal(split[3]));
|
|
||||||
}
|
|
||||||
else if (split.Length == 1)
|
|
||||||
{
|
|
||||||
// Select operation and import domains
|
|
||||||
string operation = "OPEN";
|
|
||||||
string[] newDomains = new string[domains.Length + 1];
|
|
||||||
for (int i = 0; i < domains.Length; i++)
|
|
||||||
{
|
{
|
||||||
newDomains[i] = domains[i];
|
AddBatch(split[0], split[1]);
|
||||||
|
}
|
||||||
|
else if (split.Length == 4)
|
||||||
|
{
|
||||||
|
AddBatch(split[0], split[1], Convert.ToDecimal(split[2]), Convert.ToDecimal(split[3]));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Select operation and import domains
|
||||||
|
string[] newDomains = new string[domains.Length + 1];
|
||||||
|
for (int i = 0; i < domains.Length; i++)
|
||||||
|
{
|
||||||
|
newDomains[i] = domains[i];
|
||||||
|
}
|
||||||
|
newDomains[domains.Length] = line.Trim();
|
||||||
|
domains = newDomains;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
AddLog("Error importing batch: " + ex.Message);
|
||||||
|
NotifyForm notifyForm = new NotifyForm("Error importing batch");
|
||||||
|
notifyForm.ShowDialog();
|
||||||
|
notifyForm.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (domains.Length > 0)
|
||||||
|
{
|
||||||
|
BatchImportForm batchImportForm = new BatchImportForm(domains);
|
||||||
|
batchImportForm.ShowDialog();
|
||||||
|
if (batchImportForm.batches != null)
|
||||||
|
{
|
||||||
|
foreach (Batch b in batchImportForm.batches)
|
||||||
|
{
|
||||||
|
AddBatch(b.domain, b.method, b.bid, b.lockup);
|
||||||
}
|
}
|
||||||
newDomains[domains.Length] = split[0].Trim();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sr.Dispose();
|
sr.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Post to HSD API
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="path">Path to post to</param>
|
||||||
|
/// <param name="wallet">Whether to use port 12039</param>
|
||||||
|
/// <param name="content">Content to post</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
private async Task<string> APIPost(string path, bool wallet, string content)
|
||||||
|
{
|
||||||
|
string key = mainForm.nodeSettings["Key"];
|
||||||
|
string ip = mainForm.nodeSettings["IP"];
|
||||||
|
string port = "1203";
|
||||||
|
if (mainForm.network == 1)
|
||||||
|
{
|
||||||
|
port = "1303";
|
||||||
|
}
|
||||||
|
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);
|
||||||
|
|
||||||
|
// Send request
|
||||||
|
HttpResponseMessage resp = await httpClient.SendAsync(req);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
resp.EnsureSuccessStatusCode();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
AddLog("Post Error: " + ex.Message);
|
||||||
|
return "Error";
|
||||||
|
}
|
||||||
|
|
||||||
|
return await resp.Content.ReadAsStringAsync();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public class Batch
|
public class Batch
|
||||||
{
|
{
|
||||||
public string domain { get; }
|
public string domain { get; }
|
||||||
public string operation { get; }
|
public string method { get; }
|
||||||
public decimal bid { get; }
|
public decimal bid { get; }
|
||||||
public decimal lockup { get; }
|
public decimal lockup { get; }
|
||||||
public Batch(string domain, string operation)
|
public Batch(string domain, string operation)
|
||||||
{
|
{
|
||||||
this.domain = domain;
|
this.domain = domain;
|
||||||
this.operation = operation;
|
this.method = operation;
|
||||||
bid = 0;
|
bid = 0;
|
||||||
lockup = 0;
|
lockup = 0;
|
||||||
}
|
}
|
||||||
public Batch(string domain, string operation, decimal bid, decimal lockup)
|
public Batch(string domain, string operation, decimal bid, decimal lockup)
|
||||||
{
|
{
|
||||||
this.domain = domain;
|
this.domain = domain;
|
||||||
this.operation = operation;
|
this.method = operation;
|
||||||
this.bid = bid;
|
this.bid = bid;
|
||||||
this.lockup = lockup;
|
this.lockup = lockup;
|
||||||
}
|
}
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
if (method == "BID")
|
||||||
|
{
|
||||||
|
return "[\"BID\", \"" + domain + "\", " + bid + ", " + lockup + "]";
|
||||||
|
}
|
||||||
|
return "[\"" + method + "\", \"" + domain + "\"]";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
181
FireWallet/BatchImportForm.Designer.cs
generated
Normal file
181
FireWallet/BatchImportForm.Designer.cs
generated
Normal file
@ -0,0 +1,181 @@
|
|||||||
|
namespace FireWallet
|
||||||
|
{
|
||||||
|
partial class BatchImportForm
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
listBoxDomains = new ListBox();
|
||||||
|
label1 = new Label();
|
||||||
|
comboBoxMode = new ComboBox();
|
||||||
|
label2 = new Label();
|
||||||
|
label3 = new Label();
|
||||||
|
label4 = new Label();
|
||||||
|
textBoxBid = new TextBox();
|
||||||
|
textBoxBlind = new TextBox();
|
||||||
|
buttonImport = new Button();
|
||||||
|
buttonCancel = new Button();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// listBoxDomains
|
||||||
|
//
|
||||||
|
listBoxDomains.FormattingEnabled = true;
|
||||||
|
listBoxDomains.ItemHeight = 15;
|
||||||
|
listBoxDomains.Location = new System.Drawing.Point(12, 42);
|
||||||
|
listBoxDomains.Name = "listBoxDomains";
|
||||||
|
listBoxDomains.Size = new System.Drawing.Size(241, 484);
|
||||||
|
listBoxDomains.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// label1
|
||||||
|
//
|
||||||
|
label1.AutoSize = true;
|
||||||
|
label1.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point);
|
||||||
|
label1.Location = new System.Drawing.Point(12, 9);
|
||||||
|
label1.Name = "label1";
|
||||||
|
label1.Size = new System.Drawing.Size(75, 21);
|
||||||
|
label1.TabIndex = 1;
|
||||||
|
label1.Text = "Domains:";
|
||||||
|
//
|
||||||
|
// comboBoxMode
|
||||||
|
//
|
||||||
|
comboBoxMode.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||||
|
comboBoxMode.FlatStyle = FlatStyle.Flat;
|
||||||
|
comboBoxMode.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point);
|
||||||
|
comboBoxMode.FormattingEnabled = true;
|
||||||
|
comboBoxMode.Items.AddRange(new object[] { "OPEN", "BID", "REVEAL", "REDEEM", "RENEW" });
|
||||||
|
comboBoxMode.Location = new System.Drawing.Point(346, 42);
|
||||||
|
comboBoxMode.Name = "comboBoxMode";
|
||||||
|
comboBoxMode.Size = new System.Drawing.Size(226, 29);
|
||||||
|
comboBoxMode.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// label2
|
||||||
|
//
|
||||||
|
label2.AutoSize = true;
|
||||||
|
label2.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point);
|
||||||
|
label2.Location = new System.Drawing.Point(287, 45);
|
||||||
|
label2.Name = "label2";
|
||||||
|
label2.Size = new System.Drawing.Size(53, 21);
|
||||||
|
label2.TabIndex = 3;
|
||||||
|
label2.Text = "Mode:";
|
||||||
|
//
|
||||||
|
// label3
|
||||||
|
//
|
||||||
|
label3.AutoSize = true;
|
||||||
|
label3.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point);
|
||||||
|
label3.Location = new System.Drawing.Point(305, 111);
|
||||||
|
label3.Name = "label3";
|
||||||
|
label3.Size = new System.Drawing.Size(35, 21);
|
||||||
|
label3.TabIndex = 3;
|
||||||
|
label3.Text = "Bid:";
|
||||||
|
//
|
||||||
|
// label4
|
||||||
|
//
|
||||||
|
label4.AutoSize = true;
|
||||||
|
label4.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point);
|
||||||
|
label4.Location = new System.Drawing.Point(292, 159);
|
||||||
|
label4.Name = "label4";
|
||||||
|
label4.Size = new System.Drawing.Size(48, 21);
|
||||||
|
label4.TabIndex = 3;
|
||||||
|
label4.Text = "Blind:";
|
||||||
|
//
|
||||||
|
// textBoxBid
|
||||||
|
//
|
||||||
|
textBoxBid.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point);
|
||||||
|
textBoxBid.Location = new System.Drawing.Point(346, 108);
|
||||||
|
textBoxBid.Name = "textBoxBid";
|
||||||
|
textBoxBid.Size = new System.Drawing.Size(226, 29);
|
||||||
|
textBoxBid.TabIndex = 4;
|
||||||
|
//
|
||||||
|
// textBoxBlind
|
||||||
|
//
|
||||||
|
textBoxBlind.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point);
|
||||||
|
textBoxBlind.Location = new System.Drawing.Point(346, 156);
|
||||||
|
textBoxBlind.Name = "textBoxBlind";
|
||||||
|
textBoxBlind.Size = new System.Drawing.Size(226, 29);
|
||||||
|
textBoxBlind.TabIndex = 5;
|
||||||
|
//
|
||||||
|
// buttonImport
|
||||||
|
//
|
||||||
|
buttonImport.FlatStyle = FlatStyle.Flat;
|
||||||
|
buttonImport.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point);
|
||||||
|
buttonImport.Location = new System.Drawing.Point(851, 485);
|
||||||
|
buttonImport.Name = "buttonImport";
|
||||||
|
buttonImport.Size = new System.Drawing.Size(87, 38);
|
||||||
|
buttonImport.TabIndex = 6;
|
||||||
|
buttonImport.Text = "Import";
|
||||||
|
buttonImport.UseVisualStyleBackColor = true;
|
||||||
|
buttonImport.Click += buttonImport_Click;
|
||||||
|
//
|
||||||
|
// buttonCancel
|
||||||
|
//
|
||||||
|
buttonCancel.FlatStyle = FlatStyle.Flat;
|
||||||
|
buttonCancel.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point);
|
||||||
|
buttonCancel.Location = new System.Drawing.Point(731, 485);
|
||||||
|
buttonCancel.Name = "buttonCancel";
|
||||||
|
buttonCancel.Size = new System.Drawing.Size(87, 38);
|
||||||
|
buttonCancel.TabIndex = 6;
|
||||||
|
buttonCancel.Text = "Cancel";
|
||||||
|
buttonCancel.UseVisualStyleBackColor = true;
|
||||||
|
buttonCancel.Click += buttonCancel_Click;
|
||||||
|
//
|
||||||
|
// BatchImportForm
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new System.Drawing.Size(950, 535);
|
||||||
|
Controls.Add(buttonCancel);
|
||||||
|
Controls.Add(buttonImport);
|
||||||
|
Controls.Add(textBoxBlind);
|
||||||
|
Controls.Add(textBoxBid);
|
||||||
|
Controls.Add(label4);
|
||||||
|
Controls.Add(label3);
|
||||||
|
Controls.Add(label2);
|
||||||
|
Controls.Add(comboBoxMode);
|
||||||
|
Controls.Add(label1);
|
||||||
|
Controls.Add(listBoxDomains);
|
||||||
|
FormBorderStyle = FormBorderStyle.Fixed3D;
|
||||||
|
MaximizeBox = false;
|
||||||
|
Name = "BatchImportForm";
|
||||||
|
Text = "Import";
|
||||||
|
Load += BatchImportForm_Load;
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private ListBox listBoxDomains;
|
||||||
|
private Label label1;
|
||||||
|
private ComboBox comboBoxMode;
|
||||||
|
private Label label2;
|
||||||
|
private Label label3;
|
||||||
|
private Label label4;
|
||||||
|
private TextBox textBoxBid;
|
||||||
|
private TextBox textBoxBlind;
|
||||||
|
private Button buttonImport;
|
||||||
|
private Button buttonCancel;
|
||||||
|
}
|
||||||
|
}
|
289
FireWallet/BatchImportForm.cs
Normal file
289
FireWallet/BatchImportForm.cs
Normal file
@ -0,0 +1,289 @@
|
|||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace FireWallet
|
||||||
|
{
|
||||||
|
public partial class BatchImportForm : Form
|
||||||
|
{
|
||||||
|
string dir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\FireWallet\\";
|
||||||
|
Dictionary<string, string> theme;
|
||||||
|
string[] domains;
|
||||||
|
public Batch[] batches { get; set; }
|
||||||
|
|
||||||
|
public BatchImportForm(string[] domains)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
this.domains = domains;
|
||||||
|
comboBoxMode.SelectedIndex = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void BatchImportForm_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
UpdateTheme();
|
||||||
|
foreach (string domain in domains)
|
||||||
|
{
|
||||||
|
listBoxDomains.Items.Add(domain);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#region Logging
|
||||||
|
public void AddLog(string message)
|
||||||
|
{
|
||||||
|
StreamWriter sw = new StreamWriter(dir + "log.txt", true);
|
||||||
|
sw.WriteLine(DateTime.Now.ToString() + ": " + message);
|
||||||
|
sw.Dispose();
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
#region Theming
|
||||||
|
private void UpdateTheme()
|
||||||
|
{
|
||||||
|
// Check if file exists
|
||||||
|
if (!Directory.Exists(dir))
|
||||||
|
{
|
||||||
|
CreateConfig(dir);
|
||||||
|
}
|
||||||
|
if (!File.Exists(dir + "theme.txt"))
|
||||||
|
{
|
||||||
|
CreateConfig(dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Read file
|
||||||
|
StreamReader sr = new StreamReader(dir + "theme.txt");
|
||||||
|
theme = new Dictionary<string, string>();
|
||||||
|
while (!sr.EndOfStream)
|
||||||
|
{
|
||||||
|
string line = sr.ReadLine();
|
||||||
|
string[] split = line.Split(':');
|
||||||
|
theme.Add(split[0].Trim(), split[1].Trim());
|
||||||
|
}
|
||||||
|
sr.Dispose();
|
||||||
|
|
||||||
|
if (!theme.ContainsKey("background") || !theme.ContainsKey("background-alt") || !theme.ContainsKey("foreground") || !theme.ContainsKey("foreground-alt"))
|
||||||
|
{
|
||||||
|
AddLog("Theme file is missing key");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Apply theme
|
||||||
|
this.BackColor = ColorTranslator.FromHtml(theme["background"]);
|
||||||
|
|
||||||
|
// Foreground
|
||||||
|
this.ForeColor = ColorTranslator.FromHtml(theme["foreground"]);
|
||||||
|
|
||||||
|
|
||||||
|
// Need to specify this for each groupbox to override the black text
|
||||||
|
foreach (Control c in Controls)
|
||||||
|
{
|
||||||
|
ThemeControl(c);
|
||||||
|
}
|
||||||
|
applyTransparency(theme);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
private void ThemeControl(Control c)
|
||||||
|
{
|
||||||
|
if (c.GetType() == typeof(GroupBox) || c.GetType() == typeof(Panel))
|
||||||
|
{
|
||||||
|
c.ForeColor = ColorTranslator.FromHtml(theme["foreground"]);
|
||||||
|
foreach (Control sub in c.Controls)
|
||||||
|
{
|
||||||
|
ThemeControl(sub);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (c.GetType() == typeof(TextBox) || c.GetType() == typeof(Button)
|
||||||
|
|| c.GetType() == typeof(ComboBox) || c.GetType() == typeof(StatusStrip) || c.GetType() == typeof(ToolStrip) ||
|
||||||
|
c.GetType() == typeof(ListBox))
|
||||||
|
{
|
||||||
|
c.ForeColor = ColorTranslator.FromHtml(theme["foreground-alt"]);
|
||||||
|
c.BackColor = ColorTranslator.FromHtml(theme["background-alt"]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void applyTransparency(Dictionary<string, string> theme)
|
||||||
|
{
|
||||||
|
if (theme.ContainsKey("transparent-mode"))
|
||||||
|
{
|
||||||
|
switch (theme["transparent-mode"])
|
||||||
|
{
|
||||||
|
case "mica":
|
||||||
|
var accent = new AccentPolicy { AccentState = AccentState.ACCENT_ENABLE_BLURBEHIND };
|
||||||
|
var accentStructSize = Marshal.SizeOf(accent);
|
||||||
|
var accentPtr = Marshal.AllocHGlobal(accentStructSize);
|
||||||
|
Marshal.StructureToPtr(accent, accentPtr, false);
|
||||||
|
var data = new WindowCompositionAttributeData
|
||||||
|
{
|
||||||
|
Attribute = WindowCompositionAttribute.WCA_ACCENT_POLICY,
|
||||||
|
SizeOfData = accentStructSize,
|
||||||
|
Data = accentPtr
|
||||||
|
};
|
||||||
|
User32.SetWindowCompositionAttribute(Handle, ref data);
|
||||||
|
Marshal.FreeHGlobal(accentPtr);
|
||||||
|
break;
|
||||||
|
case "key":
|
||||||
|
if (theme.ContainsKey("transparency-key"))
|
||||||
|
{
|
||||||
|
switch (theme["transparency-key"])
|
||||||
|
{
|
||||||
|
case "alt":
|
||||||
|
this.TransparencyKey = ColorTranslator.FromHtml(theme["background-alt"]);
|
||||||
|
break;
|
||||||
|
case "main":
|
||||||
|
this.TransparencyKey = ColorTranslator.FromHtml(theme["background"]);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
this.TransparencyKey = ColorTranslator.FromHtml(theme["transparency-key"]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AddLog("No transparency-key found in theme file");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "percent":
|
||||||
|
if (theme.ContainsKey("transparency-percent"))
|
||||||
|
{
|
||||||
|
Opacity = Convert.ToDouble(theme["transparency-percent"]) / 100;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AddLog("No transparency-percent found in theme file");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CreateConfig(string dir)
|
||||||
|
{
|
||||||
|
if (!Directory.Exists(dir))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(dir);
|
||||||
|
}
|
||||||
|
StreamWriter sw = new StreamWriter(dir + "theme.txt");
|
||||||
|
sw.WriteLine("background: #000000");
|
||||||
|
sw.WriteLine("foreground: #8e05c2");
|
||||||
|
sw.WriteLine("background-alt: #3e065f");
|
||||||
|
sw.WriteLine("foreground-alt: #ffffff");
|
||||||
|
sw.WriteLine("transparent-mode: off");
|
||||||
|
sw.WriteLine("transparency-key: main");
|
||||||
|
sw.WriteLine("transparency-percent: 90");
|
||||||
|
sw.WriteLine("selected-bg: #000000");
|
||||||
|
sw.WriteLine("selected-fg: #ffffff");
|
||||||
|
sw.WriteLine("error: #ff0000");
|
||||||
|
|
||||||
|
sw.Dispose();
|
||||||
|
AddLog("Created theme file");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Required for mica effect
|
||||||
|
internal enum AccentState
|
||||||
|
{
|
||||||
|
ACCENT_DISABLED = 0,
|
||||||
|
ACCENT_ENABLE_GRADIENT = 1,
|
||||||
|
ACCENT_ENABLE_TRANSPARENTGRADIENT = 2,
|
||||||
|
ACCENT_ENABLE_BLURBEHIND = 3,
|
||||||
|
ACCENT_INVALID_STATE = 4
|
||||||
|
}
|
||||||
|
|
||||||
|
internal enum WindowCompositionAttribute
|
||||||
|
{
|
||||||
|
WCA_ACCENT_POLICY = 19
|
||||||
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
internal struct AccentPolicy
|
||||||
|
{
|
||||||
|
public AccentState AccentState;
|
||||||
|
public int AccentFlags;
|
||||||
|
public int GradientColor;
|
||||||
|
public int AnimationId;
|
||||||
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
internal struct WindowCompositionAttributeData
|
||||||
|
{
|
||||||
|
public WindowCompositionAttribute Attribute;
|
||||||
|
public IntPtr Data;
|
||||||
|
public int SizeOfData;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static class User32
|
||||||
|
{
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
internal static extern int SetWindowCompositionAttribute(IntPtr hwnd, ref WindowCompositionAttributeData data);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private void buttonCancel_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
this.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonImport_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (comboBoxMode.Text == "BID")
|
||||||
|
{
|
||||||
|
batches = new Batch[0];
|
||||||
|
foreach (string domain in listBoxDomains.Items)
|
||||||
|
{
|
||||||
|
if (domain != "")
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
decimal bid = Convert.ToDecimal(textBoxBid.Text);
|
||||||
|
decimal lockup = Convert.ToDecimal(textBoxBlind.Text) + bid;
|
||||||
|
|
||||||
|
Batch[] newBatch = new Batch[batches.Length + 1];
|
||||||
|
Array.Copy(batches, newBatch, batches.Length);
|
||||||
|
newBatch[newBatch.Length - 1] = new Batch(domain, "BID", bid , lockup);
|
||||||
|
batches = newBatch;
|
||||||
|
} catch (Exception ex)
|
||||||
|
{
|
||||||
|
NotifyForm notify = new NotifyForm("Import error: \n" + ex.Message);
|
||||||
|
notify.ShowDialog();
|
||||||
|
notify.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.Close();
|
||||||
|
} else if (comboBoxMode.Text == "OPEN" || comboBoxMode.Text == "REVEAL" || comboBoxMode.Text == "REDEEM" || comboBoxMode.Text == "RENEW")
|
||||||
|
{
|
||||||
|
batches = new Batch[0];
|
||||||
|
foreach (string domain in listBoxDomains.Items)
|
||||||
|
{
|
||||||
|
if (domain != "")
|
||||||
|
{
|
||||||
|
Batch[] newBatch = new Batch[batches.Length + 1];
|
||||||
|
Array.Copy(batches, newBatch, batches.Length);
|
||||||
|
newBatch[newBatch.Length - 1] = new Batch(domain, comboBoxMode.Text);
|
||||||
|
batches = newBatch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.Close();
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
MessageBox.Show("Please select a mode");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public class Batch
|
||||||
|
{
|
||||||
|
public string domain { get; }
|
||||||
|
public string operation { get; }
|
||||||
|
public decimal bid { get; }
|
||||||
|
public decimal lockup { get; }
|
||||||
|
public Batch(string domain, string operation)
|
||||||
|
{
|
||||||
|
this.domain = domain;
|
||||||
|
this.operation = operation;
|
||||||
|
bid = 0;
|
||||||
|
lockup = 0;
|
||||||
|
}
|
||||||
|
public Batch(string domain, string operation, decimal bid, decimal lockup)
|
||||||
|
{
|
||||||
|
this.domain = domain;
|
||||||
|
this.operation = operation;
|
||||||
|
this.bid = bid;
|
||||||
|
this.lockup = lockup;
|
||||||
|
}
|
||||||
|
}
|
120
FireWallet/BatchImportForm.resx
Normal file
120
FireWallet/BatchImportForm.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing"">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
@ -1,18 +1,6 @@
|
|||||||
using System;
|
using System.Diagnostics;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Net.Http;
|
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
using BitMiracle.LibTiff.Classic;
|
|
||||||
using Microsoft.VisualBasic.Devices;
|
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
|
|
||||||
namespace FireWallet
|
namespace FireWallet
|
||||||
|
16
FireWallet/MainForm.Designer.cs
generated
16
FireWallet/MainForm.Designer.cs
generated
@ -84,6 +84,7 @@ namespace FireWallet
|
|||||||
panelDomains = new Panel();
|
panelDomains = new Panel();
|
||||||
labelDomainSearch = new Label();
|
labelDomainSearch = new Label();
|
||||||
textBoxDomainSearch = new TextBox();
|
textBoxDomainSearch = new TextBox();
|
||||||
|
buttonBatch = new Button();
|
||||||
statusStripmain.SuspendLayout();
|
statusStripmain.SuspendLayout();
|
||||||
panelaccount.SuspendLayout();
|
panelaccount.SuspendLayout();
|
||||||
groupBoxaccount.SuspendLayout();
|
groupBoxaccount.SuspendLayout();
|
||||||
@ -247,6 +248,7 @@ namespace FireWallet
|
|||||||
//
|
//
|
||||||
// panelNav
|
// panelNav
|
||||||
//
|
//
|
||||||
|
panelNav.Controls.Add(buttonBatch);
|
||||||
panelNav.Controls.Add(buttonNavDomains);
|
panelNav.Controls.Add(buttonNavDomains);
|
||||||
panelNav.Controls.Add(buttonNavReceive);
|
panelNav.Controls.Add(buttonNavReceive);
|
||||||
panelNav.Controls.Add(buttonNavSend);
|
panelNav.Controls.Add(buttonNavSend);
|
||||||
@ -630,6 +632,19 @@ namespace FireWallet
|
|||||||
textBoxDomainSearch.TabIndex = 0;
|
textBoxDomainSearch.TabIndex = 0;
|
||||||
textBoxDomainSearch.KeyDown += textBoxDomainSearch_KeyDown;
|
textBoxDomainSearch.KeyDown += textBoxDomainSearch_KeyDown;
|
||||||
//
|
//
|
||||||
|
// buttonBatch
|
||||||
|
//
|
||||||
|
buttonBatch.FlatStyle = FlatStyle.Flat;
|
||||||
|
buttonBatch.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point);
|
||||||
|
buttonBatch.Location = new Point(12, 245);
|
||||||
|
buttonBatch.Name = "buttonBatch";
|
||||||
|
buttonBatch.Size = new Size(89, 30);
|
||||||
|
buttonBatch.TabIndex = 3;
|
||||||
|
buttonBatch.TabStop = false;
|
||||||
|
buttonBatch.Text = "Batch";
|
||||||
|
buttonBatch.UseVisualStyleBackColor = true;
|
||||||
|
buttonBatch.Click += buttonBatch_Click;
|
||||||
|
//
|
||||||
// MainForm
|
// MainForm
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
@ -721,5 +736,6 @@ namespace FireWallet
|
|||||||
private Panel panelDomains;
|
private Panel panelDomains;
|
||||||
private Label labelDomainSearch;
|
private Label labelDomainSearch;
|
||||||
private TextBox textBoxDomainSearch;
|
private TextBox textBoxDomainSearch;
|
||||||
|
private Button buttonBatch;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,16 +1,9 @@
|
|||||||
using System;
|
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
|
||||||
using System.Net;
|
|
||||||
using System.Net.Http;
|
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Security.Policy;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using Point = System.Drawing.Point;
|
using Point = System.Drawing.Point;
|
||||||
using Size = System.Drawing.Size;
|
using Size = System.Drawing.Size;
|
||||||
using IronBarCode;
|
using IronBarCode;
|
||||||
using static System.Windows.Forms.DataFormats;
|
|
||||||
|
|
||||||
namespace FireWallet
|
namespace FireWallet
|
||||||
{
|
{
|
||||||
@ -21,7 +14,7 @@ namespace FireWallet
|
|||||||
public Dictionary<string, string> nodeSettings { get; set; }
|
public Dictionary<string, string> nodeSettings { get; set; }
|
||||||
public Dictionary<string, string> userSettings { get; set; }
|
public Dictionary<string, string> userSettings { get; set; }
|
||||||
public Dictionary<string, string> theme { get; set; }
|
public Dictionary<string, string> theme { get; set; }
|
||||||
public int Network { get; set; }
|
public int network { get; set; }
|
||||||
public string account { get; set; }
|
public string account { get; set; }
|
||||||
public string password { get; set; }
|
public string password { get; set; }
|
||||||
public decimal balance { get; set; }
|
public decimal balance { get; set; }
|
||||||
@ -105,8 +98,8 @@ namespace FireWallet
|
|||||||
this.Close();
|
this.Close();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Network = Convert.ToInt32(nodeSettings["Network"]);
|
network = Convert.ToInt32(nodeSettings["Network"]);
|
||||||
switch (Network)
|
switch (network)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
toolStripStatusLabelNetwork.Text = "Network: Mainnet";
|
toolStripStatusLabelNetwork.Text = "Network: Mainnet";
|
||||||
@ -509,7 +502,7 @@ namespace FireWallet
|
|||||||
string key = nodeSettings["Key"];
|
string key = nodeSettings["Key"];
|
||||||
string ip = nodeSettings["IP"];
|
string ip = nodeSettings["IP"];
|
||||||
string port = "1203";
|
string port = "1203";
|
||||||
if (Network == 1)
|
if (network == 1)
|
||||||
{
|
{
|
||||||
port = "1303";
|
port = "1303";
|
||||||
}
|
}
|
||||||
@ -547,7 +540,7 @@ namespace FireWallet
|
|||||||
string ip = nodeSettings["IP"];
|
string ip = nodeSettings["IP"];
|
||||||
|
|
||||||
string port = "1203";
|
string port = "1203";
|
||||||
if (Network == 1)
|
if (network == 1)
|
||||||
{
|
{
|
||||||
port = "1303";
|
port = "1303";
|
||||||
}
|
}
|
||||||
@ -624,10 +617,10 @@ namespace FireWallet
|
|||||||
Control[] tmpControls = new Control[txCount];
|
Control[] tmpControls = new Control[txCount];
|
||||||
for (int i = 0; i < txCount; i++)
|
for (int i = 0; i < txCount; i++)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Get last tx
|
// Get last tx
|
||||||
JObject tx = JObject.Parse(txs[txs.Count - 1 - i].ToString());
|
JObject tx = JObject.Parse(txs[txs.Count - 1 - i].ToString());
|
||||||
|
|
||||||
string hash = tx["hash"].ToString();
|
string hash = tx["hash"].ToString();
|
||||||
string date = tx["mdate"].ToString();
|
string date = tx["mdate"].ToString();
|
||||||
|
|
||||||
@ -1035,7 +1028,7 @@ namespace FireWallet
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region Batching
|
#region Batching
|
||||||
public void AddBatch(string domain, string operation)
|
public void AddBatch(string domain, string operation)
|
||||||
{
|
{
|
||||||
@ -1067,5 +1060,16 @@ namespace FireWallet
|
|||||||
batchForm.Dispose();
|
batchForm.Dispose();
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
private void buttonBatch_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (!batchMode)
|
||||||
|
{
|
||||||
|
batchForm = new BatchForm(this);
|
||||||
|
batchForm.Show();
|
||||||
|
batchMode = true;
|
||||||
|
}
|
||||||
|
else batchForm.Focus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user