This commit is contained in:
parent
56d5c40f8a
commit
96fb8a53d3
203
PROMS/DataLoader/ConversionRTBProblems.cs
Normal file
203
PROMS/DataLoader/ConversionRTBProblems.cs
Normal file
@ -0,0 +1,203 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Xml;
|
||||||
|
using System.Xml.Serialization;
|
||||||
|
using System.Xml.Schema;
|
||||||
|
using System.IO;
|
||||||
|
using VEPROMS.CSLA.Library;
|
||||||
|
|
||||||
|
namespace DataLoader
|
||||||
|
{
|
||||||
|
[XmlRoot("Proms2010Print")]
|
||||||
|
//[Serializable()]
|
||||||
|
public class ConversionRTBProblems
|
||||||
|
{
|
||||||
|
private RTBProblems _RTBProblems;
|
||||||
|
|
||||||
|
public RTBProblems RTBProblems
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_RTBProblems == null) _RTBProblems = new RTBProblems();
|
||||||
|
return _RTBProblems;
|
||||||
|
}
|
||||||
|
set { _RTBProblems = value; }
|
||||||
|
}
|
||||||
|
public void Save(string fileName)
|
||||||
|
{
|
||||||
|
XmlSerializer<ConversionRTBProblems>.WriteFile(this, fileName);
|
||||||
|
}
|
||||||
|
public static ConversionRTBProblems LoadProblems(string fileName)
|
||||||
|
{
|
||||||
|
return XmlSerializer<ConversionRTBProblems>.ReadFile(fileName);
|
||||||
|
}
|
||||||
|
public void Add(int itemID, int contentID, string originalRTF, string oldRTF, string stepRTF, string newRTF, string stepPath)
|
||||||
|
{
|
||||||
|
_RTBProblems.Add(itemID, contentID, originalRTF, oldRTF, stepRTF, newRTF, stepPath);
|
||||||
|
}
|
||||||
|
//public void Add(int itemID, int contentID, string originalRTF, string oldRTF, string stepRTF, string newRTF, string stepPath, ItemInfo iteminfo)
|
||||||
|
//{
|
||||||
|
// _RTBProblems.Add(itemID, contentID, originalRTF, oldRTF, stepRTF, newRTF, stepPath, iteminfo);
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
public class RTBProblems : List<RTBProblem>
|
||||||
|
{
|
||||||
|
//public void Add(int itemID, int contentID, string originalRTF, string oldRTF, string stepRTF, string newRTF, string stepPath, ItemInfo iteminfo)
|
||||||
|
public void Add(int itemID, int contentID, string originalRTF, string oldRTF, string stepRTF, string newRTF, string stepPath)
|
||||||
|
{
|
||||||
|
base.Add(new RTBProblem(itemID, contentID, originalRTF, oldRTF, stepRTF, newRTF, stepPath));
|
||||||
|
//base.Add(new RTBProblem(itemID, contentID, originalRTF, oldRTF, stepRTF, newRTF, stepPath, iteminfo));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public class RTBProblem
|
||||||
|
{
|
||||||
|
public RTBProblem()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
//public RTBProblem(int itemID, int contentID, string originalRTF, string oldRTF, string stepRTF, string newRTF, string stepPath, ItemInfo iteminfo)
|
||||||
|
public RTBProblem(int itemID, int contentID, string originalRTF, string oldRTF, string stepRTF, string newRTF, string stepPath)
|
||||||
|
{
|
||||||
|
_ItemID = itemID;
|
||||||
|
_ContentID = contentID;
|
||||||
|
_OldRTF = oldRTF;
|
||||||
|
_NewRTF = newRTF;
|
||||||
|
_StepPath = stepPath;
|
||||||
|
_OriginalRTF = originalRTF;
|
||||||
|
_StepRtf = stepRTF;
|
||||||
|
//_itemInfo = iteminfo;
|
||||||
|
}
|
||||||
|
private int _ItemID;
|
||||||
|
[XmlAttribute("ItemID")]
|
||||||
|
public int ItemID
|
||||||
|
{
|
||||||
|
get { return _ItemID; }
|
||||||
|
set { _ItemID = value; }
|
||||||
|
}
|
||||||
|
private int _ContentID;
|
||||||
|
[XmlAttribute("ContentID")]
|
||||||
|
public int ContentID
|
||||||
|
{
|
||||||
|
get { return _ContentID; }
|
||||||
|
set { _ContentID = value; }
|
||||||
|
}
|
||||||
|
private string _OriginalRTF;
|
||||||
|
[XmlAttribute("OriginalRTF")]
|
||||||
|
public string OriginalRTF
|
||||||
|
{
|
||||||
|
get { return _OriginalRTF; }
|
||||||
|
set { _OriginalRTF = value; }
|
||||||
|
}
|
||||||
|
private string _OldRTF;
|
||||||
|
[XmlAttribute("OldRTF")]
|
||||||
|
public string OldRTF
|
||||||
|
{
|
||||||
|
get { return _OldRTF; }
|
||||||
|
set { _OldRTF = value; }
|
||||||
|
}
|
||||||
|
private string _StepRtf;
|
||||||
|
[XmlAttribute("StepRTF")]
|
||||||
|
public string StepRtf
|
||||||
|
{
|
||||||
|
get { return _StepRtf; }
|
||||||
|
set { _StepRtf = value; }
|
||||||
|
}
|
||||||
|
private string _NewRTF;
|
||||||
|
[XmlAttribute("NewRTF")]
|
||||||
|
public string NewRTF
|
||||||
|
{
|
||||||
|
get { return _NewRTF; }
|
||||||
|
set { _NewRTF = value; }
|
||||||
|
}
|
||||||
|
private string _StepPath;
|
||||||
|
[XmlAttribute("StepPath")]
|
||||||
|
public string StepPath
|
||||||
|
{
|
||||||
|
get { return _StepPath; }
|
||||||
|
set { _StepPath = value; }
|
||||||
|
}
|
||||||
|
private string _Comparison;
|
||||||
|
[XmlIgnore]
|
||||||
|
public string Comparison
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_Comparison == null)
|
||||||
|
_Comparison = GetComparison(_OldRTF, _NewRTF);
|
||||||
|
return _Comparison;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private string _StripRTF;
|
||||||
|
[XmlIgnore]
|
||||||
|
public string StripRTF
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_StripRTF == null)
|
||||||
|
_StripRTF = GetStrip(_StepRtf);
|
||||||
|
return _StripRTF;
|
||||||
|
}
|
||||||
|
set { _StripRTF = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
//private ItemInfo _itemInfo;
|
||||||
|
//[XmlIgnore]
|
||||||
|
//public ItemInfo ItemInfo
|
||||||
|
//{
|
||||||
|
// get { return _itemInfo; }
|
||||||
|
// set { _itemInfo = value; }
|
||||||
|
//}
|
||||||
|
|
||||||
|
private string GetStrip(string _StepRtf)
|
||||||
|
{
|
||||||
|
string rttval = Volian.Controls.Library.DisplayText.StaticStripRtfCommands(_StepRtf);
|
||||||
|
//string rttval = Volian.Controls.Library.DisplayText.StaticStripRtfCommands(_StepRtf, _itemInfo);
|
||||||
|
//return rttval.Replace(@"\u8209?", "-");
|
||||||
|
return rttval;
|
||||||
|
}
|
||||||
|
private string GetComparison(string str1, string str2)
|
||||||
|
{
|
||||||
|
if (str1 == str2) return str1;
|
||||||
|
int endMatch = 0;
|
||||||
|
int l1 = str1.Length;
|
||||||
|
int l2 = str2.Length;
|
||||||
|
int min = l1 > l2 ? l2 : l1;
|
||||||
|
int startMatch = min;
|
||||||
|
for (int i = 0; i < min; i++)
|
||||||
|
if (str1[i] != str2[i])
|
||||||
|
{
|
||||||
|
startMatch = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
min = min - startMatch;
|
||||||
|
endMatch = min;
|
||||||
|
for (int i = 1; i < min; i++)
|
||||||
|
if (str1[l1 - i] != str2[l2 - i])
|
||||||
|
{
|
||||||
|
endMatch = i - 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
string prefix = str1.Substring(0, startMatch);
|
||||||
|
string part1 = str1.Substring(startMatch, l1 - (startMatch + endMatch));
|
||||||
|
string part2 = str2.Substring(startMatch, l2 - (startMatch + endMatch));
|
||||||
|
string suffix = str1.Substring(l1 - endMatch, endMatch);
|
||||||
|
return prefix + "\r\n<<<" + part1 + "|||" + part2 + ">>>\r\n" + suffix;
|
||||||
|
}
|
||||||
|
private ItemInfo _MyItem;
|
||||||
|
[XmlIgnore]
|
||||||
|
public ItemInfo MyItem
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_MyItem == null)
|
||||||
|
_MyItem = ItemInfo.Get(_ItemID);
|
||||||
|
return _MyItem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return MyItem.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
213
PROMS/DataLoader/DataLoaderGlitches.cs
Normal file
213
PROMS/DataLoader/DataLoaderGlitches.cs
Normal file
@ -0,0 +1,213 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Xml;
|
||||||
|
using System.Xml.Serialization;
|
||||||
|
using System.Xml.Schema;
|
||||||
|
using System.IO;
|
||||||
|
using VEPROMS.CSLA.Library;
|
||||||
|
|
||||||
|
namespace DataLoader
|
||||||
|
{
|
||||||
|
[XmlRoot("DataLoaderGlitches")]
|
||||||
|
//[Serializable()]
|
||||||
|
public class DataLoaderGlitches
|
||||||
|
{
|
||||||
|
private Glitches _Glitches;
|
||||||
|
|
||||||
|
public Glitches Glitches
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_Glitches == null) _Glitches = new Glitches();
|
||||||
|
return _Glitches;
|
||||||
|
}
|
||||||
|
set { _Glitches = value; }
|
||||||
|
}
|
||||||
|
public void Add(string cause, string originalText, string newText)
|
||||||
|
{
|
||||||
|
Glitches.Add(cause, originalText, newText);
|
||||||
|
}
|
||||||
|
public void Save(string fileName)
|
||||||
|
{
|
||||||
|
XmlSerializer<DataLoaderGlitches>.WriteFile(this, fileName);
|
||||||
|
}
|
||||||
|
public static DataLoaderGlitches LoadProblems(string fileName)
|
||||||
|
{
|
||||||
|
return XmlSerializer<DataLoaderGlitches>.ReadFile(fileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public class Glitches : List<Glitch>
|
||||||
|
{
|
||||||
|
public void Add(string cause, string originalText, string newText)
|
||||||
|
{
|
||||||
|
base.Add(new Glitch(cause, originalText, newText));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public class Glitch
|
||||||
|
{
|
||||||
|
public Glitch()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
public Glitch(string cause, string originalText, string newText)
|
||||||
|
{
|
||||||
|
_Cause = cause;
|
||||||
|
_OriginalText = originalText;
|
||||||
|
_NewText = newText;
|
||||||
|
}
|
||||||
|
private string _Cause;
|
||||||
|
[XmlAttribute("Cause")]
|
||||||
|
public string Cause
|
||||||
|
{
|
||||||
|
get { return _Cause; }
|
||||||
|
set { _Cause = value; }
|
||||||
|
}
|
||||||
|
private string _OriginalText;
|
||||||
|
[XmlAttribute("OriginalText")]
|
||||||
|
public string OriginalText
|
||||||
|
{
|
||||||
|
get { return _OriginalText; }
|
||||||
|
set { _OriginalText = value; }
|
||||||
|
}
|
||||||
|
private string _NewText;
|
||||||
|
[XmlAttribute("NewText")]
|
||||||
|
public string NewText
|
||||||
|
{
|
||||||
|
get { return _NewText; }
|
||||||
|
set { _NewText = value; }
|
||||||
|
}
|
||||||
|
private string _Comparison;
|
||||||
|
[XmlIgnore]
|
||||||
|
public string Comparison
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_Comparison == null)
|
||||||
|
_Comparison = GetComparison(_OriginalText, _NewText);
|
||||||
|
return _Comparison;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private string GetComparison(string str1, string str2)
|
||||||
|
{
|
||||||
|
if(str1 == str2)return str1;
|
||||||
|
int endMatch = 0;
|
||||||
|
int l1 = str1.Length;
|
||||||
|
int l2 = str2.Length;
|
||||||
|
int min = l1 > l2 ? l2 : l1;
|
||||||
|
int startMatch = min;
|
||||||
|
for(int i = 0; i< min; i++)
|
||||||
|
if (str1[i] != str2[i])
|
||||||
|
{
|
||||||
|
startMatch = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
for (int i = 1; i < min; i++)
|
||||||
|
if (str1[l1-i] != str2[l2-i])
|
||||||
|
{
|
||||||
|
endMatch = i-1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
string prefix = str1.Substring(0, startMatch);
|
||||||
|
string part1 = str1.Substring(startMatch, l1 - (startMatch + endMatch));
|
||||||
|
string part2 = str2.Substring(startMatch, l2 - (startMatch + endMatch));
|
||||||
|
string suffix = str1.Substring(l1 - endMatch, endMatch);
|
||||||
|
_Delta = "<<<" + part1 + "|||" + part2 + ">>>";
|
||||||
|
return prefix + "\r\n<<<" + part1 + "|||" + part2 + ">>>\r\n" + suffix;
|
||||||
|
}
|
||||||
|
private string _Delta = null;
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
if (Comparison == null) { ;} // This gets the Comparsion and sets _Delta
|
||||||
|
return _Delta;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static class XmlSerializer<T> where T : class
|
||||||
|
{
|
||||||
|
public static string StringSerialize(T t)
|
||||||
|
{
|
||||||
|
string strOutput = string.Empty;
|
||||||
|
XmlSerializer xs = new XmlSerializer(typeof(T), "http://www.volian.com");
|
||||||
|
using (MemoryStream ms = new MemoryStream())
|
||||||
|
{
|
||||||
|
xs.Serialize(new NonXsiTextWriter(ms, Encoding.UTF8), t);
|
||||||
|
//xs.Serialize(ms, t);
|
||||||
|
ms.Position = 0;
|
||||||
|
StreamReader sr = new StreamReader(ms);
|
||||||
|
strOutput = sr.ReadToEnd();
|
||||||
|
ms.Close();
|
||||||
|
}
|
||||||
|
return strOutput;
|
||||||
|
}
|
||||||
|
public static T StringDeserialize(string s)
|
||||||
|
{
|
||||||
|
T t;
|
||||||
|
XmlSerializer xs = new XmlSerializer(typeof(T), "http://www.volian.com");
|
||||||
|
UTF8Encoding enc = new UTF8Encoding();
|
||||||
|
Byte[] arrBytData = enc.GetBytes(s);
|
||||||
|
using (MemoryStream ms = new MemoryStream(arrBytData))
|
||||||
|
{
|
||||||
|
t = (T)xs.Deserialize(ms);
|
||||||
|
}
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
public static void WriteFile(T t, string fileName)
|
||||||
|
{
|
||||||
|
string strOutput = string.Empty;
|
||||||
|
XmlSerializer xs = new XmlSerializer(typeof(T), "http://www.volian.com");
|
||||||
|
using (FileStream fs = new FileStream(fileName, FileMode.Create))
|
||||||
|
{
|
||||||
|
xs.Serialize(new NonXsiTextWriter(fs, Encoding.UTF8), t);
|
||||||
|
fs.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static T ReadFile(string fileName)
|
||||||
|
{
|
||||||
|
T t;
|
||||||
|
XmlSerializer xs = new XmlSerializer(typeof(T), "http://www.volian.com");
|
||||||
|
using (FileStream fs = new FileStream(fileName, FileMode.Open))
|
||||||
|
{
|
||||||
|
t = (T)xs.Deserialize(fs);
|
||||||
|
}
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public class NonXsiTextWriter : XmlTextWriter
|
||||||
|
{
|
||||||
|
public NonXsiTextWriter(TextWriter w) : base(w) { }
|
||||||
|
public NonXsiTextWriter(Stream w, Encoding encoding)
|
||||||
|
: base(w, encoding)
|
||||||
|
{
|
||||||
|
this.Formatting = Formatting.Indented;
|
||||||
|
}
|
||||||
|
public NonXsiTextWriter(string filename, Encoding encoding) : base(filename, encoding) { }
|
||||||
|
bool _skip = false;
|
||||||
|
public override void WriteStartAttribute(string prefix, string localName, string ns)
|
||||||
|
{
|
||||||
|
if ((prefix == "xmlns" && (localName == "xsd" || localName == "xsi")) || // Omits XSD and XSI declarations.
|
||||||
|
ns == XmlSchema.InstanceNamespace) // Omits all XSI attributes.
|
||||||
|
{
|
||||||
|
_skip = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (localName == "xlink_href")
|
||||||
|
base.WriteStartAttribute(prefix, "xlink:href", ns);
|
||||||
|
else
|
||||||
|
base.WriteStartAttribute(prefix, localName, ns);
|
||||||
|
}
|
||||||
|
public override void WriteString(string text)
|
||||||
|
{
|
||||||
|
if (_skip) return;
|
||||||
|
base.WriteString(text);
|
||||||
|
}
|
||||||
|
public override void WriteEndAttribute()
|
||||||
|
{
|
||||||
|
if (_skip)
|
||||||
|
{ // Reset the flag, so we keep writing.
|
||||||
|
_skip = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
base.WriteEndAttribute();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
133
PROMS/DataLoader/TransitionFixer.cs
Normal file
133
PROMS/DataLoader/TransitionFixer.cs
Normal file
@ -0,0 +1,133 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using Volian.Controls.Library;
|
||||||
|
using VEPROMS.CSLA.Library;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
|
namespace DataLoader
|
||||||
|
{
|
||||||
|
public delegate void TransitionFixerEvent(object sender, TransitionFixerEventArgs args);
|
||||||
|
public class TransitionFixerEventArgs
|
||||||
|
{
|
||||||
|
private string _MyStatus;
|
||||||
|
|
||||||
|
public string MyStatus
|
||||||
|
{
|
||||||
|
get { return _MyStatus; }
|
||||||
|
set { _MyStatus = value; }
|
||||||
|
}
|
||||||
|
public TransitionFixerEventArgs(string myStatus)
|
||||||
|
{
|
||||||
|
_MyStatus = myStatus;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
class TransitionFixer
|
||||||
|
{
|
||||||
|
public event TransitionFixerEvent StatusChanged;
|
||||||
|
private void OnStatusChanged(object sender, TransitionFixerEventArgs args)
|
||||||
|
{
|
||||||
|
if (StatusChanged != null)
|
||||||
|
StatusChanged(sender, args);
|
||||||
|
}
|
||||||
|
private string _Status;
|
||||||
|
|
||||||
|
public string Status
|
||||||
|
{
|
||||||
|
get { return _Status; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_Status = value;
|
||||||
|
OnStatusChanged(this, new TransitionFixerEventArgs(_Status));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private int _ErrorCount = 0;
|
||||||
|
|
||||||
|
public int ErrorCount
|
||||||
|
{
|
||||||
|
get { return _ErrorCount; }
|
||||||
|
set { _ErrorCount = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private StepRTB _MyStepRTB;
|
||||||
|
|
||||||
|
public StepRTB MyStepRTB
|
||||||
|
{
|
||||||
|
get { return _MyStepRTB; }
|
||||||
|
}
|
||||||
|
public TransitionFixer(StepRTB myStepRTB)
|
||||||
|
{
|
||||||
|
_MyStepRTB = myStepRTB;
|
||||||
|
}
|
||||||
|
public TimeSpan Process()
|
||||||
|
{
|
||||||
|
DateTime tstart = DateTime.Now;
|
||||||
|
ProcessTransitions();
|
||||||
|
return DateTime.Now - tstart;
|
||||||
|
}
|
||||||
|
private void ProcessTransitions()
|
||||||
|
{
|
||||||
|
Status = "Getting List...";
|
||||||
|
// Loop through all Items and check before and after text
|
||||||
|
ItemInfoList myList = ItemInfoList.Get();
|
||||||
|
ConversionRTBProblems myProblems = new ConversionRTBProblems();
|
||||||
|
int i = 0;
|
||||||
|
foreach (ItemInfo item in myList)
|
||||||
|
{
|
||||||
|
Status = string.Format("Processing {0} of {1} steps", ++i, myList.Count);
|
||||||
|
MyStepRTB.ViewRTB = false;
|
||||||
|
string originalText = item.MyContent.Text;
|
||||||
|
string updatedText = item.MyContent.Text;
|
||||||
|
if (item.ItemID == 1850)
|
||||||
|
Console.WriteLine("HERE");
|
||||||
|
if (item.ItemDocVersionCount != 0 || item.MyPrevious != null || item.MyParent != null)
|
||||||
|
{
|
||||||
|
if (item.MyContent.ContentTransitionCount > 0)
|
||||||
|
{
|
||||||
|
//updatedText = Volian.Controls.Library.DisplayText.StaticRemoveRtfStyles(updatedText, item);
|
||||||
|
foreach (TransitionInfo tran in item.MyContent.ContentTransitions)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
updatedText = FixTransitionText(updatedText, tran);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine("{0} {1}", ex.GetType().Name, ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
MyStepRTB.MyItemInfo = item;
|
||||||
|
MyStepRTB.SaveText();
|
||||||
|
string afterText = item.MyContent.Text;
|
||||||
|
if (updatedText != afterText)//|| newStripped != afterText)
|
||||||
|
myProblems.RTBProblems.Add(item.ItemID, item.MyContent.ContentID, originalText, updatedText, MyStepRTB.Rtf, afterText, item.Path);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Console.WriteLine("here");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Status = "Saving problems";
|
||||||
|
ErrorCount = myProblems.RTBProblems.Count;
|
||||||
|
myProblems.Save(@"C:\temp\RTBProblems.xml");
|
||||||
|
Status = "Done comparing";
|
||||||
|
|
||||||
|
}
|
||||||
|
public string FixTransitionText(string Text, TransitionInfo tran)
|
||||||
|
{
|
||||||
|
string transText = tran.ResolvePathTo();
|
||||||
|
string lookFor = string.Format(@"<START\]\\v0 ([^#]*?)\\v #Link:Transition[^:]*?:{0} {1}( [0-9]*){2}\[END>", tran.TranType, tran.TransitionID, "{1,2}");
|
||||||
|
Match m = Regex.Match(Text, lookFor);
|
||||||
|
if (m != null && m.Groups.Count > 1)
|
||||||
|
{
|
||||||
|
System.Text.RegularExpressions.Group g = m.Groups[1];
|
||||||
|
if (g.ToString() != transText)
|
||||||
|
Text = Text.Substring(0, g.Index) + transText + Text.Substring(g.Index + g.Length);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Console.WriteLine("Transition not Found");
|
||||||
|
return Text;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user