Skip to content

Commit

Permalink
dotnet format fix
Browse files Browse the repository at this point in the history
  • Loading branch information
tkrch committed Aug 19, 2024
1 parent f27f452 commit 3a01195
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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;
}
}

Expand Down
2 changes: 1 addition & 1 deletion KVA/Migration.Toolkit.Source/Helpers/KenticoHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<ICmsSettingsKey>("KeyName = @keyName", "SiteID", new SqlParameter("keyName", keyName)).ToList();
Expand Down
11 changes: 5 additions & 6 deletions KVA/Migration.Toolkit.Source/Mappers/ContentItemMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -82,7 +81,7 @@ protected override IEnumerable<IUmtModel> 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)
Expand All @@ -91,7 +90,7 @@ protected override IEnumerable<IUmtModel> 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)
Expand Down Expand Up @@ -840,14 +839,14 @@ private void WalkProperties(int siteId, JObject properties, List<EditingFormCont
{
case Kx13FormComponents.Kentico_PathSelector:
{
if (value?.ToObject<List<Services.Model.PathSelectorItem>>() is { Count: > 0 } items)
if (value?.ToObject<List<PathSelectorItem>>() 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:
Expand All @@ -862,7 +861,7 @@ private void WalkProperties(int siteId, JObject properties, List<EditingFormCont
}
case Kx13FormComponents.Kentico_PageSelector when newFormComponent == FormComponents.Kentico_Xperience_Admin_Websites_WebPageSelectorComponent:
{
if (value?.ToObject<List<Services.Model.PageSelectorItem>>() is { Count: > 0 } items)
if (value?.ToObject<List<PageSelectorItem>>() is { Count: > 0 } items)
{
properties[key] = JToken.FromObject(items.Select(x => new WebPageRelatedItem { WebPageGuid = spoiledGuidContext.EnsureNodeGuid(x.NodeGuid, siteId) }).ToList());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,14 +181,14 @@ private void WalkProperties(int siteId, JObject properties, List<EditingFormCont
{
case Kx13FormComponents.Kentico_PathSelector:
{
if (value?.ToObject<List<Services.Model.PathSelectorItem>>() is { Count: > 0 } items)
if (value?.ToObject<List<PathSelectorItem>>() 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:
Expand Down

0 comments on commit 3a01195

Please sign in to comment.