Ejemplo n.º 1
0
        /// <summary>
        /// Runs the Mode.
        /// </summary>
        /// <param name="args"></param>
        public override void Run( string[] args )
        {
            DemoMode dm = new DemoMode( );

              dm.ParseArgs( args );
              List<Results> Resultss = new List<Results>( );
              List<PlaylistEntry> Playlist = new List<PlaylistEntry>( );
              if ( Directory.Exists( dm.file ) || dm.file.EndsWith( ".xml" ) || dm.file.EndsWith( ".gwmap" ) ) {
            var Files = Net.Mokon.Utilities.Files.GetFilesRecursive( dm.file ).Where(
               file => ( file.EndsWith( ".gwmap" ) || file.EndsWith( ".xml" ) )
               && !file.Contains( "KEY" ) ) ;
            foreach ( string file in Files ) {
              Playlist.Add( new PlaylistEntry( ) {
            File = file, Opl = "100000"
              } );
            }
              } else {
            StreamReader pl = new StreamReader( new FileStream(
             dm.file, FileMode.Open, FileAccess.Read ) );
            string pll;

            while ( ( pll = pl.ReadLine( ) ) != null ) {
              var ppls =  pll.Split( );
              if ( ppls.Length == 2 ) {
            Playlist.Add( new PlaylistEntry( ) {
              File = "../../" + ppls[0], Opl = ppls[1]
            } );
              } else if ( ppls.Length == 1 ) {
            Playlist.Add( new PlaylistEntry( ) {
              File = "../../" +  ppls[0], Opl = null
            } );
              } else {
            break;
              }
            }
            pl.Close( );
              }

              while ( Playlist.Count != 0 ) {
            foreach ( PlaylistEntry ple in Playlist ) {
              dm.SetFilename( "" + ple.File );
              if ( ple.Opl == null ) {
            dm.Solve = true;
              } else {
            dm.Solve = false;
            dm.OptimalPathLenth = new Metric( double.Parse( ple.Opl ) );
              }
              dm.Run( args );
              Resultss.Add( dm.Results );
              dm.Resultss = Resultss;
            }
              }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Runs the Mode.
        /// </summary>
        /// <param name="args"></param>
        public override void Run(string[] args)
        {
            DemoMode dm = new DemoMode( );

            dm.ParseArgs(args);
            List <Results>       Resultss = new List <Results>( );
            List <PlaylistEntry> Playlist = new List <PlaylistEntry>( );

            if (Directory.Exists(dm.file) || dm.file.EndsWith(".xml") || dm.file.EndsWith(".gwmap"))
            {
                var Files = Net.Mokon.Utilities.Files.GetFilesRecursive(dm.file).Where(
                    file => (file.EndsWith(".gwmap") || file.EndsWith(".xml")) &&
                    !file.Contains("KEY"));
                foreach (string file in Files)
                {
                    Playlist.Add(new PlaylistEntry( )
                    {
                        File = file, Opl = "100000"
                    });
                }
            }
            else
            {
                StreamReader pl = new StreamReader(new FileStream(
                                                       dm.file, FileMode.Open, FileAccess.Read));
                string pll;

                while ((pll = pl.ReadLine( )) != null)
                {
                    var ppls = pll.Split( );
                    if (ppls.Length == 2)
                    {
                        Playlist.Add(new PlaylistEntry( )
                        {
                            File = "../../" + ppls[0], Opl = ppls[1]
                        });
                    }
                    else if (ppls.Length == 1)
                    {
                        Playlist.Add(new PlaylistEntry( )
                        {
                            File = "../../" + ppls[0], Opl = null
                        });
                    }
                    else
                    {
                        break;
                    }
                }
                pl.Close( );
            }


            while (Playlist.Count != 0)
            {
                foreach (PlaylistEntry ple in Playlist)
                {
                    dm.SetFilename("" + ple.File);
                    if (ple.Opl == null)
                    {
                        dm.Solve = true;
                    }
                    else
                    {
                        dm.Solve            = false;
                        dm.OptimalPathLenth = new Metric(double.Parse(ple.Opl));
                    }
                    dm.Run(args);
                    Resultss.Add(dm.Results);
                    dm.Resultss = Resultss;
                }
            }
        }