Ok, here is the output:
BTW/ if I'm right on this you owe me a "telling everyone you know about my
blog" !!!
![Blush :o :o](/styles/default/custom/smilies/blush.gif)
p
Your input data?
receiveDate: 03/12/2010
jobName: BJK
contractor: David Construction
assignDate: 03/12/2010
detailerName: Ron
receiveDate: 03/11/2010
jobName: MUTC Cave
contractor: AML
assignDate: 03/11/2010
detailerName: Ron
receiveDate: 03/11/2010
jobName: Steindam Apartments - Fort Knox
contractor: Roederer Construction
assignDate: 03/11/2010
detailerName: Ron
receiveDate: 03/10/2010
jobName: Camp Piomingo
contractor: David Construction
assignDate: 03/10/2010
detailerName: Ron
receiveDate: 03/10/2010
jobName: Caldwell E-6953 Independence Kansas
contractor: Caldwell
assignDate: 03/11/2010
detailerName: Ron
receiveDate: 03/08/2010
jobName: Dollar General English, In
contractor: Sprigler
assignDate: 03/09/2010
detailerName: Ron
receiveDate: 03/05/2010
jobName: Glassworks Garage
contractor: Bosse-Mattingly
assignDate: 03/11/2010
detailerName: Ron
receiveDate: 03/05/2010
jobName: Clay Commons
contractor: Bosse-Mattingly
assignDate: 03/11/2010
detailerName: Ron
receiveDate: 03/04/2010
jobName: Norton Cancer
contractor: Sullivan & Cozart
assignDate: 03/04/2010
detailerName: John
receiveDate: 03/03/2010
jobName: E.W. Brown LG&E
contractor: Kelsey
assignDate: 03/03/2010
detailerName: Ron
receiveDate: 03/02/2010
jobName: Scottsburg TIE Center
contractor: Broughton
assignDate: 03/10/2010
detailerName: John
receiveDate: 03/02/2010
jobName: Ft. Knox
contractor: Kelsey
assignDate: 03/04/2010
detailerName: Ron
receiveDate: 03/01/2010
jobName: Taffel
contractor: E&W
assignDate: 03/01/2010
detailerName: Ron
receiveDate: 03/01/2010
jobName: Wendy's Clarksville, Tn
contractor: Castlewood
assignDate: 03/01/2010
detailerName: Ron
receiveDate: 02/26/2010
jobName: Mammoth Cave
contractor: Howard Pence
assignDate: 03/01/2010
detailerName: Ron
receiveDate: 02/24/2010
jobName: Kohl's
contractor: AML
assignDate: 02/24/2010
detailerName: Ron / John
receiveDate: 02/22/2010
jobName: GENENTECH
contractor: Parco
assignDate: 02/23/2010
detailerName: Ron
receiveDate: 02/19/2010
jobName: E.W.BROWN GYPSUM-MERCER CO.
contractor: Evans Const/Kelsey Const
assignDate: 02/19/2010
detailerName: Ron
receiveDate: 02/17/2010
jobName: CALDWELL TANK 1,000,000 GAL.FDN E-6984 ELKHART,IND
contractor: Caldwell Tanks
assignDate: 02/19/2010
detailerName: Don
receiveDate: 02/16/2010
jobName: DECO-NEW PRESS
contractor: Sullivan & Cozart
assignDate: 02/17/2010
detailerName: Don
receiveDate: 02/08/2010
jobName: CALDWELL TANK 750,000 GAL DOME E-6950 SANGAMON CO.,ILL
contractor: Caldwell Tanks
assignDate: 02/10/2010
detailerName: Don
receiveDate: 01/26/2010
jobName: KY. TRAILER
contractor: Parco
assignDate: 01/26/2010
detailerName: Don
receiveDate: 01/22/2010
jobName: FIELD ELEM.SCHOOL-MECH.VAULT REPAIR
contractor: David Const.
assignDate: 01/25/2010
detailerName: Don
receiveDate: 01/13/2010
jobName: PIOMINGO POOL HOUSE
contractor: David Const.
assignDate: 01/14/2010
detailerName: Ron
receiveDate: 01/11/2010
jobName: KENTUCKY EXPO HORSE BARNS
contractor: Parco
assignDate: 01/11/2010
detailerName: Don
receiveDate: 01/11/2010
jobName: WESTPORT RD. CHURCH of CHRIT
contractor: A M L Construction
assignDate: 01/19/2010
detailerName: Ron
receiveDate: 01/08/2010
jobName: ESSROC MISC.-SELLERSBURG
contractor: Huelsman-Sweeney Const.
assignDate: 01/08/2010
detailerName: Don
receiveDate: 01/05/2010
jobName: CALDWELL TANK 1,000,000 GAL,DOME E-6948 ADAIR CO.,KY.
contractor: Caldwell Tanks
assignDate: 01/06/2010
detailerName: Don
If so, the format was, first byte is the length of the data ... Then you
read the maximum field length (from your first post). Then you convert to
ASCII the result of that (but only convert the length of the data, given by
the first byte) ... Then repeat...
!!!DISCLAIMER!!!
This code is a 5 minute hack up, it's not my best but it demonstrates what I
did...
static void Main(string[] args)
{
var base64 = "<base64 data you posted>";
var rawData = Convert.FromBase64String(base64);
var stream = new MemoryStream(rawData);
while (true)
{
var receiveDate = GetBlock(stream, 10);
var jobName = GetBlock(stream, 150);
var contractor = GetBlock(stream, 100);
var assignDate = GetBlock(stream, 10);
var detailerName = GetBlock(stream, 30);
if (detailerName == null) break;
Console.WriteLine("receiveDate: {0}", receiveDate);
Console.WriteLine("jobName: {0}", jobName);
Console.WriteLine("contractor: {0}", contractor);
Console.WriteLine("assignDate: {0}", assignDate);
Console.WriteLine("detailerName: {0}", detailerName);
Console.WriteLine();
}
Console.ReadLine();
}
private static string GetBlock(Stream stream, int maxSize)
{
var buffer = new byte[maxSize];
stream.Read(buffer, 0, 1); // first byte is the size
var size = buffer[0];
var length = stream.Read(buffer, 0, maxSize); // read the entire field
length
if (length == 0) return null; // nothing returned
return Encoding.ASCII.GetString(buffer, 0, size); // return the ASCII
string
}