Exemple #1
0
        protected void RenameDefinition(Definitions.IDefinition u)
        {
            switch (u)
            {
            case Definitions.MacroDefinition m: RenameMacro(m); break;

            case Definitions.EnumDefinition e: RenameEnum(e); break;

            case Definitions.StructDefinition s: RenameStruct(s); break;

            case Definitions.FunctionDefinition f: RenameFunction(f); break;

            case Definitions.DelegateDefinition d: RenameDelegate(d); break;

            case Definitions.FixedArrayDefinition fa: RenameFixedArray(fa); break;
            }
        }
Exemple #2
0
        protected virtual void Visit(Definitions.IDefinition definition)
        {
            switch (definition)
            {
            case Definitions.MacroDefinition m: VisitMacro(m); break;

            case Definitions.EnumDefinition e: VisitEnum(e); break;

            case Definitions.StructDefinition s: VisitStruct(s); break;

            case Definitions.FunctionDefinition f: VisitFunction(f); break;

            case Definitions.DelegateDefinition d: VisitDelegate(d); break;

            case Definitions.TypeDefinition t: VisitType(t); break;

            case Definitions.FixedArrayDefinition fa: VisitFixedArray(fa); break;
            }
        }
Exemple #3
0
        public object Create(string value, Definitions.IDefinition definition)
        {
            _renderer.Settings = Settings.Copy();
            definition.TransformSettings(_renderer.Settings);

            if (!definition.IsDataValid(value))
            {
                throw new BarcodeException();
            }

            var codes = definition.GetCodes(value);
            var dt    = definition.GetDisplayText(value);

            if (definition.IsChecksumRequired || _renderer.Settings.IsChecksumCalculated)
            {
                dt = definition.AddChecksum(dt, codes);
            }

            _renderer.Definition = definition;

            return(_renderer.Render(codes, dt));
        }
Exemple #4
0
        public virtual Definitions.IDefinition GetDefinition(BarcodeFormats format)
        {
            if (_cache.ContainsKey(format))
            {
                return(_cache[format]);
            }

            Definitions.IDefinition result = null;
            switch (format)
            {
            case BarcodeFormats.Code3of9:
                result = Locator.Get <Definitions.Single.Code3of9>();
                break;

            case BarcodeFormats.Code128:
                break;

            case BarcodeFormats.Codabar:
                result = Locator.Get <Definitions.Single.Codabar>();
                break;

            case BarcodeFormats.Code11:
                result = Locator.Get <Definitions.Single.Code11>();
                break;

            case BarcodeFormats.Code2of5:
                result = Locator.Get <Definitions.Single.Code2of5>();
                break;

            case BarcodeFormats.Code93:
                result = Locator.Get <Definitions.Single.Code93>();
                break;

            case BarcodeFormats.EAN128:
                break;

            case BarcodeFormats.EAN13:
                result = Locator.Get <Definitions.EAN.EAN13>();
                break;

            case BarcodeFormats.EAN8:
                break;

            case BarcodeFormats.Extended3of9:
                result = Locator.Get <Definitions.Single.ExtendedCode3of9>();
                break;

            case BarcodeFormats.Interleaved2of5:
                result = Locator.Get <Definitions.Single.Interleaved2of5>();
                break;

            case BarcodeFormats.UPC:
                break;

            case BarcodeFormats.UPC2:
                break;

            case BarcodeFormats.UPC5:
                break;

            case BarcodeFormats.UPCE:
                break;

            case BarcodeFormats.CPC:
                result = Locator.Get <Definitions.Postal.CPC>();
                break;

            case BarcodeFormats.IntelligentMail:
                result = Locator.Get <Definitions.Postal.IntelligentMail>();
                break;

            case BarcodeFormats.Postnet:
                result = Locator.Get <Definitions.Postal.Postnet>();
                break;

            case BarcodeFormats.RM4SCC:
                result = Locator.Get <Definitions.Postal.RM4SCC>();
                break;

            default:
                break;
            }

            if (result == null)
            {
                throw new NotImplementedException();
            }

            _cache[format] = result;
            return(result);
        }