/// <summary> /// Fetches the index of the recordset. /// </summary> /// <param name="part">The part.</param> /// <param name="entry">The entry.</param> /// <param name="isFramed"></param> /// <returns></returns> public int FetchRecordsetIndex(IIntellisenseResult part, IBinaryDataListEntry entry, bool isFramed) { // figure out the index type ;) enRecordsetIndexType idxType = DataListUtil.GetRecordsetIndexTypeRaw(part.Option.RecordsetIndex); int result = 1; if (idxType == enRecordsetIndexType.Numeric) { // fix index insert ;) if (!Int32.TryParse(part.Option.RecordsetIndex, out result)) { result = -1; } } else if (idxType == enRecordsetIndexType.Blank) { // append mode if (!_recordsetAppendIndexs.TryGetValue(part.Option.Recordset, out result)) { if (entry != null) { result = entry.FetchAppendRecordsetIndex(); _recordsetAppendIndexs[part.Option.Recordset] = result; // stash in cache } } // Assign behavior ;) if (!isFramed) { // duplicate match ;) if (nonFramedTokens.Contains(part)) { // reset the framing ;) nonFramedTokens.Clear(); nonFramedTokens.Add(part); // inc this index ;) _recordsetAppendIndexs[part.Option.Recordset]++; result++; } else { // current append indexes are alright ;) nonFramedTokens.Add(part); } } } else if (idxType == enRecordsetIndexType.Star) { // overwrite mode from idx 1 if (!_recordsetOverwriteIndexs.TryGetValue(part.Option.Recordset, out result)) { result = 1; _recordsetOverwriteIndexs[part.Option.Recordset] = result; } } return(result); }
/// <summary> /// Fetches the index of the recordset. /// </summary> /// <param name="part">The part.</param> /// <param name="entry">The entry.</param> /// <param name="isFramed"></param> /// <returns></returns> public int FetchRecordsetIndex(IIntellisenseResult part, IBinaryDataListEntry entry, bool isFramed) { // figure out the index type ;) enRecordsetIndexType idxType = DataListUtil.GetRecordsetIndexTypeRaw(part.Option.RecordsetIndex); int result = 1; if(idxType == enRecordsetIndexType.Numeric) { // fix index insert ;) if(!Int32.TryParse(part.Option.RecordsetIndex, out result)) { result = -1; } } else if(idxType == enRecordsetIndexType.Blank) { // append mode if(!_recordsetAppendIndexs.TryGetValue(part.Option.Recordset, out result)) { if(entry != null) { result = entry.FetchAppendRecordsetIndex(); _recordsetAppendIndexs[part.Option.Recordset] = result; // stash in cache } } // Assign behavior ;) if(!isFramed) { // duplicate match ;) if(nonFramedTokens.Contains(part)) { // reset the framing ;) nonFramedTokens.Clear(); nonFramedTokens.Add(part); // inc this index ;) _recordsetAppendIndexs[part.Option.Recordset]++; result++; } else { // current append indexes are alright ;) nonFramedTokens.Add(part); } } } else if(idxType == enRecordsetIndexType.Star) { // overwrite mode from idx 1 if(!_recordsetOverwriteIndexs.TryGetValue(part.Option.Recordset, out result)) { result = 1; _recordsetOverwriteIndexs[part.Option.Recordset] = result; } } return result; }