private void TrimVersions(Item langItem)
 {
     // no specific version number provided
     if (!Version.Any())
     {
         // version number trimming
         if (IsParameterSpecified(nameof(MaxRecentVersions)))
         {
             if (langItem.Versions.Count > MaxRecentVersions)
             {
                 langItem.Versions.GetVersionNumbers()
                 .Take(langItem.Versions.Count - MaxRecentVersions)
                 .ForEach(verNo => RemoveVersion(langItem.Versions[verNo]));
             }
         }
         else
         {
             //just remove the piped version
             RemoveVersion(langItem);
         }
     }
     else
     {
         // versions specified - check if matching filter
         if (VersionPatterns.Any(wildcard => wildcard.IsMatch(langItem.Version.Number.ToString())))
         {
             RemoveVersion(langItem);
         }
     }
 }
        protected override void BeginProcessing()
        {
            if (ExcludeLanguage == null || !ExcludeLanguage.Any())
            {
                ExcludeLanguageWildcardPatterns = new List <WildcardPattern>();
            }
            else
            {
                ExcludeLanguageWildcardPatterns =
                    ExcludeLanguage.Select(
                        language =>
                        new WildcardPattern(language, WildcardOptions.IgnoreCase | WildcardOptions.CultureInvariant))
                    .ToList();

                if (Language == null || !Language.Any())
                {
                    Language = new[] { "*" };
                }
            }

            var langsList            = Language?.Aggregate((seed, curr) => seed + ", " + curr) ?? "not specified";
            var excludedLangsMessage = (ExcludeLanguage == null || ExcludeLanguage.Length == 0)
                ? ""
                : $"excluding {ExcludeLanguage.Aggregate((seed, curr) => seed + ", " + curr)} language(s)";

            confirmMessage =
                $"R{(Recurse ? "ecursively r" : "")}emove versions for language(s) '{langsList}' {excludedLangsMessage}";

            if (Version != null && Version.Any())
            {
                VersionPatterns =
                    Version.Select(
                        version => new WildcardPattern(version, WildcardOptions.IgnoreCase | WildcardOptions.Compiled))
                    .ToList();
            }
            else
            {
                VersionPatterns = new List <WildcardPattern>();
            }

            base.BeginProcessing();
        }
예제 #3
0
        public override string ToString()
        {
            var engine_code = (EngineCode?.Any() ?? false) ? string.Join(",", EngineCode) : "";
            var version = (Version?.Any() ?? false) ? string.Join(",", Version) : "";
            var engine_capacity = (EngineCapacity?.Any() ?? false) ? string.Join(",", EngineCapacity) : "";
            var vin = (Vin?.Any() ?? false) ? string.Join(",", Vin) : "";
            var engine_power = (EnginePower?.Any() ?? false) ? string.Join(",", EnginePower) : "";
            var gearbox = (Gearbox?.Any() ?? false) ? string.Join(",", Gearbox) : "";
            var transmission = (Transmission?.Any() ?? false) ? string.Join(",", Transmission) : "";
            var door_count = (DoorCount?.Any() ?? false) ? string.Join(",", DoorCount) : "";
            var nr_seats = (NrSeats?.Any() ?? false) ? string.Join(",", NrSeats) : "";
            var color = (Color?.Any() ?? false) ? string.Join(",", Color) : "";
            var registration = (Registration?.Any() ?? false) ? string.Join(",", Registration) : "";
            //var features = (Features?.Any() ?? false) ? string.Join(",", Features) : "";

            return string.Format("ID: " + AdId +
                "\nCena: " + PriceRaw +
                "\nTytul: " + Title +
                "\nOferta od: " + PrivateBusiness +
                "\nKategoria: " + Category +
                "\nWojewodztwo: " + Region +
                "\nMiasto: " + City +
                "\nMarka pojazdu: " + Make +
                "\nModel pojazdu: " + Model +
                "\nKod silnika: " + engine_code +
                "\nWersja: " + version +
                "\nRok produkcji: " + Year +
                "\nPrzebieg: " + Mileage +
                "\nPojemnosc skokowa: " + engine_capacity +
                "\nVin: " + vin +
                "\nRodzaj paliwa: " + FuelType +
                "\nMoc: " + engine_power +
                "\nSkrzynia biegow: " + gearbox +
                "\nNaped: " + transmission +                
                "\nTyp: " + BodyType +
                "\nLiczba drzwi: " + door_count +
                "\nLiczba miejsc: " + nr_seats +
                "\nKolor: " + color +
                "\nNumer rejestracyjny pojazdu: " + registration //+
                //"\nWyposazenie: " + features
            );
        }