This commit is contained in:
parent
1e68d76923
commit
de9081036c
@ -94,7 +94,7 @@ namespace VEPROMS.CSLA.Library
|
||||
_ROFstInfo = null;
|
||||
using (ROFstInfo rfi = ROFstInfo.Get(_ROFst.ROFstID))
|
||||
{
|
||||
_DocVersionInfo = DocVersionInfo.Get(rfi.docVer.VersionID);
|
||||
_DocVersionInfo = rfi.docVer==null?null: DocVersionInfo.Get(rfi.docVer.VersionID);
|
||||
}
|
||||
ParseIntoDictionary(rofst.ROLookup);
|
||||
}
|
||||
@ -102,15 +102,19 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
_ROFstInfo = rofstinfo;
|
||||
_ROFst = null;
|
||||
_DocVersionInfo = DocVersionInfo.Get(_ROFstInfo.docVer.VersionID);
|
||||
// docversion will be null if we're working with an ro.fst that is not currently connected
|
||||
// to a docversion. One example of this is when updating ro.fst and comparing the original
|
||||
// with the new to find differences. The docversioninfo is only used to get unit/master
|
||||
// slave info, thus is not needed to compare the raw values.
|
||||
_DocVersionInfo = _ROFstInfo.docVer==null?null: DocVersionInfo.Get(_ROFstInfo.docVer.VersionID);
|
||||
ParseIntoDictionary(rofstinfo.ROLookup);
|
||||
}
|
||||
#endregion
|
||||
#region PropertiesAndData
|
||||
public roHdr myHdr;
|
||||
private int TableID;
|
||||
private HybridDictionary dicRos;
|
||||
private HybridDictionary dicRosIntIDs;
|
||||
private Dictionary<string, rochild> dicRos;
|
||||
private Dictionary<int, rochild> dicRosIntIDs;
|
||||
#endregion
|
||||
#region AppSupport
|
||||
public void Close()
|
||||
@ -121,6 +125,22 @@ namespace VEPROMS.CSLA.Library
|
||||
if (dicRos != null)dicRos.Clear();
|
||||
dicRos = null;
|
||||
}
|
||||
public List<string> GetValueDifferences(ROFSTLookup origROFst, ref List<string> delList)
|
||||
{
|
||||
// use this list to see what differences are between it and the original
|
||||
List<string> modList = new List<string>();
|
||||
// assume each rofstlookup has a parsed dictionary
|
||||
foreach (string key in origROFst.dicRos.Keys)
|
||||
{
|
||||
string cvalue = null;
|
||||
string ovalue = origROFst.dicRos[key].value;
|
||||
if (dicRos.ContainsKey(key)) cvalue = dicRos[key].value;
|
||||
if (cvalue == null && cvalue != ovalue)
|
||||
delList.Add(key);
|
||||
else if (cvalue != ovalue) modList.Add(key);
|
||||
}
|
||||
return modList;
|
||||
}
|
||||
//public static ROImageInfo Get(RODbInfo rodbinfo, string filename)
|
||||
//{
|
||||
// if (rodbinfo.RODbROImageCount != 0)
|
||||
@ -138,7 +158,7 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
if (dicRos == null) ParseIntoDictionary(_ROFst!=null?_ROFst.ROLookup:_ROFstInfo.ROLookup);
|
||||
// Use the ROID to get the value from the dictionary
|
||||
if (dicRos.Contains(ROID))
|
||||
if (dicRos.ContainsKey(ROID))
|
||||
{
|
||||
rochild rochld = (rochild)dicRos[ROID];
|
||||
return rochld.value;
|
||||
@ -149,7 +169,7 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
if (dicRos == null) ParseIntoDictionary(_ROFst != null ? _ROFst.ROLookup : _ROFstInfo.ROLookup);
|
||||
// Use the ROID to get the value from the dictionary
|
||||
if (dicRos.Contains(ROID))
|
||||
if (dicRos.ContainsKey(ROID))
|
||||
{
|
||||
rochild rochld = (rochild)dicRos[ROID];
|
||||
return rochld;
|
||||
@ -162,7 +182,7 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
if (dicRosIntIDs == null) ParseIntoDictionary(_ROFst != null ? _ROFst.ROLookup : _ROFstInfo.ROLookup);
|
||||
// Use the id to get the value from the dictionary
|
||||
if (dicRosIntIDs.Contains(id))
|
||||
if (dicRosIntIDs.ContainsKey(id))
|
||||
{
|
||||
rochild rochld = (rochild)dicRosIntIDs[id];
|
||||
return rochld;
|
||||
@ -369,7 +389,7 @@ namespace VEPROMS.CSLA.Library
|
||||
tmp.appid = tmpg.appid;
|
||||
tmp.roid = TableID.ToString("X4") + tmp.ID.ToString("X8");
|
||||
dicRos.Add(tmp.roid, tmp);
|
||||
if (!dicRosIntIDs.Contains(tmp.ID)) dicRosIntIDs.Add(tmp.ID, tmp);
|
||||
if (!dicRosIntIDs.ContainsKey(tmp.ID)) dicRosIntIDs.Add(tmp.ID, tmp);
|
||||
int j;
|
||||
for (j = i - 1; j >= 0 && tmp.ID < myGrp.children[j].ID; j--)
|
||||
{
|
||||
@ -437,8 +457,8 @@ namespace VEPROMS.CSLA.Library
|
||||
|
||||
private void ParseIntoDictionary(byte[] ab)
|
||||
{
|
||||
if (dicRos == null) dicRos = new HybridDictionary();
|
||||
if (dicRosIntIDs == null) dicRosIntIDs = new HybridDictionary();
|
||||
if (dicRos == null) dicRos = new Dictionary<string, rochild>();
|
||||
if (dicRosIntIDs == null) dicRosIntIDs = new Dictionary<int, rochild>();
|
||||
|
||||
myHdr.hSize = BitConverter.ToInt32(ab, 0);
|
||||
myHdr.hYear = BitConverter.ToInt16(ab, 4);
|
||||
@ -477,7 +497,7 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
lstRoValues = new List<string>();
|
||||
DictROVar = new Dictionary<string, string>(); // set up a dictionary of RO defined Variables
|
||||
string tmp = ProcessRO(_DocVersionInfo.ProcessDocVersionSpecificInfo(roval), false);
|
||||
string tmp = _DocVersionInfo==null?roval:ProcessRO(_DocVersionInfo.ProcessDocVersionSpecificInfo(roval), false);
|
||||
if (lstRoValues.Count == 0) // was not a multiple return value
|
||||
lstRoValues.Add(tmp);
|
||||
return lstRoValues;
|
||||
|
@ -28,6 +28,17 @@ namespace VEPROMS.CSLA.Library
|
||||
Text = Text.Substring(0, g.Index) + transText + Text.Substring(g.Index + g.Length);
|
||||
}
|
||||
}
|
||||
public void FixContentText(RoUsageInfo rousg, string newvalue)
|
||||
{
|
||||
string lookFor = string.Format(@"<START\]\\v0 (.*?)\\v #Link:ReferencedObject:{0} .*?\[END>", rousg.ROUsageID);
|
||||
Match m = Regex.Match(Text, lookFor);
|
||||
if (m != null && m.Groups.Count > 1)
|
||||
{
|
||||
System.Text.RegularExpressions.Group g = m.Groups[1];
|
||||
if (g.ToString() != newvalue)
|
||||
Text = Text.Substring(0, g.Index) + newvalue + Text.Substring(g.Index + g.Length);
|
||||
}
|
||||
}
|
||||
}
|
||||
public partial class ContentInfo
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user