Skip to content
Permalink
Browse files

[Settings] Remove the !file when serializing setting keys

  • Loading branch information
xen2 committed Dec 14, 2018
1 parent 3aac63f commit 399f5f2b7435777ad909a201372f7d8cd74ee975
@@ -2,8 +2,6 @@
// Distributed under the MIT license. See the LICENSE.md file in the project root for more information.
using System.Collections.Generic;
using Xenko.Core.Annotations;
using Xenko.Core.IO;
using Xenko.Core.Yaml;
using Xenko.Core.Yaml.Events;

namespace Xenko.Core.Settings
@@ -12,7 +10,7 @@ namespace Xenko.Core.Settings
/// An internal dictionary class used to serialize a <see cref="SettingsProfile"/>.
/// </summary>
[NonIdentifiableCollectionItems]
internal class SettingsDictionary : Dictionary<UFile, List<ParsingEvent>>
internal class SettingsDictionary : Dictionary<string, List<ParsingEvent>>
{
// Used for temporary internal storage
[DataMemberIgnore]
@@ -23,7 +23,7 @@ public override IYamlSerializable TryCreate(SerializerContext context, [NotNull]

protected override void WriteDictionaryItem(ref ObjectContext objectContext, KeyValuePair<object, object> keyValue, KeyValuePair<Type, Type> keyValueTypes)
{
var propertyKey = (UFile)keyValue.Key;
var propertyKey = (string)keyValue.Key;
objectContext.SerializerContext.ObjectSerializerBackend.WriteDictionaryKey(ref objectContext, propertyKey, keyValueTypes.Key);

// Deduce expected value type from PropertyKey
@@ -38,7 +38,10 @@ protected override void WriteDictionaryItem(ref ObjectContext objectContext, Key
protected override KeyValuePair<object, object> ReadDictionaryItem(ref ObjectContext objectContext, KeyValuePair<Type, Type> keyValueTypes)
{
// Read PropertyKey
var keyResult = (UFile)objectContext.SerializerContext.ObjectSerializerBackend.ReadDictionaryKey(ref objectContext, keyValueTypes.Key);
var keyResult = objectContext.SerializerContext.ObjectSerializerBackend.ReadDictionaryKey(ref objectContext, keyValueTypes.Key);
// Temporary fix for launcher 3.0.x, which was serializing keys as UFile with !file prefix
if (keyResult is UFile keyResultFile)
keyResult = keyResultFile.FullPath;

// Save the Yaml stream, in case loading fails we can keep this representation
var parsingEvents = new List<ParsingEvent>();

0 comments on commit 399f5f2

Please sign in to comment.
You can’t perform that action at this time.