示例#1
0
            public Dictionary()
            {
                StreamReader    src = new StreamReader("cedict_ts.u8", System.Text.Encoding.UTF8);
                DictionaryEntry de;

                dict = new ArrayList();
                char[] buffer = new char[9 * 1024 * 1024];
                int    cb     = src.Read(buffer, 0, buffer.Length);
                int    ib     = 0;

                while (ib < cb)
                {
                    if (buffer[ib] == '#')
                    {
                        // there must still be a newline or we wouldn't be here
                        while (buffer[ib] != '\n')
                        {
                            ib++;
                        }
                    }
                    else
                    {
                        de = DictionaryEntry.ParseBuffer(buffer, ib, cb, out int ibOut);
                        ib = ibOut;
                        if (de != null)
                        {
                            dict.Add(de);
                        }
                    }
                    ib++;
                }
            }