Skip to content

Commit

Permalink
[Skybrud] Added Udi extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
rpjengaard committed Jan 25, 2018
1 parent b5a8a86 commit 779f76d
Show file tree
Hide file tree
Showing 12 changed files with 1,115 additions and 11 deletions.
Binary file not shown.
Binary file not shown.
Binary file added src/.vs/Skybrud.UmbracoEssentials/v15/.suo
Binary file not shown.
Empty file.
Binary file not shown.
1,031 changes: 1,031 additions & 0 deletions src/.vs/config/applicationhost.config

Large diffs are not rendered by default.

73 changes: 73 additions & 0 deletions src/Skybrud.UmbracoEssentials/Extensions/Udi/UdiExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Umbraco.Core.Models;
using Umbraco.Web;
using Skybrud.Essentials.Strings.Extensions;

namespace Skybrud.UmbracoEssentials.Extensions.Udi
{
public static class UdiExtensions
{
/// <summary>
/// Find node in Umbraco and return the guid of the node
/// </summary>
/// <param name="nodeId"></param>
/// <returns></returns>
public static Guid? GetGuid(this int nodeId)
{
IPublishedContent node = UmbracoContext.Current.ContentCache.GetById(nodeId);

if (node == null) return (Guid?)null;

return node.GetKey();
}

/// <summary>
/// Find node in Umbraco and returns the guid-string (w. - removed)
/// </summary>
/// <param name="nodeId"></param>
/// <returns></returns>
public static string GetGuidStringExamine(this int nodeId)
{
Guid? g = GetGuid(nodeId);

if (g == null) return string.Empty;

return g.ToString().Replace("-", "");
}

/// <summary>
/// Find nodes in Umbraco and returns the guid-strings (w. - removed)
/// </summary>
/// <param name="nodeIds">int[]</param>
/// <returns></returns>
public static string GetGuidsStringExamine(this int[] nodeIds)
{
List<string> guids = new List<string>();

foreach (int i in nodeIds)
{
Guid? g = GetGuid(i);

if (g == null) continue;

guids.Add(g.ToString().Replace("-", ""));
}

return String.Join(" ", guids.ToArray());
}

/// <summary>
/// Find nodes in Umbraco and returns the guid-strings (w. - removed)
/// </summary>
/// <param name="nodeIds">string</param>
/// <returns></returns>
public static string GetGuidsStringExamine(this string nodeIds)
{
return nodeIds.ToInt32Array().GetGuidsStringExamine();
}
}
}
6 changes: 3 additions & 3 deletions src/Skybrud.UmbracoEssentials/Properties/AssemblyInfo.Json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"company": "Skybrud.dk",
"product": "Skybrud.UmbracoEssentials",
"copyright": "Copyright © 2017",
"version": "1.0.1.0",
"informationalVersion": "1.0.1",
"fileVersion": "1.0.1.0"
"version": "1.0.2.0",
"informationalVersion": "1.0.2",
"fileVersion": "1.0.2.0"
}
6 changes: 3 additions & 3 deletions src/Skybrud.UmbracoEssentials/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyVersion("1.0.2.0")]
[assembly: AssemblyInformationalVersion("1.0.2")]
[assembly: AssemblyFileVersion("1.0.2.0")]
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,8 @@
<HintPath>..\packages\semver.1.1.2\lib\net45\Semver.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Skybrud.Essentials, Version=1.0.7.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Skybrud.Essentials.1.0.7\lib\net45\Skybrud.Essentials.dll</HintPath>
<Private>True</Private>
<Reference Include="Skybrud.Essentials, Version=1.0.11.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Skybrud.Essentials.1.0.11\lib\net45\Skybrud.Essentials.dll</HintPath>
</Reference>
<Reference Include="SQLCE4Umbraco, Version=1.0.6185.24087, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\UmbracoCms.Core.7.5.6\lib\SQLCE4Umbraco.dll</HintPath>
Expand Down Expand Up @@ -264,6 +263,7 @@
<Compile Include="Extensions\PublishedContent\PublishedContentExtensions.Content.cs" />
<Compile Include="Extensions\PublishedContent\PublishedContentExtensions.cs" />
<Compile Include="Extensions\PublishedContent\PublishedContentExtensions.Media.cs" />
<Compile Include="Extensions\Udi\UdiExtensions.cs" />
<Compile Include="Media\MediaUtils.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<id>$id$</id>
<version>$version$</version>
<title>$title$</title>
<authors>Anders Bjerner</authors>
<authors>Anders Bjerner, Rene Pjengaard Bank</authors>
<owners>Anders Bjerner</owners>
<licenseUrl>https://github.com/skybrud/Skybrud.UmbracoEssentials/blob/master/LICENSE.md</licenseUrl>
<projectUrl>https://github.com/skybrud/Skybrud.UmbracoEssentials</projectUrl>
Expand Down
2 changes: 1 addition & 1 deletion src/Skybrud.UmbracoEssentials/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<package id="Owin" version="1.0" targetFramework="net45" developmentDependency="true" />
<package id="semver" version="1.1.2" targetFramework="net45" developmentDependency="true" />
<package id="SharpZipLib" version="0.86.0" targetFramework="net45" developmentDependency="true" />
<package id="Skybrud.Essentials" version="1.0.7" targetFramework="net45" />
<package id="Skybrud.Essentials" version="1.0.11" targetFramework="net45" />
<package id="UmbracoCms.Core" version="7.5.6" targetFramework="net45" developmentDependency="true" />
<package id="UrlRewritingNet" version="2.0.7" targetFramework="net45" developmentDependency="true" />
<package id="xmlrpcnet" version="2.5.0" targetFramework="net45" developmentDependency="true" />
Expand Down

0 comments on commit 779f76d

Please sign in to comment.