Exemple #1
0
        public BlobGroupVersionAndBuildInfo FindMostRelaventVersionInfo(Engine.EngineBuildHandle forBuild)
        {
            if (forBuild.IsNone)
            {
                throw new ArgumentNoneException(nameof(forBuild));
            }

            BlobGroupVersionAndBuildInfo exact_match   = null;
            BlobGroupVersionAndBuildInfo most_relevant = null;
            int possibly_relevant_count = 0;

            foreach (var kvp in VersionAndBuildMap)
            {
                var possible_info = kvp.Value;

                // Solves for versions tied to a specific revision, if any
                if (exact_match == null &&
                    possible_info.BuildHandle == forBuild)
                {
                    exact_match = possible_info;
                }

                // Else, find the last one in the branch
                if (forBuild.IsWithinSameBranch(possible_info.BuildHandle))
                {
                    most_relevant = possible_info;
                    possibly_relevant_count++;
                }
            }

            return(exact_match ?? most_relevant);
        }
Exemple #2
0
        public bool TryGetBlobGroup(uint signature, int binarySize, int version,
                                    out BlobGroup group, out BlobGroupVersionAndBuildInfo infoForVersion)
        {
            Contract.Requires <ArgumentOutOfRangeException>(version.IsNotNone());

            group          = null;
            infoForVersion = null;

            var group_tag = GroupTags.FindGroupByTag(signature);

            return(TryGetBlobGroup(group_tag, version, ref group, ref infoForVersion));
        }
Exemple #3
0
        bool TryGetBlobGroup(string tagString, int version,
                             out BlobGroup group, out BlobGroupVersionAndBuildInfo infoForVersion)
        {
            Contract.Requires <ArgumentOutOfRangeException>(version.IsNotNone());

            group          = null;
            infoForVersion = null;

            var group_tag = (GroupTagDatum)GroupTags.FindGroupByTag(tagString);

            return(TryGetBlobGroup(group_tag, version, ref group, ref infoForVersion));
        }
Exemple #4
0
        bool TryGetBlobGroup(GroupTagDatum groupTag, int version,
                             ref BlobGroup group, ref BlobGroupVersionAndBuildInfo infoForVersion)
        {
            if (groupTag != null)
            {
                var group_candidate = Groups[groupTag];
                if (group_candidate.VersionAndBuildMap.TryGetValue(version, out infoForVersion))
                {
                    group = group_candidate;
                    return(true);
                }
            }

            return(false);
        }
Exemple #5
0
        public BlobObject CreateObject(Engine.BlamEngineTargetHandle gameTarget,
                                       WellKnownBlob knownBlob)
        {
            if (gameTarget.IsNone)
            {
                throw new ArgumentNoneException(nameof(gameTarget));
            }
            if (!gameTarget.Build.IsFullyFormed)
            {
                throw new ArgumentException("Target build needs to be fully formed", nameof(gameTarget));
            }
            if (knownBlob == WellKnownBlob.NotWellKnown)
            {
                throw new ArgumentException(nameof(WellKnownBlob.NotWellKnown), nameof(knownBlob));
            }

            BlobGroup known_blob_group;

            if (!TryGetBlobGroup(knownBlob, out known_blob_group))
            {
                throw new InvalidOperationException(string.Format(
                                                        "No blob groups marked to be known as {0} under {1}",
                                                        knownBlob,
                                                        this.Prototype.Engine));
            }

            BlobGroupVersionAndBuildInfo known_blob_group_version_info =
                known_blob_group.FindMostRelaventVersionInfo(gameTarget.Build);

            if (known_blob_group_version_info == null)
            {
                throw new InvalidOperationException(string.Format(
                                                        "No {0} blob group versions resolved possibly for {1} under {2}",
                                                        knownBlob,
                                                        gameTarget.Build,
                                                        this.Prototype.Engine));
            }

            return(CreateObject(gameTarget, known_blob_group, known_blob_group_version_info.MajorVersion));
        }