示例#1
0
        protected override Yield Start(XDoc config, Result result)
        {
            yield return(Coroutine.Invoke(base.Start, config, new Result()));

            // read configuration settings
            _username = config["username"].AsText;
            if (string.IsNullOrEmpty(_username))
            {
                throw new ArgumentException(MISSING_FIELD_ERROR, "username");
            }
            _password = config["password"].AsText;
            if (string.IsNullOrEmpty(_password))
            {
                throw new ArgumentException(MISSING_FIELD_ERROR, "password");
            }
            _uri = config["trac-uri"].AsUri;
            if (_uri == null)
            {
                throw new ArgumentException(MISSING_FIELD_ERROR, "trac-uri");
            }

            // initialize web-service
            _trac     = XmlRpcProxyGen.Create <Trac>();
            _trac.Url = _uri.At("login", "xmlrpc").ToString();
            if (!string.IsNullOrEmpty(_username))
            {
                _trac.Credentials = new System.Net.NetworkCredential(_username, _password);
            }

            result.Return();
        }
示例#2
0
        protected override Yield Stop(Result result)
        {
            // clear settings
            _password = null;
            _username = null;
            _trac     = null;
            yield return(Coroutine.Invoke(base.Stop, new Result()));

            result.Return();
        }
        protected override Yield Stop(Result result) {

            // clear settings
            _password = null;
            _username = null;
            _trac = null;
            yield return Coroutine.Invoke(base.Stop, new Result());
            result.Return();
        }
        protected override Yield Start(XDoc config, Result result) {
            yield return Coroutine.Invoke(base.Start, config, new Result());

            // read configuration settings
            _username = config["username"].AsText;
            if (string.IsNullOrEmpty(_username)) {
                throw new ArgumentException(MISSING_FIELD_ERROR, "username");
            }
            _password = config["password"].AsText;
            if (string.IsNullOrEmpty(_password)) {
                throw new ArgumentException(MISSING_FIELD_ERROR, "password");
            }
            _uri = config["trac-uri"].AsUri;
            if (_uri == null) {
                throw new ArgumentException(MISSING_FIELD_ERROR, "trac-uri");
            }

            // initialize web-service
            _trac = XmlRpcProxyGen.Create<Trac>();
            _trac.Url = _uri.At("login", "xmlrpc").ToString();
            if (!string.IsNullOrEmpty(_username)) {
                _trac.Credentials = new System.Net.NetworkCredential(_username, _password);
            }

            result.Return();
        }