mirror of
https://github.com/Nathanwoodburn/FireWallet.git
synced 2024-11-10 09:18:15 +11:00
main: Added bug fixes for new installs
This commit is contained in:
parent
92bef9ef5d
commit
7388710704
3
FireWallet/MainForm.Designer.cs
generated
3
FireWallet/MainForm.Designer.cs
generated
@ -964,16 +964,17 @@ namespace FireWallet
|
|||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(1152, 575);
|
ClientSize = new Size(1152, 575);
|
||||||
|
Controls.Add(panelaccount);
|
||||||
Controls.Add(panelRecieve);
|
Controls.Add(panelRecieve);
|
||||||
Controls.Add(panelSettings);
|
Controls.Add(panelSettings);
|
||||||
Controls.Add(panelDomains);
|
Controls.Add(panelDomains);
|
||||||
Controls.Add(panelSend);
|
Controls.Add(panelSend);
|
||||||
Controls.Add(panelPortfolio);
|
Controls.Add(panelPortfolio);
|
||||||
Controls.Add(panelNav);
|
Controls.Add(panelNav);
|
||||||
Controls.Add(panelaccount);
|
|
||||||
Controls.Add(statusStripmain);
|
Controls.Add(statusStripmain);
|
||||||
Icon = (Icon)resources.GetObject("$this.Icon");
|
Icon = (Icon)resources.GetObject("$this.Icon");
|
||||||
Name = "MainForm";
|
Name = "MainForm";
|
||||||
|
Opacity = 0D;
|
||||||
Text = "FireWallet";
|
Text = "FireWallet";
|
||||||
FormClosing += MainForm_Closing;
|
FormClosing += MainForm_Closing;
|
||||||
Load += MainForm_Load;
|
Load += MainForm_Load;
|
||||||
|
@ -39,15 +39,16 @@ namespace FireWallet
|
|||||||
public MainForm()
|
public MainForm()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
panelaccount.Visible = true;
|
||||||
}
|
}
|
||||||
private void MainForm_Load(object sender, EventArgs e)
|
private async void MainForm_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
watchOnly = false;
|
watchOnly = false;
|
||||||
account = "";
|
account = "";
|
||||||
timerNodeStatus.Stop();
|
timerNodeStatus.Stop();
|
||||||
LoadSettings();
|
LoadSettings();
|
||||||
UpdateTheme();
|
UpdateTheme();
|
||||||
LoadNode();
|
if (await LoadNode() != true) this.Close();
|
||||||
|
|
||||||
if (userSettings.ContainsKey("hide-splash"))
|
if (userSettings.ContainsKey("hide-splash"))
|
||||||
{
|
{
|
||||||
@ -59,6 +60,13 @@ namespace FireWallet
|
|||||||
ss.Dispose();
|
ss.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Show splash screen
|
||||||
|
SplashScreen ss = new SplashScreen();
|
||||||
|
ss.ShowDialog();
|
||||||
|
ss.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -79,16 +87,16 @@ namespace FireWallet
|
|||||||
GetAccounts();
|
GetAccounts();
|
||||||
|
|
||||||
AddLog("Loaded");
|
AddLog("Loaded");
|
||||||
|
Opacity = 1;
|
||||||
batchMode = false;
|
batchMode = false;
|
||||||
textBoxaccountpassword.Focus();
|
textBoxaccountpassword.Focus();
|
||||||
timerNodeStatus.Start();
|
|
||||||
}
|
}
|
||||||
private void MainForm_Closing(object sender, FormClosingEventArgs e)
|
private void MainForm_Closing(object sender, FormClosingEventArgs e)
|
||||||
{
|
{
|
||||||
AddLog("Closing");
|
AddLog("Closing");
|
||||||
if (hsdProcess != null)
|
if (hsdProcess != null)
|
||||||
{
|
{
|
||||||
this.Hide();
|
this.Opacity = 0;
|
||||||
hsdProcess.Kill();
|
hsdProcess.Kill();
|
||||||
AddLog("HSD Closed");
|
AddLog("HSD Closed");
|
||||||
Thread.Sleep(1000);
|
Thread.Sleep(1000);
|
||||||
@ -109,7 +117,7 @@ namespace FireWallet
|
|||||||
|
|
||||||
|
|
||||||
#region Settings
|
#region Settings
|
||||||
private async void LoadNode()
|
private async Task<bool> LoadNode()
|
||||||
{
|
{
|
||||||
HSD = false;
|
HSD = false;
|
||||||
if (!File.Exists(dir + "node.txt"))
|
if (!File.Exists(dir + "node.txt"))
|
||||||
@ -123,7 +131,8 @@ namespace FireWallet
|
|||||||
{
|
{
|
||||||
AddLog("Node setup failed");
|
AddLog("Node setup failed");
|
||||||
this.Close();
|
this.Close();
|
||||||
return;
|
await Task.Delay(1000);
|
||||||
|
AddLog("Close Failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
StreamReader sr = new StreamReader(dir + "node.txt");
|
StreamReader sr = new StreamReader(dir + "node.txt");
|
||||||
@ -141,7 +150,8 @@ namespace FireWallet
|
|||||||
{
|
{
|
||||||
AddLog("Node Settings file is missing key");
|
AddLog("Node Settings file is missing key");
|
||||||
this.Close();
|
this.Close();
|
||||||
return;
|
await Task.Delay(1000);
|
||||||
|
AddLog("Close Failed");
|
||||||
}
|
}
|
||||||
network = Convert.ToInt32(nodeSettings["Network"]);
|
network = Convert.ToInt32(nodeSettings["Network"]);
|
||||||
switch (network)
|
switch (network)
|
||||||
@ -181,14 +191,24 @@ namespace FireWallet
|
|||||||
}
|
}
|
||||||
hsdProcess = new Process();
|
hsdProcess = new Process();
|
||||||
|
|
||||||
hsdProcess.StartInfo.CreateNoWindow = true;
|
bool hideScreen = true;
|
||||||
|
if (nodeSettings.ContainsKey("HideScreen"))
|
||||||
|
{
|
||||||
|
if (nodeSettings["HideScreen"].ToLower() == "false")
|
||||||
|
{
|
||||||
|
hideScreen = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
hsdProcess.StartInfo.CreateNoWindow = hideScreen;
|
||||||
|
|
||||||
hsdProcess.StartInfo.RedirectStandardInput = true;
|
hsdProcess.StartInfo.RedirectStandardInput = true;
|
||||||
hsdProcess.StartInfo.RedirectStandardOutput = false;
|
hsdProcess.StartInfo.RedirectStandardOutput = false;
|
||||||
hsdProcess.StartInfo.UseShellExecute = false;
|
hsdProcess.StartInfo.UseShellExecute = false;
|
||||||
hsdProcess.StartInfo.RedirectStandardError = false;
|
hsdProcess.StartInfo.RedirectStandardError = false;
|
||||||
hsdProcess.StartInfo.FileName = "node.exe";
|
hsdProcess.StartInfo.FileName = "node.exe";
|
||||||
hsdProcess.StartInfo.Arguments = dir + "hsd/bin/hsd --index-tx --index-address --api-key" + nodeSettings["Key"];
|
hsdProcess.StartInfo.Arguments = dir + "hsd/bin/hsd --index-tx --index-address --api-key " + nodeSettings["Key"];
|
||||||
|
|
||||||
string bobPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Bob\\hsd_data";
|
string bobPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Bob\\hsd_data";
|
||||||
if (Directory.Exists(bobPath))
|
if (Directory.Exists(bobPath))
|
||||||
@ -196,18 +216,27 @@ namespace FireWallet
|
|||||||
hsdProcess.StartInfo.Arguments = hsdProcess.StartInfo.Arguments + " --prefix " + bobPath;
|
hsdProcess.StartInfo.Arguments = hsdProcess.StartInfo.Arguments + " --prefix " + bobPath;
|
||||||
}
|
}
|
||||||
hsdProcess.Start();
|
hsdProcess.Start();
|
||||||
|
// Wait for HSD to start
|
||||||
|
await Task.Delay(2000);
|
||||||
|
} catch (Exception ex)
|
||||||
|
{
|
||||||
|
AddLog("HSD Failed to start");
|
||||||
|
AddLog(ex.Message);
|
||||||
|
this.Close();
|
||||||
|
await Task.Delay(1000);
|
||||||
|
AddLog("Close Failed");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
timerNodeStatus.Start();
|
||||||
NodeStatus();
|
NodeStatus();
|
||||||
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
private void LoadSettings()
|
private void LoadSettings()
|
||||||
{
|
{
|
||||||
|
if (!Directory.Exists(dir)) Directory.CreateDirectory(dir);
|
||||||
if (!File.Exists(dir + "settings.txt"))
|
if (!File.Exists(dir + "settings.txt"))
|
||||||
{
|
{
|
||||||
AddLog("Creating settings file");
|
AddLog("Creating settings file");
|
||||||
@ -454,6 +483,8 @@ namespace FireWallet
|
|||||||
GetAccounts();
|
GetAccounts();
|
||||||
}
|
}
|
||||||
private async void GetAccounts()
|
private async void GetAccounts()
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
string APIresponse = await APIGet("wallet", true);
|
string APIresponse = await APIGet("wallet", true);
|
||||||
comboBoxaccount.Items.Clear();
|
comboBoxaccount.Items.Clear();
|
||||||
@ -481,6 +512,11 @@ namespace FireWallet
|
|||||||
comboBoxaccount.Enabled = false;
|
comboBoxaccount.Enabled = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
AddLog("Error getting accounts");
|
||||||
|
}
|
||||||
|
}
|
||||||
private async Task<bool> Login()
|
private async Task<bool> Login()
|
||||||
{
|
{
|
||||||
string path = "wallet/" + account + "/unlock";
|
string path = "wallet/" + account + "/unlock";
|
||||||
@ -676,6 +712,8 @@ namespace FireWallet
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<string> APIGet(string path, bool wallet)
|
public async Task<string> APIGet(string path, bool wallet)
|
||||||
{
|
{
|
||||||
|
if (nodeSettings == null) return "Error";
|
||||||
|
if (!nodeSettings.ContainsKey("Key") || !nodeSettings.ContainsKey("IP")) return "Error";
|
||||||
string key = nodeSettings["Key"];
|
string key = nodeSettings["Key"];
|
||||||
string ip = nodeSettings["IP"];
|
string ip = nodeSettings["IP"];
|
||||||
|
|
||||||
@ -1234,12 +1272,21 @@ namespace FireWallet
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
bool hideScreen = true;
|
||||||
|
if (nodeSettings.ContainsKey("HideScreen"))
|
||||||
|
{
|
||||||
|
if (nodeSettings["HideScreen"].ToLower() == "false")
|
||||||
|
{
|
||||||
|
hideScreen = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ProcessStartInfo startInfo = new ProcessStartInfo();
|
ProcessStartInfo startInfo = new ProcessStartInfo();
|
||||||
startInfo.FileName = "git";
|
startInfo.FileName = "git";
|
||||||
startInfo.Arguments = $"clone {repositoryUrl} {destinationPath}";
|
startInfo.Arguments = $"clone {repositoryUrl} {destinationPath}";
|
||||||
startInfo.RedirectStandardOutput = true;
|
startInfo.RedirectStandardOutput = true;
|
||||||
startInfo.UseShellExecute = false;
|
startInfo.UseShellExecute = false;
|
||||||
startInfo.CreateNoWindow = true;
|
startInfo.CreateNoWindow = hideScreen;
|
||||||
|
|
||||||
Process process = new Process();
|
Process process = new Process();
|
||||||
process.StartInfo = startInfo;
|
process.StartInfo = startInfo;
|
||||||
@ -1257,7 +1304,7 @@ namespace FireWallet
|
|||||||
FileName = "cmd",
|
FileName = "cmd",
|
||||||
RedirectStandardInput = true,
|
RedirectStandardInput = true,
|
||||||
WorkingDirectory = destinationPath,
|
WorkingDirectory = destinationPath,
|
||||||
CreateNoWindow = true
|
CreateNoWindow = hideScreen
|
||||||
};
|
};
|
||||||
var pNpmRunDist = Process.Start(psiNpmRunDist);
|
var pNpmRunDist = Process.Start(psiNpmRunDist);
|
||||||
pNpmRunDist.StandardInput.WriteLine("npm install & exit");
|
pNpmRunDist.StandardInput.WriteLine("npm install & exit");
|
||||||
|
@ -27,10 +27,7 @@ namespace FireWallet
|
|||||||
|
|
||||||
private void SplashScreen_FormClosing(object sender, FormClosingEventArgs e)
|
private void SplashScreen_FormClosing(object sender, FormClosingEventArgs e)
|
||||||
{
|
{
|
||||||
if (!close)
|
|
||||||
{
|
|
||||||
e.Cancel = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void label2_Click(object sender, EventArgs e)
|
private void label2_Click(object sender, EventArgs e)
|
||||||
|
Loading…
Reference in New Issue
Block a user