コード例 #1
0
            public CMAP(EndianBinaryReader er)
            {
                Signature      = er.ReadString(Encoding.ASCII, 4);
                SectionSize    = er.ReadUInt32();
                CodeBegin      = er.ReadUInt16();
                CodeEnd        = er.ReadUInt16();
                MappingMethod  = (CMAPMappingMethod)er.ReadUInt16();
                Reserved       = er.ReadUInt16();
                NextCMAPOffset = er.ReadUInt32();

                switch (MappingMethod)
                {
                case CMAPMappingMethod.Direct:
                    IndexOffset = er.ReadUInt16();
                    break;

                case CMAPMappingMethod.Table:
                    IndexTable = er.ReadUInt16s(CodeEnd - CodeBegin + 1);
                    break;

                case CMAPMappingMethod.Scan:
                    ScanEntries   = new Dictionary <ushort, ushort>();
                    NrScanEntries = er.ReadUInt16();
                    for (int i = 0; i < NrScanEntries; i++)
                    {
                        ScanEntries.Add(er.ReadUInt16(), er.ReadUInt16());
                    }
                    break;
                }
            }
コード例 #2
0
            public CMAP(EndianBinaryReader er)
            {
                Signature = er.ReadString(Encoding.ASCII, 4);
                SectionSize = er.ReadUInt32();
                CodeBegin = er.ReadUInt16();
                CodeEnd = er.ReadUInt16();
                MappingMethod = (CMAPMappingMethod)er.ReadUInt16();
                Reserved = er.ReadUInt16();
                NextCMAPOffset = er.ReadUInt32();

                switch (MappingMethod)
                {
                    case CMAPMappingMethod.Direct:
                        IndexOffset = er.ReadUInt16();
                        break;
                    case CMAPMappingMethod.Table:
                        IndexTable = er.ReadUInt16s(CodeEnd - CodeBegin + 1);
                        break;
                    case CMAPMappingMethod.Scan:
                        ScanEntries = new Dictionary<ushort, ushort>();
                        NrScanEntries = er.ReadUInt16();
                        for (int i = 0; i < NrScanEntries; i++) ScanEntries.Add(er.ReadUInt16(), er.ReadUInt16());
                        break;
                }
            }