Start() 공개 메소드

public Start ( ) : void
리턴 void
예제 #1
0
        private bool ReadXMLFile(FileInfo fi)
        {
            xtr = new XmlTextReader(fi.FullName);

            if (!CheckIfMimeFileIsCorrect( ))
            {
                xtr.Close( );
                Console.WriteLine(fi.Name + " doesn't seem to be a correct freedesktop shared mime info file...");
                return(false);
            }

            Console.WriteLine(fi.Name + " seems to be a correct freedesktop shared mime info file...");
            Console.WriteLine("Start parsing...");

            while (xtr.Read( ))
            {
                switch (xtr.NodeType)
                {
                case XmlNodeType.Element:
                    if (xtr.Name == "mime-type")
                    {
                        MimeType mt = new MimeType( );

                        MimeTypeReader mtr = new MimeTypeReader(xtr, mt);

                        mtr.Start( );

                        if (!MimeUtils.CheckIfMimetypeExists(mt))
                        {
                            MimeUtils.mimeTypes.Add(mt);
                        }
                    }
                    break;

                case XmlNodeType.EndElement:
                    if (xtr.Name == "mime-info")
                    {
                        break;
                    }
                    break;
                }
            }

            xtr.Close( );

            return(true);
        }
예제 #2
0
        private bool ReadXMLFile( FileInfo fi )
        {
            xtr = new XmlTextReader( fi.FullName );

            if ( !CheckIfMimeFileIsCorrect( ) )
            {
                xtr.Close( );
                Console.WriteLine( fi.Name + " doesn't seem to be a correct freedesktop shared mime info file..." );
                return false;
            }

            Console.WriteLine( fi.Name + " seems to be a correct freedesktop shared mime info file..." );
            Console.WriteLine( "Start parsing..." );

            while ( xtr.Read( ) )
            {
                switch ( xtr.NodeType )
                {
                    case XmlNodeType.Element:
                        if ( xtr.Name == "mime-type" )
                        {
                            MimeType mt = new MimeType( );

                            MimeTypeReader mtr = new MimeTypeReader( xtr, mt );

                            mtr.Start( );

                            if ( !MimeUtils.CheckIfMimetypeExists( mt ) )
                                MimeUtils.mimeTypes.Add( mt );
                        }
                        break;

                    case XmlNodeType.EndElement:
                        if ( xtr.Name == "mime-info" )
                            break;
                        break;
                }
            }

            xtr.Close( );

            return true;
        }