コード例 #1
0
ファイル: EntityAsset.cs プロジェクト: robterrell/paradox
            public void Upgrade(int currentVersion, int targetVersion, ILogger log, YamlMappingNode yamlAssetNode)
            {
                dynamic asset = new DynamicYamlMapping(yamlAssetNode);

                // Get the EntityData, and generate an Id
                var oldEntityData = asset.Data;
                oldEntityData.Id = Guid.NewGuid().ToString().ToLowerInvariant();

                // Create a new EntityDataHierarchy object
                asset.Hierarchy = new YamlMappingNode();
                asset.Hierarchy.Entities = new YamlSequenceNode();
                asset.Hierarchy.Entities.Add(oldEntityData);

                asset["~Base"] = DynamicYamlEmpty.Default;

                // Bump asset version -- make sure it is stored right after Id
                asset.SerializedVersion = AssetFormatVersion;
                asset.MoveChild("SerializedVersion", asset.IndexOf("Id") + 1);

                // Currently not final, so enable at your own risk
                throw new NotImplementedException();
            }