public int GetModuleNum() { BarCharEnumerator enumerator = this.EnumerateBars(); Bars bars = new Bars(); CharDef charDefBuffer = new CharDef(); if (!enumerator.NextBars(bars, charDefBuffer)) { return(0); } while (enumerator.NextBars(bars, charDefBuffer)) { } return((bars.GetOffset() + bars.GetWidth()) + (this._spec.bdRightMargin * this._spec.bdBarExt[0])); }
internal BarEnumerator(Barcode barcode, int iModuleWidth) { this._symbol = barcode._symbol; this._iModuleWidth = iModuleWidth; this._more = false; this._bEnumStart = true; this._bars = new Bars(); this._charDefBuffer = new CharDef(); this._bcenum = this._symbol.EnumerateBars(); this._anmBarWidth = new int[5]; this._anmSpaceWidth = new int[5]; this._symbol.GetBarExts(this._anmBarWidth, 5); this._symbol.GetSpaceExts(this._anmSpaceWidth, 5); this._currentValid = false; }
public bool MoveNext() { int num; int num4; int num5; int num6; uint num8; BarcodeType bdType = this._symbol._spec.bdType; uint style = this._symbol.GetStyle(); if (this._bEnumStart) { this._bEnumStart = false; this._more = this._bcenum.NextBars(this._bars, this._charDefBuffer); num = this._bars.GetCharDef().BCGETNUMSTRIPE(); this._iBarInd = num - 1; this._nmWth = 0; } else { if (!this._more) { this._currentValid = false; return(false); } if (this._iBarInd == -1) { this._more = this._bcenum.NextBars(this._bars, this._charDefBuffer); if (!this._more) { this._currentValid = false; return(false); } num = this._bars.GetCharDef().BCGETNUMSTRIPE(); this._iBarInd = num - 1; this._nmWth = 0; } } while (true) { int index = 0; num4 = -1; num5 = 0; num6 = this._iBarInd; while (num6 >= 0) { uint uStripe = this._bars.GetCharDef().BCGETSTRIPE(num6); if (CharDef.BCSTRIPEISBAR(uStripe)) { index = CharDef.BCSTRIPEWTHIND(uStripe); if (num4 == -1) { num4 = this._nmWth; } if ((style & 0x10000) != null) { this._nmWth += this._anmBarWidth[0]; } else { this._nmWth += this._anmBarWidth[index]; } if (num6 == 0) { num5 = this._nmWth - num4; } } else { if (num4 != -1) { num5 = this._nmWth - num4; } if ((style & 0x10000) != null) { this._nmWth += this._anmSpaceWidth[0]; } else { this._nmWth += this._anmSpaceWidth[CharDef.BCSTRIPEWTHIND(uStripe)]; } } if (num5 > 0) { num8 = this._bars.GetStyle(); if ((style & 0x10000) != null) { BarcodeType type2 = bdType; if ((type2 != BarcodeType.POSTNET) && (type2 != BarcodeType.PLANET)) { if (bdType == BarcodeType.ROYALMAIL) { switch (index) { case 1: num8 |= 0x20; break; case 2: num8 |= 0x40; break; case 3: num8 |= 0x10; break; } } } else if (index == 1) { num8 |= 0x10; } } break; } num6--; } this._more = this._bcenum.NextBars(this._bars, this._charDefBuffer); if (!this._more) { this._currentValid = false; return(false); } num = this._bars.GetCharDef().BCGETNUMSTRIPE(); this._iBarInd = num - 1; this._nmWth = 0; } BarcodeBarStyles styles = 0; if ((num8 & 8) != null) { styles |= BarcodeBarStyles.AddOnBar; } if ((num8 & 0x10) != null) { styles |= BarcodeBarStyles.LongBar; } if ((num8 & 0x20) != null) { styles |= BarcodeBarStyles.LowerBar; } if ((num8 & 0x40) != null) { styles |= BarcodeBarStyles.HigherBar; } this._current = new Bar((this._bars.GetOffset() + num4) * this._iModuleWidth, num5 * this._iModuleWidth, styles); this._iBarInd = num6 - 1; this._currentValid = true; return(true); }