Added code to support processing Calvert Cliffs data regarding node names
Added code to support processing BG&E data regarding node names Added code to correct 16-bit applicability conversion to 32-bit applicability
This commit is contained in:
parent
156d4b32ba
commit
8810301dde
@ -64,12 +64,48 @@ namespace DataLoader
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
XmlAttribute xa = nxml.Attributes.Append(xmldoc.CreateAttribute(aname.Replace(' ', '_')));
|
XmlAttribute xa = nxml.Attributes.Append(xmldoc.CreateAttribute(aname.Replace(' ', '_')));
|
||||||
|
//added by jcb 20131216
|
||||||
|
//aname = SanitizeXmlString(aname);
|
||||||
|
//XmlAttribute xa = nxml.Attributes.Append(xmldoc.CreateAttribute(aname));
|
||||||
|
//end added by jcb 20131216
|
||||||
xa.Value = avalue;
|
xa.Value = avalue;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//added by jcb 20131216
|
||||||
|
public string SanitizeXmlString(string xml)
|
||||||
|
{
|
||||||
|
if (xml == null)
|
||||||
|
throw new ArgumentNullException("xml");
|
||||||
|
xml = xml.Replace(' ', '_').Replace("/", "_fslash_").Replace("(", "_lparen_").Replace((char)0xA0, '_').Replace((char)0x20, '_').Replace(":", "_colon_");
|
||||||
|
StringBuilder buffer = new StringBuilder(xml.Length);
|
||||||
|
foreach (char c in xml)
|
||||||
|
{
|
||||||
|
if (IsLegalXmlChar(c))
|
||||||
|
buffer.Append(c);
|
||||||
|
}
|
||||||
|
return buffer.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether a given character is allowed by XML 1.0.
|
||||||
|
/// </summary>
|
||||||
|
public bool IsLegalXmlChar(int character)
|
||||||
|
{
|
||||||
|
return
|
||||||
|
(
|
||||||
|
character == 0x9 /* == '\t' == 9 */ ||
|
||||||
|
character == 0xA /* == '\n' == 10 */ ||
|
||||||
|
character == 0xD /* == '\r' == 13 */ ||
|
||||||
|
(character >= 0x20 && character <= 0xD7FF) ||
|
||||||
|
(character >= 0xE000 && character <= 0xFFFD) ||
|
||||||
|
(character >= 0x10000 && character <= 0x10FFFF)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
//end added by jcb 20131216
|
||||||
|
|
||||||
public int ItemCount
|
public int ItemCount
|
||||||
{
|
{
|
||||||
get { return xmldoc.DocumentElement.ChildNodes.Count; }
|
get { return xmldoc.DocumentElement.ChildNodes.Count; }
|
||||||
|
@ -612,21 +612,22 @@ namespace DataLoader
|
|||||||
if (cont != null)
|
if (cont != null)
|
||||||
{
|
{
|
||||||
// ContentsParts.Add can use 'fromtype', item - fromtype here = 2, section
|
// ContentsParts.Add can use 'fromtype', item - fromtype here = 2, section
|
||||||
if (cont.ContentParts.Contains(2))
|
AddPartRecursive(cont, 2, secitem);
|
||||||
{
|
//if (cont.ContentParts.Contains(2))
|
||||||
foreach (ContentPart part in cont.ContentParts)
|
//{
|
||||||
{
|
// foreach (ContentPart part in cont.ContentParts)
|
||||||
if (part.FromType == 2)
|
// {
|
||||||
{
|
// if (part.FromType == 2)
|
||||||
Item ii = Item.Get(part.ItemID);
|
// {
|
||||||
ii.MyContent.ContentParts.Add(2, secitem);
|
// Item ii = Item.Get(part.ItemID);
|
||||||
ii.Save();
|
// ii.MyContent.ContentParts.Add(2, secitem);
|
||||||
break;
|
// ii.Save();
|
||||||
}
|
// break;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
else
|
//}
|
||||||
cont.ContentParts.Add(2, secitem);
|
//else
|
||||||
|
// cont.ContentParts.Add(2, secitem);
|
||||||
if (cont.MyZContent.OldStepSequence == null || cont.MyZContent.OldStepSequence == "") cont.MyZContent.OldStepSequence = ProcNumber;
|
if (cont.MyZContent.OldStepSequence == null || cont.MyZContent.OldStepSequence == "") cont.MyZContent.OldStepSequence = ProcNumber;
|
||||||
if (!cont.IsSavable) ErrorRpt.ErrorReport(cont);
|
if (!cont.IsSavable) ErrorRpt.ErrorReport(cont);
|
||||||
cont.Save();
|
cont.Save();
|
||||||
@ -669,7 +670,7 @@ namespace DataLoader
|
|||||||
// 5 = RNO
|
// 5 = RNO
|
||||||
// 6 = step
|
// 6 = step
|
||||||
// 7 = table
|
// 7 = table
|
||||||
|
//isautogen = false; //needed for bge
|
||||||
if (!isautogen)
|
if (!isautogen)
|
||||||
{
|
{
|
||||||
// Process the Data Table - First look for High Level Steps
|
// Process the Data Table - First look for High Level Steps
|
||||||
@ -700,13 +701,48 @@ namespace DataLoader
|
|||||||
return secitem;
|
return secitem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void AddPartRecursive(Content cont, int fromType, Item secitem)
|
||||||
|
{
|
||||||
|
if (cont.ContentParts.Contains(fromType))
|
||||||
|
{
|
||||||
|
foreach (ContentPart part in cont.ContentParts)
|
||||||
|
{
|
||||||
|
if (part.FromType == fromType)
|
||||||
|
{
|
||||||
|
Item ii = Item.Get(part.ItemID);
|
||||||
|
AddPartRecursive(ii.MyContent, fromType, secitem);
|
||||||
|
ii.Save();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
cont.ContentParts.Add(fromType, secitem);
|
||||||
|
}
|
||||||
|
private static Dictionary<string, string> ApplesToOranges;
|
||||||
|
private static void ResetApplesToOranges()
|
||||||
|
{
|
||||||
|
ApplesToOranges = new Dictionary<string, string>();
|
||||||
|
}
|
||||||
private string AddApplicability(string recnum)
|
private string AddApplicability(string recnum)
|
||||||
{
|
{
|
||||||
//if (recnum == "00002491")
|
|
||||||
// System.Threading.Thread.Sleep(1000);
|
|
||||||
if (!MyProcAPL.ContainsKey(recnum))
|
if (!MyProcAPL.ContainsKey(recnum))
|
||||||
return null;
|
return null;
|
||||||
string apple = MyProcAPL[recnum];
|
string apple = MyProcAPL[recnum];
|
||||||
|
return LookupOrange(apple);
|
||||||
|
|
||||||
|
}
|
||||||
|
private string LookupOrange(string apple)
|
||||||
|
{
|
||||||
|
if (!ApplesToOranges.ContainsKey(apple))
|
||||||
|
{
|
||||||
|
ApplesToOranges.Add(apple, AddApplicability1(apple));
|
||||||
|
Console.WriteLine("Apple: '{0}' - Orange: '{1}'", apple, ApplesToOranges[apple]);
|
||||||
|
}
|
||||||
|
return ApplesToOranges[apple];
|
||||||
|
}
|
||||||
|
private string AddApplicability1(string apple)
|
||||||
|
{
|
||||||
if (apple == "40000000")
|
if (apple == "40000000")
|
||||||
return "0";
|
return "0";
|
||||||
UInt32 mask = 0;
|
UInt32 mask = 0;
|
||||||
@ -714,9 +750,11 @@ namespace DataLoader
|
|||||||
mask |= (uint)(1 << (i - 1));
|
mask |= (uint)(1 << (i - 1));
|
||||||
UInt32 val = UInt32.Parse(apple, System.Globalization.NumberStyles.HexNumber);
|
UInt32 val = UInt32.Parse(apple, System.Globalization.NumberStyles.HexNumber);
|
||||||
//UInt32 val = UInt32.Parse(apple);
|
//UInt32 val = UInt32.Parse(apple);
|
||||||
val &= mask;
|
|
||||||
if (val == 0)
|
if (val == 0)
|
||||||
return null;
|
return null;
|
||||||
|
val &= mask;
|
||||||
|
if (val == 0)
|
||||||
|
return "0";
|
||||||
if (val == mask)
|
if (val == mask)
|
||||||
return null;
|
return null;
|
||||||
int j = 1;
|
int j = 1;
|
||||||
@ -733,7 +771,6 @@ namespace DataLoader
|
|||||||
val = val >> 1;
|
val = val >> 1;
|
||||||
}
|
}
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
|
|
||||||
}
|
}
|
||||||
private void LoadSection(DataSet ds, OleDbDataAdapter da, string FileName)
|
private void LoadSection(DataSet ds, OleDbDataAdapter da, string FileName)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user