41 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			41 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
using System;
 | 
						|
using System.Collections.Generic;
 | 
						|
using System.Text;
 | 
						|
using System.IO;
 | 
						|
 | 
						|
namespace DataLoader
 | 
						|
{
 | 
						|
	public partial class Loader
 | 
						|
	{
 | 
						|
		public Dictionary<string, string> MyProcAPL;
 | 
						|
		private static Dictionary<string, string> GetApple(string proc)
 | 
						|
		{
 | 
						|
			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);
 | 
						|
				//if ((myFile.Name.ToUpper() == "PROC000.APL" && (recnum == "00002491")))
 | 
						|
				//  System.Threading.Thread.Sleep(1000);
 | 
						|
				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;
 | 
						|
			}
 | 
						|
			return procAPL;
 | 
						|
		}
 | 
						|
	}
 | 
						|
}
 |