public long RemoveBlockAt(int position) { if (count == 0 || position < 0 || position >= bytes.Count) { return(0); } long removedLength = bytes[position].LongLength; var tmp = bytes[position]; bytes.RemoveAt(position); BytesBuilder.BytesToNull(tmp); count -= removedLength; return(removedLength); }
public long RemoveLastBlock() { if (count == 0) { return(0); } long removedLength = bytes[bytes.Count - 1].LongLength; var tmp = bytes[bytes.Count - 1]; bytes.RemoveAt(bytes.Count - 1); BytesBuilder.BytesToNull(tmp); count -= removedLength; return(removedLength); }
public long RemoveBlocks(int position, int endPosition) { if (count == 0 || position < 0 || position >= bytes.Count || position > endPosition || endPosition >= bytes.Count) { return(0); } long removedLength = 0; for (int i = position; i <= endPosition; i++) { var tmp = bytes[position]; removedLength += RemoveBlockAt(position); BytesBuilder.BytesToNull(tmp); } return(removedLength); }