public override IISSiteOptions Default(IArgumentsService arguments)
        {
            var ret       = new IISSiteOptions();
            var args      = arguments.GetArguments <IISSiteArguments>();
            var rawSiteId = arguments.TryGetRequiredArgument(nameof(args.SiteId), args.SiteId);

            if (long.TryParse(rawSiteId, out long siteId))
            {
                var site = _siteHelper.GetSites(false, false).FirstOrDefault(binding => binding.Id == siteId);
                if (site != null)
                {
                    ret.SiteId = site.Id;
                    if (_optionsHelper.DefaultAdvancedOptions(args, site.Hosts, RunLevel.Unattended, ret))
                    {
                        return(ret);
                    }
                }
                else
                {
                    _log.Error("Unable to find SiteId {siteId}", siteId);
                }
            }
            else
            {
                _log.Error("Invalid SiteId {siteId}", args.SiteId);
            }
            return(null);
        }
Example #2
0
        public override Task <IISSiteOptions> Default()
        {
            var ret       = new IISSiteOptions();
            var args      = _arguments.GetArguments <IISSiteArguments>();
            var rawSiteId = _arguments.TryGetRequiredArgument(nameof(args.SiteId), args.SiteId);

            if (long.TryParse(rawSiteId, out var siteId))
            {
                var site = _siteHelper.GetSites(false).FirstOrDefault(binding => binding.Id == siteId);
                if (site != null)
                {
                    ret.SiteId = site.Id;
                    if (_optionsHelper.DefaultAdvancedOptions(args, site.Hosts, ret))
                    {
                        return(Task.FromResult(ret));
                    }
                }
                else
                {
                    _log.Error("Unable to find SiteId {siteId}", siteId);
                }
            }
            else
            {
                _log.Error("Invalid SiteId {siteId}", args.SiteId);
            }
            return(Task.FromResult(default(IISSiteOptions)));
        }
        public override Task <IISSitesOptions> Default()
        {
            var ret        = new IISSitesOptions();
            var args       = _arguments.GetArguments <IISSiteArguments>();
            var sites      = _siteHelper.GetSites(false);
            var rawSiteIds = _arguments.TryGetRequiredArgument(nameof(args.SiteId), args.SiteId);

            sites = ProcessSiteIds(ret, sites, rawSiteIds);
            if (sites != null)
            {
                if (_optionsHelper.DefaultAdvancedOptions(args, sites.SelectMany(s => s.Hosts), ret))
                {
                    return(Task.FromResult(ret));
                }
            }
            return(Task.FromResult(default(IISSitesOptions)));
        }
Example #4
0
        public override IISSitesOptions Default(IArgumentsService arguments)
        {
            var ret        = new IISSitesOptions();
            var args       = arguments.GetArguments <IISSiteArguments>();
            var sites      = _siteHelper.GetSites(false, false);
            var rawSiteIds = arguments.TryGetRequiredArgument(nameof(args.SiteId), args.SiteId);

            sites = ProcessSiteIds(ret, sites, rawSiteIds);
            if (sites == null)
            {
                return(null);
            }
            if (_optionsHelper.DefaultAdvancedOptions(args, sites.SelectMany(s => s.Hosts), RunLevel.Unattended, ret))
            {
                return(ret);
            }
            return(null);
        }