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:
@@ -7,59 +7,32 @@ namespace DataLoader
|
||||
{
|
||||
public partial class Loader
|
||||
{
|
||||
public bool BuildScopeApplicability()
|
||||
public Dictionary<string, string> MyProcAPL;
|
||||
private static Dictionary<string, string> GetApple(string proc)
|
||||
{
|
||||
bool rv = false;
|
||||
//get scopes from proc.ini
|
||||
rv |= CreateScopes();
|
||||
//end get scopes from proc.ini
|
||||
//get apl dictionary
|
||||
Dictionary<string, Dictionary<string, string>> procAPLs = new Dictionary<string, Dictionary<string, string>>();
|
||||
string[] procs = Directory.GetFiles(frmMain.MySettings.ProcedureSetPath, "PROC*.APL");
|
||||
foreach (string proc in procs)
|
||||
Dictionary<string, string> procAPL = new Dictionary<string, string>();
|
||||
FileInfo myFile = new FileInfo(proc);
|
||||
FileStream fs = myFile.OpenRead();
|
||||
BinaryReader br = new BinaryReader(fs);
|
||||
byte[] myBuff = new byte[myFile.Length];
|
||||
br.Read(myBuff, 0, (int)myFile.Length);
|
||||
br.Close();
|
||||
fs.Close();
|
||||
int offset = 0;
|
||||
while (offset < myBuff.Length)
|
||||
{
|
||||
Dictionary<string, string> procAPL = new Dictionary<string, string>();
|
||||
FileInfo myFile = new FileInfo(proc);
|
||||
FileStream fs = myFile.OpenRead();
|
||||
BinaryReader br = new BinaryReader(fs);
|
||||
byte[] myBuff = new byte[myFile.Length];
|
||||
br.Read(myBuff, 0, (int)myFile.Length);
|
||||
br.Close();
|
||||
fs.Close();
|
||||
int offset = 0;
|
||||
while (offset < myBuff.Length)
|
||||
{
|
||||
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);
|
||||
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;
|
||||
}
|
||||
//end get apl dictionary
|
||||
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;
|
||||
return procAPL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user