Files
Umbraco-CMS/src/Umbraco.Core/Extensions/GuidExtensions.cs
Sven Geusens 95849c265b Document version endpoints (#15946)
* Rename/Move/duplicate PaginationService to facilitate conversion closer to the data layer

Duplication is because of internal modifier as we don't want to expose these temporary classes

* Move Guid to Int Extensions into core + add unittests

* Added Document version endpoints

Updated used services to use async methods

* Moved PaginationConverter into core so it can be used by the service layer

* Endpoint structure improvements

* Updating OpenApi.json

* Add greedy constructors for contentService tests

* Namespace changes and naming cleanup

* Update openapispec again...

* Refactor injected services

* PR suggestion updates

- Move endpoints into their own structural section as they are also in a different swagger section
- Naming improvements
- Allign PresentationFactories with similar classes
- Cleanup unused assignments
- Cleanup refactoring comments
- Improve obsoletion remarks

* Cleanup

* ResponseModel improvements

* OpenApi spec update

---------

Co-authored-by: Sven Geusens <sge@umbraco.dk>
Co-authored-by: Elitsa <elm@umbraco.dk>
2024-04-02 12:12:36 +02:00

20 lines
554 B
C#

namespace Umbraco.Cms.Core.Extensions;
public static class GuidExtensions
{
public static bool IsFakeGuid(this Guid guid)
{
var bytes = guid.ToByteArray();
// Our fake guid is a 32 bit int, converted to a byte representation,
// so we can check if everything but the first 4 bytes are 0, if so, we know it's a fake guid.
return bytes[4..].All(x => x == 0);
}
public static int ToInt(this Guid guid)
{
var bytes = guid.ToByteArray();
return BitConverter.ToInt32(bytes, 0);
}
}