Ejemplo n.º 1
0
        public void SaveToDB(string path)
        {
            int        count = 0;
            FileStream fs    = new FileStream(path, FileMode.Create, FileAccess.Write);

            try
            {
                FH.WriteInt(fs, Entries.Count);
                foreach (EntryStruct e in Entries)
                {
                    FH.WriteString(fs, e.text);
                    if (e.speaker != null && e.speaker != "")
                    {
                        FH.WriteString(fs, e.speaker);
                    }
                    else
                    {
                        FH.WriteString(fs, "unknown");
                    }
                    FH.WriteString(fs, e.convname);
                    FH.WriteString(fs, e.pathpcc);
                    FH.WriteString(fs, e.pathdlc);
                    FH.WriteString(fs, e.pathafc);
                    FH.WriteInt(fs, e.ID);
                    FH.WriteInt(fs, e.indexpcc);
                    if (e.inDLC)
                    {
                        fs.WriteByte(1);
                    }
                    else
                    {
                        fs.WriteByte(0);
                    }
                    count++;
                }
            }
            catch (Exception e)
            {
                MessageBox.Show("Error : \n" + e.Message);
            }
            fs.Close();
        }