Example #1
0
    public void Load(string rootpath)
    {
        string dir = ProgressContainer.ProgressDirectory(rootpath);

        Directory.CreateDirectory(dir);
        string fullpath = ProgressContainer.FullPath(rootpath, m_Id);

        if (File.Exists(fullpath))
        {
            using (BinaryReader file = new BinaryReader(File.Open(fullpath, FileMode.Open)))
            {
                int version = file.ReadInt32();
                if (version >= 1)
                {
                    int booknum = file.ReadInt32();
                    for (int i = 0; i < booknum; i++)
                    {
                        string book = file.ReadString();
                        if (!m_books.Exists(x => x == book))
                        {
                            m_books.Add(book);
                        }
                    }
                }
                int count = file.ReadInt32();
                for (int i = 0; i < count; i++)
                {
                    Record record = new Record();
                    record.Load(file, version);
                    record.ProcessRecord(new Record.ProcessRecordEntry(CountOneEntry));
                    m_wordSet.Add(record.m_word, record);
                }
            }
        }

        foreach (string book in m_books)
        {
            BookDict dict = new BookDict(rootpath, book);
            dict.ReadBook(this);
            dict.SaveBook();
        }
        ReOrganize();
    }
Example #2
0
 public BookItem(string text, BookDict dict)
 {
     m_text       = text;
     m_altenative = new List <string>();
     m_dict       = dict;
 }