Esempio n. 1
0
        private void ReadCodeMaps(BinaryReader reader, IBCFNT_ContinueBlock block)
        {
            var codeMapBlock = (BCFNT_FontCodeMapBlock)block;
            {
                switch (codeMapBlock.MappingMethod)
                {
                case BCFNT_FontMapMethod.Direct:
                    var directMappingOffset = reader.ReadUInt16();
                    for (int i = codeMapBlock.CCodeBegin; i <= codeMapBlock.CCodeEnd; i++)
                    {
                        CodeMap.Add((ushort)i, (ushort)((i - codeMapBlock.CCodeBegin) + directMappingOffset));
                    }
                    break;

                case BCFNT_FontMapMethod.Table:
                    for (int i = codeMapBlock.CCodeBegin; i <= codeMapBlock.CCodeEnd; i++)
                    {
                        CodeMap.Add((ushort)i, reader.ReadUInt16());
                    }
                    break;

                case BCFNT_FontMapMethod.Scan:
                    var numEntries = reader.ReadUInt16();
                    for (int i = 0; i < numEntries; i++)
                    {
                        CodeMap.Add(reader.ReadUInt16(), reader.ReadUInt16());
                    }
                    break;
                }
            }
        }
Esempio n. 2
0
        public override object Serialize(IDesignerSerializationManager manager, object value)
        {
            if (manager == null)
            {
                throw new ArgumentNullException("manager");
            }
            if (value == null)
            {
                throw new ArgumentNullException("value");
            }

            if (_codeMap == null)
            {
                _codeMap = new CodeMap(value.GetType(), manager.GetName(value));
            }
            _codeMap.Clear();

            RootContext rootContext = new RootContext(new CodeThisReferenceExpression(), value);

            manager.Context.Push(rootContext);

            this.SerializeComponents(manager, ((IComponent)value).Site.Container.Components, (IComponent)value);

            // Serialize root component
            //
            CodeStatementCollection statements = new CodeStatementCollection();

            statements.Add(new CodeCommentStatement(String.Empty));
            statements.Add(new CodeCommentStatement(manager.GetName(value)));
            statements.Add(new CodeCommentStatement(String.Empty));
            // Note that during the serialization process below ComponentCodeDomSerializer
            // will be invoked to serialize the rootcomponent during expression serialization.
            // It will check for RootContext and return that.
            base.SerializeProperties(manager, statements, value, new Attribute[0]);
            base.SerializeEvents(manager, statements, value, new Attribute[0]);
            _codeMap.Add(statements);

            manager.Context.Pop();
            return(_codeMap.GenerateClass());
        }
        protected override void LoadCodes()
        {
            base.LoadCodes();

            AccessHelper helper = new AccessHelper();

            foreach (SubjectCode item in helper.Select <SubjectCode>())
            {
                if (!CodeMap.ContainsKey(item.Code))
                {
                    CodeMap.Add(item.Code, item.Subject);
                }
            }
        }
Esempio n. 4
0
        protected override void LoadCodes()
        {
            base.LoadCodes();

            AccessHelper helper = new AccessHelper();

            foreach (ClassCode_DomainMakeUp item in helper.Select <ClassCode_DomainMakeUp>())
            {
                if (!CodeMap.ContainsKey(item.Code))
                {
                    CodeMap.Add(item.Code, item.ClassName);
                }
            }
        }