public void Load(StreamReader file) { m_voiceName = null; m_voicePhrase = null; m_numPhrases = 0; string line; while (m_state < 3) { line = file.ReadLine(); if (line == null) { throw new IOException("Corrupt File Format"); } //Trim leading whitespace on the read string. line = line.TrimStart(null); switch (m_state) { //Read the voice name case 0: m_voiceName = line; m_state++; break; //Read the Voice Phrase Text case 1: m_voicePhrase = line.Replace('|', '\n'); m_state++; break; //Read the number of Voice Phrases case 2: m_numPhrases = Convert.ToInt32(line); m_phrases = new PapagayoPhrase[m_numPhrases]; m_phonemes = new List <PapagayoPhoneme>(); for (int j = 0; j < m_numPhrases; j++) { m_phrases[j] = new PapagayoPhrase(); m_phrases[j].Load(file, ref m_phonemes); } Coalesce(); m_state++; break; default: break; } Console.WriteLine(m_state.ToString() + " - " + line); } }
public void Load(StreamReader file) { m_voiceName = null; m_voicePhrase = null; m_numPhrases = 0; string line; while (m_state < 3) { line = file.ReadLine(); if (line == null) { throw new IOException("Corrupt File Format"); } //Trim leading whitespace on the read string. line = line.TrimStart(null); switch (m_state) { //Read the voice name case 0: m_voiceName = line; m_state++; break; //Read the Voice Phrase Text case 1: m_voicePhrase = line.Replace('|', '\n'); m_state++; break; //Read the number of Voice Phrases case 2: m_numPhrases = Convert.ToInt32(line); m_phrases = new PapagayoPhrase[m_numPhrases]; m_phonemes = new List<PapagayoPhoneme>(); for (int j = 0; j < m_numPhrases; j++) { m_phrases[j] = new PapagayoPhrase(); m_phrases[j].Load(file, ref m_phonemes); } Coalesce(); m_state++; break; default: break; } Console.WriteLine(m_state.ToString() + " - " + line); } }