Пример #1
0
        public TextSpecInfoRun[] GetTextSpecInfoRuns()
        {
            ArrayList lst = new ArrayList();
            int       pos = 0;

            int[] bits = { 1, 0, 2 };
            while (pos < _data.Length)
            {
                TextSpecInfoRun run = new TextSpecInfoRun();
                run.len  = LittleEndian.GetInt(_data, pos); pos += 4;
                run.mask = LittleEndian.GetInt(_data, pos); pos += 4;
                for (int i = 0; i < bits.Length; i++)
                {
                    if ((run.mask & 1 << bits[i]) != 0)
                    {
                        switch (bits[i])
                        {
                        case 0:
                            run.spellInfo = LittleEndian.GetShort(_data, pos); pos += 2;
                            break;

                        case 1:
                            run.langId = LittleEndian.GetShort(_data, pos); pos += 2;
                            break;

                        case 2:
                            run.altLangId = LittleEndian.GetShort(_data, pos); pos += 2;
                            break;
                        }
                    }
                }
                lst.Add(run);
            }
            return((TextSpecInfoRun[])lst.ToArray(typeof(TextSpecInfoRun)));
        }
Пример #2
0
        public TextSpecInfoRun[] GetTextSpecInfoRuns()
        {
            ArrayList lst = new ArrayList();
            int pos = 0;
            int[] bits = { 1, 0, 2 };
            while (pos < _data.Length)
            {
                TextSpecInfoRun run = new TextSpecInfoRun();
                run.len = LittleEndian.GetInt(_data, pos); pos += 4;
                run.mask = LittleEndian.GetInt(_data, pos); pos += 4;
                for (int i = 0; i < bits.Length; i++)
                {
                    if ((run.mask & 1 << bits[i]) != 0)
                    {
                        switch (bits[i])
                        {
                            case 0:
                                run.spellInfo = LittleEndian.GetShort(_data, pos); pos += 2;
                                break;
                            case 1:
                                run.langId = LittleEndian.GetShort(_data, pos); pos += 2;
                                break;
                            case 2:
                                run.altLangId = LittleEndian.GetShort(_data, pos); pos += 2;
                                break;
                        }
                    }
                }
                lst.Add(run);
            }
            return (TextSpecInfoRun[])lst.ToArray(typeof(TextSpecInfoRun));

        }