Exemplo n.º 1
0
        BlobObject CreateObjectImpl(Engine.BlamEngineTargetHandle gameTarget,
                                    BlobGroup blobGroup,
                                    int version, int binarySize)
        {
            BlobObject bobject;

            switch (blobGroup.KnownAs)
            {
            case WellKnownBlob.ContentHeader:
                bobject = new ContentHeaderBlob();
                break;

            case WellKnownBlob.GameVariant:
                bobject = new GameEngineVariantBlob();
                break;

            default:
                throw new KSoft.Debug.UnreachableException(blobGroup.GroupTag.Name);
            }

            Util.MarkUnusedVariable(ref binarySize);
            bobject.Initialize(this, gameTarget, blobGroup, version);

            return(bobject);
        }
Exemplo n.º 2
0
        public bool TryGetBlobGroup(uint signature, int binarySize, int version,
                                    out BlobGroup group)
        {
            Contract.Requires <ArgumentOutOfRangeException>(version.IsNotNone());

            BlobGroupVersionAndBuildInfo infoForVersion;

            return(TryGetBlobGroup(signature, binarySize, version, out group, out infoForVersion));
        }
Exemplo n.º 3
0
        public BlobObject CreateObject(Engine.BlamEngineTargetHandle gameTarget,
                                       BlobGroup blobGroup,
                                       int version = TypeExtensions.kNone, int binarySize = TypeExtensions.kNone)
        {
            Contract.Requires(!gameTarget.IsNone);
            Contract.Requires(blobGroup != null);
            Contract.Requires(version.IsNoneOrPositive());

            return(CreateObjectImpl(gameTarget, blobGroup, version, binarySize));
        }
Exemplo n.º 4
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));
        }
Exemplo n.º 5
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));
        }
Exemplo n.º 6
0
        static Exception SerializeObjectFoundBuildIncompatibility(BlobSystem blobSystem,
                                                                  BlobGroup blobGroup, int version,
                                                                  Engine.EngineBuildHandle buildForBlobVersion, Engine.EngineBuildHandle actualBuild)
        {
            var msg = string.Format(
                "Build incompatibility for blob object {0} v{1} which uses build={2} " +
                "but stream uses build={3}",
                blobGroup.GroupTag.TagString, version, buildForBlobVersion.ToDisplayString(),
                actualBuild.ToDisplayString());

            return(new System.IO.InvalidDataException(msg));
        }
Exemplo n.º 7
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);
        }
Exemplo n.º 8
0
        public bool TryGetBlobGroup(WellKnownBlob kind,
                                    out BlobGroup group)
        {
            group = null;

            foreach (var kvp in Groups)
            {
                if (kvp.Value.KnownAs == kind)
                {
                    group = kvp.Value;
                    break;
                }
            }

            return(group != null);
        }
Exemplo n.º 9
0
        public void Serialize <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s)
            where TDoc : class
            where TCursor : class
        {
            var system = KSoft.Debug.TypeCheck.CastReference <BlobSystem>(s.UserData);

            if (s.IsReading)
            {
                BlobGroup.SerializeVersionToBuildMapKey(s, (object)null,
                                                        ref mMajorVersion);
            }

            Engine.EngineBuildHandle.SerializeWithBaseline(s, system.RootBuildHandle, ref mBuildHandle);

            s.StreamAttributeOpt("forceLittleEndian", ref mForceLittleEndian, Predicates.IsTrue);
        }