├── src
├── Ulid.Unity
│ ├── ProjectSettings
│ │ ├── boot.config
│ │ ├── ProjectVersion.txt
│ │ ├── ClusterInputManager.asset
│ │ ├── PresetManager.asset
│ │ ├── VFXManager.asset
│ │ ├── NetworkManager.asset
│ │ ├── XRSettings.asset
│ │ ├── VersionControlSettings.asset
│ │ ├── TimeManager.asset
│ │ ├── EditorBuildSettings.asset
│ │ ├── AudioManager.asset
│ │ ├── TagManager.asset
│ │ ├── UnityConnectSettings.asset
│ │ ├── PackageManagerSettings.asset
│ │ ├── DynamicsManager.asset
│ │ ├── EditorSettings.asset
│ │ ├── MemorySettings.asset
│ │ ├── NavMeshAreas.asset
│ │ ├── GraphicsSettings.asset
│ │ ├── Physics2DSettings.asset
│ │ ├── QualitySettings.asset
│ │ ├── InputManager.asset
│ │ └── ProjectSettings.asset
│ ├── UserSettings
│ │ ├── Search.settings
│ │ └── EditorUserSettings.asset
│ ├── Assets
│ │ ├── Plugins
│ │ │ ├── System.Memory.dll
│ │ │ ├── System.Buffers.dll
│ │ │ ├── System.Runtime.CompilerServices.Unsafe.dll
│ │ │ ├── System.Memory.dll.meta
│ │ │ ├── System.Buffers.dll.meta
│ │ │ └── System.Runtime.CompilerServices.Unsafe.dll.meta
│ │ ├── Plugins.meta
│ │ ├── Scenes.meta
│ │ ├── Scenes
│ │ │ ├── SampleScene.unity.meta
│ │ │ └── SampleScene.unity
│ │ ├── Scripts.meta
│ │ └── Scripts
│ │ │ ├── Ulid.meta
│ │ │ ├── Ulid
│ │ │ ├── package.json.meta
│ │ │ ├── Ulid.asmdef.meta
│ │ │ ├── Ulid.cs.meta
│ │ │ ├── RandomProvider.cs.meta
│ │ │ ├── UlidTypeConverter.cs.meta
│ │ │ ├── package.json
│ │ │ ├── Ulid.asmdef
│ │ │ ├── UlidTypeConverter.cs
│ │ │ └── RandomProvider.cs
│ │ │ ├── Editor.meta
│ │ │ └── Editor
│ │ │ ├── PackageExporter.cs.meta
│ │ │ └── PackageExporter.cs
│ └── .vsconfig
├── Ulid.MessagePack
│ ├── Ulid.MessagePack.csproj
│ └── UlidMessagePackFormatter.cs
├── Ulid.SystemTextJson
│ └── Ulid.SystemTextJson.csproj
├── Ulid.Cli
│ ├── Ulid.Cli.csproj
│ ├── Program.cs
│ └── Util.cs
└── Ulid
│ ├── Ulid.csproj
│ ├── UlidTypeConverter.cs
│ ├── UlidJsonConverter.cs
│ └── RandomProvider.cs
├── Icon.png
├── release.snk
├── sandbox
├── BlazorWasm
│ ├── Pages
│ │ └── Index.razor
│ ├── wwwroot
│ │ ├── favicon.ico
│ │ ├── css
│ │ │ ├── open-iconic
│ │ │ │ ├── font
│ │ │ │ │ ├── fonts
│ │ │ │ │ │ ├── open-iconic.eot
│ │ │ │ │ │ ├── open-iconic.otf
│ │ │ │ │ │ ├── open-iconic.ttf
│ │ │ │ │ │ └── open-iconic.woff
│ │ │ │ │ └── css
│ │ │ │ │ │ └── open-iconic-bootstrap.min.css
│ │ │ │ ├── ICON-LICENSE
│ │ │ │ ├── README.md
│ │ │ │ └── FONT-LICENSE
│ │ │ └── app.css
│ │ └── index.html
│ ├── Shared
│ │ ├── MainLayout.razor
│ │ └── MainLayout.razor.css
│ ├── App.razor
│ ├── _Imports.razor
│ ├── BlazorWasm.csproj
│ └── Program.cs
└── TryUlid
│ ├── Program.cs
│ └── TryUlid.csproj
├── .github
├── workflows
│ ├── prevent-github-change.yaml
│ ├── stale.yaml
│ ├── toc.yaml
│ ├── build-debug.yaml
│ └── build-release.yaml
└── dependabot.yaml
├── benchmark
└── PerfBenchmark
│ ├── Program.cs
│ ├── PerfBenchmark.csproj
│ ├── Suite
│ ├── New.cs
│ ├── NewToString.cs
│ ├── Equals.cs
│ ├── ToString.cs
│ ├── GetHashCode.cs
│ ├── CompareTo.cs
│ └── Parse.cs
│ └── BenchmarkConfig.cs
├── tests
├── Ulid.Cli.Tests
│ ├── Ulid.Cli.Tests.csproj
│ ├── TextWriterBridge.cs
│ └── UlidCliTest.cs
├── Ulid.Tests
│ ├── Ulid.Tests.csproj
│ ├── UlidTypeConverterTests.cs
│ └── UlidTest.cs
├── Ulid.SystemTextJson.Tests
│ ├── Ulid.SystemTextJson.Tests.csproj
│ └── UlidJsonConverterTest.cs
└── Ulid.MessagePack.Tests
│ ├── Ulid.MessagePack.Tests.csproj
│ └── UlidMessagePackFormatterTest.cs
├── LICENSE
├── .editorconfig
├── Directory.Build.props
├── .gitignore
├── Ulid.sln
└── README.md
/src/Ulid.Unity/ProjectSettings/boot.config:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/Ulid.Unity/UserSettings/Search.settings:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/Icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Cysharp/Ulid/HEAD/Icon.png
--------------------------------------------------------------------------------
/release.snk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Cysharp/Ulid/HEAD/release.snk
--------------------------------------------------------------------------------
/sandbox/BlazorWasm/Pages/Index.razor:
--------------------------------------------------------------------------------
1 | @page "/"
2 |
3 |
Ulid: @Ulid.NewUlid().ToString()
--------------------------------------------------------------------------------
/sandbox/BlazorWasm/wwwroot/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Cysharp/Ulid/HEAD/sandbox/BlazorWasm/wwwroot/favicon.ico
--------------------------------------------------------------------------------
/src/Ulid.Unity/Assets/Plugins/System.Memory.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Cysharp/Ulid/HEAD/src/Ulid.Unity/Assets/Plugins/System.Memory.dll
--------------------------------------------------------------------------------
/src/Ulid.Unity/ProjectSettings/ProjectVersion.txt:
--------------------------------------------------------------------------------
1 | m_EditorVersion: 2021.3.41f1
2 | m_EditorVersionWithRevision: 2021.3.41f1 (6c5a9e20c022)
3 |
--------------------------------------------------------------------------------
/src/Ulid.Unity/.vsconfig:
--------------------------------------------------------------------------------
1 | {
2 | "version": "1.0",
3 | "components": [
4 | "Microsoft.VisualStudio.Workload.ManagedGame"
5 | ]
6 | }
7 |
--------------------------------------------------------------------------------
/src/Ulid.Unity/Assets/Plugins/System.Buffers.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Cysharp/Ulid/HEAD/src/Ulid.Unity/Assets/Plugins/System.Buffers.dll
--------------------------------------------------------------------------------
/sandbox/BlazorWasm/wwwroot/css/open-iconic/font/fonts/open-iconic.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Cysharp/Ulid/HEAD/sandbox/BlazorWasm/wwwroot/css/open-iconic/font/fonts/open-iconic.eot
--------------------------------------------------------------------------------
/sandbox/BlazorWasm/wwwroot/css/open-iconic/font/fonts/open-iconic.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Cysharp/Ulid/HEAD/sandbox/BlazorWasm/wwwroot/css/open-iconic/font/fonts/open-iconic.otf
--------------------------------------------------------------------------------
/sandbox/BlazorWasm/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Cysharp/Ulid/HEAD/sandbox/BlazorWasm/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf
--------------------------------------------------------------------------------
/sandbox/BlazorWasm/wwwroot/css/open-iconic/font/fonts/open-iconic.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Cysharp/Ulid/HEAD/sandbox/BlazorWasm/wwwroot/css/open-iconic/font/fonts/open-iconic.woff
--------------------------------------------------------------------------------
/src/Ulid.Unity/Assets/Plugins/System.Runtime.CompilerServices.Unsafe.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Cysharp/Ulid/HEAD/src/Ulid.Unity/Assets/Plugins/System.Runtime.CompilerServices.Unsafe.dll
--------------------------------------------------------------------------------
/src/Ulid.Unity/ProjectSettings/ClusterInputManager.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!236 &1
4 | ClusterInputManager:
5 | m_ObjectHideFlags: 0
6 | m_Inputs: []
7 |
--------------------------------------------------------------------------------
/src/Ulid.Unity/ProjectSettings/PresetManager.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!1386491679 &1
4 | PresetManager:
5 | m_ObjectHideFlags: 0
6 | m_DefaultList: []
7 |
--------------------------------------------------------------------------------
/src/Ulid.Unity/ProjectSettings/VFXManager.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!937362698 &1
4 | VFXManager:
5 | m_ObjectHideFlags: 0
6 | m_IndirectShader: {fileID: 0}
7 | m_RenderPipeSettingsPath:
8 |
--------------------------------------------------------------------------------
/src/Ulid.Unity/Assets/Plugins.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f8e43a746d080544b847dcbe305657a4
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/src/Ulid.Unity/Assets/Scenes.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 3e4672a57ce755a44805bc58b4ddea29
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/src/Ulid.Unity/Assets/Scenes/SampleScene.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 2cda990e2423bbf4892e6590ba056729
3 | DefaultImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/src/Ulid.Unity/Assets/Scripts.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 4093210f91abeec46b0af541a4332422
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/src/Ulid.Unity/ProjectSettings/NetworkManager.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!149 &1
4 | NetworkManager:
5 | m_ObjectHideFlags: 0
6 | m_DebugLevel: 0
7 | m_Sendrate: 15
8 | m_AssetToPrefab: {}
9 |
--------------------------------------------------------------------------------
/src/Ulid.Unity/Assets/Scripts/Ulid.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e02baf6b68c44b54c89dd6ab4fa7172c
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/src/Ulid.Unity/Assets/Scripts/Ulid/package.json.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 9ee36e7604ff9e145a698cf2d03360cd
3 | PackageManifestImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/sandbox/BlazorWasm/Shared/MainLayout.razor:
--------------------------------------------------------------------------------
1 | @inherits LayoutComponentBase
2 |
3 |
10 |
--------------------------------------------------------------------------------
/src/Ulid.Unity/Assets/Scripts/Editor.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: bae1509ed11b8474abe3e85fcb1ab1f8
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/src/Ulid.Unity/Assets/Scripts/Ulid/Ulid.asmdef.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 3dd436b5b2e11f944a89f0ee472bf769
3 | AssemblyDefinitionImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/src/Ulid.Unity/ProjectSettings/XRSettings.asset:
--------------------------------------------------------------------------------
1 | {
2 | "m_SettingKeys": [
3 | "VR Device Disabled",
4 | "VR Device User Alert"
5 | ],
6 | "m_SettingValues": [
7 | "False",
8 | "False"
9 | ]
10 | }
--------------------------------------------------------------------------------
/src/Ulid.Unity/ProjectSettings/VersionControlSettings.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!890905787 &1
4 | VersionControlSettings:
5 | m_ObjectHideFlags: 0
6 | m_Mode: Visible Meta Files
7 | m_CollabEditorSettings:
8 | inProgressEnabled: 1
9 |
--------------------------------------------------------------------------------
/src/Ulid.Unity/ProjectSettings/TimeManager.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!5 &1
4 | TimeManager:
5 | m_ObjectHideFlags: 0
6 | Fixed Timestep: 0.02
7 | Maximum Allowed Timestep: 0.1
8 | m_TimeScale: 1
9 | Maximum Particle Timestep: 0.03
10 |
--------------------------------------------------------------------------------
/sandbox/TryUlid/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading;
3 |
4 | namespace TryUlid
5 | {
6 | class Program
7 | {
8 | static void Main(string[] args)
9 | {
10 | Console.WriteLine(Ulid.MaxValue.ToString());
11 | }
12 | }
13 | }
--------------------------------------------------------------------------------
/src/Ulid.Unity/Assets/Scripts/Ulid/Ulid.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c5a05bd553bb1854cb06251baf130f0a
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/.github/workflows/prevent-github-change.yaml:
--------------------------------------------------------------------------------
1 | name: Prevent github change
2 | on:
3 | pull_request:
4 | paths:
5 | - ".github/**/*.yaml"
6 | - ".github/**/*.yml"
7 |
8 | jobs:
9 | detect:
10 | permissions:
11 | contents: read
12 | uses: Cysharp/Actions/.github/workflows/prevent-github-change.yaml@main
13 |
--------------------------------------------------------------------------------
/.github/workflows/stale.yaml:
--------------------------------------------------------------------------------
1 | name: "Close stale issues"
2 |
3 | on:
4 | workflow_dispatch:
5 | schedule:
6 | - cron: "0 0 * * *"
7 |
8 | jobs:
9 | stale:
10 | permissions:
11 | contents: read
12 | pull-requests: write
13 | issues: write
14 | uses: Cysharp/Actions/.github/workflows/stale-issue.yaml@main
15 |
--------------------------------------------------------------------------------
/.github/workflows/toc.yaml:
--------------------------------------------------------------------------------
1 | name: TOC Generator
2 |
3 | on:
4 | push:
5 | paths:
6 | - 'README.md'
7 |
8 | jobs:
9 | toc:
10 | permissions:
11 | contents: write
12 | uses: Cysharp/Actions/.github/workflows/toc-generator.yaml@main
13 | with:
14 | TOC_TITLE: "## Table of Contents"
15 | secrets: inherit
16 |
--------------------------------------------------------------------------------
/src/Ulid.Unity/Assets/Scripts/Ulid/RandomProvider.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 724e057c9377a464697350c83d2885aa
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/src/Ulid.Unity/Assets/Scripts/Editor/PackageExporter.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 49fb8916247062e4299df12bdaae0abc
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/src/Ulid.Unity/Assets/Scripts/Ulid/UlidTypeConverter.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ea6314adef6d2164588862dda72ce24c
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/src/Ulid.Unity/ProjectSettings/EditorBuildSettings.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!1045 &1
4 | EditorBuildSettings:
5 | m_ObjectHideFlags: 0
6 | serializedVersion: 2
7 | m_Scenes:
8 | - enabled: 1
9 | path: Assets/Scenes/SampleScene.unity
10 | guid: 2cda990e2423bbf4892e6590ba056729
11 | m_configObjects: {}
12 |
--------------------------------------------------------------------------------
/benchmark/PerfBenchmark/Program.cs:
--------------------------------------------------------------------------------
1 | using BenchmarkDotNet.Running;
2 |
3 | namespace PerfBenchmark
4 | {
5 | class Program
6 | {
7 | static void Main(string[] args)
8 | {
9 | // System.Guid.NewGuid().TryWriteBytes()
10 | BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args);
11 | }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/Ulid.Unity/Assets/Scripts/Ulid/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "com.cysharp.ulid",
3 | "displayName": "Ulid",
4 | "version": "1.4.1",
5 | "unity": "2019.4",
6 | "description": "Fast .NET C# Implementation of ULID for .NET Core and Unity.",
7 | "keywords": [
8 | "ulid"
9 | ],
10 | "license": "MIT",
11 | "category": "ulid",
12 | "dependencies": {}
13 | }
14 |
--------------------------------------------------------------------------------
/sandbox/BlazorWasm/App.razor:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Sorry, there's nothing at this address.
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/sandbox/TryUlid/TryUlid.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net7.0
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/sandbox/BlazorWasm/_Imports.razor:
--------------------------------------------------------------------------------
1 | @using System.Net.Http
2 | @using System.Net.Http.Json
3 | @using Microsoft.AspNetCore.Components.Forms
4 | @using Microsoft.AspNetCore.Components.Routing
5 | @using Microsoft.AspNetCore.Components.Web
6 | @using Microsoft.AspNetCore.Components.Web.Virtualization
7 | @using Microsoft.AspNetCore.Components.WebAssembly.Http
8 | @using Microsoft.JSInterop
9 | @using BlazorWasm
10 | @using BlazorWasm.Shared
11 |
--------------------------------------------------------------------------------
/src/Ulid.Unity/ProjectSettings/AudioManager.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!11 &1
4 | AudioManager:
5 | m_ObjectHideFlags: 0
6 | m_Volume: 1
7 | Rolloff Scale: 1
8 | Doppler Factor: 1
9 | Default Speaker Mode: 2
10 | m_SampleRate: 0
11 | m_DSPBufferSize: 1024
12 | m_VirtualVoiceCount: 512
13 | m_RealVoiceCount: 32
14 | m_SpatializerPlugin:
15 | m_AmbisonicDecoderPlugin:
16 | m_DisableAudio: 0
17 | m_VirtualizeEffects: 1
18 |
--------------------------------------------------------------------------------
/src/Ulid.Unity/Assets/Scripts/Ulid/Ulid.asmdef:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Ulid",
3 | "references": [],
4 | "includePlatforms": [],
5 | "excludePlatforms": [],
6 | "allowUnsafeCode": true,
7 | "overrideReferences": false,
8 | "precompiledReferences": [
9 | "System.Memory.dll",
10 | "System.Buffers.dll",
11 | "System.Runtime.CompilerServices.Unsafe.dll"
12 | ],
13 | "autoReferenced": true,
14 | "defineConstraints": [],
15 | "versionDefines": []
16 | }
--------------------------------------------------------------------------------
/benchmark/PerfBenchmark/PerfBenchmark.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net7.0
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/src/Ulid.Unity/ProjectSettings/TagManager.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!78 &1
4 | TagManager:
5 | serializedVersion: 2
6 | tags: []
7 | layers:
8 | - Default
9 | - TransparentFX
10 | - Ignore Raycast
11 | -
12 | - Water
13 | - UI
14 | -
15 | -
16 | -
17 | -
18 | -
19 | -
20 | -
21 | -
22 | -
23 | -
24 | -
25 | -
26 | -
27 | -
28 | -
29 | -
30 | -
31 | -
32 | -
33 | -
34 | -
35 | -
36 | -
37 | -
38 | -
39 | -
40 | m_SortingLayers:
41 | - name: Default
42 | uniqueID: 0
43 | locked: 0
44 |
--------------------------------------------------------------------------------
/benchmark/PerfBenchmark/Suite/New.cs:
--------------------------------------------------------------------------------
1 | using BenchmarkDotNet.Attributes;
2 | using System;
3 |
4 | namespace PerfBenchmark.Suite
5 | {
6 | [Config(typeof(BenchmarkConfig))]
7 | public class New
8 | {
9 | [Benchmark(Baseline = true)]
10 | public Guid Guid_()
11 | {
12 | return Guid.NewGuid();
13 | }
14 |
15 | [Benchmark]
16 | public Ulid Ulid_()
17 | {
18 | return Ulid.NewUlid();
19 | }
20 |
21 | [Benchmark]
22 | public NUlid.Ulid NUlid_()
23 | {
24 | return NUlid.Ulid.NewUlid();
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/sandbox/BlazorWasm/BlazorWasm.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net7.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/src/Ulid.MessagePack/Ulid.MessagePack.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0;netstandard2.1
5 | true
6 |
7 |
8 | true
9 | Ulid.MessagePack
10 | Ulid MessagePack Formatter.
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/benchmark/PerfBenchmark/Suite/NewToString.cs:
--------------------------------------------------------------------------------
1 | using BenchmarkDotNet.Attributes;
2 | using System;
3 |
4 | namespace PerfBenchmark.Suite
5 | {
6 | [Config(typeof(BenchmarkConfig))]
7 | public class NewToString
8 | {
9 | [Benchmark(Baseline = true)]
10 | public string Guid_()
11 | {
12 | return Guid.NewGuid().ToString();
13 | }
14 |
15 | [Benchmark]
16 | public string Ulid_()
17 | {
18 | return Ulid.NewUlid().ToString();
19 | }
20 |
21 | [Benchmark]
22 | public string NUlid_()
23 | {
24 | return NUlid.Ulid.NewUlid().ToString();
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/.github/dependabot.yaml:
--------------------------------------------------------------------------------
1 | # ref: https://docs.github.com/en/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot
2 | version: 2
3 | updates:
4 | - package-ecosystem: "github-actions"
5 | directory: "/"
6 | schedule:
7 | interval: "weekly" # Check for updates to GitHub Actions every week
8 | cooldown:
9 | default-days: 14 # Wait 14 days before creating another PR for the same dependency. This will prevent vulnerability on the package impact.
10 | ignore:
11 | # I just want update action when major/minor version is updated. patch updates are too noisy.
12 | - dependency-name: "*"
13 | update-types:
14 | - version-update:semver-patch
15 |
--------------------------------------------------------------------------------
/tests/Ulid.Cli.Tests/Ulid.Cli.Tests.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net7.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/tests/Ulid.Tests/Ulid.Tests.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net7.0
5 | UlidTests
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/tests/Ulid.SystemTextJson.Tests/Ulid.SystemTextJson.Tests.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net7.0
5 | UlidTests
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/sandbox/BlazorWasm/wwwroot/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | BlazorWasm
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | Loading...
16 |
17 |
18 | An unhandled error has occurred.
19 |
Reload
20 |
🗙
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/src/Ulid.Unity/Assets/Plugins/System.Memory.dll.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 093c0580b60756443bc1d9c561452e36
3 | PluginImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | iconMap: {}
7 | executionOrder: {}
8 | defineConstraints: []
9 | isPreloaded: 0
10 | isOverridable: 0
11 | isExplicitlyReferenced: 0
12 | validateReferences: 1
13 | platformData:
14 | - first:
15 | Any:
16 | second:
17 | enabled: 1
18 | settings: {}
19 | - first:
20 | Editor: Editor
21 | second:
22 | enabled: 0
23 | settings:
24 | DefaultValueInitialized: true
25 | - first:
26 | Windows Store Apps: WindowsStoreApps
27 | second:
28 | enabled: 0
29 | settings:
30 | CPU: AnyCPU
31 | userData:
32 | assetBundleName:
33 | assetBundleVariant:
34 |
--------------------------------------------------------------------------------
/src/Ulid.Unity/Assets/Plugins/System.Buffers.dll.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 8e7af8fe9839770458b3b543b27f9b68
3 | PluginImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | iconMap: {}
7 | executionOrder: {}
8 | defineConstraints: []
9 | isPreloaded: 0
10 | isOverridable: 0
11 | isExplicitlyReferenced: 0
12 | validateReferences: 1
13 | platformData:
14 | - first:
15 | Any:
16 | second:
17 | enabled: 1
18 | settings: {}
19 | - first:
20 | Editor: Editor
21 | second:
22 | enabled: 0
23 | settings:
24 | DefaultValueInitialized: true
25 | - first:
26 | Windows Store Apps: WindowsStoreApps
27 | second:
28 | enabled: 0
29 | settings:
30 | CPU: AnyCPU
31 | userData:
32 | assetBundleName:
33 | assetBundleVariant:
34 |
--------------------------------------------------------------------------------
/src/Ulid.Unity/Assets/Plugins/System.Runtime.CompilerServices.Unsafe.dll.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: faa5df203ffb85e4e81c6230b4bf1025
3 | PluginImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | iconMap: {}
7 | executionOrder: {}
8 | defineConstraints: []
9 | isPreloaded: 0
10 | isOverridable: 0
11 | isExplicitlyReferenced: 0
12 | validateReferences: 1
13 | platformData:
14 | - first:
15 | Any:
16 | second:
17 | enabled: 1
18 | settings: {}
19 | - first:
20 | Editor: Editor
21 | second:
22 | enabled: 0
23 | settings:
24 | DefaultValueInitialized: true
25 | - first:
26 | Windows Store Apps: WindowsStoreApps
27 | second:
28 | enabled: 0
29 | settings:
30 | CPU: AnyCPU
31 | userData:
32 | assetBundleName:
33 | assetBundleVariant:
34 |
--------------------------------------------------------------------------------
/benchmark/PerfBenchmark/BenchmarkConfig.cs:
--------------------------------------------------------------------------------
1 | using BenchmarkDotNet.Configs;
2 | using BenchmarkDotNet.Diagnosers;
3 | using BenchmarkDotNet.Environments;
4 | using BenchmarkDotNet.Exporters;
5 | using BenchmarkDotNet.Exporters.Csv;
6 | using BenchmarkDotNet.Jobs;
7 |
8 | namespace PerfBenchmark
9 | {
10 | public class BenchmarkConfig : ManualConfig
11 | {
12 | public BenchmarkConfig()
13 | {
14 | // run quickly:)
15 | var baseConfig = Job.ShortRun.WithIterationCount(1).WithWarmupCount(1);
16 |
17 | // Add(baseConfig.With(Runtime.Clr).With(Jit.RyuJit).With(Platform.X64));
18 | Add(baseConfig.With(Jit.RyuJit).With(Platform.X64));
19 |
20 | Add(MarkdownExporter.GitHub);
21 | Add(CsvExporter.Default);
22 | Add(MemoryDiagnoser.Default);
23 | }
24 | }
25 | }
--------------------------------------------------------------------------------
/sandbox/BlazorWasm/Program.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
2 | using Microsoft.Extensions.Configuration;
3 | using Microsoft.Extensions.DependencyInjection;
4 | using Microsoft.Extensions.Logging;
5 | using System;
6 | using System.Collections.Generic;
7 | using System.Net.Http;
8 | using System.Text;
9 | using System.Threading.Tasks;
10 |
11 | namespace BlazorWasm
12 | {
13 | public class Program
14 | {
15 | public static async Task Main(string[] args)
16 | {
17 | var builder = WebAssemblyHostBuilder.CreateDefault(args);
18 | builder.RootComponents.Add("#app");
19 |
20 | builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
21 |
22 | await builder.Build().RunAsync();
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/Ulid.SystemTextJson/Ulid.SystemTextJson.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0;netstandard2.1
5 | SYSTEM_TEXT_JSON
6 | true
7 |
8 |
9 | true
10 | Ulid.SystemTextJson
11 | Ulid System.Text.Json Converter.
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/tests/Ulid.MessagePack.Tests/Ulid.MessagePack.Tests.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net7.0
5 | UlidTests
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/src/Ulid.Unity/UserSettings/EditorUserSettings.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!162 &1
4 | EditorUserSettings:
5 | m_ObjectHideFlags: 0
6 | serializedVersion: 4
7 | m_ConfigSettings:
8 | RecentlyUsedSceneGuid-0:
9 | value: 515250075c0c595e5f5a5e71122159444e4e4a2f7a7d7f602f284d66b4b76661
10 | flags: 0
11 | vcSharedLogLevel:
12 | value: 0d5e400f0650
13 | flags: 0
14 | m_VCAutomaticAdd: 1
15 | m_VCDebugCom: 0
16 | m_VCDebugCmd: 0
17 | m_VCDebugOut: 0
18 | m_SemanticMergeMode: 2
19 | m_DesiredImportWorkerCount: 4
20 | m_StandbyImportWorkerCount: 2
21 | m_IdleImportWorkerShutdownDelay: 60000
22 | m_VCShowFailedCheckout: 1
23 | m_VCOverwriteFailedCheckoutAssets: 1
24 | m_VCProjectOverlayIcons: 1
25 | m_VCHierarchyOverlayIcons: 1
26 | m_VCOtherOverlayIcons: 1
27 | m_VCAllowAsyncUpdate: 1
28 | m_VCScanLocalPackagesOnConnect: 1
29 | m_ArtifactGarbageCollection: 1
30 |
--------------------------------------------------------------------------------
/benchmark/PerfBenchmark/Suite/Equals.cs:
--------------------------------------------------------------------------------
1 | using BenchmarkDotNet.Attributes;
2 | using System;
3 |
4 | namespace PerfBenchmark.Suite
5 | {
6 | [Config(typeof(BenchmarkConfig))]
7 | public class Equals
8 | {
9 | Guid guid;
10 | Ulid ulid;
11 | NUlid.Ulid nulid;
12 |
13 | [GlobalSetup]
14 | public void Setup()
15 | {
16 | guid = Guid.NewGuid();
17 | ulid = new Ulid(guid.ToByteArray());
18 | nulid = new NUlid.Ulid(guid.ToByteArray());
19 | }
20 |
21 | [Benchmark(Baseline = true)]
22 | public bool Guid_()
23 | {
24 | return guid.Equals(guid);
25 | }
26 |
27 | [Benchmark]
28 | public bool Ulid_()
29 | {
30 | return ulid.Equals(ulid);
31 | }
32 |
33 | [Benchmark]
34 | public bool NUlid_()
35 | {
36 | return nulid.Equals(nulid);
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/benchmark/PerfBenchmark/Suite/ToString.cs:
--------------------------------------------------------------------------------
1 | using BenchmarkDotNet.Attributes;
2 | using System;
3 |
4 | namespace PerfBenchmark.Suite
5 | {
6 | [Config(typeof(BenchmarkConfig))]
7 | public class ToString
8 | {
9 | Guid guid;
10 | Ulid ulid;
11 | NUlid.Ulid nulid;
12 |
13 | [GlobalSetup]
14 | public void Setup()
15 | {
16 | guid = Guid.NewGuid();
17 | ulid = new Ulid(guid.ToByteArray());
18 | nulid = new NUlid.Ulid(guid.ToByteArray());
19 | }
20 |
21 | [Benchmark(Baseline = true)]
22 | public string Guid_()
23 | {
24 | return guid.ToString();
25 | }
26 |
27 | [Benchmark]
28 | public string Ulid_()
29 | {
30 | return ulid.ToString();
31 | }
32 |
33 | [Benchmark]
34 | public string NUlid_()
35 | {
36 | return nulid.ToString();
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/benchmark/PerfBenchmark/Suite/GetHashCode.cs:
--------------------------------------------------------------------------------
1 | using BenchmarkDotNet.Attributes;
2 | using System;
3 |
4 | namespace PerfBenchmark.Suite
5 | {
6 | [Config(typeof(BenchmarkConfig))]
7 | public class GetHashCode
8 | {
9 | Guid guid;
10 | Ulid ulid;
11 | NUlid.Ulid nulid;
12 |
13 | [GlobalSetup]
14 | public void Setup()
15 | {
16 | guid = Guid.NewGuid();
17 | ulid = new Ulid(guid.ToByteArray());
18 | nulid = new NUlid.Ulid(guid.ToByteArray());
19 | }
20 |
21 | [Benchmark(Baseline = true)]
22 | public int Guid_()
23 | {
24 | return guid.GetHashCode();
25 | }
26 |
27 | [Benchmark]
28 | public int Ulid_()
29 | {
30 | return ulid.GetHashCode();
31 | }
32 |
33 | [Benchmark]
34 | public int NUlid_()
35 | {
36 | return nulid.GetHashCode();
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/benchmark/PerfBenchmark/Suite/CompareTo.cs:
--------------------------------------------------------------------------------
1 | using BenchmarkDotNet.Attributes;
2 | using System;
3 |
4 | namespace PerfBenchmark.Suite
5 | {
6 | [Config(typeof(BenchmarkConfig))]
7 | public class CompareTo
8 | {
9 | Guid guid;
10 | Ulid ulid;
11 | NUlid.Ulid nulid;
12 |
13 | [GlobalSetup]
14 | public void Setup()
15 | {
16 | guid = Guid.NewGuid();
17 | ulid = new Ulid(guid.ToByteArray());
18 | nulid = new NUlid.Ulid(guid.ToByteArray());
19 | }
20 |
21 | [Benchmark(Baseline = true)]
22 | public int Guid_()
23 | {
24 | return guid.CompareTo(guid);
25 | }
26 |
27 | [Benchmark]
28 | public int Ulid_()
29 | {
30 | return ulid.CompareTo(ulid);
31 | }
32 |
33 | [Benchmark]
34 | public int NUlid_()
35 | {
36 | return nulid.CompareTo(nulid);
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/benchmark/PerfBenchmark/Suite/Parse.cs:
--------------------------------------------------------------------------------
1 | using BenchmarkDotNet.Attributes;
2 | using System;
3 |
4 | namespace PerfBenchmark.Suite
5 | {
6 | [Config(typeof(BenchmarkConfig))]
7 | public class Parse
8 | {
9 | string guid;
10 | string ulid;
11 | string nulid;
12 |
13 | [GlobalSetup]
14 | public void Setup()
15 | {
16 | var g = Guid.NewGuid();
17 | guid = g.ToString();
18 | ulid = new Ulid(g.ToByteArray()).ToString();
19 | nulid = new NUlid.Ulid(g.ToByteArray()).ToString();
20 | }
21 |
22 | [Benchmark(Baseline = true)]
23 | public Guid Guid_()
24 | {
25 | return Guid.Parse(guid);
26 | }
27 |
28 | [Benchmark]
29 | public Ulid Ulid_()
30 | {
31 | return Ulid.Parse(ulid);
32 | }
33 |
34 | [Benchmark]
35 | public NUlid.Ulid NUlid_()
36 | {
37 | return NUlid.Ulid.Parse(nulid);
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/Ulid.Unity/ProjectSettings/UnityConnectSettings.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!310 &1
4 | UnityConnectSettings:
5 | m_ObjectHideFlags: 0
6 | serializedVersion: 1
7 | m_Enabled: 0
8 | m_TestMode: 0
9 | m_EventOldUrl: https://api.uca.cloud.unity3d.com/v1/events
10 | m_EventUrl: https://cdp.cloud.unity3d.com/v1/events
11 | m_ConfigUrl: https://config.uca.cloud.unity3d.com
12 | m_TestInitMode: 0
13 | CrashReportingSettings:
14 | m_EventUrl: https://perf-events.cloud.unity3d.com
15 | m_Enabled: 0
16 | m_LogBufferSize: 10
17 | m_CaptureEditorExceptions: 1
18 | UnityPurchasingSettings:
19 | m_Enabled: 0
20 | m_TestMode: 0
21 | UnityAnalyticsSettings:
22 | m_Enabled: 0
23 | m_TestMode: 0
24 | m_InitializeOnStartup: 1
25 | UnityAdsSettings:
26 | m_Enabled: 0
27 | m_InitializeOnStartup: 1
28 | m_TestMode: 0
29 | m_IosGameId:
30 | m_AndroidGameId:
31 | m_GameIds: {}
32 | m_GameId:
33 | PerformanceReportingSettings:
34 | m_Enabled: 0
35 |
--------------------------------------------------------------------------------
/sandbox/BlazorWasm/wwwroot/css/app.css:
--------------------------------------------------------------------------------
1 | @import url('open-iconic/font/css/open-iconic-bootstrap.min.css');
2 |
3 | html, body {
4 | font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
5 | }
6 |
7 | a, .btn-link {
8 | color: #0366d6;
9 | }
10 |
11 | .btn-primary {
12 | color: #fff;
13 | background-color: #1b6ec2;
14 | border-color: #1861ac;
15 | }
16 |
17 | .content {
18 | padding-top: 1.1rem;
19 | }
20 |
21 | .valid.modified:not([type=checkbox]) {
22 | outline: 1px solid #26b050;
23 | }
24 |
25 | .invalid {
26 | outline: 1px solid red;
27 | }
28 |
29 | .validation-message {
30 | color: red;
31 | }
32 |
33 | #blazor-error-ui {
34 | background: lightyellow;
35 | bottom: 0;
36 | box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
37 | display: none;
38 | left: 0;
39 | padding: 0.6rem 1.25rem 0.7rem 1.25rem;
40 | position: fixed;
41 | width: 100%;
42 | z-index: 1000;
43 | }
44 |
45 | #blazor-error-ui .dismiss {
46 | cursor: pointer;
47 | position: absolute;
48 | right: 0.75rem;
49 | top: 0.5rem;
50 | }
51 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019 Cysharp, Inc.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/src/Ulid.Unity/ProjectSettings/PackageManagerSettings.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!114 &1
4 | MonoBehaviour:
5 | m_ObjectHideFlags: 61
6 | m_CorrespondingSourceObject: {fileID: 0}
7 | m_PrefabInstance: {fileID: 0}
8 | m_PrefabAsset: {fileID: 0}
9 | m_GameObject: {fileID: 0}
10 | m_Enabled: 1
11 | m_EditorHideFlags: 0
12 | m_Script: {fileID: 13964, guid: 0000000000000000e000000000000000, type: 0}
13 | m_Name:
14 | m_EditorClassIdentifier:
15 | m_EnablePreReleasePackages: 0
16 | m_EnablePackageDependencies: 0
17 | m_AdvancedSettingsExpanded: 1
18 | m_ScopedRegistriesSettingsExpanded: 1
19 | m_SeeAllPackageVersions: 0
20 | oneTimeWarningShown: 0
21 | m_Registries:
22 | - m_Id: main
23 | m_Name:
24 | m_Url: https://packages.unity.com
25 | m_Scopes: []
26 | m_IsDefault: 1
27 | m_Capabilities: 7
28 | m_ConfigSource: 0
29 | m_UserSelectedRegistryName:
30 | m_UserAddingNewScopedRegistry: 0
31 | m_RegistryInfoDraft:
32 | m_Modified: 0
33 | m_ErrorMessage:
34 | m_UserModificationsInstanceId: -848
35 | m_OriginalInstanceId: -850
36 | m_LoadAssets: 0
37 |
--------------------------------------------------------------------------------
/sandbox/BlazorWasm/wwwroot/css/open-iconic/ICON-LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2014 Waybury
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
--------------------------------------------------------------------------------
/src/Ulid.Unity/ProjectSettings/DynamicsManager.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!55 &1
4 | PhysicsManager:
5 | m_ObjectHideFlags: 0
6 | serializedVersion: 7
7 | m_Gravity: {x: 0, y: -9.81, z: 0}
8 | m_DefaultMaterial: {fileID: 0}
9 | m_BounceThreshold: 2
10 | m_SleepThreshold: 0.005
11 | m_DefaultContactOffset: 0.01
12 | m_DefaultSolverIterations: 6
13 | m_DefaultSolverVelocityIterations: 1
14 | m_QueriesHitBackfaces: 0
15 | m_QueriesHitTriggers: 1
16 | m_EnableAdaptiveForce: 0
17 | m_ClothInterCollisionDistance: 0
18 | m_ClothInterCollisionStiffness: 0
19 | m_ContactsGeneration: 1
20 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
21 | m_AutoSimulation: 1
22 | m_AutoSyncTransforms: 0
23 | m_ReuseCollisionCallbacks: 1
24 | m_ClothInterCollisionSettingsToggle: 0
25 | m_ContactPairsMode: 0
26 | m_BroadphaseType: 0
27 | m_WorldBounds:
28 | m_Center: {x: 0, y: 0, z: 0}
29 | m_Extent: {x: 250, y: 250, z: 250}
30 | m_WorldSubdivisions: 8
31 |
--------------------------------------------------------------------------------
/tests/Ulid.Cli.Tests/TextWriterBridge.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Text;
5 |
6 | namespace Ulid.Cli.Tests
7 | {
8 | public class TextWriterBridge : TextWriter
9 | {
10 | public readonly List Log = new List();
11 |
12 | public TextWriterBridge()
13 | {
14 | }
15 |
16 | public override Encoding Encoding => Encoding.UTF8;
17 |
18 | public override void Write(string value)
19 | {
20 | Log.Add(value);
21 | }
22 |
23 | public static IDisposable BeginSetConsoleOut(out List log)
24 | {
25 | var current = Console.Out;
26 | var tw = new TextWriterBridge();
27 | log = tw.Log;
28 | Console.SetOut(tw);
29 | return new Scope(current);
30 | }
31 |
32 | public struct Scope : IDisposable
33 | {
34 | TextWriter writer;
35 |
36 | public Scope(TextWriter writer)
37 | {
38 | this.writer = writer;
39 | }
40 |
41 | public void Dispose()
42 | {
43 | Console.SetOut(writer);
44 | }
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/Ulid.Unity/ProjectSettings/EditorSettings.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!159 &1
4 | EditorSettings:
5 | m_ObjectHideFlags: 0
6 | serializedVersion: 9
7 | m_ExternalVersionControlSupport: Visible Meta Files
8 | m_SerializationMode: 2
9 | m_LineEndingsForNewScripts: 2
10 | m_DefaultBehaviorMode: 1
11 | m_PrefabRegularEnvironment: {fileID: 0}
12 | m_PrefabUIEnvironment: {fileID: 0}
13 | m_SpritePackerMode: 4
14 | m_SpritePackerPaddingPower: 1
15 | m_EtcTextureCompressorBehavior: 1
16 | m_EtcTextureFastCompressor: 1
17 | m_EtcTextureNormalCompressor: 2
18 | m_EtcTextureBestCompressor: 4
19 | m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd;asmref
20 | m_ProjectGenerationRootNamespace:
21 | m_CollabEditorSettings:
22 | inProgressEnabled: 1
23 | m_EnableTextureStreamingInEditMode: 1
24 | m_EnableTextureStreamingInPlayMode: 1
25 | m_AsyncShaderCompilation: 1
26 | m_EnterPlayModeOptionsEnabled: 0
27 | m_EnterPlayModeOptions: 3
28 | m_ShowLightmapResolutionOverlay: 1
29 | m_UseLegacyProbeSampleCount: 1
30 | m_AssetPipelineMode: 1
31 | m_CacheServerMode: 0
32 | m_CacheServerEndpoint:
33 | m_CacheServerNamespacePrefix: default
34 | m_CacheServerEnableDownload: 1
35 | m_CacheServerEnableUpload: 1
36 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | # top-most EditorConfig file
2 | root = true
3 |
4 | [*]
5 | charset = utf-8
6 | end_of_line = lf
7 | indent_style = space
8 | indent_size = 2
9 | insert_final_newline = true
10 | trim_trailing_whitespace = true
11 |
12 | # Visual Studio Spell checker configs (https://learn.microsoft.com/en-us/visualstudio/ide/text-spell-checker?view=vs-2022#how-to-customize-the-spell-checker)
13 | spelling_exclusion_path = ./exclusion.dic
14 |
15 | [*.cs]
16 | indent_size = 4
17 | charset = utf-8-bom
18 | end_of_line = unset
19 |
20 | # Solution files
21 | [*.{sln,slnx}]
22 | end_of_line = unset
23 |
24 | # MSBuild project files
25 | [*.{csproj,props,targets}]
26 | end_of_line = unset
27 |
28 | # Xml config files
29 | [*.{ruleset,config,nuspec,resx,runsettings,DotSettings}]
30 | end_of_line = unset
31 |
32 | [*{_AssemblyInfo.cs,.notsupported.cs}]
33 | generated_code = true
34 |
35 | # C# code style settings
36 | [*.{cs}]
37 | dotnet_diagnostic.IDE0044.severity = none # IDE0044: Make field readonly
38 |
39 | # https://stackoverflow.com/questions/79195382/how-to-disable-fading-unused-methods-in-visual-studio-2022-17-12-0
40 | dotnet_diagnostic.IDE0051.severity = none # IDE0051: Remove unused private member
41 | dotnet_diagnostic.IDE0130.severity = none # IDE0130: Namespace does not match folder structure
42 |
--------------------------------------------------------------------------------
/Directory.Build.props:
--------------------------------------------------------------------------------
1 |
2 |
3 | true
4 | 7.3
5 | $(NoWarn);CS1591
6 | true
7 | $(MSBuildThisFileDirectory)release.snk
8 |
9 |
10 | false
11 | $(Version)
12 | Cysharp
13 | Cysharp
14 | © Cysharp, Inc.
15 | https://github.com/Cysharp/Ulid
16 | README.md
17 | $(PackageProjectUrl)
18 | git
19 | MIT
20 | guid
21 | Icon.png
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/src/Ulid.Unity/ProjectSettings/MemorySettings.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!387306366 &1
4 | MemorySettings:
5 | m_ObjectHideFlags: 0
6 | m_EditorMemorySettings:
7 | m_MainAllocatorBlockSize: -1
8 | m_ThreadAllocatorBlockSize: -1
9 | m_MainGfxBlockSize: -1
10 | m_ThreadGfxBlockSize: -1
11 | m_CacheBlockSize: -1
12 | m_TypetreeBlockSize: -1
13 | m_ProfilerBlockSize: -1
14 | m_ProfilerEditorBlockSize: -1
15 | m_BucketAllocatorGranularity: -1
16 | m_BucketAllocatorBucketsCount: -1
17 | m_BucketAllocatorBlockSize: -1
18 | m_BucketAllocatorBlockCount: -1
19 | m_ProfilerBucketAllocatorGranularity: -1
20 | m_ProfilerBucketAllocatorBucketsCount: -1
21 | m_ProfilerBucketAllocatorBlockSize: -1
22 | m_ProfilerBucketAllocatorBlockCount: -1
23 | m_TempAllocatorSizeMain: -1
24 | m_JobTempAllocatorBlockSize: -1
25 | m_BackgroundJobTempAllocatorBlockSize: -1
26 | m_JobTempAllocatorReducedBlockSize: -1
27 | m_TempAllocatorSizeGIBakingWorker: -1
28 | m_TempAllocatorSizeNavMeshWorker: -1
29 | m_TempAllocatorSizeAudioWorker: -1
30 | m_TempAllocatorSizeCloudWorker: -1
31 | m_TempAllocatorSizeGfx: -1
32 | m_TempAllocatorSizeJobWorker: -1
33 | m_TempAllocatorSizeBackgroundWorker: -1
34 | m_TempAllocatorSizePreloadManager: -1
35 | m_PlatformMemorySettings: {}
36 |
--------------------------------------------------------------------------------
/tests/Ulid.MessagePack.Tests/UlidMessagePackFormatterTest.cs:
--------------------------------------------------------------------------------
1 | using FluentAssertions;
2 | using MessagePack;
3 | using System;
4 | using Xunit;
5 |
6 | namespace UlidTests
7 | {
8 | public class UlidMessagePackFormatterTest
9 | {
10 | [MessagePackObject(true)]
11 | public class TestSerializationClass
12 | {
13 | public Ulid value { get; set; }
14 | }
15 |
16 | MessagePackSerializerOptions GetOptions()
17 | {
18 | var resolver = MessagePack.Resolvers.CompositeResolver.Create(
19 | Cysharp.Serialization.MessagePack.UlidMessagePackResolver.Instance,
20 | MessagePack.Resolvers.StandardResolver.Instance);
21 | return MessagePackSerializerOptions.Standard.WithResolver(resolver);
22 | }
23 |
24 | [Fact]
25 | public void SerializeTest()
26 | {
27 | var groundTruth = new TestSerializationClass()
28 | {
29 | value = Ulid.NewUlid()
30 | };
31 |
32 | var serialized = MessagePackSerializer.Serialize(groundTruth, GetOptions());
33 | var deserialized = MessagePackSerializer.Deserialize(serialized, GetOptions());
34 | deserialized.value.Should().BeEquivalentTo(groundTruth.value, "MSGPACK serialize roundtrip");
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/Ulid.Cli/Ulid.Cli.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net6.0;net8.0
6 | 7.3
7 |
8 |
9 | LatestMajor
10 |
11 |
12 | true
13 | Ulid-Cli
14 | ULID commandline utility
15 | true
16 | dotnet-ulid
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/tests/Ulid.Tests/UlidTypeConverterTests.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel;
3 | using Xunit;
4 |
5 | namespace UlidTests
6 | {
7 | public class UlidTypeConverterTests
8 | {
9 | private readonly TypeConverter _ulidConverter = TypeDescriptor.GetConverter(typeof(Ulid));
10 | private readonly Ulid _testUlid = Ulid.NewUlid();
11 |
12 | [Fact]
13 | public void UlidCanConvertFromString()
14 | {
15 | var converted = _ulidConverter.ConvertFrom(_testUlid.ToString());
16 |
17 | Assert.Equal(_testUlid, converted);
18 | }
19 |
20 | [Fact]
21 | public void UlidCanConvertFromGuid()
22 | {
23 | var guid = _testUlid.ToGuid();
24 |
25 | var converted = _ulidConverter.ConvertFrom(guid);
26 |
27 | Assert.Equal(_testUlid, converted);
28 | }
29 |
30 | [Fact]
31 | public void UlidCanCovertToString()
32 | {
33 | var converted = _ulidConverter.ConvertTo(_testUlid, typeof(string));
34 |
35 | Assert.Equal(_testUlid.ToString(), converted);
36 | }
37 |
38 | [Fact]
39 | public void UlidCanConvertToGuid()
40 | {
41 | var converted = _ulidConverter.ConvertTo(_testUlid, typeof(Guid));
42 | Assert.Equal(_testUlid.ToGuid(), converted);
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/sandbox/BlazorWasm/Shared/MainLayout.razor.css:
--------------------------------------------------------------------------------
1 | .page {
2 | position: relative;
3 | display: flex;
4 | flex-direction: column;
5 | }
6 |
7 | .main {
8 | flex: 1;
9 | }
10 |
11 | .sidebar {
12 | background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%);
13 | }
14 |
15 | .top-row {
16 | background-color: #f7f7f7;
17 | border-bottom: 1px solid #d6d5d5;
18 | justify-content: flex-end;
19 | height: 3.5rem;
20 | display: flex;
21 | align-items: center;
22 | }
23 |
24 | .top-row ::deep a, .top-row .btn-link {
25 | white-space: nowrap;
26 | margin-left: 1.5rem;
27 | }
28 |
29 | .top-row a:first-child {
30 | overflow: hidden;
31 | text-overflow: ellipsis;
32 | }
33 |
34 | @media (max-width: 640.98px) {
35 | .top-row:not(.auth) {
36 | display: none;
37 | }
38 |
39 | .top-row.auth {
40 | justify-content: space-between;
41 | }
42 |
43 | .top-row a, .top-row .btn-link {
44 | margin-left: 0;
45 | }
46 | }
47 |
48 | @media (min-width: 641px) {
49 | .page {
50 | flex-direction: row;
51 | }
52 |
53 | .sidebar {
54 | width: 250px;
55 | height: 100vh;
56 | position: sticky;
57 | top: 0;
58 | }
59 |
60 | .top-row {
61 | position: sticky;
62 | top: 0;
63 | z-index: 1;
64 | }
65 |
66 | .main > div {
67 | padding-left: 2rem !important;
68 | padding-right: 1.5rem !important;
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/src/Ulid/Ulid.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0;netstandard2.1;net6.0;net7.0;net8.0
5 | true
6 | System
7 | true
8 | Latest
9 |
10 |
11 | true
12 | Ulid
13 | Fast .NET Standard(C#) Implementation of ULID.
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | $(MSBuildProjectDirectory)\..\Ulid.Unity\Assets\Scripts\Ulid\
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/src/Ulid.Unity/ProjectSettings/NavMeshAreas.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!126 &1
4 | NavMeshProjectSettings:
5 | m_ObjectHideFlags: 0
6 | serializedVersion: 2
7 | areas:
8 | - name: Walkable
9 | cost: 1
10 | - name: Not Walkable
11 | cost: 1
12 | - name: Jump
13 | cost: 2
14 | - name:
15 | cost: 1
16 | - name:
17 | cost: 1
18 | - name:
19 | cost: 1
20 | - name:
21 | cost: 1
22 | - name:
23 | cost: 1
24 | - name:
25 | cost: 1
26 | - name:
27 | cost: 1
28 | - name:
29 | cost: 1
30 | - name:
31 | cost: 1
32 | - name:
33 | cost: 1
34 | - name:
35 | cost: 1
36 | - name:
37 | cost: 1
38 | - name:
39 | cost: 1
40 | - name:
41 | cost: 1
42 | - name:
43 | cost: 1
44 | - name:
45 | cost: 1
46 | - name:
47 | cost: 1
48 | - name:
49 | cost: 1
50 | - name:
51 | cost: 1
52 | - name:
53 | cost: 1
54 | - name:
55 | cost: 1
56 | - name:
57 | cost: 1
58 | - name:
59 | cost: 1
60 | - name:
61 | cost: 1
62 | - name:
63 | cost: 1
64 | - name:
65 | cost: 1
66 | - name:
67 | cost: 1
68 | - name:
69 | cost: 1
70 | - name:
71 | cost: 1
72 | m_LastAgentTypeID: -887442657
73 | m_Settings:
74 | - serializedVersion: 2
75 | agentTypeID: 0
76 | agentRadius: 0.5
77 | agentHeight: 2
78 | agentSlope: 45
79 | agentClimb: 0.75
80 | ledgeDropHeight: 0
81 | maxJumpAcrossDistance: 0
82 | minRegionArea: 2
83 | manualCellSize: 0
84 | cellSize: 0.16666667
85 | manualTileSize: 0
86 | tileSize: 256
87 | accuratePlacement: 0
88 | debug:
89 | m_Flags: 0
90 | m_SettingNames:
91 | - Humanoid
92 |
--------------------------------------------------------------------------------
/src/Ulid.Cli/Program.cs:
--------------------------------------------------------------------------------
1 | using ConsoleAppFramework;
2 | using Microsoft.Extensions.Hosting;
3 | using System;
4 | using System.Threading.Tasks;
5 |
6 | namespace Ulid.Cli
7 | {
8 | class Program
9 | {
10 | static async Task Main(string[] args)
11 | {
12 | await Host.CreateDefaultBuilder()
13 | .ConfigureLogging(x => x.ReplaceToSimpleConsole())
14 | .RunConsoleAppFrameworkAsync(args)
15 | .ConfigureAwait(false);
16 | }
17 | }
18 | public class UlidBatch : ConsoleAppBase
19 | {
20 | public void New(
21 | [Option("t", "timestamp(converted to UTC, ISO8601 format recommended)")]string timestamp = null,
22 | [Option("r", "randomness bytes(formatted as Base32, must be 16 characters, case insensitive)")]string randomness = null,
23 | [Option("b", "output as base64 format, or output base32 if false")]bool base64 = false,
24 | [Option("min", "min-randomness(use 000...)")]bool minRandomness = false,
25 | [Option("max", "max-randomness(use ZZZ...)")]bool maxRandomness = false)
26 | {
27 | var t = string.IsNullOrEmpty(timestamp) ? DateTimeOffset.Now : DateTime.Parse(timestamp);
28 | string r = randomness;
29 | if (r == null)
30 | {
31 | if (minRandomness)
32 | {
33 | r = "0000000000000000";
34 | }
35 | else if (maxRandomness)
36 | {
37 | r = "ZZZZZZZZZZZZZZZZ";
38 | }
39 | }
40 |
41 | var ulid = Util.CreateUlid(t, r);
42 | Console.Write(base64 ? ulid.ToBase64() : ulid.ToString());
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/Ulid.Unity/ProjectSettings/GraphicsSettings.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!30 &1
4 | GraphicsSettings:
5 | m_ObjectHideFlags: 0
6 | serializedVersion: 12
7 | m_Deferred:
8 | m_Mode: 1
9 | m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0}
10 | m_DeferredReflections:
11 | m_Mode: 1
12 | m_Shader: {fileID: 74, guid: 0000000000000000f000000000000000, type: 0}
13 | m_ScreenSpaceShadows:
14 | m_Mode: 1
15 | m_Shader: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0}
16 | m_LegacyDeferred:
17 | m_Mode: 1
18 | m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0}
19 | m_DepthNormals:
20 | m_Mode: 1
21 | m_Shader: {fileID: 62, guid: 0000000000000000f000000000000000, type: 0}
22 | m_MotionVectors:
23 | m_Mode: 1
24 | m_Shader: {fileID: 75, guid: 0000000000000000f000000000000000, type: 0}
25 | m_LightHalo:
26 | m_Mode: 1
27 | m_Shader: {fileID: 105, guid: 0000000000000000f000000000000000, type: 0}
28 | m_LensFlare:
29 | m_Mode: 1
30 | m_Shader: {fileID: 102, guid: 0000000000000000f000000000000000, type: 0}
31 | m_AlwaysIncludedShaders:
32 | - {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0}
33 | - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0}
34 | m_PreloadedShaders: []
35 | m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000,
36 | type: 0}
37 | m_CustomRenderPipeline: {fileID: 0}
38 | m_TransparencySortMode: 0
39 | m_TransparencySortAxis: {x: 0, y: 0, z: 1}
40 | m_DefaultRenderingPath: 1
41 | m_DefaultMobileRenderingPath: 1
42 | m_TierSettings: []
43 | m_LightmapStripping: 0
44 | m_FogStripping: 0
45 | m_InstancingStripping: 0
46 | m_LightmapKeepPlain: 1
47 | m_LightmapKeepDirCombined: 1
48 | m_LightmapKeepDynamicPlain: 1
49 | m_LightmapKeepDynamicDirCombined: 1
50 | m_LightmapKeepShadowMask: 1
51 | m_LightmapKeepSubtractive: 1
52 | m_FogKeepLinear: 1
53 | m_FogKeepExp: 1
54 | m_FogKeepExp2: 1
55 | m_AlbedoSwatchInfos: []
56 | m_LightsUseLinearIntensity: 0
57 | m_LightsUseColorTemperature: 0
58 |
--------------------------------------------------------------------------------
/src/Ulid/UlidTypeConverter.cs:
--------------------------------------------------------------------------------
1 | using System.ComponentModel;
2 | using System.Globalization;
3 |
4 | namespace System
5 | {
6 | public class UlidTypeConverter : TypeConverter
7 | {
8 | private static readonly Type StringType = typeof(string);
9 | private static readonly Type GuidType = typeof(Guid);
10 |
11 | public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
12 | {
13 | if (sourceType == StringType || sourceType == GuidType)
14 | {
15 | return true;
16 | }
17 |
18 | return base.CanConvertFrom(context, sourceType);
19 | }
20 |
21 | public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
22 | {
23 | if (destinationType == StringType || destinationType == GuidType)
24 | {
25 | return true;
26 | }
27 |
28 | return base.CanConvertTo(context, destinationType);
29 | }
30 |
31 | public override object ConvertFrom(ITypeDescriptorContext context,
32 | CultureInfo culture, object value)
33 | {
34 | switch (value)
35 | {
36 | case Guid g:
37 | return new Ulid(g);
38 | case string stringValue:
39 | return Ulid.Parse(stringValue);
40 | }
41 |
42 | return base.ConvertFrom(context, culture, value);
43 | }
44 |
45 | public override object ConvertTo(
46 | ITypeDescriptorContext context,
47 | CultureInfo culture,
48 | object value,
49 | Type destinationType)
50 | {
51 | if (value is Ulid ulid)
52 | {
53 | if (destinationType == StringType)
54 | {
55 | return ulid.ToString();
56 | }
57 |
58 | if (destinationType == GuidType)
59 | {
60 | return ulid.ToGuid();
61 | }
62 | }
63 |
64 | return base.ConvertTo(context, culture, value, destinationType);
65 | }
66 | }
67 | }
--------------------------------------------------------------------------------
/src/Ulid.Unity/Assets/Scripts/Ulid/UlidTypeConverter.cs:
--------------------------------------------------------------------------------
1 | using System.ComponentModel;
2 | using System.Globalization;
3 |
4 | namespace System
5 | {
6 | public class UlidTypeConverter : TypeConverter
7 | {
8 | private static readonly Type StringType = typeof(string);
9 | private static readonly Type GuidType = typeof(Guid);
10 |
11 | public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
12 | {
13 | if (sourceType == StringType || sourceType == GuidType)
14 | {
15 | return true;
16 | }
17 |
18 | return base.CanConvertFrom(context, sourceType);
19 | }
20 |
21 | public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
22 | {
23 | if (destinationType == StringType || destinationType == GuidType)
24 | {
25 | return true;
26 | }
27 |
28 | return base.CanConvertTo(context, destinationType);
29 | }
30 |
31 | public override object ConvertFrom(ITypeDescriptorContext context,
32 | CultureInfo culture, object value)
33 | {
34 | switch (value)
35 | {
36 | case Guid g:
37 | return new Ulid(g);
38 | case string stringValue:
39 | return Ulid.Parse(stringValue);
40 | }
41 |
42 | return base.ConvertFrom(context, culture, value);
43 | }
44 |
45 | public override object ConvertTo(
46 | ITypeDescriptorContext context,
47 | CultureInfo culture,
48 | object value,
49 | Type destinationType)
50 | {
51 | if (value is Ulid ulid)
52 | {
53 | if (destinationType == StringType)
54 | {
55 | return ulid.ToString();
56 | }
57 |
58 | if (destinationType == GuidType)
59 | {
60 | return ulid.ToGuid();
61 | }
62 | }
63 |
64 | return base.ConvertTo(context, culture, value, destinationType);
65 | }
66 | }
67 | }
--------------------------------------------------------------------------------
/src/Ulid.Unity/ProjectSettings/Physics2DSettings.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!19 &1
4 | Physics2DSettings:
5 | m_ObjectHideFlags: 0
6 | serializedVersion: 4
7 | m_Gravity: {x: 0, y: -9.81}
8 | m_DefaultMaterial: {fileID: 0}
9 | m_VelocityIterations: 8
10 | m_PositionIterations: 3
11 | m_VelocityThreshold: 1
12 | m_MaxLinearCorrection: 0.2
13 | m_MaxAngularCorrection: 8
14 | m_MaxTranslationSpeed: 100
15 | m_MaxRotationSpeed: 360
16 | m_BaumgarteScale: 0.2
17 | m_BaumgarteTimeOfImpactScale: 0.75
18 | m_TimeToSleep: 0.5
19 | m_LinearSleepTolerance: 0.01
20 | m_AngularSleepTolerance: 2
21 | m_DefaultContactOffset: 0.01
22 | m_JobOptions:
23 | serializedVersion: 2
24 | useMultithreading: 0
25 | useConsistencySorting: 0
26 | m_InterpolationPosesPerJob: 100
27 | m_NewContactsPerJob: 30
28 | m_CollideContactsPerJob: 100
29 | m_ClearFlagsPerJob: 200
30 | m_ClearBodyForcesPerJob: 200
31 | m_SyncDiscreteFixturesPerJob: 50
32 | m_SyncContinuousFixturesPerJob: 50
33 | m_FindNearestContactsPerJob: 100
34 | m_UpdateTriggerContactsPerJob: 100
35 | m_IslandSolverCostThreshold: 100
36 | m_IslandSolverBodyCostScale: 1
37 | m_IslandSolverContactCostScale: 10
38 | m_IslandSolverJointCostScale: 10
39 | m_IslandSolverBodiesPerJob: 50
40 | m_IslandSolverContactsPerJob: 50
41 | m_AutoSimulation: 1
42 | m_QueriesHitTriggers: 1
43 | m_QueriesStartInColliders: 1
44 | m_CallbacksOnDisable: 1
45 | m_ReuseCollisionCallbacks: 0
46 | m_AutoSyncTransforms: 0
47 | m_AlwaysShowColliders: 0
48 | m_ShowColliderSleep: 1
49 | m_ShowColliderContacts: 0
50 | m_ShowColliderAABB: 0
51 | m_ContactArrowScale: 0.2
52 | m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412}
53 | m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432}
54 | m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745}
55 | m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804}
56 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
57 |
--------------------------------------------------------------------------------
/src/Ulid.MessagePack/UlidMessagePackFormatter.cs:
--------------------------------------------------------------------------------
1 | using MessagePack;
2 | using System.Buffers;
3 | using MessagePack.Formatters;
4 | using System;
5 |
6 | namespace Cysharp.Serialization.MessagePack
7 | {
8 | public class UlidMessagePackFormatter : IMessagePackFormatter
9 | {
10 | public Ulid Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
11 | {
12 | var bin = reader.ReadBytes();
13 | if (bin == null)
14 | {
15 | throw new MessagePackSerializationException(string.Format("Unexpected msgpack code {0} ({1}) encountered.", MessagePackCode.Nil, MessagePackCode.ToFormatName(MessagePackCode.Nil)));
16 | }
17 |
18 | var seq = bin.Value;
19 | if (seq.IsSingleSegment)
20 | {
21 | return new Ulid(seq.First.Span);
22 | }
23 | else
24 | {
25 | Span buf = stackalloc byte[16];
26 | seq.CopyTo(buf);
27 | return new Ulid(buf);
28 | }
29 | }
30 |
31 | public void Serialize(ref MessagePackWriter writer, Ulid value, MessagePackSerializerOptions options)
32 | {
33 | const int Length = 16;
34 |
35 | writer.WriteBinHeader(Length);
36 | var buffer = writer.GetSpan(Length);
37 | value.TryWriteBytes(buffer);
38 | writer.Advance(Length);
39 | }
40 | }
41 |
42 | public class UlidMessagePackResolver : IFormatterResolver
43 | {
44 | public static IFormatterResolver Instance = new UlidMessagePackResolver();
45 |
46 | UlidMessagePackResolver()
47 | {
48 |
49 | }
50 |
51 | public IMessagePackFormatter GetFormatter()
52 | {
53 | return Cache.formatter;
54 | }
55 |
56 | static class Cache
57 | {
58 | public static readonly IMessagePackFormatter formatter;
59 |
60 | static Cache()
61 | {
62 | if (typeof(T) == typeof(Ulid))
63 | {
64 | formatter = (IMessagePackFormatter)(object)new UlidMessagePackFormatter();
65 | }
66 | }
67 | }
68 | }
69 | }
--------------------------------------------------------------------------------
/src/Ulid/UlidJsonConverter.cs:
--------------------------------------------------------------------------------
1 | #if NETCOREAPP3_1_OR_GREATER || SYSTEM_TEXT_JSON
2 |
3 | using System;
4 | using System.Buffers;
5 | using System.Text.Json;
6 | using System.Text.Json.Serialization;
7 |
8 | namespace Cysharp.Serialization.Json
9 | {
10 | public class UlidJsonConverter: JsonConverter
11 | {
12 | ///
13 | /// Read a Ulid value represented by a string from JSON.
14 | ///
15 | public override Ulid Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
16 | {
17 | try
18 | {
19 | if (reader.TokenType != JsonTokenType.String && reader.TokenType != JsonTokenType.PropertyName) throw new JsonException("Expected string");
20 |
21 | if (reader.HasValueSequence)
22 | {
23 | // Parse using ValueSequence
24 | var seq = reader.ValueSequence;
25 | if (seq.Length != 26) throw new JsonException("Ulid invalid: length must be 26");
26 | Span buf = stackalloc byte[26];
27 | seq.CopyTo(buf);
28 | Ulid.TryParse(buf, out var ulid);
29 | return ulid;
30 | }
31 | else
32 | {
33 | // Parse usign ValueSpan
34 | var buf = reader.ValueSpan;
35 | if (buf.Length != 26) throw new JsonException("Ulid invalid: length must be 26");
36 | Ulid.TryParse(buf, out var ulid);
37 | return ulid;
38 | }
39 | }
40 | catch (IndexOutOfRangeException e)
41 | {
42 | throw new JsonException("Ulid invalid: length must be 26", e);
43 | }
44 | catch (OverflowException e)
45 | {
46 | throw new JsonException("Ulid invalid: invalid character", e);
47 | }
48 | }
49 |
50 | public override void Write(Utf8JsonWriter writer, Ulid value, JsonSerializerOptions options)
51 | {
52 | Span buf = stackalloc byte[26];
53 | value.TryWriteStringify(buf);
54 | writer.WriteStringValue(buf);
55 | }
56 |
57 | public override void WriteAsPropertyName(
58 | Utf8JsonWriter writer,
59 | Ulid value,
60 | JsonSerializerOptions options)
61 | {
62 | Span buf = stackalloc byte[26];
63 | value.TryWriteStringify(buf);
64 | writer.WritePropertyName(buf);
65 | }
66 |
67 | public override Ulid ReadAsPropertyName(
68 | ref Utf8JsonReader reader,
69 | Type typeToConvert,
70 | JsonSerializerOptions options)
71 | {
72 | return Read(ref reader, typeToConvert, options);
73 | }
74 | }
75 | }
76 |
77 | #endif
78 |
--------------------------------------------------------------------------------
/src/Ulid/RandomProvider.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.CompilerServices;
2 | using System.Security.Cryptography;
3 |
4 | namespace System
5 | {
6 | internal static class RandomProvider
7 | {
8 | [ThreadStatic]
9 | static Random random;
10 |
11 | [ThreadStatic]
12 | static XorShift64 xorShift;
13 |
14 | // this random is async-unsafe, be careful to use.
15 | [MethodImpl(MethodImplOptions.AggressiveInlining)]
16 | public static Random GetRandom()
17 | {
18 | if (random == null)
19 | {
20 | random = CreateRandom();
21 | }
22 | return random;
23 | }
24 |
25 | [MethodImpl(MethodImplOptions.NoInlining)]
26 | static Random CreateRandom()
27 | {
28 | using (var rng = RandomNumberGenerator.Create())
29 | {
30 | // Span buffer = stackalloc byte[sizeof(int)];
31 | var buffer = new byte[sizeof(int)];
32 | rng.GetBytes(buffer);
33 | var seed = BitConverter.ToInt32(buffer, 0);
34 | return new Random(seed);
35 | }
36 | }
37 |
38 | // this random is async-unsafe, be careful to use.
39 | [MethodImpl(MethodImplOptions.AggressiveInlining)]
40 | public static XorShift64 GetXorShift64()
41 | {
42 | if (xorShift == null)
43 | {
44 | xorShift = CreateXorShift64();
45 | }
46 | return xorShift;
47 | }
48 |
49 | [MethodImpl(MethodImplOptions.NoInlining)]
50 | static XorShift64 CreateXorShift64()
51 | {
52 | using (var rng = RandomNumberGenerator.Create())
53 | {
54 | // Span buffer = stackalloc byte[sizeof(UInt64)];
55 | var buffer = new byte[sizeof(UInt64)];
56 | rng.GetBytes(buffer);
57 | var seed = BitConverter.ToUInt64(buffer, 0);
58 | return new XorShift64(seed);
59 | }
60 | }
61 | }
62 |
63 | internal class XorShift64
64 | {
65 | UInt64 x = 88172645463325252UL;
66 |
67 | public XorShift64(UInt64 seed)
68 | {
69 | if (seed != 0)
70 | {
71 | x = seed;
72 | }
73 | }
74 |
75 | [MethodImpl(MethodImplOptions.AggressiveInlining)]
76 | public UInt64 Next()
77 | {
78 | x = x ^ (x << 7);
79 | return x = x ^ (x >> 9);
80 | }
81 | }
82 | }
--------------------------------------------------------------------------------
/src/Ulid.Unity/Assets/Scripts/Editor/PackageExporter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Linq;
4 | using UnityEditor;
5 | using UnityEngine;
6 |
7 | public static class PackageExporter
8 | {
9 | [MenuItem("Tools/Export Unitypackage")]
10 | public static void Export()
11 | {
12 | var root = "Scripts/Ulid";
13 | var version = GetVersion(root);
14 |
15 | var fileName = string.IsNullOrEmpty(version) ? "Ulid.Unity.unitypackage" : $"Ulid.Unity.{version}.unitypackage";
16 | var exportPath = "./" + fileName;
17 |
18 | var path = Path.Combine(Application.dataPath, root);
19 | var assets = Directory.EnumerateFiles(path, "*", SearchOption.AllDirectories)
20 | .Where(x => Path.GetExtension(x) == ".cs" || Path.GetExtension(x) == ".asmdef" || Path.GetExtension(x) == ".json" || Path.GetExtension(x) == ".meta")
21 | .Select(x => "Assets" + x.Replace(Application.dataPath, "").Replace(@"\", "/"))
22 | .ToArray();
23 |
24 | UnityEngine.Debug.Log("Export below files" + Environment.NewLine + string.Join(Environment.NewLine, assets));
25 |
26 | AssetDatabase.ExportPackage(
27 | assets,
28 | exportPath,
29 | ExportPackageOptions.Default);
30 |
31 | UnityEngine.Debug.Log("Export complete: " + Path.GetFullPath(exportPath));
32 | }
33 |
34 | static string GetVersion(string root)
35 | {
36 | var version = Environment.GetEnvironmentVariable("UNITY_PACKAGE_VERSION");
37 | var versionJson = Path.Combine(Application.dataPath, root, "package.json");
38 |
39 | if (File.Exists(versionJson))
40 | {
41 | var v = JsonUtility.FromJson(File.ReadAllText(versionJson));
42 |
43 | if (!string.IsNullOrEmpty(version))
44 | {
45 | if (v.version != version)
46 | {
47 | var msg = $"package.json and env version are mismatched. UNITY_PACKAGE_VERSION:{version}, package.json:{v.version}";
48 |
49 | if (Application.isBatchMode)
50 | {
51 | Console.WriteLine(msg);
52 | Application.Quit(1);
53 | }
54 |
55 | throw new Exception("package.json and env version are mismatched.");
56 | }
57 | }
58 |
59 | version = v.version;
60 | }
61 |
62 | return version;
63 | }
64 |
65 | public class Version
66 | {
67 | public string version;
68 | }
69 | }
--------------------------------------------------------------------------------
/src/Ulid.Unity/Assets/Scripts/Ulid/RandomProvider.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.CompilerServices;
2 | using System.Security.Cryptography;
3 |
4 | namespace System
5 | {
6 | internal static class RandomProvider
7 | {
8 | [ThreadStatic]
9 | static Random random;
10 |
11 | [ThreadStatic]
12 | static XorShift64 xorShift;
13 |
14 | // this random is async-unsafe, be careful to use.
15 | [MethodImpl(MethodImplOptions.AggressiveInlining)]
16 | public static Random GetRandom()
17 | {
18 | if (random == null)
19 | {
20 | random = CreateRandom();
21 | }
22 | return random;
23 | }
24 |
25 | [MethodImpl(MethodImplOptions.NoInlining)]
26 | static Random CreateRandom()
27 | {
28 | using (var rng = RandomNumberGenerator.Create())
29 | {
30 | // Span buffer = stackalloc byte[sizeof(int)];
31 | var buffer = new byte[sizeof(int)];
32 | rng.GetBytes(buffer);
33 | var seed = BitConverter.ToInt32(buffer, 0);
34 | return new Random(seed);
35 | }
36 | }
37 |
38 | // this random is async-unsafe, be careful to use.
39 | [MethodImpl(MethodImplOptions.AggressiveInlining)]
40 | public static XorShift64 GetXorShift64()
41 | {
42 | if (xorShift == null)
43 | {
44 | xorShift = CreateXorShift64();
45 | }
46 | return xorShift;
47 | }
48 |
49 | [MethodImpl(MethodImplOptions.NoInlining)]
50 | static XorShift64 CreateXorShift64()
51 | {
52 | using (var rng = RandomNumberGenerator.Create())
53 | {
54 | // Span buffer = stackalloc byte[sizeof(UInt64)];
55 | var buffer = new byte[sizeof(UInt64)];
56 | rng.GetBytes(buffer);
57 | var seed = BitConverter.ToUInt64(buffer, 0);
58 | return new XorShift64(seed);
59 | }
60 | }
61 | }
62 |
63 | internal class XorShift64
64 | {
65 | UInt64 x = 88172645463325252UL;
66 |
67 | public XorShift64(UInt64 seed)
68 | {
69 | if (seed != 0)
70 | {
71 | x = seed;
72 | }
73 | }
74 |
75 | [MethodImpl(MethodImplOptions.AggressiveInlining)]
76 | public UInt64 Next()
77 | {
78 | x = x ^ (x << 7);
79 | return x = x ^ (x >> 9);
80 | }
81 | }
82 | }
--------------------------------------------------------------------------------
/tests/Ulid.SystemTextJson.Tests/UlidJsonConverterTest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using Xunit;
5 | using FluentAssertions;
6 | using System.Text.Json;
7 | using System.Diagnostics.CodeAnalysis;
8 |
9 | namespace UlidTests
10 | {
11 | public class UlidJsonConverterTest
12 | {
13 | class TestSerializationClass
14 | {
15 | public Ulid value { get; set; }
16 | }
17 |
18 | JsonSerializerOptions GetOptions()
19 | {
20 | return new JsonSerializerOptions()
21 | {
22 | Converters =
23 | {
24 | new Cysharp.Serialization.Json.UlidJsonConverter()
25 | }
26 | };
27 | }
28 |
29 | [Fact]
30 | public void DeserializeTest()
31 | {
32 | var target = Ulid.NewUlid();
33 | var src = $"{{\"value\": \"{target.ToString()}\"}}";
34 |
35 | var parsed = JsonSerializer.Deserialize(src, GetOptions());
36 | parsed.value.Should().BeEquivalentTo(target, "JSON deserialization should parse string as Ulid");
37 | }
38 |
39 | [Fact]
40 | public void DeserializeExceptionTest()
41 | {
42 | var target = Ulid.NewUlid();
43 | var src = $"{{\"value\": \"{target.ToString().Substring(1)}\"}}";
44 | try
45 | {
46 | var parsed = JsonSerializer.Deserialize(src, GetOptions());
47 | throw new Exception("Test should fail here: no exception were thrown");
48 | }
49 | catch (JsonException)
50 | {
51 | // silentlly success
52 | }
53 | catch (Exception e)
54 | {
55 | throw new Exception($"Test should fail here: Got exception {e}");
56 | }
57 |
58 | }
59 |
60 | [Fact]
61 | public void SerializeTest()
62 | {
63 | var groundTruth = new TestSerializationClass()
64 | {
65 | value = Ulid.NewUlid()
66 | };
67 |
68 | var serialized = JsonSerializer.Serialize(groundTruth, GetOptions());
69 | var deserialized = JsonSerializer.Deserialize(serialized, GetOptions());
70 | deserialized.value.Should().BeEquivalentTo(groundTruth.value, "JSON serialize roundtrip");
71 | }
72 |
73 | [Fact]
74 | public void WithtoutOptionsTest()
75 | {
76 | var groundTruth = new TestSerializationClass()
77 | {
78 | value = Ulid.NewUlid()
79 | };
80 |
81 | var serialized = JsonSerializer.Serialize(groundTruth);
82 | var deserialized = JsonSerializer.Deserialize(serialized);
83 | deserialized.value.Should().BeEquivalentTo(groundTruth.value, "JSON serialize roundtrip");
84 | }
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/.github/workflows/build-debug.yaml:
--------------------------------------------------------------------------------
1 | name: Build-Debug
2 |
3 | on:
4 | push:
5 | branches:
6 | - "master"
7 | pull_request:
8 | branches:
9 | - "master"
10 |
11 | jobs:
12 | build-dotnet:
13 | permissions:
14 | contents: read
15 | runs-on: ubuntu-24.04
16 | timeout-minutes: 10
17 | steps:
18 | - uses: Cysharp/Actions/.github/actions/checkout@main
19 | - uses: Cysharp/Actions/.github/actions/setup-dotnet@main
20 | - run: dotnet build -c Release
21 | - run: dotnet test -c Release --no-build
22 | - run: dotnet test -c Release --no-build --environment "COMPlus_EnableHWIntrinsic=0;COMPlus_EnableSSE2=0"
23 | - run: dotnet test -c Release --no-build --environment "COMPlus_EnableSSE2=0"
24 | - run: dotnet pack -c Release --no-build -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg -o $GITHUB_WORKSPACE/artifacts
25 |
26 | build-unity:
27 | if: ${{ (github.event_name == 'push' && github.repository_owner == 'Cysharp') || startsWith(github.event.pull_request.head.label, 'Cysharp:') }}
28 | strategy:
29 | fail-fast: false
30 | max-parallel: 2
31 | matrix:
32 | unity: ["2021.3.41f1"]
33 | permissions:
34 | contents: read
35 | runs-on: ubuntu-24.04
36 | timeout-minutes: 15
37 | steps:
38 | - name: Load secrets
39 | id: op-load-secret
40 | uses: 1password/load-secrets-action@581a835fb51b8e7ec56b71cf2ffddd7e68bb25e0 # v2.0.0
41 | with:
42 | export-env: false
43 | env:
44 | OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN_PUBLIC }}
45 | UNITY_EMAIL: "op://${{ vars.OP_VAULT_ACTIONS_PUBLIC }}/UNITY_LICENSE/username"
46 | UNITY_PASSWORD: "op://${{ vars.OP_VAULT_ACTIONS_PUBLIC }}/UNITY_LICENSE/credential"
47 | UNITY_SERIAL: "op://${{ vars.OP_VAULT_ACTIONS_PUBLIC }}/UNITY_LICENSE/serial"
48 |
49 | - uses: Cysharp/Actions/.github/actions/checkout@main
50 |
51 | # Execute scripts: Export Package
52 | # /opt/Unity/Editor/Unity -quit -batchmode -nographics -silent-crashes -logFile -projectPath . -executeMethod PackageExporter.Export
53 | - name: Build Unity (.unitypacakge)
54 | uses: Cysharp/Actions/.github/actions/unity-builder@main
55 | env:
56 | UNITY_EMAIL: ${{ steps.op-load-secret.outputs.UNITY_EMAIL }}
57 | UNITY_PASSWORD: ${{ steps.op-load-secret.outputs.UNITY_PASSWORD }}
58 | UNITY_SERIAL: ${{ steps.op-load-secret.outputs.UNITY_SERIAL }}
59 | with:
60 | projectPath: src/Ulid.Unity
61 | unityVersion: ${{ matrix.unity }}
62 | targetPlatform: StandaloneLinux64
63 | buildMethod: PackageExporter.Export
64 |
65 | - uses: Cysharp/Actions/.github/actions/check-metas@main # check meta files
66 | with:
67 | directory: src/Ulid.Unity
68 |
69 | # Store artifacts.
70 | - uses: Cysharp/Actions/.github/actions/upload-artifact@main
71 | with:
72 | name: Ulid.Unity.${{ matrix.unity }}.unitypackage.zip
73 | path: ./src/Ulid.Unity/*.unitypackage
74 | retention-days: 1
75 |
--------------------------------------------------------------------------------
/src/Ulid.Cli/Util.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Ulid.Cli
4 | {
5 | internal static class Util
6 | {
7 | public static System.Ulid CreateUlid(DateTimeOffset timestamp, string randomness)
8 | {
9 | const int RandomnessStringLength = 16;
10 | if (string.IsNullOrEmpty(randomness))
11 | {
12 | return System.Ulid.NewUlid(timestamp);
13 | }
14 | else
15 | {
16 | if (randomness.Length != RandomnessStringLength)
17 | {
18 | throw new ArgumentOutOfRangeException($"randomness value must have 80 bit length({RandomnessStringLength} characters)");
19 | }
20 | // normalize character case
21 | randomness = randomness.ToUpper();
22 | Span randomnessBytes = stackalloc byte[10];
23 | Util.ConvertBase32ToBytes(randomness.AsSpan(), randomnessBytes, 0);
24 | return System.Ulid.NewUlid(timestamp, randomnessBytes);
25 | }
26 | }
27 | public static void ConvertBase32ToBytes(ReadOnlySpan cp, Span bytes, byte omitBits = 0)
28 | {
29 | if(cp.Length * 5 - omitBits > bytes.Length * 8)
30 | {
31 | throw new ArgumentOutOfRangeException(nameof(bytes), "result buffer is not enough large");
32 | }
33 | byte currentBit = 0;
34 | byte currentOffset = 0;
35 | bytes[0] = (byte)((GetBase32Value(cp[0]) << (3 + omitBits)) & 0xff);
36 | currentBit = (byte)(5 - omitBits);
37 | for (int i = 1; i < cp.Length; i++)
38 | {
39 | switch (currentBit)
40 | {
41 | case 0:
42 | case 1:
43 | case 2:
44 | bytes[currentOffset] |= (byte)(GetBase32Value(cp[i]) << (3 - currentBit));
45 | currentBit += 5;
46 | break;
47 | case 3:
48 | case 4:
49 | case 5:
50 | case 6:
51 | case 7:
52 | bytes[currentOffset] |= (byte)(GetBase32Value(cp[i]) >> (currentBit - 3));
53 | if (currentBit != 3 && currentOffset + 1 < bytes.Length)
54 | {
55 | bytes[currentOffset + 1] |= (byte)((GetBase32Value(cp[i]) << (11 - currentBit)) & 0xff);
56 | }
57 | currentBit = (byte)(currentBit - 3);
58 | currentOffset += 1;
59 | break;
60 | default:
61 | break;
62 | }
63 | }
64 | }
65 | // copy from Ulid
66 | static readonly byte[] CharToBase32 = new byte[] { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 255, 255, 255, 255, 255, 255, 255, 10, 11, 12, 13, 14, 15, 16, 17, 255, 18, 19, 255, 20, 21, 255, 22, 23, 24, 25, 26, 255, 27, 28, 29, 30, 31, 255, 255, 255, 255, 255, 255, 10, 11, 12, 13, 14, 15, 16, 17, 255, 18, 19, 255, 20, 21, 255, 22, 23, 24, 25, 26, 255, 27, 28, 29, 30, 31 };
67 | static byte GetBase32Value(char b)
68 | {
69 | if(b > CharToBase32.Length)
70 | {
71 | throw new InvalidOperationException($"invalid base32 character({b})");
72 | }
73 | var ret = CharToBase32[b];
74 | if(ret == 255)
75 | {
76 | throw new InvalidOperationException($"invalid base32 character({b})");
77 | }
78 | return ret;
79 | }
80 | }
81 | }
--------------------------------------------------------------------------------
/sandbox/BlazorWasm/wwwroot/css/open-iconic/README.md:
--------------------------------------------------------------------------------
1 | [Open Iconic v1.1.1](http://useiconic.com/open)
2 | ===========
3 |
4 | ### Open Iconic is the open source sibling of [Iconic](http://useiconic.com). It is a hyper-legible collection of 223 icons with a tiny footprint—ready to use with Bootstrap and Foundation. [View the collection](http://useiconic.com/open#icons)
5 |
6 |
7 |
8 | ## What's in Open Iconic?
9 |
10 | * 223 icons designed to be legible down to 8 pixels
11 | * Super-light SVG files - 61.8 for the entire set
12 | * SVG sprite—the modern replacement for icon fonts
13 | * Webfont (EOT, OTF, SVG, TTF, WOFF), PNG and WebP formats
14 | * Webfont stylesheets (including versions for Bootstrap and Foundation) in CSS, LESS, SCSS and Stylus formats
15 | * PNG and WebP raster images in 8px, 16px, 24px, 32px, 48px and 64px.
16 |
17 |
18 | ## Getting Started
19 |
20 | #### For code samples and everything else you need to get started with Open Iconic, check out our [Icons](http://useiconic.com/open#icons) and [Reference](http://useiconic.com/open#reference) sections.
21 |
22 | ### General Usage
23 |
24 | #### Using Open Iconic's SVGs
25 |
26 | We like SVGs and we think they're the way to display icons on the web. Since Open Iconic are just basic SVGs, we suggest you display them like you would any other image (don't forget the `alt` attribute).
27 |
28 | ```
29 |
30 | ```
31 |
32 | #### Using Open Iconic's SVG Sprite
33 |
34 | Open Iconic also comes in a SVG sprite which allows you to display all the icons in the set with a single request. It's like an icon font, without being a hack.
35 |
36 | Adding an icon from an SVG sprite is a little different than what you're used to, but it's still a piece of cake. *Tip: To make your icons easily style able, we suggest adding a general class to the* `