Added option to check RTF with StepRTB

Use Temporary Folder for SearchResults
Remove override of Equals - return to default
Comment-out Debug
Remove PDFs that are older than one hour
Added a ShowLocalStack that takes a format and a list of parameters
This commit is contained in:
Rich
2010-10-12 14:59:23 +00:00
parent d3c6e41a5a
commit dc6721f54c
9 changed files with 209 additions and 175 deletions

View File

@@ -62,13 +62,13 @@ namespace DataLoader
_MyStepRTB = myStepRTB;
_LogPath = logpath;
}
public TimeSpan Process()
public TimeSpan Process(bool checkRTF)
{
DateTime tstart = DateTime.Now;
ProcessTransitions();
ProcessTransitions(checkRTF);
return DateTime.Now - tstart;
}
private void ProcessTransitions()
private void ProcessTransitions(bool checkRTF)
{
Status = "Getting List...";
// Loop through all Items and check before and after text
@@ -81,6 +81,7 @@ namespace DataLoader
MyStepRTB.ViewRTB = false;
string originalText = item.MyContent.Text;
string updatedText = item.MyContent.Text;
// Exclude items that are not connected (Dummy steps for invalid transition destinations)
if (item.ItemDocVersionCount != 0 || item.MyPrevious != null || item.MyParent != null)
{
if (item.MyContent.ContentTransitionCount > 0)
@@ -104,35 +105,43 @@ namespace DataLoader
c.Text = updatedText;
c.Save();
}
MyStepRTB.MyItemInfo = item;
MyStepRTB.SaveText();
string afterText = item.MyContent.Text;
// aftertext is 'newrtf'
if (afterText != updatedText)
myProblems.RTBProblems.Add(item.ItemID, item.MyContent.ContentID, originalText, updatedText, MyStepRTB.Rtf, afterText, item.Path);
if (checkRTF)
{
MyStepRTB.MyItemInfo = item;
MyStepRTB.SaveText(true); // Force Save - This will put change bars on everything
string afterText = item.MyContent.Text;
// aftertext is 'newrtf'
if (afterText != updatedText)
myProblems.RTBProblems.Add(item.ItemID, item.MyContent.ContentID, originalText, updatedText, MyStepRTB.Rtf, afterText, item.Path);
}
}
}
if (checkRTF)
{
Status = "Saving problems";
string logFile = _LogPath + @"\RTBProblems.xml";
ErrorCount = myProblems.RTBProblems.Count;
myProblems.Save(logFile);
if (ErrorCount > 0)
{
System.Windows.Forms.DialogResult answer = System.Windows.Forms.MessageBox.Show(
string.Format("{0} Differences found in Transition Text\r\nResults in {1}\r\n\r\nOpen Log File?",
ErrorCount, logFile), "Transitions Different", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Question);
if(answer == System.Windows.Forms.DialogResult.Yes)
System.Diagnostics.Process.Start(logFile);
}
//#if DEBUG
else if (VlnSettings.DebugMode)
{
Console.WriteLine("here");
}
//#endif
}
//Status = "Saving problems";
//ErrorCount = myProblems.RTBProblems.Count;
////myProblems.Save(@"C:\temp\RTBProblems.xml");
myProblems.Save(_LogPath + @"\RTBProblems.xml");
Status = "Done comparing";
}
public string FixTransitionText(string Text, TransitionInfo tran)
{
string lookFor = string.Format(@"<START\]\\v0 ([^#]*?)\\v #Link:Transition[^:]*?:{0} {1}( [0-9]*){2}\[END>", tran.TranType, tran.TransitionID, "{1,2}");
Console.WriteLine(">>>>> FixTransitionText");
Console.WriteLine("Text = {0}", Text);
Console.WriteLine("lookFor = {0}", lookFor);
string transText = tran.ResolvePathTo();
Console.WriteLine("TransText = {0}", transText);
//Console.WriteLine(">>>>> FixTransitionText");
//Console.WriteLine("Text = {0}", Text);
//Console.WriteLine("lookFor = {0}", lookFor);
//Console.WriteLine("TransText = {0}", transText);
Match m = Regex.Match(Text, lookFor);
if (m != null && m.Groups.Count > 1)
{