public override short Initialize(string path) { string tmpFullPath = string.Format("{0}\\{1}", path, "wcctext2.dat"); ContentType = ContentTypes.TextBlocks; if (File.Exists(tmpFullPath) == true) { LogManager.Log("Loading {0} from {1}", ContentType.ToString(), tmpFullPath); FileName = BtrieveUtility.ConvertFileName(tmpFullPath); TextBlockType RecordData = new TextBlockType(); RecordSize = Marshal.SizeOf(RecordData); Status = BTRCALL(BtrieveTypes.BtrieveActionType.BOPEN, PositionBlock, ref RecordData, ref RecordSize, FileName, 0, 0); Status = BTRCALL(BtrieveTypes.BtrieveActionType.BGETFIRST, PositionBlock, ref RecordData, ref RecordSize, FileName, 0, 0); if (Status == BtrieveTypes.BtrieveStatus.COMPLETE_SUCCESSFULLY) { if (Contents.ContainsKey(RecordData.Number) == false) { Contents.Add(RecordData.Number, new Dictionary <short, TextBlockType>()); } Contents.Storage[RecordData.Number].Add(RecordData.PartNum, RecordData); } else { Console.WriteLine("Error: {0}", Status); } while (Status != BtrieveTypes.BtrieveStatus.END_OF_FILE) { Status = BTRCALL(BtrieveTypes.BtrieveActionType.BGETNEXT, PositionBlock, ref RecordData, ref RecordSize, FileName, 0, 0); if (Status == BtrieveTypes.BtrieveStatus.END_OF_FILE) { Status = (short)BtrieveTypes.BtrieveStatus.COMPLETE_SUCCESSFULLY; break; } if (Status == BtrieveTypes.BtrieveStatus.COMPLETE_SUCCESSFULLY) { if (Contents.ContainsKey(RecordData.Number) == false) { Contents.Add(RecordData.Number, new Dictionary <short, TextBlockType>()); } Contents.Storage[RecordData.Number].Add(RecordData.PartNum, RecordData); } else { Console.WriteLine("Error: {0}", Status); } } } else { LogManager.Log("Could not find file {0}", tmpFullPath); } LogManager.Log("Number of {0} loaded: {1}. Status = {2}", ContentType.ToString(), Count, BtrieveTypes.BtrieveErrorCode(Status)); return(Status); }
public override short Initialize(string path) { ContentType = Structures.ContentTypes.Gangs; string tmpFullPath = string.Format("{0}\\{1}", path, "wccgang2.dat"); if (File.Exists(tmpFullPath) == true) { LogManager.Log("Loading {0} from {1}", ContentType.ToString(), tmpFullPath); FileName = BtrieveUtility.ConvertFileName(tmpFullPath); GangType RecordData = new GangType(); RecordSize = Marshal.SizeOf(RecordData); Status = BTRCALL(BtrieveTypes.BtrieveActionType.BOPEN, PositionBlock, ref RecordData, ref RecordSize, FileName, 0, 0); Status = BTRCALL(BtrieveTypes.BtrieveActionType.BGETFIRST, PositionBlock, ref RecordData, ref RecordSize, FileName, 0, 0); if (Status == BtrieveTypes.BtrieveStatus.COMPLETE_SUCCESSFULLY) { Contents.Add(BtrieveUtility.ConvertToString(RecordData.KeyName), RecordData); } else { if (Status == BtrieveTypes.BtrieveStatus.END_OF_FILE) { return((short)BtrieveTypes.BtrieveStatus.COMPLETE_SUCCESSFULLY); } Console.WriteLine("Error: {0}", Status); } while (Status != BtrieveTypes.BtrieveStatus.END_OF_FILE) { Status = BTRCALL(BtrieveTypes.BtrieveActionType.BGETNEXT, PositionBlock, ref RecordData, ref RecordSize, FileName, 0, 0); if (Status == BtrieveTypes.BtrieveStatus.END_OF_FILE) { Status = (short)BtrieveTypes.BtrieveStatus.COMPLETE_SUCCESSFULLY; break; } if (Status == BtrieveTypes.BtrieveStatus.COMPLETE_SUCCESSFULLY) { Contents.Add(BtrieveUtility.ConvertToString(RecordData.KeyName), RecordData); } else { Console.WriteLine("Error: {0}", Status); } } } else { LogManager.Log("Could not find file {0}", tmpFullPath); } LogManager.Log("Number of {0} loaded: {1}. Status = {2}", ContentType.ToString(), Count, BtrieveTypes.BtrieveErrorCode(Status)); return(Status); }