From 3a0119592e029e8f5c38293b38a5350e855f34b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Krch?= Date: Mon, 19 Aug 2024 23:20:11 +0200 Subject: [PATCH] dotnet format fix --- .../Handlers/MigrateMediaLibrariesCommandHandler.cs | 8 ++++---- KVA/Migration.Toolkit.Source/Helpers/KenticoHelper.cs | 2 +- .../Mappers/ContentItemMapper.cs | 11 +++++------ .../Mappers/PageTemplateConfigurationMapper.cs | 4 ++-- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/KVA/Migration.Toolkit.Source/Handlers/MigrateMediaLibrariesCommandHandler.cs b/KVA/Migration.Toolkit.Source/Handlers/MigrateMediaLibrariesCommandHandler.cs index c5d279ba..6d55a960 100644 --- a/KVA/Migration.Toolkit.Source/Handlers/MigrateMediaLibrariesCommandHandler.cs +++ b/KVA/Migration.Toolkit.Source/Handlers/MigrateMediaLibrariesCommandHandler.cs @@ -181,7 +181,7 @@ private async Task RequireMigratedMediaFiles(List<(IMediaLibrary sourceLibrary, if (!toolkitConfiguration.MigrateOnlyMediaFileInfo.GetValueOrDefault(true) && !string.IsNullOrWhiteSpace(toolkitConfiguration.KxCmsDirPath)) { - string? cmsMediaLibrariesFolder = KenticoHelper.GetSettingsKey(modelFacade, ksSite.SiteID, "CMSMediaLibrariesFolder"); + string? cmsMediaLibrariesFolder = KenticoHelper.GetSettingsKey(modelFacade, ksSite.SiteID, "CMSMediaLibrariesFolder"); if (cmsMediaLibrariesFolder != null) { if (Path.IsPathRooted(cmsMediaLibrariesFolder)) @@ -193,21 +193,21 @@ private async Task RequireMigratedMediaFiles(List<(IMediaLibrary sourceLibrary, { if (cmsMediaLibrariesFolder.StartsWith("~/")) { - string cleared = $"{cmsMediaLibrariesFolder.Substring(2, cmsMediaLibrariesFolder.Length - 2)}".Replace("/", "\\"); + string cleared = $"{cmsMediaLibrariesFolder[2..]}".Replace("/", "\\"); sourceMediaLibraryPath = Path.Combine(toolkitConfiguration.KxCmsDirPath, cleared, ksSite.SiteName, ksMediaLibrary.LibraryFolder); loadMediaFileData = true; } else { sourceMediaLibraryPath = Path.Combine(toolkitConfiguration.KxCmsDirPath, cmsMediaLibrariesFolder, ksSite.SiteName, ksMediaLibrary.LibraryFolder); - loadMediaFileData = true; + loadMediaFileData = true; } } } else { sourceMediaLibraryPath = Path.Combine(toolkitConfiguration.KxCmsDirPath, ksSite.SiteName, DirMedia, ksMediaLibrary.LibraryFolder); - loadMediaFileData = true; + loadMediaFileData = true; } } diff --git a/KVA/Migration.Toolkit.Source/Helpers/KenticoHelper.cs b/KVA/Migration.Toolkit.Source/Helpers/KenticoHelper.cs index 811ef70e..e0bc02cd 100644 --- a/KVA/Migration.Toolkit.Source/Helpers/KenticoHelper.cs +++ b/KVA/Migration.Toolkit.Source/Helpers/KenticoHelper.cs @@ -16,7 +16,7 @@ public static void CopyCustomData(ContainerCustomData target, string? sourceXml) target.SetValue(columnName, customNodeData.GetValue(columnName)); } } - + public static string? GetSettingsKey(ModelFacade facade, int? siteId, string keyName) { var keys = facade.Select("KeyName = @keyName", "SiteID", new SqlParameter("keyName", keyName)).ToList(); diff --git a/KVA/Migration.Toolkit.Source/Mappers/ContentItemMapper.cs b/KVA/Migration.Toolkit.Source/Mappers/ContentItemMapper.cs index ea788966..90b3e109 100644 --- a/KVA/Migration.Toolkit.Source/Mappers/ContentItemMapper.cs +++ b/KVA/Migration.Toolkit.Source/Mappers/ContentItemMapper.cs @@ -8,7 +8,6 @@ using CMS.MediaLibrary; using CMS.Websites; using CMS.Websites.Internal; -using Kentico.Components.Web.Mvc.FormComponents; using Kentico.Xperience.UMT.Model; using Microsoft.Extensions.Logging; @@ -82,7 +81,7 @@ protected override IEnumerable MapInternal(CmsTreeMapperSource source .WhereEquals(nameof(WebPageItemInfo.WebPageItemGUID), contentItemGuid) .FirstOrDefault(); string? treePath = targetWebPage?.WebPageItemTreePath; - + var websiteChannelInfo = WebsiteChannelInfoProvider.ProviderObject.Get(siteGuid); var treePathConvertor = TreePathConvertor.GetSiteConverter(websiteChannelInfo.WebsiteChannelID); if (treePath == null) @@ -91,7 +90,7 @@ protected override IEnumerable MapInternal(CmsTreeMapperSource source if (treePathIsDifferent) { logger.LogInformation($"Original node alias path '{cmsTree.NodeAliasPath}' of '{cmsTree.NodeName}' item was converted to '{treePath}' since the value does not allow original range of allowed characters."); - } + } } foreach (var cmsDocument in migratedDocuments) @@ -840,14 +839,14 @@ private void WalkProperties(int siteId, JObject properties, List>() is { Count: > 0 } items) + if (value?.ToObject>() is { Count: > 0 } items) { properties[key] = JToken.FromObject(items.Select(x => new Kentico.Components.Web.Mvc.FormComponents.PathSelectorItem { TreePath = x.NodeAliasPath }).ToList()); } - + break; } case Kx13FormComponents.Kentico_AttachmentSelector when newFormComponent == FormComponents.AdminAssetSelectorComponent: @@ -862,7 +861,7 @@ private void WalkProperties(int siteId, JObject properties, List>() is { Count: > 0 } items) + if (value?.ToObject>() is { Count: > 0 } items) { properties[key] = JToken.FromObject(items.Select(x => new WebPageRelatedItem { WebPageGuid = spoiledGuidContext.EnsureNodeGuid(x.NodeGuid, siteId) }).ToList()); } diff --git a/KVA/Migration.Toolkit.Source/Mappers/PageTemplateConfigurationMapper.cs b/KVA/Migration.Toolkit.Source/Mappers/PageTemplateConfigurationMapper.cs index 986f5442..589eb5ca 100644 --- a/KVA/Migration.Toolkit.Source/Mappers/PageTemplateConfigurationMapper.cs +++ b/KVA/Migration.Toolkit.Source/Mappers/PageTemplateConfigurationMapper.cs @@ -181,14 +181,14 @@ private void WalkProperties(int siteId, JObject properties, List>() is { Count: > 0 } items) + if (value?.ToObject>() is { Count: > 0 } items) { properties[key] = JToken.FromObject(items.Select(x => new Kentico.Components.Web.Mvc.FormComponents.PathSelectorItem { TreePath = x.NodeAliasPath }).ToList()); } - + break; } case Kx13FormComponents.Kentico_AttachmentSelector when newFormComponent == FormComponents.AdminAssetSelectorComponent: