BTDB.IL.ILDynamicTypeDebugImpl.SelectSubsectionsToRemove C# (CSharp) Метод

SelectSubsectionsToRemove() статический приватный Метод

static private SelectSubsectionsToRemove ( string name, List sections, int needRemove ) : void
name string
sections List
needRemove int
Результат void
        static void SelectSubsectionsToRemove(string name, List<int> sections, int needRemove)
        {
            // subsections to remove mark as negative 0,0,|1,-2,2,2|7,-2,-2,2,|13,0
            var pos = sections.Count - 1;
            while (needRemove > 0)
            {
                var newPos = pos - sections[pos] - 2;
                for (var i = newPos + 2; i < pos; i++)
                {
                    if (sections[i] == 1)
                        continue;
                    needRemove -= sections[i];
                    sections[i] = -sections[i];
                    if (needRemove <= 0)
                        return;
                }
                if (newPos <=0)
                    throw new BTDBException($"Cannot shorten dynamic assembly path {name}.");
                pos = newPos;
            }
        }