Add separate counts for Errors, Warnings and Information

Cleanup memory after transition processing
Adjusted width of Error Count
Added memory usage to output
Added Stored Procedure GetJustFormat
Reduce Memory Use
Removed extra using statement
This commit is contained in:
Rich
2012-05-21 13:30:21 +00:00
parent 508a86a8ac
commit f5544b7053
9 changed files with 117 additions and 37 deletions

View File

@@ -95,18 +95,18 @@ namespace DataLoader
get { return tsslError.Text; }
set
{
MyFrmErrors.Add(value);
MyFrmErrors.Add(value, MessageType.Error);
_MyLog.ErrorFormat(value);
tsslError.Text = string.Format("{0} Errors", MyFrmErrors.MyErrors.Count); }
tsslError.Text = string.Format("{0} Errors", MyFrmErrors.ErrorCount); }
}
public string MyWarning
{
get { return tsslError.Text; }
set
{
MyFrmErrors.Add(value);
MyFrmErrors.Add(value, MessageType.Warning);
_MyLog.WarnFormat(value);
tsslError.Text = string.Format("{0} Errors", MyFrmErrors.MyErrors.Count);
//tsslError.Text = string.Format("{0} Errors", MyFrmErrors.ErrorCount);
}
}
public string MyInfo
@@ -114,9 +114,9 @@ namespace DataLoader
get { return tsslError.Text; }
set
{
MyFrmErrors.Add(value);
_MyLog.InfoFormat(value);
tsslError.Text = string.Format("{0} Errors", MyFrmErrors.MyErrors.Count);
MyFrmErrors.Add(value, MessageType.Information);
_MyLog.Info(value);
//tsslError.Text = string.Format("{0} Errors", MyFrmErrors.ErrorCount);
}
}
public void AddError(string format, params object[] objs)
@@ -595,6 +595,11 @@ namespace DataLoader
}
private void btnFixTransitions_Click(object sender, EventArgs e)
{
List<int> cacheContentInfo = ContentInfo.CacheList;
List<int> cacheItemInfo = ItemInfo.CacheList;
//List<int> cacheEntryInfo = EntryInfo.CacheList;
//List<int> cachePdfInfo = PdfInfo.CacheList;
//List<int> cacheDocVersionInfo = DocVersionInfo.CacheList;
//if (!CheckLogPath()) return;
StepRTB rtb = new StepRTB();
TransitionFixer myFixer = new TransitionFixer(rtb,MySettings.LogFilePath);
@@ -605,6 +610,12 @@ namespace DataLoader
if(!ProcessComplete) MessageBox.Show(string.Format("{0}\r\n\n({1} Total Seconds)", TransFixTime, howlong.TotalSeconds));
//MessageBox.Show(string.Format("Fix Transitions completion time: {0:D2}:{1:D2}:{2:D2}.{3}\r\n\n({4} Total Seconds)", howlong.Hours, howlong.Minutes, howlong.Seconds, howlong.Milliseconds, howlong.TotalSeconds));
CreateBackupRestoreBatchFiles();
ItemInfo.RestoreCacheList(cacheItemInfo);
ContentInfo.RestoreCacheList(cacheContentInfo);
//EntryInfo.RestoreCacheList(cacheEntryInfo);
//PdfInfo.RestoreCacheList(cachePdfInfo);
//DocVersionInfo.RestoreCacheList(cacheDocVersionInfo);
MyInfo = CSLACache.UsageAll;
}
void myFixer_StatusChanged(object sender, TransitionFixerEventArgs args)
@@ -641,7 +652,7 @@ namespace DataLoader
if (TextConvert.MyGlitches.Glitches.Count > 0)
TextConvert.MyGlitches.Save(MySettings.LogFilePath + @"\ConversionGlitches.xml");
// Save the Error Log
if (_MyFrmErrors.ItemCount() > 0)
if (_MyFrmErrors.ErrorCount > 0)
_MyFrmErrors.Save(MySettings.LogFilePath + @"\ConversionErrors.txt");
}
@@ -731,6 +742,8 @@ namespace DataLoader
mb.Append("Backup Complete");
Status = "Processing Complete";
ProcessComplete = false;
Clipboard.Clear();
Clipboard.SetText(mb.ToString());
MessageBox.Show(mb.ToString(), "Processing Complete", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void ConvertToChangeManager()
@@ -885,12 +898,14 @@ namespace DataLoader
}
public void Append(string format, params object [] args)
{
string msg = "\r\n" + string.Format(format,args);
string msg = string.Format(format,args);
DateTime now = DateTime.Now;
TimeSpan ts = TimeSpan.FromTicks(now.Ticks - _LastTime.Ticks);
string timestamp = string.Format("{0:D2}:{1:D2}:{2:D2}.{3:D3}", ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds);
_LastTime = now;
_MyStringBulider.Append("\r\n" + timestamp + " " + msg);
GC.Collect();
long memUse = GC.GetTotalMemory(true);
_MyStringBulider.Append("\r\n" + timestamp + "\t" + memUse.ToString() + "\t" + msg);
}
public override string ToString()
{