Beispiel #1
0
        internal static bool TryConstruct(cSequenceSets pSequenceSets, int pAsterisk, bool pDistinct, out cUIntList rResult)
        {
            if (pSequenceSets == null)
            {
                throw new ArgumentNullException(nameof(pSequenceSets));
            }

            rResult = new cUIntList();

            foreach (var lSequenceSet in pSequenceSets)
            {
                if (lSequenceSet == null)
                {
                    return(false);
                }
                if (!ZExpand(lSequenceSet, pAsterisk, out var lResult))
                {
                    return(false);
                }
                rResult.AddRange(lResult);
            }

            if (pDistinct)
            {
                rResult = new cUIntList(rResult.Distinct());
            }
            return(true);
        }
                public override eProcessDataResult ProcessData(cBytesCursor pCursor, cTrace.cContext pParentContext)
                {
                    var lContext = pParentContext.NewMethod(nameof(cCommandHookBaseSearch), nameof(ProcessData));

                    if (!pCursor.SkipBytes(kSearch))
                    {
                        return(eProcessDataResult.notprocessed);
                    }

                    cUIntList lMSNs = new cUIntList();

                    while (true)
                    {
                        if (!pCursor.SkipByte(cASCII.SPACE))
                        {
                            break;
                        }

                        if (!pCursor.GetNZNumber(out _, out var lMSN))
                        {
                            lContext.TraceWarning("likely malformed search: not an nz-number list?");
                            return(eProcessDataResult.notprocessed);
                        }

                        lMSNs.Add(lMSN);
                    }

                    if (!pCursor.Position.AtEnd)
                    {
                        lContext.TraceWarning("likely malformed search: not at end?");
                        return(eProcessDataResult.notprocessed);
                    }

                    if (mMSNs == null)
                    {
                        mMSNs = lMSNs;
                    }
                    else
                    {
                        mMSNs.AddRange(lMSNs);
                    }

                    return(eProcessDataResult.processed);
                }