Beispiel #1
0
        protected override void ProcessRecord()
        {
            var newRestrict = new Restriction();

            if (_lib.ParameterHasValue(PARAM))
            {
                newRestrict.Tags.UnionWith(_lib.GetUnderlyingValues <Tag>(PARAM).Select(x => x.Id));
            }

            if (this.ContainsParameter(x => x.IgnoredTerms))
            {
                newRestrict.Ignored.UnionWith(this.IgnoredTerms);
            }

            if (this.ContainsParameter(x => x.RequiredTerms))
            {
                newRestrict.Required.UnionWith(this.RequiredTerms);
            }

            if (base.ShouldProcess(string.Format(SHOULD_MSG, newRestrict.Ignored.ToJson(), newRestrict.Required.ToJson()), "New"))
            {
                Restriction restriction = base.SendSonarrPost <Restriction>(ApiEndpoints.Restriction, newRestrict);
                base.SendToPipeline(restriction);
            }
        }
Beispiel #2
0
        protected override void ProcessRecord()
        {
            IEnumerable <IndexerSchema> chosen = _lib.GetUnderlyingValues <IndexerSchema>(PARAM);

            foreach (IndexerSchema schema in chosen)
            {
                var template = new IndexerTemplate(schema);
                base.WriteObject(template);
            }
        }
Beispiel #3
0
        protected override void BeginProcessing()
        {
            base.BeginProcessing();

            if (_dynLib.ParameterHasValue("Database"))
            {
                _dbs = _dynLib.GetUnderlyingValues <Database>("Database");
            }

            _users = new List <SqlUserBase>();
        }
        protected override void ProcessRecord()
        {
            IEnumerable <string> names = _dynLib.GetParameterValues <string>(QUALITY);

            if (base.FormatShouldProcess(string.Format("Enabling '{0}'", string.Join("', '", names)), "Profile Id: {0}",
                                         this.InputObject.Id))
            {
                IEnumerable <Quality> _chosen = _dynLib.GetUnderlyingValues <Quality>(QUALITY);
                this.InputObject.ApplyAllowables(_chosen);
                base.WriteObject(this.InputObject);
            }
        }
 protected override void ProcessRecord()
 {
     _names = _dynLib.GetParameterValues <string>(QUALITY);
     if (_names.Contains(this.InputObject.Cutoff.Name, _comparer))
     {
         base.WriteWarning(string.Format("You cannot disable the cutoff resolution \"{0}\".  Skipping...", this.InputObject.Cutoff.Name));
         _names = _names.Where(x => !x.Equals(this.InputObject.Cutoff.Name, StringComparison.CurrentCultureIgnoreCase));
     }
     if (base.FormatShouldProcess(string.Format("Disabling '{0}'", string.Join("', '", _names)), "Profile Id: {0}",
                                  this.InputObject.Id))
     {
         IEnumerable <Quality> _chosen = _dynLib.GetUnderlyingValues <Quality>(QUALITY);
         this.InputObject.ApplyDisallowables(_chosen);
         base.WriteObject(this.InputObject);
     }
 }
Beispiel #6
0
        protected override void BeginProcessing()
        {
            base.BeginProcessing();
            jobs = new List <SmoJob>();
            if (!this.JobId.Equals(Guid.Empty))
            {
                jobs.Add(SmoContext.Connection.JobServer.Jobs.ItemById(this.JobId));
            }

            else if (_dynLib != null && _dynLib.ParameterHasValue("JobName"))
            {
                jobs.AddRange(_dynLib.GetUnderlyingValues <SmoJob>("JobName"));
            }

            else if (this.SqlServer == null && _dynLib != null)
            {
                jobs.AddRange(_dynLib.GetBackingItems <SmoJob>("JobName"));
            }
        }
        protected override void ProcessRecord()
        {
            Quality cutoff     = _dynLib.GetUnderlyingValue <Quality>(CUTOFF_QUALITY);
            var     newProfile = new QualityProfileNew
            {
                Cutoff   = cutoff,
                Language = this.Language,
                Name     = this.Name
            };

            newProfile.PopulateQualities(Context.AllQualities);
            IEnumerable <Quality> allowables = _dynLib.GetUnderlyingValues <Quality>(ALLOWED_QUALITIES);

            newProfile.ApplyAllowables(allowables);

            base.WriteDebug(newProfile.ToJson());

            if (base.FormatShouldProcess("New", WHAT_IF_FORMAT, this.Language.ToString(), this.Name, newProfile.AllowedQualities.Count, cutoff.Name))
            {
                QualityProfile createdProfile = base.SendSonarrPost <QualityProfile>(EP, newProfile);
                base.SendToPipeline(createdProfile);
            }
        }
Beispiel #8
0
 protected override void ProcessRecord()
 {
     if (!this.ContainsParameter(x => x.Id))
     {
         IEnumerable <Restriction> restrictions = this.GetAllRestrictions();
         restrictions = base.FilterByStringParameter(restrictions, r => r.Ignored, this, cmd => cmd.IgnoredTerms);
         restrictions = base.FilterByStringParameter(restrictions, r => r.Required, this, cmd => cmd.RequiredTerms);
         if (_lib.ParameterHasValue(PARAM))
         {
             IEnumerable <Tag> tags = _lib.GetUnderlyingValues <Tag>(PARAM);
             restrictions = restrictions
                            .Where(x => x.Tags.Overlaps(tags.Select(t => t.Id)));
         }
         base.SendToPipeline(restrictions);
     }
     else
     {
         for (int i = 0; i < this.Id.Length; i++)
         {
             base.SendToPipeline(this.GetRestrictionById(this.Id[i]));
         }
     }
 }
Beispiel #9
0
 protected private IEnumerable <Database> RetrieveDatabases()
 {
     return(_dynLib != null && _dynLib.ParameterHasValue(DBNAME)
         ? _dynLib.GetUnderlyingValues <Database>(DBNAME)
         : _dynLib.GetBackingItems <Database>(DBNAME));
 }