Exemplo n.º 1
0
        void loadToasters()
        {
            FileStream fs = null;

            try
            {
                // The DocumentFolder is where all per-user configuration files should be stored.
                fs = new FileStream(m_host.DocumentFolder + "\\toasters.txt",
                                    FileMode.Open, FileAccess.Read, FileShare.Read);
            }
            catch (Exception e)
            {
                m_host.speakError(String.Format("{0} (loadToaters) {1} ", m_host.FancyName, e.Message));
                return;
            }

            StreamReader sr = new StreamReader(fs);

            m_toasters.Clear( );
            while (!sr.EndOfStream)
            {
                Toaster t = new Toaster(m_host.makeShortname(sr.ReadLine( )), 0);
                if (t.shortname.Length > 0)
                {
                    m_toasters.AddLast(t);
                }
            }

            sr.Close( );
        }
Exemplo n.º 2
0
        void loadToasters()
        {
            FileStream fs = null;

             try
             {
            // The DocumentFolder is where all per-user configuration files should be stored.
            fs = new FileStream( m_host.DocumentFolder + "\\toasters.txt",
                                 FileMode.Open, FileAccess.Read, FileShare.Read );
             }
             catch (Exception e)
             {
            m_host.speakError( String.Format( "{0} (loadToaters) {1} ", m_host.FancyName, e.Message ) );
            return;
             }

             StreamReader sr = new StreamReader( fs );

             m_toasters.Clear( );
             while (!sr.EndOfStream)
             {
            Toaster t = new Toaster( m_host.makeShortname( sr.ReadLine( ) ), 0 );
            if (t.shortname.Length > 0)
               m_toasters.AddLast( t );
             }

             sr.Close( );
        }