This commit is contained in:
parent
a9da618d54
commit
b6ea14f1b3
@ -20,6 +20,7 @@ using System.Collections.Generic;
|
|||||||
using System.Xml;
|
using System.Xml;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
using VEPROMS.CSLA.Library;
|
using VEPROMS.CSLA.Library;
|
||||||
|
|
||||||
namespace DataLoader
|
namespace DataLoader
|
||||||
@ -286,12 +287,15 @@ namespace DataLoader
|
|||||||
private void ShowMissingTransitions()
|
private void ShowMissingTransitions()
|
||||||
{
|
{
|
||||||
if (dicTrans_ItemIds.Keys.Count > 0)
|
if (dicTrans_ItemIds.Keys.Count > 0)
|
||||||
//log.Warn("Missing Transitions from Dictionary");
|
|
||||||
foreach (string s in dicTrans_ItemIds.Keys)
|
|
||||||
{
|
{
|
||||||
//log.WarnFormat("{0} - {1}", s, dicTrans_ItemIds[s]);
|
// see if any end in |A0, if so, point these to the procedure associated with it.
|
||||||
frmMain.AddError("Missing Transition Destination {0} - {1}", s, dicTrans_ItemIds[s].ItemID);
|
CleanupTransToNonExistentSectionA0();
|
||||||
//AddItemAnnotation(dicTrans_ItemIds[s]);
|
foreach (string s in dicTrans_ItemIds.Keys)
|
||||||
|
{
|
||||||
|
//log.WarnFormat("{0} - {1}", s, dicTrans_ItemIds[s]);
|
||||||
|
frmMain.AddError("Missing Transition Destination {0} - {1}", s, dicTrans_ItemIds[s].ItemID);
|
||||||
|
//AddItemAnnotation(dicTrans_ItemIds[s]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
foreach (string s in dicTrans_MigrationErrors.Keys)
|
foreach (string s in dicTrans_MigrationErrors.Keys)
|
||||||
{
|
{
|
||||||
@ -315,6 +319,69 @@ namespace DataLoader
|
|||||||
log.Info("End of Missing Transitions");
|
log.Info("End of Missing Transitions");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void CleanupTransToNonExistentSectionA0()
|
||||||
|
{
|
||||||
|
// see if any end in |A0, if so, point these to the procedure associated with it.
|
||||||
|
foreach (string s in dicTrans_ItemIds.Keys)
|
||||||
|
{
|
||||||
|
if (s.EndsWith("|A0"))
|
||||||
|
{
|
||||||
|
// make a list to store those that need changed because can't change data in
|
||||||
|
// a foreach:
|
||||||
|
List<int> transToChg = new List<int>();
|
||||||
|
List<int> transRgChg = new List<int>();
|
||||||
|
Item item = dicTrans_ItemIds[s];
|
||||||
|
ItemInfo ii = ItemInfo.Get(item.ItemID);
|
||||||
|
ItemInfo procItem = ii.MyProcedure as ItemInfo;
|
||||||
|
foreach (ItemTransition_ToID transid in item.ItemTransitions_ToID) transToChg.Add(transid.TransitionID);
|
||||||
|
foreach (ItemTransition_RangeID transid in item.ItemTransitions_RangeID) transRgChg.Add(transid.TransitionID);
|
||||||
|
//foreach (int transid in transToChg) UpdateTranDataForA0(procItem, transid, false);
|
||||||
|
//foreach (int transidr in transRgChg) UpdateTranDataForA0(procItem, transidr, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//private static void UpdateTranDataForA0(ItemInfo procItem, int transid, bool isRange)
|
||||||
|
//{
|
||||||
|
// int type;
|
||||||
|
// int oldto;
|
||||||
|
// int oldrg;
|
||||||
|
// int oldfrom;
|
||||||
|
// using (Transition t = Transition.Get(transid))
|
||||||
|
// {
|
||||||
|
// type = t.TranType;
|
||||||
|
// oldto = t.ToID;
|
||||||
|
// oldrg = t.RangeID;
|
||||||
|
// oldfrom = t.FromID;
|
||||||
|
// if (!isRange)
|
||||||
|
// t.MyItemToID = procItem;
|
||||||
|
// else
|
||||||
|
// t.MyItemRangeID = procItem;
|
||||||
|
// t.Save();
|
||||||
|
// }
|
||||||
|
// using (Content c = Content.Get(oldfrom))
|
||||||
|
// {
|
||||||
|
// string lookFor = isRange?string.Format(@"<START\]\\v0 ([^#]*?)\\v #Link:TransitionRange:{0} {1} {2} {3})\[END>", type, transid, oldto, oldrg):
|
||||||
|
// string.Format(@"<START\]\\v0 ([^#]*?)\\v #Link:Transition[^:]*?:{0} {1} {2}( [0-9]*)\[END>", type, transid, oldto);
|
||||||
|
|
||||||
|
// Console.WriteLine(">>>>> FixTransitionA0");
|
||||||
|
// Console.WriteLine("Text = {0}", c.Text);
|
||||||
|
// Console.WriteLine("lookFor = {0}", lookFor);
|
||||||
|
// string replaceWith = isRange?string.Format(@"<START\]\\v0 ([^#]*?)\\v #Link:TransitionRange:{0} {1} {2} {3}\[END>", type, transid, oldto, procItem.ItemID):
|
||||||
|
// string.Format(@"<START\]\\v0 ([^#]*?)\\v #Link:Transition[^:]*?:{0} {1} {2}( [0-9]*)\[END>", type, transid, procItem.ItemID);
|
||||||
|
// Console.WriteLine("replaceWith = {0}", replaceWith);
|
||||||
|
// Match m = Regex.Match(c.Text, lookFor);
|
||||||
|
// if (m != null && m.Groups.Count > 1)
|
||||||
|
// {
|
||||||
|
// System.Text.RegularExpressions.Group g = m.Groups[1];
|
||||||
|
// if (g.ToString() != replaceWith)
|
||||||
|
// c.Text = c.Text.Substring(0, g.Index) + replaceWith + c.Text.Substring(g.Index + g.Length);
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// Console.WriteLine("Transition not Found");
|
||||||
|
// c.Save();
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
private void AddItemAnnotation(Item itm)
|
private void AddItemAnnotation(Item itm)
|
||||||
{
|
{
|
||||||
foreach (ItemTransition_ToID tmp in itm.ItemTransitions_ToID)
|
foreach (ItemTransition_ToID tmp in itm.ItemTransitions_ToID)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user