コード例 #1
0
        public void ReadFile( )
        {
            StringReader reader = new StringReader(
                "1.1.1.1\talias\tTrue\r\n" +
                "work\t\tFalse\r\n" +
                // The "classic" style, computer \t alias
                "2.2.2.2\tclassic\r\n" +
                "3.3.3.3\t\r\n" +
                "\r\n" +
                "4.4.4.4" );

            ComputerListFile serializer = new ComputerListFile();
            RecentComputerList computers = serializer.Read( reader );

            ComputerName[] cnames = new ComputerName[]
            {
                new ComputerName( "1.1.1.1", "alias", true ),
                new ComputerName( "work", null, false ),
                new ComputerName( "2.2.2.2", "classic", false ),
                new ComputerName( "3.3.3.3", null, false ),
                new ComputerName( "4.4.4.4", null, false )
            };
            Assert.AreEqual( cnames, computers.ToArray() );
        }
コード例 #2
0
 private RecentComputerList LoadRecentComputerList( )
 {
     // Normally we read the computer list from our own setting file but on the first run
     // we will need import it from the registry.
     var listFile = new ComputerListFile();
     var computers = listFile.Read();
     if ( computers.Count == 0 )
     {
         Logger.LogString( "Computer list file not found.  Reading from registry." );
         computers = listFile.ReadFromRegistry();
     }
     return computers;
 }