public void DuplicateAlias( )
        {
            RecentComputerList computers = new RecentComputerList();
            computers.Add( new ComputerName( "1.1.1.1", "work" ) );
            computers.Add( new ComputerName( "2.2.2.2", "CASE" ) );

            computers.Push( new ComputerName( "3.3.3.3", "work" ) );

            // Alias is removed from the old item.
            Assert2.AssertComputerNames( new string[]
            {
                "3.3.3.3", "work",
                "1.1.1.1", null,
                "2.2.2.2", "CASE",
            }, computers.ToArray() );

            // Confirm case sensitive.
            computers.Push( new ComputerName( "4.4.4.4", "case" ) );

            Assert2.AssertComputerNames( new string[]
            {
                "4.4.4.4", "case",
                "3.3.3.3", "work",
                "1.1.1.1", null,
                "2.2.2.2", null,
            }, computers.ToArray() );
        }
        public void VariableMaxComputerCount( )
        {
            RecentComputerList list = new RecentComputerList( 4, 3 );
            list.Push( new ComputerName( "eeee", null ) );
            list.Push( new ComputerName( "dddd", null ) );
            list.Push( new ComputerName( "cccc", null ) );
            list.Push( new ComputerName( "bbbb", null ) );
            list.Push( new ComputerName( "aaaa", null ) );

            Assert.AreEqual( new string[]
            {
                "aaaa",
                "bbbb",
                "cccc",
                "dddd"
            },
            GetComputers( list ) );

            list.MaxComputerCount = 5;
            list.Push( new ComputerName( "eeee", null ) );

            Assert.AreEqual( new string[]
            {
                "eeee",
                "aaaa",
                "bbbb",
                "cccc",
                "dddd"
            },
            GetComputers( list ) );
        }
        public void MstscConnect( MstscSettings settings )
        {
            var mstscApp = new MstscApp();
            #if DEBUG
            mstscApp.TestMode = true;
            #endif
            try
            {
                mstscApp.Run( settings );
            }
            catch ( Exception ex )
            {
                Logger.LogException( ex );
            }

            OnMstscAppExited();

            // It is important to read before we write in case we have two instances of RemoteDesktopPlus open.
            // However RemoteDesktop doesn't have special logic for adding an IP address to the list like we
            // do so we need to do an integrate step.
            m_RecentComputerList = LoadRecentComputerList();

            // We use our own logic to determine what the recent computer list should be after a
            // connection was made.
            m_RecentComputerList.Push( settings.Computer );

            ComputerListFile serializer = new ComputerListFile();
            serializer.Write( m_RecentComputerList );

            OnComputerListUpdated();
        }