예제 #1
0
        public static void Serialize <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s,
                                                     ref BlamEngineTargetHandle value)
            where TDoc : class
            where TCursor : class
        {
            bool reading = s.IsReading;

            var build = reading
                                ? EngineBuildHandle.None
                                : value.Build;
            var platform_index = reading
                                ? TypeExtensions.kNone
                                : value.TargetPlatformIndex;
            var rsrc_model_index = reading
                                ? TypeExtensions.kNone
                                : value.ResourceModelIndex;

            EngineBuildHandle.Serialize(s, ref build);
            if (!build.IsNone)
            {
                if (EngineTargetPlatform.SerializeId(s, "targetPlatform", ref platform_index, true))
                {
                    EngineRegistry.SerializeResourceModelId(s, "resourceModel", ref rsrc_model_index, true);
                }
            }

            if (reading)
            {
                value = new BlamEngineTargetHandle(build, platform_index, rsrc_model_index);
            }
        }
예제 #2
0
        void SerializeExtern <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s)
            where TDoc : class
            where TCursor : class
        {
/*			var prototype = KSoft.Debug.TypeCheck.CastReference<BlamEngineSystem>(s.Owner);
 *                      if (s.IsReading)
 *                              Prototype = prototype;
 *                      else
 *                              Contract.Assert(prototype == Prototype);*/

            EngineBuildHandle.Serialize(s, ref mRootBuildHandleBaseline);

            using (s.EnterUserDataBookmark(this))
            {
                SerializeExternBody(s);
            }

            if (s.IsReading)
            {
                int expected_engine_index = Engine.RootBuildHandle.EngineIndex;
                int actual_engine_index   = RootBuildHandle.EngineIndex;
                KSoft.Debug.ValueCheck.AreEqual(
                    string.Format("{0} definition for {1} uses wrong engine id",
                                  GetType().Name, Engine.Name),
                    expected_engine_index, actual_engine_index);
            }
        }