Ejemplo n.º 1
0
        public void Load(StreamReader file, ref List <PapagayoPhoneme> phonemes)
        {
            string line;

            while (m_state < 4)
            {
                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 phrase text
                case 0:
                    m_text = line;
                    m_state++;
                    break;

                //Read the start frame
                case 1:
                    StartFrame = Convert.ToInt32(line);
                    m_state++;
                    break;

                //Read the end frame
                case 2:
                    EndFrame = Convert.ToInt32(line);
                    m_state++;
                    break;

                //Read the end frame
                case 3:
                    m_numWords = Convert.ToInt32(line);
                    m_words    = new PapagayoWord[m_numWords];

                    for (int j = 0; j < m_numWords; j++)
                    {
                        m_words[j] = new PapagayoWord(file, ref phonemes);
                    }
                    m_state++;
                    break;

                default:
                    break;
                }
                Console.WriteLine(m_state.ToString() + " - " + line);
            }
        }
Ejemplo n.º 2
0
        public void Load(StreamReader file, ref List<PapagayoPhoneme> phonemes)
        {
            string line;
            while (m_state < 4)
            {
                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 phrase text
                    case 0:
                        m_text = line;
                        m_state++;
                        break;

                    //Read the start frame
                    case 1:
                        StartFrame = Convert.ToInt32(line);
                        m_state++;
                        break;

                    //Read the end frame
                    case 2:
                        EndFrame = Convert.ToInt32(line);
                        m_state++;
                        break;

                    //Read the end frame
                    case 3:
                        m_numWords = Convert.ToInt32(line);
                        m_words = new PapagayoWord[m_numWords];

                        for (int j = 0; j < m_numWords; j++)
                        {
                            m_words[j] = new PapagayoWord(file, ref phonemes);
                        }
                        m_state++;
                        break;

                    default:
                        break;
                }
                Console.WriteLine(m_state.ToString() + " - " + line);
            }
        }