Skip to content

Commit

Permalink
Fixed issue with settings migration.
Browse files Browse the repository at this point in the history
  • Loading branch information
NickeManarin committed Dec 24, 2021
1 parent 247a5f7 commit b90ec5b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
16 changes: 16 additions & 0 deletions ScreenToGif.Util/Settings/Migrations/Migration2_32_0To2_35_0.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,32 @@ private static void UpdateNamespaces(List<Property> properties)
case "ImgurPreset":
{
child.NameSpace = "clr-namespace:ScreenToGif.ViewModel.UploadPresets.Imgur;assembly=ScreenToGif.ViewModel";

UpdateNamespaces(child.Children);
break;
}
case "GfycatPreset":
{
child.NameSpace = "clr-namespace:ScreenToGif.ViewModel.UploadPresets.Gfycat;assembly=ScreenToGif.ViewModel";

UpdateNamespaces(child.Children);
break;
}
case "YandexPreset":
{
child.NameSpace = "clr-namespace:ScreenToGif.ViewModel.UploadPresets.Yandex;assembly=ScreenToGif.ViewModel";

UpdateNamespaces(child.Children);
break;
}
case "ImgurAlbum":
{
child.NameSpace = "clr-namespace:ScreenToGif.ViewModel.UploadPresets.Imgur;assembly=ScreenToGif.ViewModel";
break;
}
case "History":
{
child.NameSpace = "clr-namespace:ScreenToGif.ViewModel.UploadPresets.History;assembly=ScreenToGif.ViewModel";
break;
}
case "MouseClicksViewModel":
Expand Down
4 changes: 3 additions & 1 deletion ScreenToGif.Util/Settings/UserSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ private static ResourceDictionary Load(string path)
{
var value = ParseProperty(property);

if (value != null)
if (value != null && !resource.Contains(property.Key))
resource.Add(property.Key, value);
}

Expand Down Expand Up @@ -308,6 +308,8 @@ private static object ParseProperty(Property property)
return DateTime.Parse(property.Value);
case "TimeSpan":
return TimeSpan.Parse(property.Value);
case "TextAlignment":
return Enum.Parse(typeof(TextAlignment), property.Value);

case "ArrayList":
{
Expand Down

0 comments on commit b90ec5b

Please sign in to comment.