├── .editorconfig ├── .github ├── dependabot.yaml └── workflows │ ├── build-debug.yaml │ ├── build-release.yaml │ ├── prevent-github-change.yaml │ ├── stale.yaml │ └── toc.yaml ├── .gitignore ├── Directory.Build.props ├── LICENSE ├── README.md ├── Ulid.sln ├── benchmark └── PerfBenchmark │ ├── BenchmarkConfig.cs │ ├── PerfBenchmark.csproj │ ├── Program.cs │ └── Suite │ ├── CompareTo.cs │ ├── Equals.cs │ ├── GetHashCode.cs │ ├── New.cs │ ├── NewToString.cs │ ├── Parse.cs │ └── ToString.cs ├── sandbox ├── BlazorWasm │ ├── App.razor │ ├── BlazorWasm.csproj │ ├── Pages │ │ └── Index.razor │ ├── Program.cs │ ├── Shared │ │ ├── MainLayout.razor │ │ └── MainLayout.razor.css │ ├── _Imports.razor │ └── wwwroot │ │ ├── css │ │ ├── app.css │ │ ├── bootstrap │ │ │ ├── bootstrap.min.css │ │ │ └── bootstrap.min.css.map │ │ └── open-iconic │ │ │ ├── FONT-LICENSE │ │ │ ├── ICON-LICENSE │ │ │ ├── README.md │ │ │ └── font │ │ │ ├── css │ │ │ └── open-iconic-bootstrap.min.css │ │ │ └── fonts │ │ │ ├── open-iconic.eot │ │ │ ├── open-iconic.otf │ │ │ ├── open-iconic.svg │ │ │ ├── open-iconic.ttf │ │ │ └── open-iconic.woff │ │ ├── favicon.ico │ │ └── index.html └── TryUlid │ ├── Program.cs │ └── TryUlid.csproj ├── src ├── Ulid.Cli │ ├── Program.cs │ ├── Ulid.Cli.csproj │ └── Util.cs ├── Ulid.MessagePack │ ├── Ulid.MessagePack.csproj │ ├── UlidMessagePackFormatter.cs │ └── release.snk ├── Ulid.SystemTextJson │ ├── Ulid.SystemTextJson.csproj │ └── release.snk ├── Ulid.Unity │ ├── .vsconfig │ ├── Assets │ │ ├── Plugins.meta │ │ ├── Plugins │ │ │ ├── System.Buffers.dll │ │ │ ├── System.Buffers.dll.meta │ │ │ ├── System.Memory.dll │ │ │ ├── System.Memory.dll.meta │ │ │ ├── System.Runtime.CompilerServices.Unsafe.dll │ │ │ └── System.Runtime.CompilerServices.Unsafe.dll.meta │ │ ├── Scenes.meta │ │ ├── Scenes │ │ │ ├── SampleScene.unity │ │ │ └── SampleScene.unity.meta │ │ ├── Scripts.meta │ │ └── Scripts │ │ │ ├── Editor.meta │ │ │ ├── Editor │ │ │ ├── PackageExporter.cs │ │ │ └── PackageExporter.cs.meta │ │ │ ├── Ulid.meta │ │ │ └── Ulid │ │ │ ├── RandomProvider.cs │ │ │ ├── RandomProvider.cs.meta │ │ │ ├── Ulid.asmdef │ │ │ ├── Ulid.asmdef.meta │ │ │ ├── Ulid.cs │ │ │ ├── Ulid.cs.meta │ │ │ ├── UlidTypeConverter.cs │ │ │ ├── UlidTypeConverter.cs.meta │ │ │ ├── package.json │ │ │ └── package.json.meta │ ├── ProjectSettings │ │ ├── AudioManager.asset │ │ ├── ClusterInputManager.asset │ │ ├── DynamicsManager.asset │ │ ├── EditorBuildSettings.asset │ │ ├── EditorSettings.asset │ │ ├── GraphicsSettings.asset │ │ ├── InputManager.asset │ │ ├── MemorySettings.asset │ │ ├── NavMeshAreas.asset │ │ ├── NetworkManager.asset │ │ ├── PackageManagerSettings.asset │ │ ├── Physics2DSettings.asset │ │ ├── PresetManager.asset │ │ ├── ProjectSettings.asset │ │ ├── ProjectVersion.txt │ │ ├── QualitySettings.asset │ │ ├── TagManager.asset │ │ ├── TimeManager.asset │ │ ├── UnityConnectSettings.asset │ │ ├── VFXManager.asset │ │ ├── VersionControlSettings.asset │ │ ├── XRSettings.asset │ │ └── boot.config │ └── UserSettings │ │ ├── EditorUserSettings.asset │ │ ├── Layouts │ │ └── default-2021.dwlt │ │ └── Search.settings └── Ulid │ ├── Icon.png │ ├── RandomProvider.cs │ ├── Ulid.cs │ ├── Ulid.csproj │ ├── UlidJsonConverter.cs │ ├── UlidTypeConverter.cs │ └── release.snk └── tests ├── Ulid.Cli.Tests ├── TextWriterBridge.cs ├── Ulid.Cli.Tests.csproj └── UlidCliTest.cs ├── Ulid.MessagePack.Tests ├── Ulid.MessagePack.Tests.csproj └── UlidMessagePackFormatterTest.cs ├── Ulid.SystemTextJson.Tests ├── Ulid.SystemTextJson.Tests.csproj └── UlidJsonConverterTest.cs └── Ulid.Tests ├── Ulid.Tests.csproj ├── UlidTest.cs └── UlidTypeConverterTests.cs /.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 | -------------------------------------------------------------------------------- /.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 | ignore: 9 | # I just want update action when major/minor version is updated. patch updates are too noisy. 10 | - dependency-name: '*' 11 | update-types: 12 | - version-update:semver-patch 13 | -------------------------------------------------------------------------------- /.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 Debug 21 | - run: dotnet test -c Debug --no-build 22 | - run: dotnet test -c Debug --no-build --environment "COMPlus_EnableHWIntrinsic=0;COMPlus_EnableSSE2=0" 23 | - run: dotnet test -c Debug --no-build --environment "COMPlus_EnableSSE2=0" 24 | 25 | build-unity: 26 | if: ${{ (github.event_name == 'push' && github.repository_owner == 'Cysharp') || startsWith(github.event.pull_request.head.label, 'Cysharp:') }} 27 | strategy: 28 | fail-fast: false 29 | max-parallel: 2 30 | matrix: 31 | unity: ["2021.3.41f1"] 32 | permissions: 33 | contents: read 34 | runs-on: ubuntu-24.04 35 | timeout-minutes: 15 36 | steps: 37 | - name: Load secrets 38 | id: op-load-secret 39 | uses: 1password/load-secrets-action@581a835fb51b8e7ec56b71cf2ffddd7e68bb25e0 # v2.0.0 40 | with: 41 | export-env: false 42 | env: 43 | OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN_PUBLIC }} 44 | UNITY_EMAIL: "op://${{ vars.OP_VAULT_ACTIONS_PUBLIC }}/UNITY_LICENSE/username" 45 | UNITY_PASSWORD: "op://${{ vars.OP_VAULT_ACTIONS_PUBLIC }}/UNITY_LICENSE/credential" 46 | UNITY_SERIAL: "op://${{ vars.OP_VAULT_ACTIONS_PUBLIC }}/UNITY_LICENSE/serial" 47 | 48 | - uses: Cysharp/Actions/.github/actions/checkout@main 49 | 50 | # Execute scripts: Export Package 51 | # /opt/Unity/Editor/Unity -quit -batchmode -nographics -silent-crashes -logFile -projectPath . -executeMethod PackageExporter.Export 52 | - name: Build Unity (.unitypacakge) 53 | uses: Cysharp/Actions/.github/actions/unity-builder@main 54 | env: 55 | UNITY_EMAIL: ${{ steps.op-load-secret.outputs.UNITY_EMAIL }} 56 | UNITY_PASSWORD: ${{ steps.op-load-secret.outputs.UNITY_PASSWORD }} 57 | UNITY_SERIAL: ${{ steps.op-load-secret.outputs.UNITY_SERIAL }} 58 | with: 59 | projectPath: src/Ulid.Unity 60 | unityVersion: ${{ matrix.unity }} 61 | targetPlatform: StandaloneLinux64 62 | buildMethod: PackageExporter.Export 63 | 64 | - uses: Cysharp/Actions/.github/actions/check-metas@main # check meta files 65 | with: 66 | directory: src/Ulid.Unity 67 | 68 | # Store artifacts. 69 | - uses: Cysharp/Actions/.github/actions/upload-artifact@main 70 | with: 71 | name: Ulid.Unity.${{ matrix.unity }}.unitypackage.zip 72 | path: ./src/Ulid.Unity/*.unitypackage 73 | retention-days: 1 74 | -------------------------------------------------------------------------------- /.github/workflows/build-release.yaml: -------------------------------------------------------------------------------- 1 | name: Build-Release 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | tag: 7 | description: "tag: git tag you want create. (sample 1.0.0)" 8 | required: true 9 | dry-run: 10 | description: "dry-run: true will never create relase/nuget." 11 | required: true 12 | default: false 13 | type: boolean 14 | 15 | jobs: 16 | update-packagejson: 17 | permissions: 18 | actions: read 19 | contents: write 20 | uses: Cysharp/Actions/.github/workflows/update-packagejson.yaml@main 21 | with: 22 | file-path: ./src/Ulid.Unity/Assets/Scripts/Ulid/package.json 23 | tag: ${{ inputs.tag }} 24 | dry-run: ${{ inputs.dry-run }} 25 | 26 | build-dotnet: 27 | needs: [update-packagejson] 28 | permissions: 29 | contents: read 30 | runs-on: ubuntu-24.04 31 | timeout-minutes: 10 32 | steps: 33 | - uses: Cysharp/Actions/.github/actions/checkout@main 34 | with: 35 | ref: ${{ needs.update-packagejson.outputs.sha }} 36 | - uses: Cysharp/Actions/.github/actions/setup-dotnet@main 37 | - run: dotnet build -c Release -p:Version=${{ inputs.tag }} 38 | - run: dotnet test -c Release -p:Version=${{ inputs.tag }} 39 | - run: dotnet pack -c Release --no-build -p:Version=${{ inputs.tag }} -o ./publish 40 | 41 | # Store artifacts. 42 | - uses: Cysharp/Actions/.github/actions/upload-artifact@main 43 | with: 44 | name: nuget 45 | path: ./publish/ 46 | retention-days: 1 47 | 48 | build-unity: 49 | needs: [update-packagejson] 50 | strategy: 51 | matrix: 52 | unity: ["2021.3.41f1"] 53 | permissions: 54 | contents: read 55 | runs-on: ubuntu-24.04 56 | timeout-minutes: 15 57 | steps: 58 | - name: Load secrets 59 | id: op-load-secret 60 | uses: 1password/load-secrets-action@581a835fb51b8e7ec56b71cf2ffddd7e68bb25e0 # v2.0.0 61 | with: 62 | export-env: false 63 | env: 64 | OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN_PUBLIC }} 65 | UNITY_EMAIL: "op://${{ vars.OP_VAULT_ACTIONS_PUBLIC }}/UNITY_LICENSE/username" 66 | UNITY_PASSWORD: "op://${{ vars.OP_VAULT_ACTIONS_PUBLIC }}/UNITY_LICENSE/credential" 67 | UNITY_SERIAL: "op://${{ vars.OP_VAULT_ACTIONS_PUBLIC }}/UNITY_LICENSE/serial" 68 | 69 | - uses: Cysharp/Actions/.github/actions/checkout@main 70 | with: 71 | ref: ${{ needs.update-packagejson.outputs.sha }} 72 | 73 | # Execute scripts: Export Package 74 | # /opt/Unity/Editor/Unity -quit -batchmode -nographics -silent-crashes -logFile -projectPath . -executeMethod PackageExporter.Export 75 | - name: Build Unity (.unitypacakge) 76 | uses: Cysharp/Actions/.github/actions/unity-builder@main 77 | env: 78 | UNITY_EMAIL: ${{ steps.op-load-secret.outputs.UNITY_EMAIL }} 79 | UNITY_PASSWORD: ${{ steps.op-load-secret.outputs.UNITY_PASSWORD }} 80 | UNITY_SERIAL: ${{ steps.op-load-secret.outputs.UNITY_SERIAL }} 81 | UNITY_PACKAGE_VERSION: ${{ inputs.tag }} 82 | with: 83 | projectPath: src/Ulid.Unity 84 | unityVersion: ${{ matrix.unity }} 85 | targetPlatform: StandaloneLinux64 86 | buildMethod: PackageExporter.Export 87 | 88 | - uses: Cysharp/Actions/.github/actions/check-metas@main # check meta files 89 | with: 90 | directory: src/Ulid.Unity 91 | 92 | # Store artifacts. 93 | - uses: Cysharp/Actions/.github/actions/upload-artifact@main 94 | with: 95 | name: Ulid.Unity.${{ inputs.tag }}.unitypackage 96 | path: ./src/Ulid.Unity/Ulid.Unity.${{ inputs.tag }}.unitypackage 97 | retention-days: 1 98 | 99 | # release 100 | create-release: 101 | needs: [update-packagejson, build-dotnet, build-unity] 102 | permissions: 103 | contents: write 104 | uses: Cysharp/Actions/.github/workflows/create-release.yaml@main 105 | with: 106 | commit-id: ${{ needs.update-packagejson.outputs.sha }} 107 | dry-run: ${{ inputs.dry-run }} 108 | tag: ${{ inputs.tag }} 109 | nuget-push: true 110 | release-upload: true 111 | release-asset-path: ./Ulid.Unity.${{ inputs.tag }}.unitypackage/Ulid.Unity.${{ inputs.tag }}.unitypackage 112 | secrets: inherit 113 | 114 | cleanup: 115 | if: ${{ needs.update-packagejson.outputs.is-branch-created == 'true' }} 116 | needs: [update-packagejson, build-dotnet, build-unity] 117 | permissions: 118 | contents: write 119 | uses: Cysharp/Actions/.github/workflows/clean-packagejson-branch.yaml@main 120 | with: 121 | branch: ${{ needs.update-packagejson.outputs.branch-name }} 122 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.suo 8 | *.user 9 | *.userosscache 10 | *.sln.docstates 11 | 12 | # User-specific files (MonoDevelop/Xamarin Studio) 13 | *.userprefs 14 | 15 | # Build results 16 | [Dd]ebug/ 17 | [Dd]ebugPublic/ 18 | [Rr]elease/ 19 | [Rr]eleases/ 20 | x64/ 21 | x86/ 22 | bld/ 23 | [Bb]in/ 24 | [Oo]bj/ 25 | [Ll]og/ 26 | 27 | # Visual Studio 2015/2017 cache/options directory 28 | .vs/ 29 | # Uncomment if you have tasks that create the project's static files in wwwroot 30 | #wwwroot/ 31 | 32 | # Visual Studio 2017 auto generated files 33 | Generated\ Files/ 34 | 35 | # MSTest test Results 36 | [Tt]est[Rr]esult*/ 37 | [Bb]uild[Ll]og.* 38 | 39 | # NUNIT 40 | *.VisualState.xml 41 | TestResult.xml 42 | 43 | # Build Results of an ATL Project 44 | [Dd]ebugPS/ 45 | [Rr]eleasePS/ 46 | dlldata.c 47 | 48 | # Benchmark Results 49 | BenchmarkDotNet.Artifacts/ 50 | 51 | # .NET Core 52 | project.lock.json 53 | project.fragment.lock.json 54 | artifacts/ 55 | **/Properties/launchSettings.json 56 | 57 | # StyleCop 58 | StyleCopReport.xml 59 | 60 | # Files built by Visual Studio 61 | *_i.c 62 | *_p.c 63 | *_i.h 64 | *.ilk 65 | *.obj 66 | *.iobj 67 | *.pch 68 | *.pdb 69 | *.ipdb 70 | *.pgc 71 | *.pgd 72 | *.rsp 73 | *.sbr 74 | *.tlb 75 | *.tli 76 | *.tlh 77 | *.tmp 78 | *.tmp_proj 79 | *.log 80 | *.vspscc 81 | *.vssscc 82 | .builds 83 | *.pidb 84 | *.svclog 85 | *.scc 86 | 87 | # Chutzpah Test files 88 | _Chutzpah* 89 | 90 | # Visual C++ cache files 91 | ipch/ 92 | *.aps 93 | *.ncb 94 | *.opendb 95 | *.opensdf 96 | *.sdf 97 | *.cachefile 98 | *.VC.db 99 | *.VC.VC.opendb 100 | 101 | # Visual Studio profiler 102 | *.psess 103 | *.vsp 104 | *.vspx 105 | *.sap 106 | 107 | # Visual Studio Trace Files 108 | *.e2e 109 | 110 | # TFS 2012 Local Workspace 111 | $tf/ 112 | 113 | # Guidance Automation Toolkit 114 | *.gpState 115 | 116 | # ReSharper is a .NET coding add-in 117 | _ReSharper*/ 118 | *.[Rr]e[Ss]harper 119 | *.DotSettings.user 120 | 121 | # JustCode is a .NET coding add-in 122 | .JustCode 123 | 124 | # TeamCity is a build add-in 125 | _TeamCity* 126 | 127 | # DotCover is a Code Coverage Tool 128 | *.dotCover 129 | 130 | # AxoCover is a Code Coverage Tool 131 | .axoCover/* 132 | !.axoCover/settings.json 133 | 134 | # Visual Studio code coverage results 135 | *.coverage 136 | *.coveragexml 137 | 138 | # NCrunch 139 | _NCrunch_* 140 | .*crunch*.local.xml 141 | nCrunchTemp_* 142 | 143 | # MightyMoose 144 | *.mm.* 145 | AutoTest.Net/ 146 | 147 | # Web workbench (sass) 148 | .sass-cache/ 149 | 150 | # Installshield output folder 151 | [Ee]xpress/ 152 | 153 | # DocProject is a documentation generator add-in 154 | DocProject/buildhelp/ 155 | DocProject/Help/*.HxT 156 | DocProject/Help/*.HxC 157 | DocProject/Help/*.hhc 158 | DocProject/Help/*.hhk 159 | DocProject/Help/*.hhp 160 | DocProject/Help/Html2 161 | DocProject/Help/html 162 | 163 | # Click-Once directory 164 | publish/ 165 | 166 | # Publish Web Output 167 | *.[Pp]ublish.xml 168 | *.azurePubxml 169 | # Note: Comment the next line if you want to checkin your web deploy settings, 170 | # but database connection strings (with potential passwords) will be unencrypted 171 | *.pubxml 172 | *.publishproj 173 | 174 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 175 | # checkin your Azure Web App publish settings, but sensitive information contained 176 | # in these scripts will be unencrypted 177 | PublishScripts/ 178 | 179 | # NuGet Packages 180 | *.nupkg 181 | # The packages folder can be ignored because of Package Restore 182 | **/[Pp]ackages/* 183 | # except build/, which is used as an MSBuild target. 184 | !**/[Pp]ackages/build/ 185 | # Uncomment if necessary however generally it will be regenerated when needed 186 | #!**/[Pp]ackages/repositories.config 187 | # NuGet v3's project.json files produces more ignorable files 188 | *.nuget.props 189 | *.nuget.targets 190 | 191 | # Microsoft Azure Build Output 192 | csx/ 193 | *.build.csdef 194 | 195 | # Microsoft Azure Emulator 196 | ecf/ 197 | rcf/ 198 | 199 | # Windows Store app package directories and files 200 | AppPackages/ 201 | BundleArtifacts/ 202 | Package.StoreAssociation.xml 203 | _pkginfo.txt 204 | *.appx 205 | 206 | # Visual Studio cache files 207 | # files ending in .cache can be ignored 208 | *.[Cc]ache 209 | # but keep track of directories ending in .cache 210 | !*.[Cc]ache/ 211 | 212 | # Others 213 | ClientBin/ 214 | ~$* 215 | *~ 216 | *.dbmdl 217 | *.dbproj.schemaview 218 | *.jfm 219 | *.pfx 220 | *.publishsettings 221 | orleans.codegen.cs 222 | 223 | # Including strong name files can present a security risk 224 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 225 | #*.snk 226 | 227 | # Since there are multiple workflows, uncomment next line to ignore bower_components 228 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 229 | #bower_components/ 230 | 231 | # RIA/Silverlight projects 232 | Generated_Code/ 233 | 234 | # Backup & report files from converting an old project file 235 | # to a newer Visual Studio version. Backup files are not needed, 236 | # because we have git ;-) 237 | _UpgradeReport_Files/ 238 | Backup*/ 239 | UpgradeLog*.XML 240 | UpgradeLog*.htm 241 | ServiceFabricBackup/ 242 | *.rptproj.bak 243 | 244 | # SQL Server files 245 | *.mdf 246 | *.ldf 247 | *.ndf 248 | 249 | # Business Intelligence projects 250 | *.rdl.data 251 | *.bim.layout 252 | *.bim_*.settings 253 | *.rptproj.rsuser 254 | 255 | # Microsoft Fakes 256 | FakesAssemblies/ 257 | 258 | # GhostDoc plugin setting file 259 | *.GhostDoc.xml 260 | 261 | # Node.js Tools for Visual Studio 262 | .ntvs_analysis.dat 263 | node_modules/ 264 | 265 | # Visual Studio 6 build log 266 | *.plg 267 | 268 | # Visual Studio 6 workspace options file 269 | *.opt 270 | 271 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 272 | *.vbw 273 | 274 | # Visual Studio LightSwitch build output 275 | **/*.HTMLClient/GeneratedArtifacts 276 | **/*.DesktopClient/GeneratedArtifacts 277 | **/*.DesktopClient/ModelManifest.xml 278 | **/*.Server/GeneratedArtifacts 279 | **/*.Server/ModelManifest.xml 280 | _Pvt_Extensions 281 | 282 | # Paket dependency manager 283 | .paket/paket.exe 284 | paket-files/ 285 | 286 | # FAKE - F# Make 287 | .fake/ 288 | 289 | # JetBrains Rider 290 | .idea/ 291 | *.sln.iml 292 | 293 | # CodeRush 294 | .cr/ 295 | 296 | # Python Tools for Visual Studio (PTVS) 297 | __pycache__/ 298 | *.pyc 299 | 300 | # Cake - Uncomment if you are using it 301 | # tools/** 302 | # !tools/packages.config 303 | 304 | # Tabs Studio 305 | *.tss 306 | 307 | # Telerik's JustMock configuration file 308 | *.jmconfig 309 | 310 | # BizTalk build output 311 | *.btp.cs 312 | *.btm.cs 313 | *.odx.cs 314 | *.xsd.cs 315 | 316 | # OpenCover UI analysis results 317 | OpenCover/ 318 | 319 | # Azure Stream Analytics local run output 320 | ASALocalRun/ 321 | 322 | # MSBuild Binary and Structured Log 323 | *.binlog 324 | 325 | # NVidia Nsight GPU debugger configuration file 326 | *.nvuser 327 | 328 | # MFractors (Xamarin productivity tool) working folder 329 | .mfractor/ 330 | 331 | 332 | # Unity 333 | Library/ 334 | Temp/ 335 | src/Ulid.Unity/*.csproj 336 | src/Ulid.Unity/Ulid.Unity.sln 337 | src/Ulid.Unity/Ulid.Unity.unitypackage 338 | -------------------------------------------------------------------------------- /Directory.Build.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | true 4 | 7.3 5 | $(NoWarn);CS1591 6 | 7 | 8 | $(Version) 9 | Cysharp 10 | Cysharp 11 | © Cysharp, Inc. 12 | https://github.com/Cysharp/Ulid 13 | $(PackageProjectUrl) 14 | git 15 | MIT 16 | guid 17 | Icon.png 18 | 19 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Ulid 2 | === 3 | [![GitHub Actions](https://github.com/Cysharp/Ulid/workflows/Build-Debug/badge.svg)](https://github.com/Cysharp/Ulid/actions) [![Releases](https://img.shields.io/github/release/Cysharp/Ulid.svg)](https://github.com/Cysharp/Ulid/releases) 4 | 5 | Fast C# Implementation of [ULID](https://github.com/ulid/spec) for .NET Core and Unity. Ulid is sortable, random id generator. This project aims performance by fastest binary serializer([MessagePack-CSharp](https://github.com/neuecc/MessagePack-CSharp/)) technology. It achives faster generate than Guid.NewGuid. 6 | 7 | ![image](https://user-images.githubusercontent.com/46207/55129636-266c0d00-515b-11e9-85ab-3437de539451.png) 8 | 9 | NuGet: [Ulid](https://www.nuget.org/packages/Ulid) or download .unitypackage from [Ulid/Releases](https://github.com/Cysharp/Ulid/releases) page. 10 | 11 | ``` 12 | Install-Package Ulid 13 | ``` 14 | 15 | 16 | 17 | ## Table of Contents 18 | 19 | - [How to use](#how-to-use) 20 | - [Performance](#performance) 21 | - [Cli](#cli) 22 | - [Integrate](#integrate) 23 | - [License](#license) 24 | 25 | 26 | 27 | How to use 28 | --- 29 | Similar api to Guid. 30 | 31 | * `Ulid.NewUlid()` 32 | * `Ulid.Parse()` 33 | * `Ulid.TryParse()` 34 | * `new Ulid()` 35 | * `.ToString()` 36 | * `.ToByteArray()` 37 | * `.TryWriteBytes()` 38 | * `.TryWriteStringify()` 39 | * `.ToBase64()` 40 | * `.Time` 41 | * `.Random` 42 | 43 | Allow to convert Guid. 44 | 45 | * `.ToGuid()` 46 | * `(Guid)ulid` 47 | 48 | Performance 49 | --- 50 | `Guid` is standard corelib guid. `Ulid` is this library. `NUlid` is competitor [RobThree/NUlid](https://github.com/RobThree/NUlid). 51 | 52 | * New 53 | 54 | | Method | Mean | Error | Ratio | Gen 0/1k Op | Gen 1/1k Op | Gen 2/1k Op | Allocated Memory/Op | 55 | |------- |----------:|------:|------:|------------:|------------:|------------:|--------------------:| 56 | | Guid_ | 73.13 ns | NA | 1.00 | - | - | - | - | 57 | | Ulid_ | 65.41 ns | NA | 0.89 | - | - | - | - | 58 | | NUlid_ | 209.89 ns | NA | 2.87 | 0.0162 | - | - | 104 B | 59 | 60 | `Ulid.NewUlid()` is faster than `Guid.NewGuid()` and zero allocation. 61 | 62 | * Parse 63 | 64 | | Method | Mean | Error | Ratio | Gen 0/1k Op | Gen 1/1k Op | Gen 2/1k Op | Allocated Memory/Op | 65 | |------- |----------:|------:|------:|------------:|------------:|------------:|--------------------:| 66 | | Guid_ | 197.98 ns | NA | 1.00 | - | - | - | - | 67 | | Ulid_ | 28.67 ns | NA | 0.14 | - | - | - | - | 68 | | NUlid_ | 161.03 ns | NA | 0.81 | 0.0441 | - | - | 280 B | 69 | 70 | from string(Base32) to ulid, `Ulid.Parse(string)` is fastest and zero allocation. 71 | 72 | * ToString 73 | 74 | | Method | Mean | Error | Ratio | Gen 0/1k Op | Gen 1/1k Op | Gen 2/1k Op | Allocated Memory/Op | 75 | |------- |---------:|------:|------:|------------:|------------:|------------:|--------------------:| 76 | | Guid_ | 57.73 ns | NA | 1.00 | 0.0163 | - | - | 104 B | 77 | | Ulid_ | 38.77 ns | NA | 0.67 | 0.0126 | - | - | 80 B | 78 | | NUlid_ | 96.76 ns | NA | 1.68 | 0.0583 | - | - | 368 B | 79 | 80 | to string representation(Base32), `Ulid.ToString()` is fastest and less allocation. 81 | 82 | * NewId().ToString() 83 | 84 | | Method | Mean | Error | Ratio | Gen 0/1k Op | Gen 1/1k Op | Gen 2/1k Op | Allocated Memory/Op | 85 | |------- |---------:|------:|------:|------------:|------------:|------------:|--------------------:| 86 | | Guid_ | 205.7 ns | NA | 1.00 | 0.0162 | - | - | 104 B | 87 | | Ulid_ | 110.2 ns | NA | 0.54 | 0.0125 | - | - | 80 B | 88 | | NUlid_ | 301.7 ns | NA | 1.47 | 0.0744 | - | - | 472 B | 89 | 90 | case of get the string representation immediately, `Ulid` is twice faster than Guid. 91 | 92 | * GetHashCode 93 | 94 | | Method | Mean | Error | Ratio | Gen 0/1k Op | Gen 1/1k Op | Gen 2/1k Op | Allocated Memory/Op | 95 | |------- |-----------:|------:|------:|------------:|------------:|------------:|--------------------:| 96 | | Guid_ | 0.9706 ns | NA | 1.00 | - | - | - | - | 97 | | Ulid_ | 1.0329 ns | NA | 1.06 | - | - | - | - | 98 | | NUlid_ | 20.6175 ns | NA | 21.24 | 0.0063 | - | - | 40 B | 99 | 100 | GetHashCode is called when use dictionary's key. `Ulid` is fast and zero allocation. 101 | 102 | * Equals 103 | 104 | | Method | Mean | Error | Ratio | Gen 0/1k Op | Gen 1/1k Op | Gen 2/1k Op | Allocated Memory/Op | 105 | |------- |----------:|------:|------:|------------:|------------:|------------:|--------------------:| 106 | | Guid_ | 1.819 ns | NA | 1.00 | - | - | - | - | 107 | | Ulid_ | 2.023 ns | NA | 1.11 | - | - | - | - | 108 | | NUlid_ | 29.875 ns | NA | 16.43 | 0.0126 | - | - | 80 B | 109 | 110 | Equals is called when use dictionary's key. `Ulid` is fast and zero allocation. 111 | 112 | * CompareTo 113 | 114 | | Method | Mean | Error | Ratio | Gen 0/1k Op | Gen 1/1k Op | Gen 2/1k Op | Allocated Memory/Op | 115 | |------- |----------:|------:|------:|------------:|------------:|------------:|--------------------:| 116 | | Guid_ | 5.409 ns | NA | 1.00 | - | - | - | - | 117 | | Ulid_ | 3.838 ns | NA | 0.71 | - | - | - | - | 118 | | NUlid_ | 17.126 ns | NA | 3.17 | 0.0063 | - | - | 40 B | 119 | 120 | CompareTo is called when use sort. `Ulid` is fastest and zero allocation. 121 | 122 | Cli 123 | --- 124 | You can install command-line to generate ulid string by .NET Core Global Tool. 125 | 126 | `dotnet tool install --global ulid-cli` 127 | 128 | after installed, you can call like here. 129 | 130 | ``` 131 | $ dotnet ulid 132 | 01D7CB31YQKCJPY9FDTN2WTAFF 133 | 134 | $ dotnet ulid -t "2019/03/25" -min 135 | 01D6R3EBC00000000000000000 136 | 137 | $ dotnet ulid -t "2019/03/25" -max 138 | 01D6R3EBC0ZZZZZZZZZZZZZZZZ 139 | 140 | $ dotnet ulid -t "2019/03/25" -max -base64 141 | AWmwNy2A/////////////w== 142 | ``` 143 | 144 | ``` 145 | argument list: 146 | -t, -timestamp: [default=null]timestamp(converted to UTC, ISO8601 format recommended) 147 | -r, -randomness: [default=null]randomness bytes(formatted as Base32, must be 16 characters, case insensitive) 148 | -b, -base64: [default=False]output as base64 format, or output base32 if false 149 | -min, -minRandomness: [default=False]min-randomness(use 000...) 150 | -max, -maxRandomness: [default=False]max-randomness(use ZZZ...) 151 | ``` 152 | 153 | This CLI tool is powered by [ConsoleAppFramework](https://github.com/Cysharp/ConsoleAppFramework/). 154 | 155 | Integrate 156 | --- 157 | **System.Text.Json** 158 | 159 | NuGet: [Ulid.SystemTextJson](https://www.nuget.org/packages/Ulid.SystemTextJson) 160 | 161 | You can use custom Ulid converter - `Cysharp.Serialization.Json.UlidJsonConverter`. 162 | 163 | ```csharp 164 | var options = new JsonSerializerOptions() 165 | { 166 | Converters = 167 | { 168 | new Cysharp.Serialization.Json.UlidJsonConverter() 169 | } 170 | }; 171 | 172 | JsonSerializer.Serialize(Ulid.NewUlid(), options); 173 | ``` 174 | 175 | If application targetframework is `netcoreapp3.0`, converter is builtin, does not require to add `Ulid.SystemTextJson` package, and does not require use custom options. 176 | 177 | **MessagePack-CSharp** 178 | 179 | NuGet: [Ulid.MessagePack](https://www.nuget.org/packages/Ulid.MessagePack) 180 | 181 | You can use custom Ulid formatter - `Cysharp.Serialization.MessagePack.UlidMessagePackFormatter` and resolver - `Cysharp.Serialization.MessagePack.UlidMessagePackResolver`. 182 | 183 | ```csharp 184 | var resolver = MessagePack.Resolvers.CompositeResolver.Create( 185 | Cysharp.Serialization.MessagePack.UlidMessagePackResolver.Instance, 186 | MessagePack.Resolvers.StandardResolver.Instance); 187 | var options = MessagePackSerializerOptions.Standard.WithResolver(resolver); 188 | 189 | MessagePackSerializer.Serialize(Ulid.NewUlid(), options); 190 | ``` 191 | 192 | If you want to use this custom formatter on Unity, download [UlidMessagePackFormatter.cs](https://github.com/Cysharp/Ulid/blob/master/src/Ulid.MessagePack/UlidMessagePackFormatter.cs). 193 | 194 | **Dapper** 195 | 196 | For [Dapper](https://github.com/StackExchange/Dapper) or other ADO.NET database mapper, register custom converter from Ulid to binary or Ulid to string. 197 | 198 | ```csharp 199 | public class BinaryUlidHandler : TypeHandler 200 | { 201 | public override Ulid Parse(object value) 202 | { 203 | return new Ulid((byte[])value); 204 | } 205 | 206 | public override void SetValue(IDbDataParameter parameter, Ulid value) 207 | { 208 | parameter.DbType = DbType.Binary; 209 | parameter.Size = 16; 210 | parameter.Value = value.ToByteArray(); 211 | } 212 | } 213 | 214 | public class StringUlidHandler : TypeHandler 215 | { 216 | public override Ulid Parse(object value) 217 | { 218 | return Ulid.Parse((string)value); 219 | } 220 | 221 | public override void SetValue(IDbDataParameter parameter, Ulid value) 222 | { 223 | parameter.DbType = DbType.StringFixedLength; 224 | parameter.Size = 26; 225 | parameter.Value = value.ToString(); 226 | } 227 | } 228 | 229 | // setup handler 230 | Dapper.SqlMapper.AddTypeHandler(new BinaryUlidHandler()); 231 | ``` 232 | 233 | **Entity Framework Core** 234 | 235 | to use in EF, create ValueConverter and bind it. 236 | 237 | ```csharp 238 | public class UlidToBytesConverter : ValueConverter 239 | { 240 | private static readonly ConverterMappingHints DefaultHints = new ConverterMappingHints(size: 16); 241 | 242 | public UlidToBytesConverter() : this(null) 243 | { 244 | } 245 | 246 | public UlidToBytesConverter(ConverterMappingHints? mappingHints) 247 | : base( 248 | convertToProviderExpression: x => x.ToByteArray(), 249 | convertFromProviderExpression: x => new Ulid(x), 250 | mappingHints: DefaultHints.With(mappingHints)) 251 | { 252 | } 253 | } 254 | 255 | public class UlidToStringConverter : ValueConverter 256 | { 257 | private static readonly ConverterMappingHints DefaultHints = new ConverterMappingHints(size: 26); 258 | 259 | public UlidToStringConverter() : this(null) 260 | { 261 | } 262 | 263 | public UlidToStringConverter(ConverterMappingHints? mappingHints) 264 | : base( 265 | convertToProviderExpression: x => x.ToString(), 266 | convertFromProviderExpression: x => Ulid.Parse(x), 267 | mappingHints: DefaultHints.With(mappingHints)) 268 | { 269 | } 270 | } 271 | ``` 272 | 273 | To use those converters, you can either specify individual properties of entities in `OnModelCreating` method of your context: 274 | ```csharp 275 | protected override void OnModelCreating(ModelBuilder modelBuilder) 276 | { 277 | modelBuilder.Entity() 278 | .Property(e => e.MyProperty) 279 | .HasConversion() 280 | .HasConversion(); 281 | } 282 | ``` 283 | 284 | or use model bulk configuration for all properties of type `Ulid`. To do this, overload `ConfigureConventions` method of your context: 285 | 286 | ```csharp 287 | protected override void ConfigureConventions(ModelConfigurationBuilder configurationBuilder) 288 | { 289 | configurationBuilder 290 | .Properties() 291 | .HaveConversion() 292 | .HaveConversion(); 293 | } 294 | ``` 295 | 296 | License 297 | --- 298 | This library is under the MIT License. 299 | -------------------------------------------------------------------------------- /Ulid.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.29613.14 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{A0803F51-FC43-4216-B067-41B516965BA0}" 7 | EndProject 8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{8AB8257F-2CB1-4F78-9980-8E5A0F017F84}" 9 | EndProject 10 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ulid", "src\Ulid\Ulid.csproj", "{E44C0355-5194-49EF-A54E-4EAC9A385622}" 11 | EndProject 12 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TryUlid", "sandbox\TryUlid\TryUlid.csproj", "{9ED5BA79-E7F1-4247-9956-F3908F2F87A2}" 13 | EndProject 14 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "sandbox", "sandbox", "{F1B5C8EA-DCBF-4A5F-819A-5E394F279AF9}" 15 | EndProject 16 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PerfBenchmark", "benchmark\PerfBenchmark\PerfBenchmark.csproj", "{3E24E35E-05A1-4A29-8DA3-EC3E9A636D75}" 17 | EndProject 18 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ulid.Tests", "tests\Ulid.Tests\Ulid.Tests.csproj", "{7A21DCC2-C6C4-4E40-850F-281258856C4A}" 19 | EndProject 20 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".circleci", ".circleci", "{60DA2E6D-48CF-4EF1-AE2F-F581EF755F0D}" 21 | ProjectSection(SolutionItems) = preProject 22 | .circleci\config.yml = .circleci\config.yml 23 | EndProjectSection 24 | EndProject 25 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ulid.Cli", "src\Ulid.Cli\Ulid.Cli.csproj", "{CD41A6E5-9F68-472E-9992-922F567BDB87}" 26 | EndProject 27 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ulid.Cli.Tests", "tests\Ulid.Cli.Tests\Ulid.Cli.Tests.csproj", "{3488CD90-AAEA-442A-8E2E-0639497E037F}" 28 | EndProject 29 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ulid.SystemTextJson", "src\Ulid.SystemTextJson\Ulid.SystemTextJson.csproj", "{66E152B2-4828-4770-BB24-A6FED7578CFC}" 30 | EndProject 31 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ulid.SystemTextJson.Tests", "tests\Ulid.SystemTextJson.Tests\Ulid.SystemTextJson.Tests.csproj", "{7A7716D3-2738-4C02-934B-9FFA86EFC01A}" 32 | EndProject 33 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ulid.MessagePack", "src\Ulid.MessagePack\Ulid.MessagePack.csproj", "{BE35B408-0611-44C1-92B7-DF10DC178FF3}" 34 | EndProject 35 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ulid.MessagePack.Tests", "tests\Ulid.MessagePack.Tests\Ulid.MessagePack.Tests.csproj", "{057D3071-FD7C-418A-8652-3A27F0E9A41E}" 36 | EndProject 37 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{3075C489-8B76-47CE-BA7F-C856FCC56DF1}" 38 | ProjectSection(SolutionItems) = preProject 39 | .gitignore = .gitignore 40 | Directory.Build.props = Directory.Build.props 41 | README.md = README.md 42 | EndProjectSection 43 | EndProject 44 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlazorWasm", "sandbox\BlazorWasm\BlazorWasm.csproj", "{B49392BF-3988-48A0-A754-99647320AD61}" 45 | EndProject 46 | Global 47 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 48 | Debug|Any CPU = Debug|Any CPU 49 | Release|Any CPU = Release|Any CPU 50 | EndGlobalSection 51 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 52 | {E44C0355-5194-49EF-A54E-4EAC9A385622}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 53 | {E44C0355-5194-49EF-A54E-4EAC9A385622}.Debug|Any CPU.Build.0 = Debug|Any CPU 54 | {E44C0355-5194-49EF-A54E-4EAC9A385622}.Release|Any CPU.ActiveCfg = Release|Any CPU 55 | {E44C0355-5194-49EF-A54E-4EAC9A385622}.Release|Any CPU.Build.0 = Release|Any CPU 56 | {9ED5BA79-E7F1-4247-9956-F3908F2F87A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 57 | {9ED5BA79-E7F1-4247-9956-F3908F2F87A2}.Debug|Any CPU.Build.0 = Debug|Any CPU 58 | {9ED5BA79-E7F1-4247-9956-F3908F2F87A2}.Release|Any CPU.ActiveCfg = Release|Any CPU 59 | {9ED5BA79-E7F1-4247-9956-F3908F2F87A2}.Release|Any CPU.Build.0 = Release|Any CPU 60 | {3E24E35E-05A1-4A29-8DA3-EC3E9A636D75}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 61 | {3E24E35E-05A1-4A29-8DA3-EC3E9A636D75}.Debug|Any CPU.Build.0 = Debug|Any CPU 62 | {3E24E35E-05A1-4A29-8DA3-EC3E9A636D75}.Release|Any CPU.ActiveCfg = Release|Any CPU 63 | {3E24E35E-05A1-4A29-8DA3-EC3E9A636D75}.Release|Any CPU.Build.0 = Release|Any CPU 64 | {7A21DCC2-C6C4-4E40-850F-281258856C4A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 65 | {7A21DCC2-C6C4-4E40-850F-281258856C4A}.Debug|Any CPU.Build.0 = Debug|Any CPU 66 | {7A21DCC2-C6C4-4E40-850F-281258856C4A}.Release|Any CPU.ActiveCfg = Release|Any CPU 67 | {7A21DCC2-C6C4-4E40-850F-281258856C4A}.Release|Any CPU.Build.0 = Release|Any CPU 68 | {CD41A6E5-9F68-472E-9992-922F567BDB87}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 69 | {CD41A6E5-9F68-472E-9992-922F567BDB87}.Debug|Any CPU.Build.0 = Debug|Any CPU 70 | {CD41A6E5-9F68-472E-9992-922F567BDB87}.Release|Any CPU.ActiveCfg = Release|Any CPU 71 | {CD41A6E5-9F68-472E-9992-922F567BDB87}.Release|Any CPU.Build.0 = Release|Any CPU 72 | {3488CD90-AAEA-442A-8E2E-0639497E037F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 73 | {3488CD90-AAEA-442A-8E2E-0639497E037F}.Debug|Any CPU.Build.0 = Debug|Any CPU 74 | {3488CD90-AAEA-442A-8E2E-0639497E037F}.Release|Any CPU.ActiveCfg = Release|Any CPU 75 | {3488CD90-AAEA-442A-8E2E-0639497E037F}.Release|Any CPU.Build.0 = Release|Any CPU 76 | {66E152B2-4828-4770-BB24-A6FED7578CFC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 77 | {66E152B2-4828-4770-BB24-A6FED7578CFC}.Debug|Any CPU.Build.0 = Debug|Any CPU 78 | {66E152B2-4828-4770-BB24-A6FED7578CFC}.Release|Any CPU.ActiveCfg = Release|Any CPU 79 | {66E152B2-4828-4770-BB24-A6FED7578CFC}.Release|Any CPU.Build.0 = Release|Any CPU 80 | {7A7716D3-2738-4C02-934B-9FFA86EFC01A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 81 | {7A7716D3-2738-4C02-934B-9FFA86EFC01A}.Debug|Any CPU.Build.0 = Debug|Any CPU 82 | {7A7716D3-2738-4C02-934B-9FFA86EFC01A}.Release|Any CPU.ActiveCfg = Release|Any CPU 83 | {7A7716D3-2738-4C02-934B-9FFA86EFC01A}.Release|Any CPU.Build.0 = Release|Any CPU 84 | {BE35B408-0611-44C1-92B7-DF10DC178FF3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 85 | {BE35B408-0611-44C1-92B7-DF10DC178FF3}.Debug|Any CPU.Build.0 = Debug|Any CPU 86 | {BE35B408-0611-44C1-92B7-DF10DC178FF3}.Release|Any CPU.ActiveCfg = Release|Any CPU 87 | {BE35B408-0611-44C1-92B7-DF10DC178FF3}.Release|Any CPU.Build.0 = Release|Any CPU 88 | {057D3071-FD7C-418A-8652-3A27F0E9A41E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 89 | {057D3071-FD7C-418A-8652-3A27F0E9A41E}.Debug|Any CPU.Build.0 = Debug|Any CPU 90 | {057D3071-FD7C-418A-8652-3A27F0E9A41E}.Release|Any CPU.ActiveCfg = Release|Any CPU 91 | {057D3071-FD7C-418A-8652-3A27F0E9A41E}.Release|Any CPU.Build.0 = Release|Any CPU 92 | {B49392BF-3988-48A0-A754-99647320AD61}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 93 | {B49392BF-3988-48A0-A754-99647320AD61}.Debug|Any CPU.Build.0 = Debug|Any CPU 94 | {B49392BF-3988-48A0-A754-99647320AD61}.Release|Any CPU.ActiveCfg = Release|Any CPU 95 | {B49392BF-3988-48A0-A754-99647320AD61}.Release|Any CPU.Build.0 = Release|Any CPU 96 | EndGlobalSection 97 | GlobalSection(SolutionProperties) = preSolution 98 | HideSolutionNode = FALSE 99 | EndGlobalSection 100 | GlobalSection(NestedProjects) = preSolution 101 | {E44C0355-5194-49EF-A54E-4EAC9A385622} = {A0803F51-FC43-4216-B067-41B516965BA0} 102 | {9ED5BA79-E7F1-4247-9956-F3908F2F87A2} = {F1B5C8EA-DCBF-4A5F-819A-5E394F279AF9} 103 | {3E24E35E-05A1-4A29-8DA3-EC3E9A636D75} = {F1B5C8EA-DCBF-4A5F-819A-5E394F279AF9} 104 | {7A21DCC2-C6C4-4E40-850F-281258856C4A} = {8AB8257F-2CB1-4F78-9980-8E5A0F017F84} 105 | {CD41A6E5-9F68-472E-9992-922F567BDB87} = {A0803F51-FC43-4216-B067-41B516965BA0} 106 | {3488CD90-AAEA-442A-8E2E-0639497E037F} = {8AB8257F-2CB1-4F78-9980-8E5A0F017F84} 107 | {66E152B2-4828-4770-BB24-A6FED7578CFC} = {A0803F51-FC43-4216-B067-41B516965BA0} 108 | {7A7716D3-2738-4C02-934B-9FFA86EFC01A} = {8AB8257F-2CB1-4F78-9980-8E5A0F017F84} 109 | {BE35B408-0611-44C1-92B7-DF10DC178FF3} = {A0803F51-FC43-4216-B067-41B516965BA0} 110 | {057D3071-FD7C-418A-8652-3A27F0E9A41E} = {8AB8257F-2CB1-4F78-9980-8E5A0F017F84} 111 | {B49392BF-3988-48A0-A754-99647320AD61} = {F1B5C8EA-DCBF-4A5F-819A-5E394F279AF9} 112 | EndGlobalSection 113 | GlobalSection(ExtensibilityGlobals) = postSolution 114 | SolutionGuid = {2E82BF37-8451-4819-BEF6-F9D9A2B48901} 115 | EndGlobalSection 116 | EndGlobal 117 | -------------------------------------------------------------------------------- /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 | } -------------------------------------------------------------------------------- /benchmark/PerfBenchmark/PerfBenchmark.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net7.0 6 | false 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/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/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/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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /sandbox/BlazorWasm/App.razor: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |

Sorry, there's nothing at this address.

8 |
9 |
10 |
11 | -------------------------------------------------------------------------------- /sandbox/BlazorWasm/BlazorWasm.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net7.0 5 | false 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /sandbox/BlazorWasm/Pages/Index.razor: -------------------------------------------------------------------------------- 1 | @page "/" 2 | 3 |

Ulid: @Ulid.NewUlid().ToString()

-------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /sandbox/BlazorWasm/Shared/MainLayout.razor: -------------------------------------------------------------------------------- 1 | @inherits LayoutComponentBase 2 | 3 |
4 |
5 |
6 | @Body 7 |
8 |
9 |
10 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /sandbox/BlazorWasm/wwwroot/css/open-iconic/FONT-LICENSE: -------------------------------------------------------------------------------- 1 | SIL OPEN FONT LICENSE Version 1.1 2 | 3 | Copyright (c) 2014 Waybury 4 | 5 | PREAMBLE 6 | The goals of the Open Font License (OFL) are to stimulate worldwide 7 | development of collaborative font projects, to support the font creation 8 | efforts of academic and linguistic communities, and to provide a free and 9 | open framework in which fonts may be shared and improved in partnership 10 | with others. 11 | 12 | The OFL allows the licensed fonts to be used, studied, modified and 13 | redistributed freely as long as they are not sold by themselves. The 14 | fonts, including any derivative works, can be bundled, embedded, 15 | redistributed and/or sold with any software provided that any reserved 16 | names are not used by derivative works. The fonts and derivatives, 17 | however, cannot be released under any other type of license. The 18 | requirement for fonts to remain under this license does not apply 19 | to any document created using the fonts or their derivatives. 20 | 21 | DEFINITIONS 22 | "Font Software" refers to the set of files released by the Copyright 23 | Holder(s) under this license and clearly marked as such. This may 24 | include source files, build scripts and documentation. 25 | 26 | "Reserved Font Name" refers to any names specified as such after the 27 | copyright statement(s). 28 | 29 | "Original Version" refers to the collection of Font Software components as 30 | distributed by the Copyright Holder(s). 31 | 32 | "Modified Version" refers to any derivative made by adding to, deleting, 33 | or substituting -- in part or in whole -- any of the components of the 34 | Original Version, by changing formats or by porting the Font Software to a 35 | new environment. 36 | 37 | "Author" refers to any designer, engineer, programmer, technical 38 | writer or other person who contributed to the Font Software. 39 | 40 | PERMISSION & CONDITIONS 41 | Permission is hereby granted, free of charge, to any person obtaining 42 | a copy of the Font Software, to use, study, copy, merge, embed, modify, 43 | redistribute, and sell modified and unmodified copies of the Font 44 | Software, subject to the following conditions: 45 | 46 | 1) Neither the Font Software nor any of its individual components, 47 | in Original or Modified Versions, may be sold by itself. 48 | 49 | 2) Original or Modified Versions of the Font Software may be bundled, 50 | redistributed and/or sold with any software, provided that each copy 51 | contains the above copyright notice and this license. These can be 52 | included either as stand-alone text files, human-readable headers or 53 | in the appropriate machine-readable metadata fields within text or 54 | binary files as long as those fields can be easily viewed by the user. 55 | 56 | 3) No Modified Version of the Font Software may use the Reserved Font 57 | Name(s) unless explicit written permission is granted by the corresponding 58 | Copyright Holder. This restriction only applies to the primary font name as 59 | presented to the users. 60 | 61 | 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font 62 | Software shall not be used to promote, endorse or advertise any 63 | Modified Version, except to acknowledge the contribution(s) of the 64 | Copyright Holder(s) and the Author(s) or with their explicit written 65 | permission. 66 | 67 | 5) The Font Software, modified or unmodified, in part or in whole, 68 | must be distributed entirely under this license, and must not be 69 | distributed under any other license. The requirement for fonts to 70 | remain under this license does not apply to any document created 71 | using the Font Software. 72 | 73 | TERMINATION 74 | This license becomes null and void if any of the above conditions are 75 | not met. 76 | 77 | DISCLAIMER 78 | THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 79 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF 80 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT 81 | OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE 82 | COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 83 | INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL 84 | DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 85 | FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM 86 | OTHER DEALINGS IN THE FONT SOFTWARE. 87 | -------------------------------------------------------------------------------- /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. -------------------------------------------------------------------------------- /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 | icon name 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* `` *tag and a unique class name for each different icon in the* `` *tag.* 37 | 38 | ``` 39 | 40 | 41 | 42 | ``` 43 | 44 | Sizing icons only needs basic CSS. All the icons are in a square format, so just set the `` tag with equal width and height dimensions. 45 | 46 | ``` 47 | .icon { 48 | width: 16px; 49 | height: 16px; 50 | } 51 | ``` 52 | 53 | Coloring icons is even easier. All you need to do is set the `fill` rule on the `` tag. 54 | 55 | ``` 56 | .icon-account-login { 57 | fill: #f00; 58 | } 59 | ``` 60 | 61 | To learn more about SVG Sprites, read [Chris Coyier's guide](http://css-tricks.com/svg-sprites-use-better-icon-fonts/). 62 | 63 | #### Using Open Iconic's Icon Font... 64 | 65 | 66 | ##### …with Bootstrap 67 | 68 | You can find our Bootstrap stylesheets in `font/css/open-iconic-bootstrap.{css, less, scss, styl}` 69 | 70 | 71 | ``` 72 | 73 | ``` 74 | 75 | 76 | ``` 77 | 78 | ``` 79 | 80 | ##### …with Foundation 81 | 82 | You can find our Foundation stylesheets in `font/css/open-iconic-foundation.{css, less, scss, styl}` 83 | 84 | ``` 85 | 86 | ``` 87 | 88 | 89 | ``` 90 | 91 | ``` 92 | 93 | ##### …on its own 94 | 95 | You can find our default stylesheets in `font/css/open-iconic.{css, less, scss, styl}` 96 | 97 | ``` 98 | 99 | ``` 100 | 101 | ``` 102 | 103 | ``` 104 | 105 | 106 | ## License 107 | 108 | ### Icons 109 | 110 | All code (including SVG markup) is under the [MIT License](http://opensource.org/licenses/MIT). 111 | 112 | ### Fonts 113 | 114 | All fonts are under the [SIL Licensed](http://scripts.sil.org/cms/scripts/page.php?item_id=OFL_web). 115 | -------------------------------------------------------------------------------- /sandbox/BlazorWasm/wwwroot/css/open-iconic/font/css/open-iconic-bootstrap.min.css: -------------------------------------------------------------------------------- 1 | @font-face{font-family:Icons;src:url(../fonts/open-iconic.eot);src:url(../fonts/open-iconic.eot?#iconic-sm) format('embedded-opentype'),url(../fonts/open-iconic.woff) format('woff'),url(../fonts/open-iconic.ttf) format('truetype'),url(../fonts/open-iconic.otf) format('opentype'),url(../fonts/open-iconic.svg#iconic-sm) format('svg');font-weight:400;font-style:normal}.oi{position:relative;top:1px;display:inline-block;speak:none;font-family:Icons;font-style:normal;font-weight:400;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.oi:empty:before{width:1em;text-align:center;box-sizing:content-box}.oi.oi-align-center:before{text-align:center}.oi.oi-align-left:before{text-align:left}.oi.oi-align-right:before{text-align:right}.oi.oi-flip-horizontal:before{-webkit-transform:scale(-1,1);-ms-transform:scale(-1,1);transform:scale(-1,1)}.oi.oi-flip-vertical:before{-webkit-transform:scale(1,-1);-ms-transform:scale(-1,1);transform:scale(1,-1)}.oi.oi-flip-horizontal-vertical:before{-webkit-transform:scale(-1,-1);-ms-transform:scale(-1,1);transform:scale(-1,-1)}.oi-account-login:before{content:'\e000'}.oi-account-logout:before{content:'\e001'}.oi-action-redo:before{content:'\e002'}.oi-action-undo:before{content:'\e003'}.oi-align-center:before{content:'\e004'}.oi-align-left:before{content:'\e005'}.oi-align-right:before{content:'\e006'}.oi-aperture:before{content:'\e007'}.oi-arrow-bottom:before{content:'\e008'}.oi-arrow-circle-bottom:before{content:'\e009'}.oi-arrow-circle-left:before{content:'\e00a'}.oi-arrow-circle-right:before{content:'\e00b'}.oi-arrow-circle-top:before{content:'\e00c'}.oi-arrow-left:before{content:'\e00d'}.oi-arrow-right:before{content:'\e00e'}.oi-arrow-thick-bottom:before{content:'\e00f'}.oi-arrow-thick-left:before{content:'\e010'}.oi-arrow-thick-right:before{content:'\e011'}.oi-arrow-thick-top:before{content:'\e012'}.oi-arrow-top:before{content:'\e013'}.oi-audio-spectrum:before{content:'\e014'}.oi-audio:before{content:'\e015'}.oi-badge:before{content:'\e016'}.oi-ban:before{content:'\e017'}.oi-bar-chart:before{content:'\e018'}.oi-basket:before{content:'\e019'}.oi-battery-empty:before{content:'\e01a'}.oi-battery-full:before{content:'\e01b'}.oi-beaker:before{content:'\e01c'}.oi-bell:before{content:'\e01d'}.oi-bluetooth:before{content:'\e01e'}.oi-bold:before{content:'\e01f'}.oi-bolt:before{content:'\e020'}.oi-book:before{content:'\e021'}.oi-bookmark:before{content:'\e022'}.oi-box:before{content:'\e023'}.oi-briefcase:before{content:'\e024'}.oi-british-pound:before{content:'\e025'}.oi-browser:before{content:'\e026'}.oi-brush:before{content:'\e027'}.oi-bug:before{content:'\e028'}.oi-bullhorn:before{content:'\e029'}.oi-calculator:before{content:'\e02a'}.oi-calendar:before{content:'\e02b'}.oi-camera-slr:before{content:'\e02c'}.oi-caret-bottom:before{content:'\e02d'}.oi-caret-left:before{content:'\e02e'}.oi-caret-right:before{content:'\e02f'}.oi-caret-top:before{content:'\e030'}.oi-cart:before{content:'\e031'}.oi-chat:before{content:'\e032'}.oi-check:before{content:'\e033'}.oi-chevron-bottom:before{content:'\e034'}.oi-chevron-left:before{content:'\e035'}.oi-chevron-right:before{content:'\e036'}.oi-chevron-top:before{content:'\e037'}.oi-circle-check:before{content:'\e038'}.oi-circle-x:before{content:'\e039'}.oi-clipboard:before{content:'\e03a'}.oi-clock:before{content:'\e03b'}.oi-cloud-download:before{content:'\e03c'}.oi-cloud-upload:before{content:'\e03d'}.oi-cloud:before{content:'\e03e'}.oi-cloudy:before{content:'\e03f'}.oi-code:before{content:'\e040'}.oi-cog:before{content:'\e041'}.oi-collapse-down:before{content:'\e042'}.oi-collapse-left:before{content:'\e043'}.oi-collapse-right:before{content:'\e044'}.oi-collapse-up:before{content:'\e045'}.oi-command:before{content:'\e046'}.oi-comment-square:before{content:'\e047'}.oi-compass:before{content:'\e048'}.oi-contrast:before{content:'\e049'}.oi-copywriting:before{content:'\e04a'}.oi-credit-card:before{content:'\e04b'}.oi-crop:before{content:'\e04c'}.oi-dashboard:before{content:'\e04d'}.oi-data-transfer-download:before{content:'\e04e'}.oi-data-transfer-upload:before{content:'\e04f'}.oi-delete:before{content:'\e050'}.oi-dial:before{content:'\e051'}.oi-document:before{content:'\e052'}.oi-dollar:before{content:'\e053'}.oi-double-quote-sans-left:before{content:'\e054'}.oi-double-quote-sans-right:before{content:'\e055'}.oi-double-quote-serif-left:before{content:'\e056'}.oi-double-quote-serif-right:before{content:'\e057'}.oi-droplet:before{content:'\e058'}.oi-eject:before{content:'\e059'}.oi-elevator:before{content:'\e05a'}.oi-ellipses:before{content:'\e05b'}.oi-envelope-closed:before{content:'\e05c'}.oi-envelope-open:before{content:'\e05d'}.oi-euro:before{content:'\e05e'}.oi-excerpt:before{content:'\e05f'}.oi-expand-down:before{content:'\e060'}.oi-expand-left:before{content:'\e061'}.oi-expand-right:before{content:'\e062'}.oi-expand-up:before{content:'\e063'}.oi-external-link:before{content:'\e064'}.oi-eye:before{content:'\e065'}.oi-eyedropper:before{content:'\e066'}.oi-file:before{content:'\e067'}.oi-fire:before{content:'\e068'}.oi-flag:before{content:'\e069'}.oi-flash:before{content:'\e06a'}.oi-folder:before{content:'\e06b'}.oi-fork:before{content:'\e06c'}.oi-fullscreen-enter:before{content:'\e06d'}.oi-fullscreen-exit:before{content:'\e06e'}.oi-globe:before{content:'\e06f'}.oi-graph:before{content:'\e070'}.oi-grid-four-up:before{content:'\e071'}.oi-grid-three-up:before{content:'\e072'}.oi-grid-two-up:before{content:'\e073'}.oi-hard-drive:before{content:'\e074'}.oi-header:before{content:'\e075'}.oi-headphones:before{content:'\e076'}.oi-heart:before{content:'\e077'}.oi-home:before{content:'\e078'}.oi-image:before{content:'\e079'}.oi-inbox:before{content:'\e07a'}.oi-infinity:before{content:'\e07b'}.oi-info:before{content:'\e07c'}.oi-italic:before{content:'\e07d'}.oi-justify-center:before{content:'\e07e'}.oi-justify-left:before{content:'\e07f'}.oi-justify-right:before{content:'\e080'}.oi-key:before{content:'\e081'}.oi-laptop:before{content:'\e082'}.oi-layers:before{content:'\e083'}.oi-lightbulb:before{content:'\e084'}.oi-link-broken:before{content:'\e085'}.oi-link-intact:before{content:'\e086'}.oi-list-rich:before{content:'\e087'}.oi-list:before{content:'\e088'}.oi-location:before{content:'\e089'}.oi-lock-locked:before{content:'\e08a'}.oi-lock-unlocked:before{content:'\e08b'}.oi-loop-circular:before{content:'\e08c'}.oi-loop-square:before{content:'\e08d'}.oi-loop:before{content:'\e08e'}.oi-magnifying-glass:before{content:'\e08f'}.oi-map-marker:before{content:'\e090'}.oi-map:before{content:'\e091'}.oi-media-pause:before{content:'\e092'}.oi-media-play:before{content:'\e093'}.oi-media-record:before{content:'\e094'}.oi-media-skip-backward:before{content:'\e095'}.oi-media-skip-forward:before{content:'\e096'}.oi-media-step-backward:before{content:'\e097'}.oi-media-step-forward:before{content:'\e098'}.oi-media-stop:before{content:'\e099'}.oi-medical-cross:before{content:'\e09a'}.oi-menu:before{content:'\e09b'}.oi-microphone:before{content:'\e09c'}.oi-minus:before{content:'\e09d'}.oi-monitor:before{content:'\e09e'}.oi-moon:before{content:'\e09f'}.oi-move:before{content:'\e0a0'}.oi-musical-note:before{content:'\e0a1'}.oi-paperclip:before{content:'\e0a2'}.oi-pencil:before{content:'\e0a3'}.oi-people:before{content:'\e0a4'}.oi-person:before{content:'\e0a5'}.oi-phone:before{content:'\e0a6'}.oi-pie-chart:before{content:'\e0a7'}.oi-pin:before{content:'\e0a8'}.oi-play-circle:before{content:'\e0a9'}.oi-plus:before{content:'\e0aa'}.oi-power-standby:before{content:'\e0ab'}.oi-print:before{content:'\e0ac'}.oi-project:before{content:'\e0ad'}.oi-pulse:before{content:'\e0ae'}.oi-puzzle-piece:before{content:'\e0af'}.oi-question-mark:before{content:'\e0b0'}.oi-rain:before{content:'\e0b1'}.oi-random:before{content:'\e0b2'}.oi-reload:before{content:'\e0b3'}.oi-resize-both:before{content:'\e0b4'}.oi-resize-height:before{content:'\e0b5'}.oi-resize-width:before{content:'\e0b6'}.oi-rss-alt:before{content:'\e0b7'}.oi-rss:before{content:'\e0b8'}.oi-script:before{content:'\e0b9'}.oi-share-boxed:before{content:'\e0ba'}.oi-share:before{content:'\e0bb'}.oi-shield:before{content:'\e0bc'}.oi-signal:before{content:'\e0bd'}.oi-signpost:before{content:'\e0be'}.oi-sort-ascending:before{content:'\e0bf'}.oi-sort-descending:before{content:'\e0c0'}.oi-spreadsheet:before{content:'\e0c1'}.oi-star:before{content:'\e0c2'}.oi-sun:before{content:'\e0c3'}.oi-tablet:before{content:'\e0c4'}.oi-tag:before{content:'\e0c5'}.oi-tags:before{content:'\e0c6'}.oi-target:before{content:'\e0c7'}.oi-task:before{content:'\e0c8'}.oi-terminal:before{content:'\e0c9'}.oi-text:before{content:'\e0ca'}.oi-thumb-down:before{content:'\e0cb'}.oi-thumb-up:before{content:'\e0cc'}.oi-timer:before{content:'\e0cd'}.oi-transfer:before{content:'\e0ce'}.oi-trash:before{content:'\e0cf'}.oi-underline:before{content:'\e0d0'}.oi-vertical-align-bottom:before{content:'\e0d1'}.oi-vertical-align-center:before{content:'\e0d2'}.oi-vertical-align-top:before{content:'\e0d3'}.oi-video:before{content:'\e0d4'}.oi-volume-high:before{content:'\e0d5'}.oi-volume-low:before{content:'\e0d6'}.oi-volume-off:before{content:'\e0d7'}.oi-warning:before{content:'\e0d8'}.oi-wifi:before{content:'\e0d9'}.oi-wrench:before{content:'\e0da'}.oi-x:before{content:'\e0db'}.oi-yen:before{content:'\e0dc'}.oi-zoom-in:before{content:'\e0dd'}.oi-zoom-out:before{content:'\e0de'} -------------------------------------------------------------------------------- /sandbox/BlazorWasm/wwwroot/css/open-iconic/font/fonts/open-iconic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cysharp/Ulid/1fe01ee2c9ab286813f6b25c3095894f0097fc72/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/1fe01ee2c9ab286813f6b25c3095894f0097fc72/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/1fe01ee2c9ab286813f6b25c3095894f0097fc72/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/1fe01ee2c9ab286813f6b25c3095894f0097fc72/sandbox/BlazorWasm/wwwroot/css/open-iconic/font/fonts/open-iconic.woff -------------------------------------------------------------------------------- /sandbox/BlazorWasm/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cysharp/Ulid/1fe01ee2c9ab286813f6b25c3095894f0097fc72/sandbox/BlazorWasm/wwwroot/favicon.ico -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | } -------------------------------------------------------------------------------- /sandbox/TryUlid/TryUlid.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net7.0 6 | false 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /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.Cli/Ulid.Cli.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | <_Parameter1>Ulid.Cli.Tests 10 | 11 | 12 | 13 | 14 | Exe 15 | net6.0;net7.0 16 | dotnet-ulid 17 | true 18 | 7.3 19 | true 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | Ulid-Cli 33 | $(Version) 34 | Cysharp 35 | Cysharp 36 | ULID commandline utility 37 | https://github.com/Cysharp/Ulid 38 | $(PackageProjectUrl) 39 | git 40 | guid 41 | Icon.png 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /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 | } -------------------------------------------------------------------------------- /src/Ulid.MessagePack/Ulid.MessagePack.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0;netstandard2.1 5 | true 6 | release.snk 7 | true 8 | 9 | 10 | Ulid.MessagePack 11 | Ulid MessagePack Formatter. 12 | true 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /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.MessagePack/release.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cysharp/Ulid/1fe01ee2c9ab286813f6b25c3095894f0097fc72/src/Ulid.MessagePack/release.snk -------------------------------------------------------------------------------- /src/Ulid.SystemTextJson/Ulid.SystemTextJson.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netstandard2.0;netstandard2.1 5 | SYSTEM_TEXT_JSON 6 | true 7 | release.snk 8 | true 9 | 10 | 11 | Ulid.SystemTextJson 12 | Ulid System.Text.Json Converter. 13 | true 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/Ulid.SystemTextJson/release.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cysharp/Ulid/1fe01ee2c9ab286813f6b25c3095894f0097fc72/src/Ulid.SystemTextJson/release.snk -------------------------------------------------------------------------------- /src/Ulid.Unity/.vsconfig: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1.0", 3 | "components": [ 4 | "Microsoft.VisualStudio.Workload.ManagedGame" 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /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/Plugins/System.Buffers.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cysharp/Ulid/1fe01ee2c9ab286813f6b25c3095894f0097fc72/src/Ulid.Unity/Assets/Plugins/System.Buffers.dll -------------------------------------------------------------------------------- /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.Memory.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cysharp/Ulid/1fe01ee2c9ab286813f6b25c3095894f0097fc72/src/Ulid.Unity/Assets/Plugins/System.Memory.dll -------------------------------------------------------------------------------- /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.Runtime.CompilerServices.Unsafe.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cysharp/Ulid/1fe01ee2c9ab286813f6b25c3095894f0097fc72/src/Ulid.Unity/Assets/Plugins/System.Runtime.CompilerServices.Unsafe.dll -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!29 &1 4 | OcclusionCullingSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_OcclusionBakeSettings: 8 | smallestOccluder: 5 9 | smallestHole: 0.25 10 | backfaceThreshold: 100 11 | m_SceneGUID: 00000000000000000000000000000000 12 | m_OcclusionCullingData: {fileID: 0} 13 | --- !u!104 &2 14 | RenderSettings: 15 | m_ObjectHideFlags: 0 16 | serializedVersion: 9 17 | m_Fog: 0 18 | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} 19 | m_FogMode: 3 20 | m_FogDensity: 0.01 21 | m_LinearFogStart: 0 22 | m_LinearFogEnd: 300 23 | m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} 24 | m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} 25 | m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} 26 | m_AmbientIntensity: 1 27 | m_AmbientMode: 3 28 | m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} 29 | m_SkyboxMaterial: {fileID: 0} 30 | m_HaloStrength: 0.5 31 | m_FlareStrength: 1 32 | m_FlareFadeSpeed: 3 33 | m_HaloTexture: {fileID: 0} 34 | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} 35 | m_DefaultReflectionMode: 0 36 | m_DefaultReflectionResolution: 128 37 | m_ReflectionBounces: 1 38 | m_ReflectionIntensity: 1 39 | m_CustomReflection: {fileID: 0} 40 | m_Sun: {fileID: 0} 41 | m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} 42 | m_UseRadianceAmbientProbe: 0 43 | --- !u!157 &3 44 | LightmapSettings: 45 | m_ObjectHideFlags: 0 46 | serializedVersion: 11 47 | m_GIWorkflowMode: 1 48 | m_GISettings: 49 | serializedVersion: 2 50 | m_BounceScale: 1 51 | m_IndirectOutputScale: 1 52 | m_AlbedoBoost: 1 53 | m_TemporalCoherenceThreshold: 1 54 | m_EnvironmentLightingMode: 0 55 | m_EnableBakedLightmaps: 0 56 | m_EnableRealtimeLightmaps: 0 57 | m_LightmapEditorSettings: 58 | serializedVersion: 10 59 | m_Resolution: 2 60 | m_BakeResolution: 40 61 | m_AtlasSize: 1024 62 | m_AO: 0 63 | m_AOMaxDistance: 1 64 | m_CompAOExponent: 1 65 | m_CompAOExponentDirect: 0 66 | m_Padding: 2 67 | m_LightmapParameters: {fileID: 0} 68 | m_LightmapsBakeMode: 1 69 | m_TextureCompression: 1 70 | m_FinalGather: 0 71 | m_FinalGatherFiltering: 1 72 | m_FinalGatherRayCount: 256 73 | m_ReflectionCompression: 2 74 | m_MixedBakeMode: 2 75 | m_BakeBackend: 0 76 | m_PVRSampling: 1 77 | m_PVRDirectSampleCount: 32 78 | m_PVRSampleCount: 500 79 | m_PVRBounces: 2 80 | m_PVRFilterTypeDirect: 0 81 | m_PVRFilterTypeIndirect: 0 82 | m_PVRFilterTypeAO: 0 83 | m_PVRFilteringMode: 1 84 | m_PVRCulling: 1 85 | m_PVRFilteringGaussRadiusDirect: 1 86 | m_PVRFilteringGaussRadiusIndirect: 5 87 | m_PVRFilteringGaussRadiusAO: 2 88 | m_PVRFilteringAtrousPositionSigmaDirect: 0.5 89 | m_PVRFilteringAtrousPositionSigmaIndirect: 2 90 | m_PVRFilteringAtrousPositionSigmaAO: 1 91 | m_ShowResolutionOverlay: 1 92 | m_LightingDataAsset: {fileID: 0} 93 | m_UseShadowmask: 1 94 | --- !u!196 &4 95 | NavMeshSettings: 96 | serializedVersion: 2 97 | m_ObjectHideFlags: 0 98 | m_BuildSettings: 99 | serializedVersion: 2 100 | agentTypeID: 0 101 | agentRadius: 0.5 102 | agentHeight: 2 103 | agentSlope: 45 104 | agentClimb: 0.4 105 | ledgeDropHeight: 0 106 | maxJumpAcrossDistance: 0 107 | minRegionArea: 2 108 | manualCellSize: 0 109 | cellSize: 0.16666667 110 | manualTileSize: 0 111 | tileSize: 256 112 | accuratePlacement: 0 113 | debug: 114 | m_Flags: 0 115 | m_NavMeshData: {fileID: 0} 116 | --- !u!1 &519420028 117 | GameObject: 118 | m_ObjectHideFlags: 0 119 | m_PrefabParentObject: {fileID: 0} 120 | m_PrefabInternal: {fileID: 0} 121 | serializedVersion: 5 122 | m_Component: 123 | - component: {fileID: 519420032} 124 | - component: {fileID: 519420031} 125 | - component: {fileID: 519420029} 126 | m_Layer: 0 127 | m_Name: Main Camera 128 | m_TagString: MainCamera 129 | m_Icon: {fileID: 0} 130 | m_NavMeshLayer: 0 131 | m_StaticEditorFlags: 0 132 | m_IsActive: 1 133 | --- !u!81 &519420029 134 | AudioListener: 135 | m_ObjectHideFlags: 0 136 | m_PrefabParentObject: {fileID: 0} 137 | m_PrefabInternal: {fileID: 0} 138 | m_GameObject: {fileID: 519420028} 139 | m_Enabled: 1 140 | --- !u!20 &519420031 141 | Camera: 142 | m_ObjectHideFlags: 0 143 | m_PrefabParentObject: {fileID: 0} 144 | m_PrefabInternal: {fileID: 0} 145 | m_GameObject: {fileID: 519420028} 146 | m_Enabled: 1 147 | serializedVersion: 2 148 | m_ClearFlags: 2 149 | m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} 150 | m_NormalizedViewPortRect: 151 | serializedVersion: 2 152 | x: 0 153 | y: 0 154 | width: 1 155 | height: 1 156 | near clip plane: 0.3 157 | far clip plane: 1000 158 | field of view: 60 159 | orthographic: 1 160 | orthographic size: 5 161 | m_Depth: -1 162 | m_CullingMask: 163 | serializedVersion: 2 164 | m_Bits: 4294967295 165 | m_RenderingPath: -1 166 | m_TargetTexture: {fileID: 0} 167 | m_TargetDisplay: 0 168 | m_TargetEye: 0 169 | m_HDR: 1 170 | m_AllowMSAA: 0 171 | m_AllowDynamicResolution: 0 172 | m_ForceIntoRT: 0 173 | m_OcclusionCulling: 0 174 | m_StereoConvergence: 10 175 | m_StereoSeparation: 0.022 176 | --- !u!4 &519420032 177 | Transform: 178 | m_ObjectHideFlags: 0 179 | m_PrefabParentObject: {fileID: 0} 180 | m_PrefabInternal: {fileID: 0} 181 | m_GameObject: {fileID: 519420028} 182 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 183 | m_LocalPosition: {x: 0, y: 0, z: -10} 184 | m_LocalScale: {x: 1, y: 1, z: 1} 185 | m_Children: [] 186 | m_Father: {fileID: 0} 187 | m_RootOrder: 0 188 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 189 | -------------------------------------------------------------------------------- /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/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/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/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.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/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/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/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 | } -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /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/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/Assets/Scripts/Ulid/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "com.cysharp.ulid", 3 | "displayName": "Ulid", 4 | "version": "1.3.4", 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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/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/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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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.Unity/ProjectSettings/InputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!13 &1 4 | InputManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Axes: 8 | - serializedVersion: 3 9 | m_Name: Horizontal 10 | descriptiveName: 11 | descriptiveNegativeName: 12 | negativeButton: left 13 | positiveButton: right 14 | altNegativeButton: a 15 | altPositiveButton: d 16 | gravity: 3 17 | dead: 0.001 18 | sensitivity: 3 19 | snap: 1 20 | invert: 0 21 | type: 0 22 | axis: 0 23 | joyNum: 0 24 | - serializedVersion: 3 25 | m_Name: Vertical 26 | descriptiveName: 27 | descriptiveNegativeName: 28 | negativeButton: down 29 | positiveButton: up 30 | altNegativeButton: s 31 | altPositiveButton: w 32 | gravity: 3 33 | dead: 0.001 34 | sensitivity: 3 35 | snap: 1 36 | invert: 0 37 | type: 0 38 | axis: 0 39 | joyNum: 0 40 | - serializedVersion: 3 41 | m_Name: Fire1 42 | descriptiveName: 43 | descriptiveNegativeName: 44 | negativeButton: 45 | positiveButton: left ctrl 46 | altNegativeButton: 47 | altPositiveButton: mouse 0 48 | gravity: 1000 49 | dead: 0.001 50 | sensitivity: 1000 51 | snap: 0 52 | invert: 0 53 | type: 0 54 | axis: 0 55 | joyNum: 0 56 | - serializedVersion: 3 57 | m_Name: Fire2 58 | descriptiveName: 59 | descriptiveNegativeName: 60 | negativeButton: 61 | positiveButton: left alt 62 | altNegativeButton: 63 | altPositiveButton: mouse 1 64 | gravity: 1000 65 | dead: 0.001 66 | sensitivity: 1000 67 | snap: 0 68 | invert: 0 69 | type: 0 70 | axis: 0 71 | joyNum: 0 72 | - serializedVersion: 3 73 | m_Name: Fire3 74 | descriptiveName: 75 | descriptiveNegativeName: 76 | negativeButton: 77 | positiveButton: left shift 78 | altNegativeButton: 79 | altPositiveButton: mouse 2 80 | gravity: 1000 81 | dead: 0.001 82 | sensitivity: 1000 83 | snap: 0 84 | invert: 0 85 | type: 0 86 | axis: 0 87 | joyNum: 0 88 | - serializedVersion: 3 89 | m_Name: Jump 90 | descriptiveName: 91 | descriptiveNegativeName: 92 | negativeButton: 93 | positiveButton: space 94 | altNegativeButton: 95 | altPositiveButton: 96 | gravity: 1000 97 | dead: 0.001 98 | sensitivity: 1000 99 | snap: 0 100 | invert: 0 101 | type: 0 102 | axis: 0 103 | joyNum: 0 104 | - serializedVersion: 3 105 | m_Name: Mouse X 106 | descriptiveName: 107 | descriptiveNegativeName: 108 | negativeButton: 109 | positiveButton: 110 | altNegativeButton: 111 | altPositiveButton: 112 | gravity: 0 113 | dead: 0 114 | sensitivity: 0.1 115 | snap: 0 116 | invert: 0 117 | type: 1 118 | axis: 0 119 | joyNum: 0 120 | - serializedVersion: 3 121 | m_Name: Mouse Y 122 | descriptiveName: 123 | descriptiveNegativeName: 124 | negativeButton: 125 | positiveButton: 126 | altNegativeButton: 127 | altPositiveButton: 128 | gravity: 0 129 | dead: 0 130 | sensitivity: 0.1 131 | snap: 0 132 | invert: 0 133 | type: 1 134 | axis: 1 135 | joyNum: 0 136 | - serializedVersion: 3 137 | m_Name: Mouse ScrollWheel 138 | descriptiveName: 139 | descriptiveNegativeName: 140 | negativeButton: 141 | positiveButton: 142 | altNegativeButton: 143 | altPositiveButton: 144 | gravity: 0 145 | dead: 0 146 | sensitivity: 0.1 147 | snap: 0 148 | invert: 0 149 | type: 1 150 | axis: 2 151 | joyNum: 0 152 | - serializedVersion: 3 153 | m_Name: Horizontal 154 | descriptiveName: 155 | descriptiveNegativeName: 156 | negativeButton: 157 | positiveButton: 158 | altNegativeButton: 159 | altPositiveButton: 160 | gravity: 0 161 | dead: 0.19 162 | sensitivity: 1 163 | snap: 0 164 | invert: 0 165 | type: 2 166 | axis: 0 167 | joyNum: 0 168 | - serializedVersion: 3 169 | m_Name: Vertical 170 | descriptiveName: 171 | descriptiveNegativeName: 172 | negativeButton: 173 | positiveButton: 174 | altNegativeButton: 175 | altPositiveButton: 176 | gravity: 0 177 | dead: 0.19 178 | sensitivity: 1 179 | snap: 0 180 | invert: 1 181 | type: 2 182 | axis: 1 183 | joyNum: 0 184 | - serializedVersion: 3 185 | m_Name: Fire1 186 | descriptiveName: 187 | descriptiveNegativeName: 188 | negativeButton: 189 | positiveButton: joystick button 0 190 | altNegativeButton: 191 | altPositiveButton: 192 | gravity: 1000 193 | dead: 0.001 194 | sensitivity: 1000 195 | snap: 0 196 | invert: 0 197 | type: 0 198 | axis: 0 199 | joyNum: 0 200 | - serializedVersion: 3 201 | m_Name: Fire2 202 | descriptiveName: 203 | descriptiveNegativeName: 204 | negativeButton: 205 | positiveButton: joystick button 1 206 | altNegativeButton: 207 | altPositiveButton: 208 | gravity: 1000 209 | dead: 0.001 210 | sensitivity: 1000 211 | snap: 0 212 | invert: 0 213 | type: 0 214 | axis: 0 215 | joyNum: 0 216 | - serializedVersion: 3 217 | m_Name: Fire3 218 | descriptiveName: 219 | descriptiveNegativeName: 220 | negativeButton: 221 | positiveButton: joystick button 2 222 | altNegativeButton: 223 | altPositiveButton: 224 | gravity: 1000 225 | dead: 0.001 226 | sensitivity: 1000 227 | snap: 0 228 | invert: 0 229 | type: 0 230 | axis: 0 231 | joyNum: 0 232 | - serializedVersion: 3 233 | m_Name: Jump 234 | descriptiveName: 235 | descriptiveNegativeName: 236 | negativeButton: 237 | positiveButton: joystick button 3 238 | altNegativeButton: 239 | altPositiveButton: 240 | gravity: 1000 241 | dead: 0.001 242 | sensitivity: 1000 243 | snap: 0 244 | invert: 0 245 | type: 0 246 | axis: 0 247 | joyNum: 0 248 | - serializedVersion: 3 249 | m_Name: Submit 250 | descriptiveName: 251 | descriptiveNegativeName: 252 | negativeButton: 253 | positiveButton: return 254 | altNegativeButton: 255 | altPositiveButton: joystick button 0 256 | gravity: 1000 257 | dead: 0.001 258 | sensitivity: 1000 259 | snap: 0 260 | invert: 0 261 | type: 0 262 | axis: 0 263 | joyNum: 0 264 | - serializedVersion: 3 265 | m_Name: Submit 266 | descriptiveName: 267 | descriptiveNegativeName: 268 | negativeButton: 269 | positiveButton: enter 270 | altNegativeButton: 271 | altPositiveButton: space 272 | gravity: 1000 273 | dead: 0.001 274 | sensitivity: 1000 275 | snap: 0 276 | invert: 0 277 | type: 0 278 | axis: 0 279 | joyNum: 0 280 | - serializedVersion: 3 281 | m_Name: Cancel 282 | descriptiveName: 283 | descriptiveNegativeName: 284 | negativeButton: 285 | positiveButton: escape 286 | altNegativeButton: 287 | altPositiveButton: joystick button 1 288 | gravity: 1000 289 | dead: 0.001 290 | sensitivity: 1000 291 | snap: 0 292 | invert: 0 293 | type: 0 294 | axis: 0 295 | joyNum: 0 296 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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.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/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 | -------------------------------------------------------------------------------- /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.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/ProjectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!129 &1 4 | PlayerSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 17 7 | productGUID: 2ccf24d3c3fd4cb4a8c88961aac652a9 8 | AndroidProfiler: 0 9 | AndroidFilterTouchesWhenObscured: 0 10 | AndroidEnableSustainedPerformanceMode: 0 11 | defaultScreenOrientation: 4 12 | targetDevice: 2 13 | useOnDemandResources: 0 14 | accelerometerFrequency: 60 15 | companyName: DefaultCompany 16 | productName: Ulid.Unity 17 | defaultCursor: {fileID: 0} 18 | cursorHotspot: {x: 0, y: 0} 19 | m_SplashScreenBackgroundColor: {r: 0.13725491, g: 0.12156863, b: 0.1254902, a: 1} 20 | m_ShowUnitySplashScreen: 1 21 | m_ShowUnitySplashLogo: 1 22 | m_SplashScreenOverlayOpacity: 1 23 | m_SplashScreenAnimation: 1 24 | m_SplashScreenLogoStyle: 1 25 | m_SplashScreenDrawMode: 0 26 | m_SplashScreenBackgroundAnimationZoom: 1 27 | m_SplashScreenLogoAnimationZoom: 1 28 | m_SplashScreenBackgroundLandscapeAspect: 1 29 | m_SplashScreenBackgroundPortraitAspect: 1 30 | m_SplashScreenBackgroundLandscapeUvs: 31 | serializedVersion: 2 32 | x: 0 33 | y: 0 34 | width: 1 35 | height: 1 36 | m_SplashScreenBackgroundPortraitUvs: 37 | serializedVersion: 2 38 | x: 0 39 | y: 0 40 | width: 1 41 | height: 1 42 | m_SplashScreenLogos: [] 43 | m_VirtualRealitySplashScreen: {fileID: 0} 44 | m_HolographicTrackingLossScreen: {fileID: 0} 45 | defaultScreenWidth: 1024 46 | defaultScreenHeight: 768 47 | defaultScreenWidthWeb: 960 48 | defaultScreenHeightWeb: 600 49 | m_StereoRenderingPath: 0 50 | m_ActiveColorSpace: 0 51 | m_MTRendering: 1 52 | m_StackTraceTypes: 010000000100000001000000010000000100000001000000 53 | iosShowActivityIndicatorOnLoading: -1 54 | androidShowActivityIndicatorOnLoading: -1 55 | iosAppInBackgroundBehavior: 0 56 | displayResolutionDialog: 1 57 | iosAllowHTTPDownload: 1 58 | allowedAutorotateToPortrait: 1 59 | allowedAutorotateToPortraitUpsideDown: 1 60 | allowedAutorotateToLandscapeRight: 1 61 | allowedAutorotateToLandscapeLeft: 1 62 | useOSAutorotation: 1 63 | use32BitDisplayBuffer: 1 64 | preserveFramebufferAlpha: 0 65 | disableDepthAndStencilBuffers: 0 66 | androidStartInFullscreen: 1 67 | androidRenderOutsideSafeArea: 1 68 | androidUseSwappy: 0 69 | androidBlitType: 0 70 | defaultIsNativeResolution: 1 71 | macRetinaSupport: 1 72 | runInBackground: 1 73 | captureSingleScreen: 0 74 | muteOtherAudioSources: 0 75 | Prepare IOS For Recording: 0 76 | Force IOS Speakers When Recording: 0 77 | deferSystemGesturesMode: 0 78 | hideHomeButton: 0 79 | submitAnalytics: 1 80 | usePlayerLog: 1 81 | bakeCollisionMeshes: 0 82 | forceSingleInstance: 0 83 | resizableWindow: 0 84 | useMacAppStoreValidation: 0 85 | macAppStoreCategory: public.app-category.games 86 | gpuSkinning: 0 87 | graphicsJobs: 0 88 | xboxPIXTextureCapture: 0 89 | xboxEnableAvatar: 0 90 | xboxEnableKinect: 0 91 | xboxEnableKinectAutoTracking: 0 92 | xboxEnableFitness: 0 93 | visibleInBackground: 1 94 | allowFullscreenSwitch: 1 95 | graphicsJobMode: 0 96 | fullscreenMode: 1 97 | xboxSpeechDB: 0 98 | xboxEnableHeadOrientation: 0 99 | xboxEnableGuest: 0 100 | xboxEnablePIXSampling: 0 101 | metalFramebufferOnly: 0 102 | xboxOneResolution: 0 103 | xboxOneSResolution: 0 104 | xboxOneXResolution: 3 105 | xboxOneMonoLoggingLevel: 0 106 | xboxOneLoggingLevel: 1 107 | xboxOneDisableEsram: 0 108 | xboxOnePresentImmediateThreshold: 0 109 | switchQueueCommandMemory: 0 110 | switchQueueControlMemory: 16384 111 | switchQueueComputeMemory: 262144 112 | switchNVNShaderPoolsGranularity: 33554432 113 | switchNVNDefaultPoolsGranularity: 16777216 114 | switchNVNOtherPoolsGranularity: 16777216 115 | vulkanEnableSetSRGBWrite: 0 116 | m_SupportedAspectRatios: 117 | 4:3: 1 118 | 5:4: 1 119 | 16:10: 1 120 | 16:9: 1 121 | Others: 1 122 | bundleVersion: 0.1 123 | preloadedAssets: [] 124 | metroInputSource: 0 125 | wsaTransparentSwapchain: 0 126 | m_HolographicPauseOnTrackingLoss: 1 127 | xboxOneDisableKinectGpuReservation: 1 128 | xboxOneEnable7thCore: 1 129 | vrSettings: 130 | cardboard: 131 | depthFormat: 0 132 | enableTransitionView: 0 133 | daydream: 134 | depthFormat: 0 135 | useSustainedPerformanceMode: 0 136 | enableVideoLayer: 0 137 | useProtectedVideoMemory: 0 138 | minimumSupportedHeadTracking: 0 139 | maximumSupportedHeadTracking: 1 140 | hololens: 141 | depthFormat: 1 142 | depthBufferSharingEnabled: 1 143 | lumin: 144 | depthFormat: 0 145 | frameTiming: 2 146 | enableGLCache: 0 147 | glCacheMaxBlobSize: 524288 148 | glCacheMaxFileSize: 8388608 149 | oculus: 150 | sharedDepthBuffer: 1 151 | dashSupport: 1 152 | lowOverheadMode: 0 153 | enable360StereoCapture: 0 154 | isWsaHolographicRemotingEnabled: 0 155 | protectGraphicsMemory: 0 156 | enableFrameTimingStats: 0 157 | useHDRDisplay: 0 158 | m_ColorGamuts: 00000000 159 | targetPixelDensity: 30 160 | resolutionScalingMode: 0 161 | androidSupportedAspectRatio: 1 162 | androidMaxAspectRatio: 2.1 163 | applicationIdentifier: 164 | Standalone: com.Company.ProductName 165 | buildNumber: {} 166 | AndroidBundleVersionCode: 1 167 | AndroidMinSdkVersion: 16 168 | AndroidTargetSdkVersion: 0 169 | AndroidPreferredInstallLocation: 1 170 | aotOptions: 171 | stripEngineCode: 1 172 | iPhoneStrippingLevel: 0 173 | iPhoneScriptCallOptimization: 0 174 | ForceInternetPermission: 0 175 | ForceSDCardPermission: 0 176 | CreateWallpaper: 0 177 | APKExpansionFiles: 0 178 | keepLoadedShadersAlive: 0 179 | StripUnusedMeshComponents: 1 180 | VertexChannelCompressionMask: 4054 181 | iPhoneSdkVersion: 988 182 | iOSTargetOSVersionString: 9.0 183 | tvOSSdkVersion: 0 184 | tvOSRequireExtendedGameController: 0 185 | tvOSTargetOSVersionString: 9.0 186 | uIPrerenderedIcon: 0 187 | uIRequiresPersistentWiFi: 0 188 | uIRequiresFullScreen: 1 189 | uIStatusBarHidden: 1 190 | uIExitOnSuspend: 0 191 | uIStatusBarStyle: 0 192 | iPhoneSplashScreen: {fileID: 0} 193 | iPhoneHighResSplashScreen: {fileID: 0} 194 | iPhoneTallHighResSplashScreen: {fileID: 0} 195 | iPhone47inSplashScreen: {fileID: 0} 196 | iPhone55inPortraitSplashScreen: {fileID: 0} 197 | iPhone55inLandscapeSplashScreen: {fileID: 0} 198 | iPhone58inPortraitSplashScreen: {fileID: 0} 199 | iPhone58inLandscapeSplashScreen: {fileID: 0} 200 | iPadPortraitSplashScreen: {fileID: 0} 201 | iPadHighResPortraitSplashScreen: {fileID: 0} 202 | iPadLandscapeSplashScreen: {fileID: 0} 203 | iPadHighResLandscapeSplashScreen: {fileID: 0} 204 | iPhone65inPortraitSplashScreen: {fileID: 0} 205 | iPhone65inLandscapeSplashScreen: {fileID: 0} 206 | iPhone61inPortraitSplashScreen: {fileID: 0} 207 | iPhone61inLandscapeSplashScreen: {fileID: 0} 208 | appleTVSplashScreen: {fileID: 0} 209 | appleTVSplashScreen2x: {fileID: 0} 210 | tvOSSmallIconLayers: [] 211 | tvOSSmallIconLayers2x: [] 212 | tvOSLargeIconLayers: [] 213 | tvOSLargeIconLayers2x: [] 214 | tvOSTopShelfImageLayers: [] 215 | tvOSTopShelfImageLayers2x: [] 216 | tvOSTopShelfImageWideLayers: [] 217 | tvOSTopShelfImageWideLayers2x: [] 218 | iOSLaunchScreenType: 0 219 | iOSLaunchScreenPortrait: {fileID: 0} 220 | iOSLaunchScreenLandscape: {fileID: 0} 221 | iOSLaunchScreenBackgroundColor: 222 | serializedVersion: 2 223 | rgba: 0 224 | iOSLaunchScreenFillPct: 100 225 | iOSLaunchScreenSize: 100 226 | iOSLaunchScreenCustomXibPath: 227 | iOSLaunchScreeniPadType: 0 228 | iOSLaunchScreeniPadImage: {fileID: 0} 229 | iOSLaunchScreeniPadBackgroundColor: 230 | serializedVersion: 2 231 | rgba: 0 232 | iOSLaunchScreeniPadFillPct: 100 233 | iOSLaunchScreeniPadSize: 100 234 | iOSLaunchScreeniPadCustomXibPath: 235 | iOSUseLaunchScreenStoryboard: 0 236 | iOSLaunchScreenCustomStoryboardPath: 237 | iOSDeviceRequirements: [] 238 | iOSURLSchemes: [] 239 | iOSBackgroundModes: 0 240 | iOSMetalForceHardShadows: 0 241 | metalEditorSupport: 1 242 | metalAPIValidation: 1 243 | iOSRenderExtraFrameOnPause: 0 244 | appleDeveloperTeamID: 245 | iOSManualSigningProvisioningProfileID: 246 | tvOSManualSigningProvisioningProfileID: 247 | iOSManualSigningProvisioningProfileType: 0 248 | tvOSManualSigningProvisioningProfileType: 0 249 | appleEnableAutomaticSigning: 0 250 | iOSRequireARKit: 0 251 | iOSAutomaticallyDetectAndAddCapabilities: 1 252 | appleEnableProMotion: 0 253 | clonedFromGUID: 5f34be1353de5cf4398729fda238591b 254 | templatePackageId: com.unity.template.2d@3.1.0 255 | templateDefaultScene: Assets/Scenes/SampleScene.unity 256 | AndroidTargetArchitectures: 1 257 | AndroidSplashScreenScale: 0 258 | androidSplashScreen: {fileID: 0} 259 | AndroidKeystoreName: '{inproject}: ' 260 | AndroidKeyaliasName: 261 | AndroidBuildApkPerCpuArchitecture: 0 262 | AndroidTVCompatibility: 0 263 | AndroidIsGame: 1 264 | AndroidEnableTango: 0 265 | androidEnableBanner: 1 266 | androidUseLowAccuracyLocation: 0 267 | androidUseCustomKeystore: 0 268 | m_AndroidBanners: 269 | - width: 320 270 | height: 180 271 | banner: {fileID: 0} 272 | androidGamepadSupportLevel: 0 273 | AndroidValidateAppBundleSize: 1 274 | AndroidAppBundleSizeToValidate: 100 275 | resolutionDialogBanner: {fileID: 0} 276 | m_BuildTargetIcons: [] 277 | m_BuildTargetPlatformIcons: [] 278 | m_BuildTargetBatching: [] 279 | m_BuildTargetGraphicsAPIs: 280 | - m_BuildTarget: AndroidPlayer 281 | m_APIs: 150000000b000000 282 | m_Automatic: 0 283 | m_BuildTargetVRSettings: [] 284 | m_BuildTargetEnableVuforiaSettings: [] 285 | openGLRequireES31: 0 286 | openGLRequireES31AEP: 0 287 | openGLRequireES32: 0 288 | m_TemplateCustomTags: {} 289 | mobileMTRendering: 290 | Android: 1 291 | iPhone: 1 292 | tvOS: 1 293 | m_BuildTargetGroupLightmapEncodingQuality: [] 294 | m_BuildTargetGroupLightmapSettings: [] 295 | playModeTestRunnerEnabled: 0 296 | runPlayModeTestAsEditModeTest: 0 297 | actionOnDotNetUnhandledException: 1 298 | enableInternalProfiler: 0 299 | logObjCUncaughtExceptions: 1 300 | enableCrashReportAPI: 0 301 | cameraUsageDescription: 302 | locationUsageDescription: 303 | microphoneUsageDescription: 304 | switchNetLibKey: 305 | switchSocketMemoryPoolSize: 6144 306 | switchSocketAllocatorPoolSize: 128 307 | switchSocketConcurrencyLimit: 14 308 | switchScreenResolutionBehavior: 2 309 | switchUseCPUProfiler: 0 310 | switchApplicationID: 0x01004b9000490000 311 | switchNSODependencies: 312 | switchTitleNames_0: 313 | switchTitleNames_1: 314 | switchTitleNames_2: 315 | switchTitleNames_3: 316 | switchTitleNames_4: 317 | switchTitleNames_5: 318 | switchTitleNames_6: 319 | switchTitleNames_7: 320 | switchTitleNames_8: 321 | switchTitleNames_9: 322 | switchTitleNames_10: 323 | switchTitleNames_11: 324 | switchTitleNames_12: 325 | switchTitleNames_13: 326 | switchTitleNames_14: 327 | switchPublisherNames_0: 328 | switchPublisherNames_1: 329 | switchPublisherNames_2: 330 | switchPublisherNames_3: 331 | switchPublisherNames_4: 332 | switchPublisherNames_5: 333 | switchPublisherNames_6: 334 | switchPublisherNames_7: 335 | switchPublisherNames_8: 336 | switchPublisherNames_9: 337 | switchPublisherNames_10: 338 | switchPublisherNames_11: 339 | switchPublisherNames_12: 340 | switchPublisherNames_13: 341 | switchPublisherNames_14: 342 | switchIcons_0: {fileID: 0} 343 | switchIcons_1: {fileID: 0} 344 | switchIcons_2: {fileID: 0} 345 | switchIcons_3: {fileID: 0} 346 | switchIcons_4: {fileID: 0} 347 | switchIcons_5: {fileID: 0} 348 | switchIcons_6: {fileID: 0} 349 | switchIcons_7: {fileID: 0} 350 | switchIcons_8: {fileID: 0} 351 | switchIcons_9: {fileID: 0} 352 | switchIcons_10: {fileID: 0} 353 | switchIcons_11: {fileID: 0} 354 | switchIcons_12: {fileID: 0} 355 | switchIcons_13: {fileID: 0} 356 | switchIcons_14: {fileID: 0} 357 | switchSmallIcons_0: {fileID: 0} 358 | switchSmallIcons_1: {fileID: 0} 359 | switchSmallIcons_2: {fileID: 0} 360 | switchSmallIcons_3: {fileID: 0} 361 | switchSmallIcons_4: {fileID: 0} 362 | switchSmallIcons_5: {fileID: 0} 363 | switchSmallIcons_6: {fileID: 0} 364 | switchSmallIcons_7: {fileID: 0} 365 | switchSmallIcons_8: {fileID: 0} 366 | switchSmallIcons_9: {fileID: 0} 367 | switchSmallIcons_10: {fileID: 0} 368 | switchSmallIcons_11: {fileID: 0} 369 | switchSmallIcons_12: {fileID: 0} 370 | switchSmallIcons_13: {fileID: 0} 371 | switchSmallIcons_14: {fileID: 0} 372 | switchManualHTML: 373 | switchAccessibleURLs: 374 | switchLegalInformation: 375 | switchMainThreadStackSize: 1048576 376 | switchPresenceGroupId: 377 | switchLogoHandling: 0 378 | switchReleaseVersion: 0 379 | switchDisplayVersion: 1.0.0 380 | switchStartupUserAccount: 0 381 | switchTouchScreenUsage: 0 382 | switchSupportedLanguagesMask: 0 383 | switchLogoType: 0 384 | switchApplicationErrorCodeCategory: 385 | switchUserAccountSaveDataSize: 0 386 | switchUserAccountSaveDataJournalSize: 0 387 | switchApplicationAttribute: 0 388 | switchCardSpecSize: -1 389 | switchCardSpecClock: -1 390 | switchRatingsMask: 0 391 | switchRatingsInt_0: 0 392 | switchRatingsInt_1: 0 393 | switchRatingsInt_2: 0 394 | switchRatingsInt_3: 0 395 | switchRatingsInt_4: 0 396 | switchRatingsInt_5: 0 397 | switchRatingsInt_6: 0 398 | switchRatingsInt_7: 0 399 | switchRatingsInt_8: 0 400 | switchRatingsInt_9: 0 401 | switchRatingsInt_10: 0 402 | switchRatingsInt_11: 0 403 | switchLocalCommunicationIds_0: 404 | switchLocalCommunicationIds_1: 405 | switchLocalCommunicationIds_2: 406 | switchLocalCommunicationIds_3: 407 | switchLocalCommunicationIds_4: 408 | switchLocalCommunicationIds_5: 409 | switchLocalCommunicationIds_6: 410 | switchLocalCommunicationIds_7: 411 | switchParentalControl: 0 412 | switchAllowsScreenshot: 1 413 | switchAllowsVideoCapturing: 1 414 | switchAllowsRuntimeAddOnContentInstall: 0 415 | switchDataLossConfirmation: 0 416 | switchUserAccountLockEnabled: 0 417 | switchSystemResourceMemory: 16777216 418 | switchSupportedNpadStyles: 3 419 | switchNativeFsCacheSize: 32 420 | switchIsHoldTypeHorizontal: 0 421 | switchSupportedNpadCount: 8 422 | switchSocketConfigEnabled: 0 423 | switchTcpInitialSendBufferSize: 32 424 | switchTcpInitialReceiveBufferSize: 64 425 | switchTcpAutoSendBufferSizeMax: 256 426 | switchTcpAutoReceiveBufferSizeMax: 256 427 | switchUdpSendBufferSize: 9 428 | switchUdpReceiveBufferSize: 42 429 | switchSocketBufferEfficiency: 4 430 | switchSocketInitializeEnabled: 1 431 | switchNetworkInterfaceManagerInitializeEnabled: 1 432 | switchPlayerConnectionEnabled: 1 433 | ps4NPAgeRating: 12 434 | ps4NPTitleSecret: 435 | ps4NPTrophyPackPath: 436 | ps4ParentalLevel: 11 437 | ps4ContentID: ED1633-NPXX51362_00-0000000000000000 438 | ps4Category: 0 439 | ps4MasterVersion: 01.00 440 | ps4AppVersion: 01.00 441 | ps4AppType: 0 442 | ps4ParamSfxPath: 443 | ps4VideoOutPixelFormat: 0 444 | ps4VideoOutInitialWidth: 1920 445 | ps4VideoOutBaseModeInitialWidth: 1920 446 | ps4VideoOutReprojectionRate: 60 447 | ps4PronunciationXMLPath: 448 | ps4PronunciationSIGPath: 449 | ps4BackgroundImagePath: 450 | ps4StartupImagePath: 451 | ps4StartupImagesFolder: 452 | ps4IconImagesFolder: 453 | ps4SaveDataImagePath: 454 | ps4SdkOverride: 455 | ps4BGMPath: 456 | ps4ShareFilePath: 457 | ps4ShareOverlayImagePath: 458 | ps4PrivacyGuardImagePath: 459 | ps4NPtitleDatPath: 460 | ps4RemotePlayKeyAssignment: -1 461 | ps4RemotePlayKeyMappingDir: 462 | ps4PlayTogetherPlayerCount: 0 463 | ps4EnterButtonAssignment: 1 464 | ps4ApplicationParam1: 0 465 | ps4ApplicationParam2: 0 466 | ps4ApplicationParam3: 0 467 | ps4ApplicationParam4: 0 468 | ps4DownloadDataSize: 0 469 | ps4GarlicHeapSize: 2048 470 | ps4ProGarlicHeapSize: 2560 471 | playerPrefsMaxSize: 32768 472 | ps4Passcode: frAQBc8Wsa1xVPfvJcrgRYwTiizs2trQ 473 | ps4pnSessions: 1 474 | ps4pnPresence: 1 475 | ps4pnFriends: 1 476 | ps4pnGameCustomData: 1 477 | playerPrefsSupport: 0 478 | enableApplicationExit: 0 479 | resetTempFolder: 1 480 | restrictedAudioUsageRights: 0 481 | ps4UseResolutionFallback: 0 482 | ps4ReprojectionSupport: 0 483 | ps4UseAudio3dBackend: 0 484 | ps4SocialScreenEnabled: 0 485 | ps4ScriptOptimizationLevel: 0 486 | ps4Audio3dVirtualSpeakerCount: 14 487 | ps4attribCpuUsage: 0 488 | ps4PatchPkgPath: 489 | ps4PatchLatestPkgPath: 490 | ps4PatchChangeinfoPath: 491 | ps4PatchDayOne: 0 492 | ps4attribUserManagement: 0 493 | ps4attribMoveSupport: 0 494 | ps4attrib3DSupport: 0 495 | ps4attribShareSupport: 0 496 | ps4attribExclusiveVR: 0 497 | ps4disableAutoHideSplash: 0 498 | ps4videoRecordingFeaturesUsed: 0 499 | ps4contentSearchFeaturesUsed: 0 500 | ps4attribEyeToEyeDistanceSettingVR: 0 501 | ps4IncludedModules: [] 502 | monoEnv: 503 | splashScreenBackgroundSourceLandscape: {fileID: 0} 504 | splashScreenBackgroundSourcePortrait: {fileID: 0} 505 | blurSplashScreenBackground: 1 506 | spritePackerPolicy: 507 | webGLMemorySize: 16 508 | webGLExceptionSupport: 1 509 | webGLNameFilesAsHashes: 0 510 | webGLDataCaching: 1 511 | webGLDebugSymbols: 0 512 | webGLEmscriptenArgs: 513 | webGLModulesDirectory: 514 | webGLTemplate: APPLICATION:Default 515 | webGLAnalyzeBuildSize: 0 516 | webGLUseEmbeddedResources: 0 517 | webGLCompressionFormat: 1 518 | webGLLinkerTarget: 1 519 | webGLThreadsSupport: 0 520 | webGLWasmStreaming: 0 521 | scriptingDefineSymbols: {} 522 | platformArchitecture: {} 523 | scriptingBackend: {} 524 | il2cppCompilerConfiguration: {} 525 | managedStrippingLevel: {} 526 | incrementalIl2cppBuild: {} 527 | allowUnsafeCode: 0 528 | additionalIl2CppArgs: 529 | scriptingRuntimeVersion: 1 530 | gcIncremental: 0 531 | gcWBarrierValidation: 0 532 | apiCompatibilityLevelPerPlatform: {} 533 | m_RenderingPath: 1 534 | m_MobileRenderingPath: 1 535 | metroPackageName: Template_2D 536 | metroPackageVersion: 537 | metroCertificatePath: 538 | metroCertificatePassword: 539 | metroCertificateSubject: 540 | metroCertificateIssuer: 541 | metroCertificateNotAfter: 0000000000000000 542 | metroApplicationDescription: Template_2D 543 | wsaImages: {} 544 | metroTileShortName: 545 | metroTileShowName: 0 546 | metroMediumTileShowName: 0 547 | metroLargeTileShowName: 0 548 | metroWideTileShowName: 0 549 | metroSupportStreamingInstall: 0 550 | metroLastRequiredScene: 0 551 | metroDefaultTileSize: 1 552 | metroTileForegroundText: 2 553 | metroTileBackgroundColor: {r: 0.13333334, g: 0.17254902, b: 0.21568628, a: 0} 554 | metroSplashScreenBackgroundColor: {r: 0.12941177, g: 0.17254902, b: 0.21568628, 555 | a: 1} 556 | metroSplashScreenUseBackgroundColor: 0 557 | platformCapabilities: {} 558 | metroTargetDeviceFamilies: {} 559 | metroFTAName: 560 | metroFTAFileTypes: [] 561 | metroProtocolName: 562 | XboxOneProductId: 563 | XboxOneUpdateKey: 564 | XboxOneSandboxId: 565 | XboxOneContentId: 566 | XboxOneTitleId: 567 | XboxOneSCId: 568 | XboxOneGameOsOverridePath: 569 | XboxOnePackagingOverridePath: 570 | XboxOneAppManifestOverridePath: 571 | XboxOneVersion: 1.0.0.0 572 | XboxOnePackageEncryption: 0 573 | XboxOnePackageUpdateGranularity: 2 574 | XboxOneDescription: 575 | XboxOneLanguage: 576 | - enus 577 | XboxOneCapability: [] 578 | XboxOneGameRating: {} 579 | XboxOneIsContentPackage: 0 580 | XboxOneEnableGPUVariability: 1 581 | XboxOneSockets: {} 582 | XboxOneSplashScreen: {fileID: 0} 583 | XboxOneAllowedProductIds: [] 584 | XboxOnePersistentLocalStorageSize: 0 585 | XboxOneXTitleMemory: 8 586 | XboxOneOverrideIdentityName: 587 | vrEditorSettings: 588 | daydream: 589 | daydreamIconForeground: {fileID: 0} 590 | daydreamIconBackground: {fileID: 0} 591 | cloudServicesEnabled: 592 | UNet: 1 593 | luminIcon: 594 | m_Name: 595 | m_ModelFolderPath: 596 | m_PortalFolderPath: 597 | luminCert: 598 | m_CertPath: 599 | m_SignPackage: 1 600 | luminIsChannelApp: 0 601 | luminVersion: 602 | m_VersionCode: 1 603 | m_VersionName: 604 | facebookSdkVersion: 7.9.4 605 | facebookAppId: 606 | facebookCookies: 1 607 | facebookLogging: 1 608 | facebookStatus: 1 609 | facebookXfbml: 0 610 | facebookFrictionlessRequests: 1 611 | apiCompatibilityLevel: 6 612 | cloudProjectId: 613 | framebufferDepthMemorylessMode: 0 614 | projectName: 615 | organizationId: 616 | cloudEnabled: 0 617 | enableNativePlatformBackendsForNewInputSystem: 0 618 | disableOldInputManagerSupport: 0 619 | legacyClampBlendShapeWeights: 1 620 | -------------------------------------------------------------------------------- /src/Ulid.Unity/ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 2021.3.41f1 2 | m_EditorVersionWithRevision: 2021.3.41f1 (6c5a9e20c022) 3 | -------------------------------------------------------------------------------- /src/Ulid.Unity/ProjectSettings/QualitySettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!47 &1 4 | QualitySettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 5 7 | m_CurrentQuality: 3 8 | m_QualitySettings: 9 | - serializedVersion: 2 10 | name: Very Low 11 | pixelLightCount: 0 12 | shadows: 0 13 | shadowResolution: 0 14 | shadowProjection: 1 15 | shadowCascades: 1 16 | shadowDistance: 15 17 | shadowNearPlaneOffset: 3 18 | shadowCascade2Split: 0.33333334 19 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 20 | shadowmaskMode: 0 21 | blendWeights: 1 22 | textureQuality: 1 23 | anisotropicTextures: 0 24 | antiAliasing: 0 25 | softParticles: 0 26 | softVegetation: 0 27 | realtimeReflectionProbes: 0 28 | billboardsFaceCameraPosition: 0 29 | vSyncCount: 0 30 | lodBias: 0.3 31 | maximumLODLevel: 0 32 | particleRaycastBudget: 4 33 | asyncUploadTimeSlice: 2 34 | asyncUploadBufferSize: 16 35 | resolutionScalingFixedDPIFactor: 1 36 | excludedTargetPlatforms: [] 37 | - serializedVersion: 2 38 | name: Low 39 | pixelLightCount: 0 40 | shadows: 0 41 | shadowResolution: 0 42 | shadowProjection: 1 43 | shadowCascades: 1 44 | shadowDistance: 20 45 | shadowNearPlaneOffset: 3 46 | shadowCascade2Split: 0.33333334 47 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 48 | shadowmaskMode: 0 49 | blendWeights: 2 50 | textureQuality: 0 51 | anisotropicTextures: 0 52 | antiAliasing: 0 53 | softParticles: 0 54 | softVegetation: 0 55 | realtimeReflectionProbes: 0 56 | billboardsFaceCameraPosition: 0 57 | vSyncCount: 0 58 | lodBias: 0.4 59 | maximumLODLevel: 0 60 | particleRaycastBudget: 16 61 | asyncUploadTimeSlice: 2 62 | asyncUploadBufferSize: 16 63 | resolutionScalingFixedDPIFactor: 1 64 | excludedTargetPlatforms: [] 65 | - serializedVersion: 2 66 | name: Medium 67 | pixelLightCount: 1 68 | shadows: 0 69 | shadowResolution: 0 70 | shadowProjection: 1 71 | shadowCascades: 1 72 | shadowDistance: 20 73 | shadowNearPlaneOffset: 3 74 | shadowCascade2Split: 0.33333334 75 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 76 | shadowmaskMode: 0 77 | blendWeights: 2 78 | textureQuality: 0 79 | anisotropicTextures: 0 80 | antiAliasing: 0 81 | softParticles: 0 82 | softVegetation: 0 83 | realtimeReflectionProbes: 0 84 | billboardsFaceCameraPosition: 0 85 | vSyncCount: 1 86 | lodBias: 0.7 87 | maximumLODLevel: 0 88 | particleRaycastBudget: 64 89 | asyncUploadTimeSlice: 2 90 | asyncUploadBufferSize: 16 91 | resolutionScalingFixedDPIFactor: 1 92 | excludedTargetPlatforms: [] 93 | - serializedVersion: 2 94 | name: High 95 | pixelLightCount: 2 96 | shadows: 0 97 | shadowResolution: 1 98 | shadowProjection: 1 99 | shadowCascades: 2 100 | shadowDistance: 40 101 | shadowNearPlaneOffset: 3 102 | shadowCascade2Split: 0.33333334 103 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 104 | shadowmaskMode: 1 105 | blendWeights: 2 106 | textureQuality: 0 107 | anisotropicTextures: 0 108 | antiAliasing: 0 109 | softParticles: 0 110 | softVegetation: 1 111 | realtimeReflectionProbes: 0 112 | billboardsFaceCameraPosition: 0 113 | vSyncCount: 1 114 | lodBias: 1 115 | maximumLODLevel: 0 116 | particleRaycastBudget: 256 117 | asyncUploadTimeSlice: 2 118 | asyncUploadBufferSize: 16 119 | resolutionScalingFixedDPIFactor: 1 120 | excludedTargetPlatforms: [] 121 | - serializedVersion: 2 122 | name: Very High 123 | pixelLightCount: 3 124 | shadows: 0 125 | shadowResolution: 2 126 | shadowProjection: 1 127 | shadowCascades: 2 128 | shadowDistance: 70 129 | shadowNearPlaneOffset: 3 130 | shadowCascade2Split: 0.33333334 131 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 132 | shadowmaskMode: 1 133 | blendWeights: 4 134 | textureQuality: 0 135 | anisotropicTextures: 0 136 | antiAliasing: 0 137 | softParticles: 0 138 | softVegetation: 1 139 | realtimeReflectionProbes: 0 140 | billboardsFaceCameraPosition: 0 141 | vSyncCount: 1 142 | lodBias: 1.5 143 | maximumLODLevel: 0 144 | particleRaycastBudget: 1024 145 | asyncUploadTimeSlice: 2 146 | asyncUploadBufferSize: 16 147 | resolutionScalingFixedDPIFactor: 1 148 | excludedTargetPlatforms: [] 149 | - serializedVersion: 2 150 | name: Ultra 151 | pixelLightCount: 4 152 | shadows: 0 153 | shadowResolution: 0 154 | shadowProjection: 1 155 | shadowCascades: 4 156 | shadowDistance: 150 157 | shadowNearPlaneOffset: 3 158 | shadowCascade2Split: 0.33333334 159 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 160 | shadowmaskMode: 1 161 | blendWeights: 4 162 | textureQuality: 0 163 | anisotropicTextures: 0 164 | antiAliasing: 0 165 | softParticles: 0 166 | softVegetation: 1 167 | realtimeReflectionProbes: 0 168 | billboardsFaceCameraPosition: 0 169 | vSyncCount: 1 170 | lodBias: 2 171 | maximumLODLevel: 0 172 | particleRaycastBudget: 4096 173 | asyncUploadTimeSlice: 2 174 | asyncUploadBufferSize: 16 175 | resolutionScalingFixedDPIFactor: 1 176 | excludedTargetPlatforms: [] 177 | m_PerPlatformDefaultQuality: 178 | Android: 2 179 | Nintendo 3DS: 5 180 | Nintendo Switch: 5 181 | PS4: 5 182 | PSM: 5 183 | PSP2: 2 184 | Standalone: 5 185 | Tizen: 2 186 | WebGL: 3 187 | WiiU: 5 188 | Windows Store Apps: 5 189 | XboxOne: 5 190 | iPhone: 2 191 | tvOS: 2 192 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/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/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/boot.config: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cysharp/Ulid/1fe01ee2c9ab286813f6b25c3095894f0097fc72/src/Ulid.Unity/ProjectSettings/boot.config -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /src/Ulid.Unity/UserSettings/Search.settings: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /src/Ulid/Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cysharp/Ulid/1fe01ee2c9ab286813f6b25c3095894f0097fc72/src/Ulid/Icon.png -------------------------------------------------------------------------------- /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/Ulid.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netstandard2.0;netstandard2.1;net6.0;net7.0;net8.0 5 | true 6 | System 7 | true 8 | release.snk 9 | true 10 | Latest 11 | 12 | 13 | Ulid 14 | Fast .NET Standard(C#) Implementation of ULID. 15 | true 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | $(MSBuildProjectDirectory)\..\Ulid.Unity\Assets\Scripts\Ulid\ 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /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) 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 | } 58 | 59 | #endif -------------------------------------------------------------------------------- /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/release.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cysharp/Ulid/1fe01ee2c9ab286813f6b25c3095894f0097fc72/src/Ulid/release.snk -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /tests/Ulid.Cli.Tests/Ulid.Cli.Tests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net7.0 5 | 6 | false 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /tests/Ulid.Cli.Tests/UlidCliTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Threading.Tasks; 4 | using Xunit; 5 | using CliUtil = Ulid.Cli.Util; 6 | using FluentAssertions; 7 | 8 | namespace Ulid.Cli.Tests 9 | { 10 | public class UlidCliTest 11 | { 12 | [Fact] 13 | public async Task Default() 14 | { 15 | var first = CliUtil.CreateUlid(DateTimeOffset.Now, null); 16 | await Task.Delay(1).ConfigureAwait(false); 17 | // empty string is treated same as null 18 | var second = CliUtil.CreateUlid(DateTimeOffset.Now, ""); 19 | first.Time.Should().NotBe(second.Time); 20 | first.Random.Should().NotBeEquivalentTo(second.Random); 21 | } 22 | [Fact] 23 | public void SameTime() 24 | { 25 | var d = new DateTimeOffset(new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)); 26 | var first = CliUtil.CreateUlid(d, null); 27 | var second = CliUtil.CreateUlid(d, null); 28 | first.Time.Should().Be(d); 29 | second.Time.Should().Be(d); 30 | first.Random.Should().NotBeEquivalentTo(second.Random); 31 | } 32 | [Theory] 33 | [InlineData('1')] 34 | [InlineData('A')] 35 | public void SameRandomness(char c) 36 | { 37 | var r1 = new string(c, 16).ToLower(); 38 | var r2 = new string(c, 16).ToUpper(); 39 | var d = DateTimeOffset.Parse("1970-1-1T00:00:00Z"); 40 | 41 | var first = CliUtil.CreateUlid(DateTimeOffset.Now, r1); 42 | var second = CliUtil.CreateUlid(DateTimeOffset.Now, r2); 43 | first.Random.Should().BeEquivalentTo(second.Random); 44 | } 45 | [Fact] 46 | public void InvalidRandomness() 47 | { 48 | var d = DateTimeOffset.Now; 49 | // short length 50 | Assert.Throws(() => CliUtil.CreateUlid(d, "A")); 51 | // invalid character 52 | Assert.Throws(() => CliUtil.CreateUlid(d, new string('+', 16))); 53 | } 54 | [Fact] 55 | public void Base32() 56 | { 57 | var pairs = new KeyValuePair[] 58 | { 59 | new KeyValuePair("00000000", new byte[]{ 0, 0, 0, 0, 0 }), 60 | new KeyValuePair("ZZZZZZZZ", new byte[]{ 0xff, 0xff, 0xff, 0xff, 0xff }), 61 | new KeyValuePair(new string('1', 8), new byte[]{ 0x08, 0x42, 0x10, 0x84, 0x21 }) 62 | }; 63 | foreach (var pair in pairs) 64 | { 65 | var buf = new byte[5]; 66 | CliUtil.ConvertBase32ToBytes(pair.Key, buf, 0); 67 | buf.Should().BeEquivalentTo(pair.Value); 68 | } 69 | } 70 | [Fact] 71 | public void Base32SameAsUlidGenerated() 72 | { 73 | var ulid = System.Ulid.Parse("0123456789ABCDEFGHJKMNPQRS"); 74 | var b32 = ulid.ToString(); 75 | var b = ulid.ToByteArray(); 76 | var actual = new byte[b.Length]; 77 | CliUtil.ConvertBase32ToBytes(b32, actual, 2); 78 | actual.Should().BeEquivalentTo(b); 79 | } 80 | 81 | [Fact] 82 | public void Min() 83 | { 84 | using (TextWriterBridge.BeginSetConsoleOut(out var log)) 85 | { 86 | new UlidBatch().New(timestamp: "2001/12/31", minRandomness: true); 87 | System.Ulid.Parse(log[0]).Random.Should().BeEquivalentTo(new byte[] 88 | { 89 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 90 | }); 91 | } 92 | } 93 | 94 | [Fact] 95 | public void Max() 96 | { 97 | using (TextWriterBridge.BeginSetConsoleOut(out var log)) 98 | { 99 | new UlidBatch().New(timestamp: "2001/12/31", maxRandomness: true); 100 | System.Ulid.Parse(log[0]).Random.Should().BeEquivalentTo(new byte[] 101 | { 102 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 103 | }); 104 | } 105 | } 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /tests/Ulid.MessagePack.Tests/Ulid.MessagePack.Tests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net7.0 5 | 6 | false 7 | 8 | UlidTests 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /tests/Ulid.SystemTextJson.Tests/Ulid.SystemTextJson.Tests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net7.0 5 | 6 | false 7 | 8 | UlidTests 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /tests/Ulid.Tests/Ulid.Tests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net7.0 5 | 6 | false 7 | 8 | UlidTests 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /tests/Ulid.Tests/UlidTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using FluentAssertions; 4 | using Xunit; 5 | 6 | namespace UlidTests 7 | { 8 | public class UlidTest 9 | { 10 | [Fact] 11 | public void New_ByteEquals_ToString_Equals() 12 | { 13 | for (int i = 0; i < 100; i++) 14 | { 15 | { 16 | var ulid = Ulid.NewUlid(); 17 | var nulid = new NUlid.Ulid(ulid.ToByteArray()); 18 | 19 | ulid.ToByteArray().Should().BeEquivalentTo(nulid.ToByteArray()); 20 | ulid.ToString().Should().Be(nulid.ToString()); 21 | ulid.Equals(ulid).Should().BeTrue(); 22 | ulid.Equals(Ulid.NewUlid()).Should().BeFalse(); 23 | } 24 | { 25 | var nulid = NUlid.Ulid.NewUlid(); 26 | var ulid = new Ulid(nulid.ToByteArray()); 27 | 28 | ulid.ToByteArray().Should().BeEquivalentTo(nulid.ToByteArray()); 29 | ulid.ToString().Should().Be(nulid.ToString()); 30 | ulid.Equals(ulid).Should().BeTrue(); 31 | ulid.Equals(Ulid.NewUlid()).Should().BeFalse(); 32 | } 33 | } 34 | } 35 | 36 | [Fact] 37 | public void Compare_Time() 38 | { 39 | var times = new DateTimeOffset[] 40 | { 41 | new DateTime(2012,12,4), 42 | new DateTime(2011,12,31), 43 | new DateTime(2012,1,5), 44 | new DateTime(2013,12,4), 45 | new DateTime(2016,12,4), 46 | }; 47 | 48 | times.Select(x => Ulid.NewUlid(x)).OrderBy(x => x).Select(x => x.Time).Should().BeEquivalentTo(times.OrderBy(x => x)); 49 | } 50 | 51 | [Fact] 52 | public void HashCode() 53 | { 54 | var ulid = Ulid.Parse("01ARZ3NDEKTSV4RRFFQ69G5FAV"); 55 | 56 | Assert.Equal(-1363483029, ulid.GetHashCode()); 57 | } 58 | 59 | [Fact] 60 | public void Parse() 61 | { 62 | for (int i = 0; i < 100; i++) 63 | { 64 | var nulid = NUlid.Ulid.NewUlid(); 65 | Ulid.Parse(nulid.ToString()).ToByteArray().Should().BeEquivalentTo(nulid.ToByteArray()); 66 | } 67 | } 68 | 69 | [Fact] 70 | public void Randomness() 71 | { 72 | var d = DateTime.Parse("1970/1/1 00:00:00Z"); 73 | var r = new byte[10]; 74 | var first = Ulid.NewUlid(d, r); 75 | var second = Ulid.NewUlid(d, r); 76 | first.ToString().Should().BeEquivalentTo(second.ToString()); 77 | // Console.WriteLine($"first={first.ToString()}, second={second.ToString()}"); 78 | } 79 | 80 | [Fact] 81 | public void GuidInterop() 82 | { 83 | var ulid = Ulid.NewUlid(); 84 | var guid = ulid.ToGuid(); 85 | var ulid2 = new Ulid(guid); 86 | 87 | ulid2.Should().BeEquivalentTo(ulid, "a Ulid-Guid roundtrip should result in identical values"); 88 | } 89 | 90 | [Fact] 91 | public void UlidCompareTo() 92 | { 93 | var largeUlid = Ulid.MaxValue; 94 | var smallUlid = Ulid.MinValue; 95 | 96 | largeUlid.CompareTo(smallUlid).Should().Be(1); 97 | smallUlid.CompareTo(largeUlid).Should().Be(-1); 98 | smallUlid.CompareTo(smallUlid).Should().Be(0); 99 | 100 | object smallObject = (object)smallUlid; 101 | largeUlid.CompareTo(smallUlid).Should().Be(1); 102 | largeUlid.CompareTo(null).Should().Be(1); 103 | largeUlid.Invoking(u=> u.CompareTo("")).Should().Throw(); 104 | } 105 | 106 | [Fact] 107 | public void GuidComparison() 108 | { 109 | var data_smaller = new byte[] { 0, 255, 255, 255, 255, 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; 110 | var data_larger = new byte[] { 1, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; 111 | var ulid_smaller = new Ulid(data_smaller); 112 | var ulid_larger = new Ulid(data_larger); 113 | 114 | var guid_smaller = ulid_smaller.ToGuid(); 115 | var guid_larger = ulid_larger.ToGuid(); 116 | 117 | ulid_smaller.CompareTo(ulid_larger).Should().BeLessThan(0, "a Ulid comparison should compare byte to byte"); 118 | guid_smaller.CompareTo(guid_larger).Should().BeLessThan(0, "a Ulid to Guid cast should preserve order"); 119 | } 120 | 121 | [Fact] 122 | public void UlidParseRejectsInvalidStrings() 123 | { 124 | Assert.Throws(() => Ulid.Parse("1234")); 125 | Assert.Throws(() => Ulid.Parse(Guid.NewGuid().ToString())); 126 | } 127 | 128 | [Fact] 129 | public void UlidTryParseFailsForInvalidStrings() 130 | { 131 | Assert.False(Ulid.TryParse("1234", out _)); 132 | Assert.False(Ulid.TryParse(Guid.NewGuid().ToString(), out _)); 133 | } 134 | 135 | #if NET6_0_OR_GREATER 136 | [Fact] 137 | public void UlidTryFormatReturnsStringAndLength() 138 | { 139 | var asString = "01ARZ3NDEKTSV4RRFFQ69G5FAV"; 140 | var ulid = Ulid.Parse(asString); 141 | var destination = new char[26]; 142 | var largeDestination = new char[27]; 143 | 144 | ulid.TryFormat(destination, out int length, default, null).Should().BeTrue(); 145 | destination.Should().BeEquivalentTo(asString); 146 | length.Should().Be(26); 147 | 148 | ulid.TryFormat(largeDestination, out int largeLength, default, null).Should().BeTrue(); 149 | largeDestination.AsSpan().Slice(0,26).ToArray().Should().BeEquivalentTo(asString); 150 | largeLength.Should().Be(26); 151 | } 152 | 153 | [Fact] 154 | public void UlidTryFormatReturnsFalseWhenInvalidDestination() 155 | { 156 | var asString = "01ARZ3NDEKTSV4RRFFQ69G5FAV"; 157 | var ulid = Ulid.Parse(asString); 158 | var formatted = new char[25]; 159 | 160 | ulid.TryFormat(formatted, out int length, default, null).Should().BeFalse(); 161 | formatted.Should().BeEquivalentTo(new char[25]); 162 | length.Should().Be(0); 163 | } 164 | #endif 165 | #if NET7_0_OR_GREATER 166 | 167 | [Fact] 168 | public void IParsable() 169 | { 170 | for (int i = 0; i < 100; i++) 171 | { 172 | var nulid = NUlid.Ulid.NewUlid(); 173 | Ulid.Parse(nulid.ToString(),null).ToByteArray().Should().BeEquivalentTo(nulid.ToByteArray()); 174 | 175 | Ulid.TryParse(nulid.ToString(), null, out Ulid ulid).Should().BeTrue(); 176 | ulid.ToByteArray().Should().BeEquivalentTo(nulid.ToByteArray()); 177 | } 178 | } 179 | 180 | [Fact] 181 | public void ISpanParsable() 182 | { 183 | for (int i = 0; i < 100; i++) 184 | { 185 | var nulid = NUlid.Ulid.NewUlid(); 186 | Ulid.Parse(nulid.ToString().AsSpan(), null).ToByteArray().Should().BeEquivalentTo(nulid.ToByteArray()); 187 | 188 | Ulid.TryParse(nulid.ToString().AsSpan(), null, out Ulid ulid).Should().BeTrue(); 189 | ulid.ToByteArray().Should().BeEquivalentTo(nulid.ToByteArray()); 190 | } 191 | } 192 | #endif 193 | 194 | [Fact] 195 | public void TryFormatUtf8Bytes() 196 | { 197 | var value = Ulid.NewUlid(); 198 | var utf8Value = System.Text.Encoding.UTF8.GetBytes(value.ToString()); 199 | 200 | var result = new byte[26]; 201 | value.TryFormat(result, out var bytesWritten, Array.Empty(), null).Should().BeTrue(); 202 | bytesWritten.Should().Be(26); 203 | result.Should().Equal(utf8Value); 204 | } 205 | } 206 | } 207 | 208 | -------------------------------------------------------------------------------- /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 | } --------------------------------------------------------------------------------