⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 program.cs

📁 .net 获取msn联系人名单(转载) windows ApI
💻 CS
字号:
//Code by Gnilly (http://gnillydev.blogspot.com)
//Offical site: http://opencontacts.sourceforge.net

//This program is free software: you can redistribute it and/or modify
//it under the terms of the GNU Lesser General Public License as published by
//the Free Software Foundation, either version 3 of the License, or
//(at your option) any later version.

//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//GNU Lesser General Public License for more details.

//You should have received a copy of the GNU Lesser General Public License
//along with this program.  If not, see <http://www.gnu.org/licenses/>.

using System;
using System.Collections.Generic;
using System.Net;
using System.Text;

namespace OpenContactsNet.Test
{
    internal class Program
    {
        private static void Main( string[] args )
        {
            if ( args.Length < 2 )
            {
                Console.WriteLine( "Usage: OpenContactsNet.Test.exe <mail> <password>" );
                return;
            }

            MailContactList list = null;

            if ( args[ 0 ].ToLower().EndsWith( "gmail.com" ) )
            {
                Console.WriteLine( "Importing from Google Mail" );
                GmailExtract extractor = new GmailExtract();
                bool res = extractor.Extract( new NetworkCredential( args[ 0 ], args[ 1 ] ), out list );
                Console.WriteLine( res ? "Succeeded" : "Failed" );
            }
            else if ( args[ 0 ].ToLower().EndsWith( "yahoo.com" ) )
            {
                Console.WriteLine( "Importing from Yahoo! mail" );
                YahooExtract extractor = new YahooExtract();
                bool res = extractor.Extract( new NetworkCredential( args[ 0 ], args[ 1 ] ), out list );
                Console.WriteLine( res ? "Succeeded" : "Failed" );
            }
            else if ( args[ 0 ].ToLower().EndsWith( "live.com" ) || args[ 0 ].ToLower().EndsWith( "hotmail.com" ) )
            {
                Console.WriteLine( "Importing from Live mail" );
                LiveExtract extractor = new LiveExtract();
                bool res = extractor.Extract( new NetworkCredential( args[ 0 ], args[ 1 ] ), out list );
                Console.WriteLine( res ? "Succeeded" : "Failed" );
            }
            else
            {
                Console.WriteLine( "OpenContacts.NET doesn't support specified web mail service" );
            }

            if ( list != null )
            {
                Console.WriteLine( "{0} items imported", list.Count );
                foreach ( MailContact contact in list )
                {
                    Console.WriteLine( "EMail: {0} Name: {1}", contact.Email, contact.Name );
                }
            }

            Console.ReadKey();
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -