示例#1
0
        public void SaveMasked(BinaryWriter writer)
        {
            List <MiddleMap> list = Calc(out List <HighMap> hiList);

            writer.Write((ushort)hiList.Count);
            writer.Write((ushort)list.Count);
            for (int i = 0; i < _highMap.Length; i++)
            {
                writer.Write((ushort)(_highMap[i].Index * 16));
            }
            for (int i = 0; i < hiList.Count; i++)
            {
                var mid = hiList[i].Map;
                for (int j = 0; j < 16; j++)
                {
                    writer.Write((ushort)(mid[j].Index * 16));
                }
            }
            for (int i = 0; i < list.Count; i++)
            {
                MiddleMap middle = list[i];
                int[]     mid    = middle.Map;
                writer.Write((ushort)middle.Mask);
                Debug.WriteLine($"mid {i}:{(ushort)middle.Mask:X4}");
                for (int j = 0; j < 16; j++)
                {
                    writer.Write((ushort)mid[j]);
                }
            }
        }
示例#2
0
 public HighMap()
 {
     Map = new MiddleMap[16];
     for (int i = 0; i < Map.Length; i++)
     {
         Map[i] = new MiddleMap();
     }
 }
示例#3
0
            public bool Equals(MiddleMap other)
            {
                for (int i = 0; i < Map.Length; i++)
                {
                    if (other.Map[i] != Map[i])
                    {
                        return(false);
                    }
                }

                return(true);
            }
示例#4
0
        private MiddleMap SetSlot(char wch, int diff)
        {
            if (diff > _maxOffset)
            {
                _maxOffset = diff;
            }

            if (diff < _minOffset)
            {
                _minOffset = diff;
            }
            HighMap   high = _highMap[wch >> 8];
            MiddleMap mid  = high.Map[(wch >> 4) & 0xf];

            mid.Map[wch & 0xf] = diff;
            return(mid);
        }