Added memory usage to output
Add separate counts for Errors, Warnings and Information
This commit is contained in:
parent
07fd6f3a4e
commit
508a86a8ac
@ -52,7 +52,8 @@ namespace DataLoader
|
|||||||
if (System.IO.File.Exists(fname))
|
if (System.IO.File.Exists(fname))
|
||||||
{
|
{
|
||||||
FileInfo myFile = new FileInfo(fname);
|
FileInfo myFile = new FileInfo(fname);
|
||||||
frmMain.AddInfo("Processing {0}", fname);
|
GC.Collect();
|
||||||
|
frmMain.AddInfo("Processing {0} {1}", fname, GC.GetTotalMemory(true));
|
||||||
//string tmpName = @"C:\Temp\DataLoader\" + myFile.Name.Replace(".", "_") + ".RTF";
|
//string tmpName = @"C:\Temp\DataLoader\" + myFile.Name.Replace(".", "_") + ".RTF";
|
||||||
string tmpName = Path.GetTempFileName();
|
string tmpName = Path.GetTempFileName();
|
||||||
string temppath = Path.GetTempFileName();
|
string temppath = Path.GetTempFileName();
|
||||||
|
@ -17,15 +17,44 @@ namespace DataLoader
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_MyParent = myParent;
|
_MyParent = myParent;
|
||||||
}
|
}
|
||||||
private List<string> _MyErrors = new List<string>();
|
private List<string> _MyMessages = new List<string>();
|
||||||
public List<string> MyErrors
|
private int _ErrorCount = 0;
|
||||||
|
|
||||||
|
public int ErrorCount
|
||||||
{
|
{
|
||||||
get { return _MyErrors; }
|
get { return _ErrorCount; }
|
||||||
|
set { _ErrorCount = value; }
|
||||||
|
}
|
||||||
|
private int _WarningCount = 0;
|
||||||
|
public int WarningCount
|
||||||
|
{
|
||||||
|
get { return _WarningCount; }
|
||||||
|
set { _WarningCount = value; }
|
||||||
|
}
|
||||||
|
private int _InfoCount = 0;
|
||||||
|
public int InfoCount
|
||||||
|
{
|
||||||
|
get { return _InfoCount; }
|
||||||
|
set { _InfoCount = value; }
|
||||||
}
|
}
|
||||||
string sep = "";
|
string sep = "";
|
||||||
public void Add(string err)
|
public void Add(string err, MessageType messageType)
|
||||||
{
|
{
|
||||||
_MyErrors.Add(err);
|
switch (messageType)
|
||||||
|
{
|
||||||
|
case MessageType.Information:
|
||||||
|
_InfoCount++;
|
||||||
|
break;
|
||||||
|
case MessageType.Warning:
|
||||||
|
_WarningCount++;
|
||||||
|
break;
|
||||||
|
case MessageType.Error:
|
||||||
|
_ErrorCount++;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
_MyMessages.Add(err);
|
||||||
tbErrors.SelectionStart = tbErrors.TextLength;
|
tbErrors.SelectionStart = tbErrors.TextLength;
|
||||||
tbErrors.SelectedText = sep + err;
|
tbErrors.SelectedText = sep + err;
|
||||||
sep = "\r\n";
|
sep = "\r\n";
|
||||||
@ -47,13 +76,15 @@ namespace DataLoader
|
|||||||
public void Save(string path)
|
public void Save(string path)
|
||||||
{
|
{
|
||||||
StreamWriter fs = new StreamWriter(path,false);
|
StreamWriter fs = new StreamWriter(path,false);
|
||||||
foreach (string txt in MyErrors)
|
foreach (string txt in _MyMessages)
|
||||||
fs.WriteLine(txt);
|
fs.WriteLine(txt);
|
||||||
fs.Close();
|
fs.Close();
|
||||||
}
|
}
|
||||||
public int ItemCount()
|
|
||||||
{
|
|
||||||
return MyErrors.Count;
|
|
||||||
}
|
}
|
||||||
|
public enum MessageType
|
||||||
|
{
|
||||||
|
Information,
|
||||||
|
Warning,
|
||||||
|
Error
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user