mirror of
https://github.com/Nathanwoodburn/FireWallet.git
synced 2024-11-24 08:08:14 +11:00
main: Move log if it is getting big
This commit is contained in:
parent
d4620af384
commit
7c38bfc755
@ -308,6 +308,18 @@ namespace FireWallet
|
|||||||
public void AddLog(string message)
|
public void AddLog(string message)
|
||||||
{
|
{
|
||||||
if (message.Contains("Get Error: No connection could be made because the target machine actively refused it")) return;
|
if (message.Contains("Get Error: No connection could be made because the target machine actively refused it")) return;
|
||||||
|
|
||||||
|
// If file size is over 1MB, rename it to old.log.txt
|
||||||
|
if (File.Exists(dir + "log.txt"))
|
||||||
|
{
|
||||||
|
FileInfo fi = new FileInfo(dir + "log.txt");
|
||||||
|
if (fi.Length > 1000000)
|
||||||
|
{
|
||||||
|
if (File.Exists(dir + "old.log.txt")) File.Delete(dir + "old.log.txt"); // Delete old log file as it is super old
|
||||||
|
File.Move(dir + "log.txt", dir + "old.log.txt");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
StreamWriter sw = new StreamWriter(dir + "log.txt", true);
|
StreamWriter sw = new StreamWriter(dir + "log.txt", true);
|
||||||
sw.WriteLine(DateTime.Now.ToString() + ": " + message);
|
sw.WriteLine(DateTime.Now.ToString() + ": " + message);
|
||||||
sw.Dispose();
|
sw.Dispose();
|
||||||
@ -912,10 +924,7 @@ namespace FireWallet
|
|||||||
}
|
}
|
||||||
|
|
||||||
JArray txs = JArray.Parse(TXGET["result"].ToString());
|
JArray txs = JArray.Parse(TXGET["result"].ToString());
|
||||||
if (toGet > txs.Count)
|
if (toGet > txs.Count) toGet = txs.Count; // In case there are less TXs than expected (usually happens when the get TX's fails)
|
||||||
{
|
|
||||||
toGet = txs.Count;
|
|
||||||
}
|
|
||||||
Control[] tmpControls = new Control[toGet];
|
Control[] tmpControls = new Control[toGet];
|
||||||
for (int i = 0; i < toGet; i++)
|
for (int i = 0; i < toGet; i++)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user