예제 #1
0
 public bool Validate(IWebController context)
 {
     if (string.IsNullOrEmpty(context.ClientVersion))
     {
         return(false);
     }
     return(Versions.Contains(context.ClientVersion));
 }
예제 #2
0
 private bool VersionMatch(IPackageSearchMetadata metadata)
 {
     if (Versions == null || Versions.All(string.IsNullOrWhiteSpace))
     {
         return(true);
     }
     return(Versions.Contains(metadata.Identity.Version.ToString()));
 }
예제 #3
0
        private void AddVersion(string version)
        {
            if (Versions == null)
            {
                Versions = new List <string>();
            }

            if (!Versions.Contains(version))
            {
                Versions.Add(version);
            }
        }
예제 #4
0
 public void AddVersion(PackageItemDocument version)
 {
     if (!Versions.Contains(version))
     {
         Versions.Add(version);
         if (string.Compare(LatestVersion, version.Version) < 0)
         {
             LatestVersion = version.Version;
             RaisePropertyChanged(nameof(LatestVersion));
         }
     }
 }
예제 #5
0
        public void DeleteVersion(Version removedVersion)
        {
            Debug.Assert(Versions.Contains(removedVersion));
            versions.Remove(removedVersion);
            versionedProjects.Remove(removedVersion);
            Versions.InvokeCollectionChanged();

            if (removedVersion.CreatedFrom != null)
            {
                Version previous = removedVersion.CreatedFrom;

                List <Version> branchedVersions = removedVersion.BranchedVersions.ToList();
                foreach (Version branchedVersion in branchedVersions)
                {
                    branchedVersion.CreatedFrom = previous;

                    // there are some elements created in deleted removedVersion
                    foreach (IVersionedElement createdInVersion in removedVersion.ElementsCreatedInVersion)
                    {
                        // I try to look up the element in all the derived removedVersion
                        IVersionedElement derivedElement = this.LookupElementVersion(createdInVersion, branchedVersion);
                        if (derivedElement != null)
                        {
                            // this derivedElement is now a first removedVersion
                            SetAsFirstVersion(derivedElement, branchedVersion);
                        }
                    }
                }

                previous.BranchedVersions.Remove(removedVersion);
            }

            List <ComposedKey <IVersionedElement, Version> > toRemove = new List <ComposedKey <IVersionedElement, Version> >();

            foreach (DictionaryEntry entry in versionTable)
            {
                ComposedKey <IVersionedElement, Version> key = (ComposedKey <IVersionedElement, Version>)entry.Key;
                IVersionedElement originalElement            = key.First;
                Version           derivedVersion             = key.Second;
                IVersionedElement derivedElement             = (IVersionedElement)entry.Value;

                if (derivedVersion == removedVersion)
                {
                    toRemove.Add(key);
                }
            }

            foreach (var key in toRemove)
            {
                versionTable.Remove(key);
            }
        }
예제 #6
0
        private void AddDefaultVersionIfNotContains()
        {
            if (DocsWebConsts.DefaultVersion == null)
            {
                return;
            }

            if (Versions.Contains(DocsWebConsts.DefaultVersion))
            {
                return;
            }

            Versions.Insert(0, DocsWebConsts.DefaultVersion);
        }
예제 #7
0
        /// <summary>
        /// Determines whether <paramref name="versionToCheck"/> is compatible with the combination of <see cref="Versions"/> and
        /// the <see cref="VersionMode"/> setting.
        /// </summary>
        /// <param name="versionToCheck"></param>
        /// <returns></returns>
        public bool IsSupported(float versionToCheck)
        {
            switch (VersionMode)
            {
            case RfwsVersionMode.AllVersions:
                return(true);

            case RfwsVersionMode.SpecificVersions:
                return(Versions.Contains(versionToCheck));

            case RfwsVersionMode.SupportedVersionsAndLater:
                var supportedVersions = from supportedVersion in Versions
                                        where versionToCheck >= supportedVersion
                                        select supportedVersion;
                return(supportedVersions.Any());

            default:
                return(false);
            }
        }
예제 #8
0
 public bool Contains(ProjectionVersion item)
 {
     return(Versions.Contains(item));
 }