Changed how Loader class processes 16-bit APL files
Added ReviewDate property to ProcInfo class Changed how RevDate and ReviewDate values obtained from 16-bit data Added AddSlaveNode and AddSlaveItem methods to ConfigInfo class Added validity check to verify Procedure Set Path and Process Only In Location are in synch
This commit is contained in:
parent
44396a7200
commit
03d49ce2df
@ -7,59 +7,32 @@ namespace DataLoader
|
|||||||
{
|
{
|
||||||
public partial class Loader
|
public partial class Loader
|
||||||
{
|
{
|
||||||
public bool BuildScopeApplicability()
|
public Dictionary<string, string> MyProcAPL;
|
||||||
|
private static Dictionary<string, string> GetApple(string proc)
|
||||||
{
|
{
|
||||||
bool rv = false;
|
Dictionary<string, string> procAPL = new Dictionary<string, string>();
|
||||||
//get scopes from proc.ini
|
FileInfo myFile = new FileInfo(proc);
|
||||||
rv |= CreateScopes();
|
FileStream fs = myFile.OpenRead();
|
||||||
//end get scopes from proc.ini
|
BinaryReader br = new BinaryReader(fs);
|
||||||
//get apl dictionary
|
byte[] myBuff = new byte[myFile.Length];
|
||||||
Dictionary<string, Dictionary<string, string>> procAPLs = new Dictionary<string, Dictionary<string, string>>();
|
br.Read(myBuff, 0, (int)myFile.Length);
|
||||||
string[] procs = Directory.GetFiles(frmMain.MySettings.ProcedureSetPath, "PROC*.APL");
|
br.Close();
|
||||||
foreach (string proc in procs)
|
fs.Close();
|
||||||
|
int offset = 0;
|
||||||
|
while (offset < myBuff.Length)
|
||||||
{
|
{
|
||||||
Dictionary<string, string> procAPL = new Dictionary<string, string>();
|
string recnum = Encoding.Default.GetString(myBuff, offset, 8);
|
||||||
FileInfo myFile = new FileInfo(proc);
|
int applicability = BitConverter.ToInt32(myBuff, offset + 8);
|
||||||
FileStream fs = myFile.OpenRead();
|
string applicabilityToStr = string.Format("{0:X8}", applicability);
|
||||||
BinaryReader br = new BinaryReader(fs);
|
//4294967296
|
||||||
byte[] myBuff = new byte[myFile.Length];
|
if (!procAPL.ContainsKey(recnum))
|
||||||
br.Read(myBuff, 0, (int)myFile.Length);
|
procAPL.Add(recnum, applicabilityToStr);
|
||||||
br.Close();
|
else
|
||||||
fs.Close();
|
if (procAPL[recnum] != applicabilityToStr)
|
||||||
int offset = 0;
|
procAPL[recnum] = applicabilityToStr;
|
||||||
while (offset < myBuff.Length)
|
offset += 12;
|
||||||
{
|
|
||||||
string recnum = Encoding.Default.GetString(myBuff, offset, 8);
|
|
||||||
int applicability = BitConverter.ToInt32(myBuff, offset + 8);
|
|
||||||
string applicabilityToStr = string.Format("{0:X8}", applicability);
|
|
||||||
//4294967296
|
|
||||||
if (!procAPL.ContainsKey(recnum))
|
|
||||||
procAPL.Add(recnum, applicabilityToStr);
|
|
||||||
else
|
|
||||||
if (procAPL[recnum] != applicabilityToStr)
|
|
||||||
procAPL[recnum] = applicabilityToStr;
|
|
||||||
offset += 12;
|
|
||||||
}
|
|
||||||
procAPLs.Add(proc, procAPL);
|
|
||||||
}
|
}
|
||||||
//end get apl dictionary
|
return procAPL;
|
||||||
rv = true;
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool CreateScopes()
|
|
||||||
{
|
|
||||||
string iniFile = string.Format(@"{0}\PROC.ini", frmMain.MySettings.ProcedureSetPath);
|
|
||||||
TextReader tr = File.OpenText(iniFile);
|
|
||||||
string line = string.Empty;
|
|
||||||
while (!line.StartsWith("Name="))
|
|
||||||
line = tr.ReadLine();
|
|
||||||
tr.Close();
|
|
||||||
string[] parts = line.Split('=');
|
|
||||||
string[] scopes = parts[1].Split(',');
|
|
||||||
foreach (string scope in scopes)
|
|
||||||
Console.WriteLine(scope);
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -377,6 +377,12 @@ namespace DataLoader
|
|||||||
get { return _RevDate; }
|
get { return _RevDate; }
|
||||||
set { _RevDate = value; }
|
set { _RevDate = value; }
|
||||||
}
|
}
|
||||||
|
private string _ReviewDate;
|
||||||
|
public string ReviewDate
|
||||||
|
{
|
||||||
|
get { return _ReviewDate; }
|
||||||
|
set { _ReviewDate = value; }
|
||||||
|
}
|
||||||
public ProcInfo(DataRow dr, string afpath)
|
public ProcInfo(DataRow dr, string afpath)
|
||||||
{
|
{
|
||||||
Number = dr["NUMBER"].ToString();
|
Number = dr["NUMBER"].ToString();
|
||||||
@ -396,9 +402,8 @@ namespace DataLoader
|
|||||||
if (fis.Count > 0)
|
if (fis.Count > 0)
|
||||||
{
|
{
|
||||||
Rev = fis[0].Rev;
|
Rev = fis[0].Rev;
|
||||||
// the following line needs fixed, i.e. should the date come from the set file or
|
RevDate = fis[0].RevDate ?? GetDBFRevDate(afpath);
|
||||||
// the datetime stamp of dbf (GetDBFRevDate):
|
ReviewDate = fis[0].ReviewDate;
|
||||||
//RevDate = fis[0].RevDate ?? GetDBFRevDate(afpath);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public System.DateTime GetDTS(string date, string time)
|
public System.DateTime GetDTS(string date, string time)
|
||||||
|
@ -80,6 +80,30 @@ namespace DataLoader
|
|||||||
if (xmldoc != null) return xmldoc.InnerXml;
|
if (xmldoc != null) return xmldoc.InnerXml;
|
||||||
else return null;
|
else return null;
|
||||||
}
|
}
|
||||||
|
public void AddSlaveNode(int index)
|
||||||
|
{
|
||||||
|
XmlElement slaves = xmldoc.SelectSingleNode("Config/Slaves") as XmlElement;
|
||||||
|
if (slaves == null)
|
||||||
|
{
|
||||||
|
slaves = xmldoc.CreateElement("Slaves");
|
||||||
|
xmldoc.DocumentElement.AppendChild(slaves);
|
||||||
|
}
|
||||||
|
XmlElement slave = xmldoc.CreateElement("Slave");
|
||||||
|
XmlAttribute xa = xmldoc.CreateAttribute("index");
|
||||||
|
xa.InnerText = index.ToString();
|
||||||
|
slave.Attributes.Append(xa);
|
||||||
|
slaves.AppendChild(slave);
|
||||||
|
}
|
||||||
|
public void AddSlaveItem(int index, string aname, string avalue)
|
||||||
|
{
|
||||||
|
string srch = "Config/Slaves/Slave[@index='" + index.ToString() + "']";
|
||||||
|
XmlElement slave = xmldoc.SelectSingleNode(srch) as XmlElement;
|
||||||
|
if (slave != null)
|
||||||
|
{
|
||||||
|
XmlAttribute xa = xmldoc.CreateAttribute(aname);
|
||||||
|
xa.InnerText = avalue;
|
||||||
|
slave.Attributes.Append(xa);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -320,6 +320,14 @@ namespace DataLoader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//added by jcb 20121127
|
||||||
|
//check is ProcedureSetPath contains ProcessOnlyInLocation
|
||||||
|
if (ProcedureSetPath.StartsWith(ProcessOnlyInLocation) == false)
|
||||||
|
{
|
||||||
|
sb.Append(ErrorPrefix + "Check Process Only In Location value is pointing to similar directory as Procedure Set Path\r\n");
|
||||||
|
ErrorPrefix = "";
|
||||||
|
}
|
||||||
|
//end added by jcb 20121127
|
||||||
// BackupFileName = Has to be non-blank
|
// BackupFileName = Has to be non-blank
|
||||||
if ((BackupFileName ?? "") == "")
|
if ((BackupFileName ?? "") == "")
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user