示例#1
0
        public NodeService(string name, string username, string password, Uri endPoint, ApiTypes api) : base(name)
        {
            UserName     = username;
            UserPassword = password;
            EndPoint     = endPoint;
            // Default account icon
            PathIcon = "M12,19.2C9.5,19.2 7.29,17.92 6,16C6.03,14 10,12.9 12,12.9C14,12.9 17.97,14 18,16C16.71,17.92 14.5,19.2 12,19.2M12,5A3,3 0 0,1 15,8A3,3 0 0,1 12,11A3,3 0 0,1 9,8A3,3 0 0,1 12,5M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12C22,6.47 17.5,2 12,2Z";

            switch (api)
            {
            case ApiTypes.atAtomPub:
                Client = new AtomPubClient(UserName, UserPassword, EndPoint);
                break;

            case ApiTypes.atXMLRPC:
                Client = new XmlRpcClient(UserName, UserPassword, EndPoint);
                break;

            case ApiTypes.atAtomFeed:
                Client = new AtomFeedClient(EndPoint);
                break;

                //TODO: AtomAPI
            }

            Api = api;

            ID = Guid.NewGuid().ToString();
        }
示例#2
0
文件: Node.cs 项目: torum/BlogWrite
        public NodeService(string name, Uri endPoint, ApiTypes api, ServiceTypes serviceType) : base(name)
        {
            // Default account icon
            PathIcon = "M12,19.2C9.5,19.2 7.29,17.92 6,16C6.03,14 10,12.9 12,12.9C14,12.9 17.97,14 18,16C16.71,17.92 14.5,19.2 12,19.2M12,5A3,3 0 0,1 15,8A3,3 0 0,1 12,11A3,3 0 0,1 9,8A3,3 0 0,1 12,5M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12C22,6.47 17.5,2 12,2Z";

            EndPoint = endPoint;

            Api = api;

            ServiceType = serviceType;

            //Id = Guid.NewGuid().ToString();
            Id = endPoint.AbsoluteUri;

            switch (api)
            {
            case ApiTypes.atAtomPub:
                Client = new AtomPubClient(UserName, UserPassword, EndPoint);
                break;

            case ApiTypes.atXMLRPC_MovableType:
                Client = new XmlRpcClient(UserName, UserPassword, EndPoint);
                break;

            case ApiTypes.atXMLRPC_WordPress:
                Client = new XmlRpcClient(UserName, UserPassword, EndPoint);
                break;

            case ApiTypes.atFeed:
                Client = new FeedClient();
                break;

                //TODO: WP, AtomAPI
            }
        }
示例#3
0
        static public AtomPubClient GetClient()
        {
            AtomPubClient client;

            client = new AtomPubClient();
            client.BypassCacheOnRetrieve = true;
            client.ServerCredential      = null;
            return(client);
        }
示例#4
0
        private AtomPubClient EnsureInitAtomClient()
        {
            if (atom != null)
            {
                return(atom);
            }

            atom            = new AtomPubClient();
            atom.Credential = new NetworkCredential(credential.HatenaId, credential.ApiKey);
            atom.UserAgent  = userAgent;

            return(atom);
        }
        static public AtomPubClient GetClient()
        {
            AtomPubClient client;

            client = new AtomPubClient();
            client.BypassCacheOnRetrieve = true;

            if (!String.IsNullOrEmpty(user) && !String.IsNullOrEmpty(password))
            {
                client.ServerCredential = new PasswordCredential()
                {
                    UserName = user,
                    Password = password
                };
            }
            else
            {
                client.ServerCredential = null;
            }

            return(client);
        }
示例#6
0
 public DataServiceHttpTests()
 {
     _appClient          = new AtomPubClient();
     _dummyDCDataService = new dcDataService(new Uri(BaseUrl + V1BaseUrl + V1DCBaseUrl));
 }