Update Transition Text
This commit is contained in:
@@ -191,6 +191,7 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
try
|
||||
{
|
||||
FormatInfo formatInfo = _MyItemInfo.ActiveFormat;
|
||||
_MyItem = _MyItemInfo.Get();
|
||||
// check for different text, i.e. text from this itm doesn't match
|
||||
// original text, a change occurred in database, but not from this user.
|
||||
@@ -225,6 +226,10 @@ namespace Volian.Controls.Library
|
||||
if (ctReplacements.Count > 0)
|
||||
{
|
||||
EditText = FixCtReplacements(EditText, ctReplacements);
|
||||
// Replace Transition Text
|
||||
foreach (ContentTransition ct in ctReplacements.Values)
|
||||
using (TransitionInfo tran = TransitionInfo.Get(ct.TransitionID))
|
||||
_MyItem.MyContent.FixTransitionText(tran);
|
||||
_MyItem.Save();
|
||||
}
|
||||
if (roUsgReplacements.Count > 0)
|
||||
@@ -695,7 +700,7 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
if (ti.TransitionID == transitionID)
|
||||
{
|
||||
string path = ti.ResolvePathTo(_MyFormat, _MyItemInfo, ItemInfo.Get(ti.ToID), ti.RangeID==0?null:ItemInfo.Get(ti.RangeID));
|
||||
string path = ti.ResolvePathTo(_MyFormat, _MyItemInfo, ti.TranType, ti.MyItemToID, ti.MyItemRangeID);
|
||||
return path;
|
||||
}
|
||||
}
|
||||
@@ -746,7 +751,14 @@ namespace Volian.Controls.Library
|
||||
else if (text[endComment + 3] == '\\') retlen = 3;
|
||||
vte.TextAndLink = text.Substring(index, endComment - index + retlen);
|
||||
rettoken = endComment + retlen;
|
||||
if (vte.Type != E_TextElementType.ReferencedObject) vte.TextAndLink = vte.TextAndLink = vte.TextAndLink.Replace("(Resolved Transition Text)", tmptxt);
|
||||
if (vte.Type != E_TextElementType.ReferencedObject)
|
||||
{
|
||||
if (vte.TextAndLink.Contains("(Resolved Transition Text)"))
|
||||
vte.TextAndLink = vte.TextAndLink.Replace("(Resolved Transition Text)", tmptxt);
|
||||
else
|
||||
if (vte.Text != tmptxt)
|
||||
vte.Text = tmptxt;
|
||||
}
|
||||
DisplayTextElementList.Add(vte);
|
||||
return rettoken;
|
||||
}
|
||||
@@ -825,8 +837,17 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
else
|
||||
{
|
||||
string pat = @"(?<=\W|^)" + rs.ReplaceWord + @"(?=\W|$)";
|
||||
Text = Regex.Replace(Text, pat, rs.ReplaceWith);
|
||||
// If there are Regex Control Characters '\[]()' prefix them with backslash
|
||||
string replaceWord = Regex.Replace(rs.ReplaceWord, @"\\[[\]()]", @"\$0");
|
||||
string pat = @"(?<=\W|^)" + replaceWord + @"(?=\W|$)";
|
||||
try
|
||||
{
|
||||
Text = Regex.Replace(Text, pat, rs.ReplaceWith);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("{0},'{1}',{2},'{3}'", _MyItemInfo.ActiveFormat.Name, replaceWord, ex.GetType().Name, ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -852,8 +873,8 @@ namespace Volian.Controls.Library
|
||||
get { return _Type; }
|
||||
set { _Type = value; }
|
||||
}
|
||||
private string _Text;
|
||||
public string Text
|
||||
protected string _Text;
|
||||
virtual public string Text
|
||||
{
|
||||
get { return _Text; }
|
||||
set { _Text = value; }
|
||||
@@ -873,6 +894,31 @@ namespace Volian.Controls.Library
|
||||
get { return _TextAndLink; }
|
||||
set { _TextAndLink = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Text - this should parse the text and return the results
|
||||
/// </summary>
|
||||
override public string Text
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_TextAndLink != null)
|
||||
{
|
||||
Match m = Regex.Match(_TextAndLink, @"<START\]\\v0 (.*?)\\v #Link:(.*?)\[END>");
|
||||
return m.Groups[1].ToString();
|
||||
}
|
||||
return _Text;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (_TextAndLink != null)
|
||||
{
|
||||
Match m = Regex.Match(_TextAndLink, @"<START\]\\v0 (.*?)\\v #Link:(.*?)\[END>");
|
||||
System.Text.RegularExpressions.Group g = m.Groups[1];
|
||||
_TextAndLink = _TextAndLink.Substring(0, g.Index) + value + _TextAndLink.Substring(g.Index + g.Length);
|
||||
}
|
||||
_Text = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
Reference in New Issue
Block a user