diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..c192d27 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,21 @@ +# .github/dependabot.yml +version: 2 +updates: + # Keep GitHub Actions up to date + - package-ecosystem: "github-actions" + directory: "/" # Location of workflow files + schedule: + interval: "weekly" + labels: + - "dependencies" + - "github-actions" + + # Keep NuGet dependencies up to date + - package-ecosystem: "nuget" + directory: "/" # Location of solution file + schedule: + interval: "weekly" + open-pull-requests-limit: 5 + labels: + - "dependencies" + - "nuget" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..0afa8a9 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,37 @@ + # .github/workflows/ci.yml + name: CI + + on: + push: + branches: [ "**" ] # run on any branch push + tags: [ "v*" ] # also run when a version tag is pushed + pull_request: + branches: [ "**" ] # run on any branch PR + + permissions: + contents: read + + jobs: + build: + name: Build & Test + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v5 + + - name: Setup .NET + uses: actions/setup-dotnet@v5 + with: + dotnet-version: 9.0 + + - name: Restore dependencies + run: dotnet restore + + - name: Build + run: dotnet build --configuration Release --no-restore + + - name: Run tests + run: dotnet test --no-build --configuration Release --verbosity normal + + - name: Check vulnerable packages + run: dotnet list package --vulnerable --include-transitive diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..ba6114c --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,101 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL Advanced" + +on: + push: + branches: [ "**" ] # run on any branch push + pull_request: + branches: [ "**" ] # run on any branch PR + schedule: + - cron: '43 2 * * 3' + +jobs: + analyze: + if: github.event_name != 'workflow_dispatch' || github.actor != 'nektos/act' + name: Analyze (${{ matrix.language }}) + # Runner size impacts CodeQL analysis time. To learn more, please see: + # - https://gh.io/recommended-hardware-resources-for-running-codeql + # - https://gh.io/supported-runners-and-hardware-resources + # - https://gh.io/using-larger-runners (GitHub.com only) + # Consider using larger runners or machines with greater resources for possible analysis time improvements. + runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} + permissions: + # required for all workflows + security-events: write + + # required to fetch internal or private CodeQL packs + packages: read + + # only required for workflows in private repositories + actions: read + contents: read + + strategy: + fail-fast: false + matrix: + include: + - language: actions + build-mode: none + - language: csharp + build-mode: none + # CodeQL supports the following values keywords for 'language': 'actions', 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' + # Use `c-cpp` to analyze code written in C, C++ or both + # Use 'java-kotlin' to analyze code written in Java, Kotlin or both + # Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both + # To learn more about changing the languages that are analyzed or customizing the build mode for your analysis, + # see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning. + # If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how + # your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages + steps: + - name: Checkout repository + uses: actions/checkout@v5 + + # Add any setup steps before running the `github/codeql-action/init` action. + # This includes steps like installing compilers or runtimes (`actions/setup-node` + # or others). This is typically only required for manual builds. + # - name: Setup runtime (example) + # uses: actions/setup-example@v1 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v4 + with: + languages: ${{ matrix.language }} + build-mode: ${{ matrix.build-mode }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + + # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality + + # If the analyze step fails for one of the languages you are analyzing with + # "We were unable to automatically build your code", modify the matrix above + # to set the build mode to "manual" for that language. Then modify this step + # to build your code. + # ℹ️ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + - if: matrix.build-mode == 'manual' + shell: bash + run: | + echo 'If you are using a "manual" build mode for one or more of the' \ + 'languages you are analyzing, replace this with the commands to build' \ + 'your code, for example:' + echo ' make bootstrap' + echo ' make release' + exit 1 + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v4 + with: + category: "/language:${{matrix.language}}" diff --git a/.github/workflows/dependabot-auto-merge.yml b/.github/workflows/dependabot-auto-merge.yml new file mode 100644 index 0000000..4ac8a21 --- /dev/null +++ b/.github/workflows/dependabot-auto-merge.yml @@ -0,0 +1,22 @@ +# .github/workflows/dependabot-auto-merge.yml +name: Dependabot auto-merge + +on: + pull_request: + branches: [ "main" ] + +permissions: + pull-requests: write + contents: write + +jobs: + dependabot: + runs-on: ubuntu-latest + if: github.actor == 'dependabot[bot]' + steps: + - uses: actions/checkout@v5 + + - name: Auto-merge Dependabot PRs + uses: fastify/github-action-merge-dependabot@v3 + with: + target: minor diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..86fa56c --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,43 @@ +name: Release + +on: + push: + tags: + - '[0-9]+.[0-9]+.[0-9]+*' + +permissions: + contents: write + packages: write + +jobs: + publish: + name: Publish Release & NuGet + runs-on: windows-latest # required for .NET Framework builds + + steps: + - uses: actions/checkout@v5 + + - name: Setup .NET + uses: actions/setup-dotnet@v5 + with: + dotnet-version: 9.0 + + - name: Restore dependencies + run: dotnet restore + + - name: Build (Release) + run: dotnet build --configuration Release --no-restore + + - name: Pack NuGet package + run: dotnet pack src/Kajabity.Tools.Java/Kajabity.Tools.Java.csproj --configuration Release --no-build -o ./artifacts + + - name: Publish to GitHub Packages + run: dotnet nuget push **/artifacts/*.nupkg --api-key ${{ secrets.GITHUB_TOKEN }} --source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json --skip-duplicate + + - name: Publish to NuGet.org + run: dotnet nuget push **/artifacts/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate + + - name: Create GitHub Release + uses: softprops/action-gh-release@v2 + with: + files: artifacts/**/*.nupkg diff --git a/.github/workflows/secrets-check.yml b/.github/workflows/secrets-check.yml new file mode 100644 index 0000000..7dec275 --- /dev/null +++ b/.github/workflows/secrets-check.yml @@ -0,0 +1,23 @@ +name: gitleaks +on: + pull_request: + push: + workflow_dispatch: + schedule: + - cron: "0 4 * * *" # run once a day at 4 AM + +permissions: + contents: read + +jobs: + scan: + name: gitleaks + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v5 + with: + fetch-depth: 0 + - uses: gitleaks/gitleaks-action@v2 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# GITLEAKS_LICENSE: ${{ secrets.GITLEAKS_LICENSE }} # Only required for Organizations, not personal accounts. diff --git a/Kajabity.Tools.Java.sln b/Kajabity.Tools.Java.sln index 950742c..01ce09b 100644 --- a/Kajabity.Tools.Java.sln +++ b/Kajabity.Tools.Java.sln @@ -1,18 +1,17 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.31515.178 +# Visual Studio Version 18 +VisualStudioVersion = 18.2.11408.102 d18.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{C4DC639F-FAF7-451B-856A-7133B434F10C}" ProjectSection(SolutionItems) = preProject .gitignore = .gitignore - appveyor.yml = appveyor.yml README.md = README.md EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Kajabity.Tools.Java", "Kajabity.Tools.Java\Kajabity.Tools.Java.csproj", "{4CF13660-95BA-482C-BA3E-BF97B9624F19}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Kajabity.Tools.Java", "src\Kajabity.Tools.Java\Kajabity.Tools.Java.csproj", "{4CF13660-95BA-482C-BA3E-BF97B9624F19}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Kajabity.Tools.Java.Test", "Kajabity.Tools.Java.Test\Kajabity.Tools.Java.Test.csproj", "{F182CD46-5B4C-4EDF-A3EE-AEE11FB2A1BE}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Kajabity.Tools.Java.Test", "tests\Kajabity.Tools.Java.Test\Kajabity.Tools.Java.Test.csproj", "{F182CD46-5B4C-4EDF-A3EE-AEE11FB2A1BE}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/Kajabity.Tools.Java/Kajabity.Tools.Java.csproj b/Kajabity.Tools.Java/Kajabity.Tools.Java.csproj deleted file mode 100644 index 37668cb..0000000 --- a/Kajabity.Tools.Java/Kajabity.Tools.Java.csproj +++ /dev/null @@ -1,63 +0,0 @@ - - - - netstandard2.0;net47;net471;net472;net48;net481;net10.0 - - Kajabity.Tools.Java - $(AssemblyName) - $(AssemblyTitle) - Williams Technologies Limited - Copyright © 2009-21 $(AssemblyCompany). - $(AssemblyCompany) - Classes to read and write Java style “.properties” files in .NET applications. - - - $([System.DateTime]::op_Subtraction($([System.DateTime]::get_Now().get_Date()),$([System.DateTime]::new(2000,1,1))).get_TotalDays()) - $([MSBuild]::Divide($([System.DateTime]::get_Now().get_TimeOfDay().get_TotalSeconds()), 2).ToString('F0')) - 0.3.$(Build).$(Revision) - $(Version) - $(Version) - $(Version) - - - http://www.apache.org/licenses/LICENSE-2.0 - http://kajabity.com/kajabity-tools/java-properties-classes/ - http://kajabity.com/images/logo-57x57.png - $(PackageIconUri) - Java Properties - $(Version) - https://github.com/Kajabity/Kajabity.Tools.Java - - - - Debug - AnyCPU - - false - {4CF13660-95BA-482C-BA3E-BF97B9624F19} - Library - Properties - Kajabity.Tools - en-US - - - - - true - full - false - DEBUG;TRACE;$(FrameworkSymbols) - - - - pdbonly - true - TRACE;$(FrameworkSymbols) - - - - true - Kajabity.Tools.Java.snk - True - - diff --git a/Kajabity.Tools.Java/README.md b/Kajabity.Tools.Java/README.md deleted file mode 100644 index 9d3aa1d..0000000 --- a/Kajabity.Tools.Java/README.md +++ /dev/null @@ -1,16 +0,0 @@ -Kajabity.Tools.Java -=================== - -This directory contains the Kajabity.Tools.Java DLL project and it produces -a Strongly Named DLL which is packaged as a NuGet. - -Kajabity.Tools.Java is available in several forms: - -- As a project which you can clone or fork from GitHub and include into your own Visual Studio solutions. -- Copy some or all the source files/code into your own projects. -- Download the sources or NuGet packages from [GitHub Releases](https://github.com/Kajabity/Kajabity.Tools.Java/releases). -- Add the NuGet component to your project from [nuget.org](https://www.nuget.org/packages/Kajabity.Tools.Java/). - -Developed using Microsoft Visual Studio 2019. - -Full documentation is available at [http://www.kajabity.com/kajabity-tools/](http://www.kajabity.com/kajabity-tools/). diff --git a/Kajabity.Tools.Java/license.rtf b/Kajabity.Tools.Java/license.rtf deleted file mode 100644 index 52a2f86..0000000 --- a/Kajabity.Tools.Java/license.rtf +++ /dev/null @@ -1,200 +0,0 @@ -{\rtf1\adeflang1025\ansi\ansicpg1252\uc1\adeff0\deff0\stshfdbch0\stshfloch0\stshfhich0\stshfbi0\deflang2057\deflangfe2057{\fonttbl{\f0\froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f1\fswiss\fcharset0\fprq2{\*\panose 020b0604020202020204}Arial;}{\f37\froman\fcharset238\fprq2 Times New Roman CE;} -{\f38\froman\fcharset204\fprq2 Times New Roman Cyr;}{\f40\froman\fcharset161\fprq2 Times New Roman Greek;}{\f41\froman\fcharset162\fprq2 Times New Roman Tur;}{\f42\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);} -{\f43\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\f44\froman\fcharset186\fprq2 Times New Roman Baltic;}{\f45\froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\f47\fswiss\fcharset238\fprq2 Arial CE;} -{\f48\fswiss\fcharset204\fprq2 Arial Cyr;}{\f50\fswiss\fcharset161\fprq2 Arial Greek;}{\f51\fswiss\fcharset162\fprq2 Arial Tur;}{\f52\fbidi \fswiss\fcharset177\fprq2 Arial (Hebrew);}{\f53\fbidi \fswiss\fcharset178\fprq2 Arial (Arabic);} -{\f54\fswiss\fcharset186\fprq2 Arial Baltic;}{\f55\fswiss\fcharset163\fprq2 Arial (Vietnamese);}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0; -\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}{\stylesheet{ -\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 \snext0 Normal;}{\*\cs10 \additive \ssemihidden -Default Paragraph Font;}{\*\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\trcbpat1\trcfpat1\tblind0\tblindtype3\tscellwidthfts0\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv -\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \fs20\lang1024\langfe1024\cgrid\langnp1024\langfenp1024 \snext11 \ssemihidden Normal Table;}} -{\*\latentstyles\lsdstimax156\lsdlockeddef0}{\*\rsidtbl \rsid6122943}{\*\generator Microsoft Word 11.0.0000;}{\info{\operator Simon J. Williams}{\creatim\yr2009\mo12\dy1\hr23\min9}{\revtim\yr2009\mo12\dy1\hr23\min10}{\version2}{\edmins1}{\nofpages4} -{\nofwords1540}{\nofchars8780}{\nofcharsws10300}{\vern24615}{\*\password 00000000}}{\*\xmlnstbl {\xmlns1 http://schemas.microsoft.com/office/word/2003/wordml}}\paperw12240\paperh15840\margl1800\margr1800\margt1440\margb1440\gutter0\ltrsect -\widowctrl\ftnbj\aenddoc\donotembedsysfont0\donotembedlingdata1\grfdocevents0\validatexml0\showplaceholdtext0\ignoremixedcontent0\saveinvalidxml0\showxmlerrors0\horzdoc\dghspace120\dgvspace120\dghorigin1701\dgvorigin1984\dghshow0\dgvshow3 -\jcompress\viewkind4\viewscale100\rsidroot6122943 \fet0{\*\wgrffmtfilter 013f}\ilfomacatclnup0\ltrpar \sectd \ltrsect\linex0\sectdefaultcl\sftnbj {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl2 -\pnucltr\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl6 -\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang -{\pntxtb (}{\pntxta )}}\pard\plain \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 -\f1\fs20\cf1\insrsid6122943 Copyright (c) 2009, Williams Technologies Limited. -\par -\par Kajabity }{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\cf1\insrsid6122943 Tools}{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\cf1\insrsid6122943 is released under the Apache License Version 2.0 -\par which is reproduced below. -\par -\par -\par Apache License -\par Version 2.0, January 2004 -\par }{\rtlch\fcs1 \ab\af1\afs20 \ltrch\fcs0 \b\f1\fs20\cf1\insrsid6122943 http://www.apache.org/licenses/ -\par }{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\cf1\insrsid6122943 -\par TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION -\par -\par }{\rtlch\fcs1 \ab\af1\afs20 \ltrch\fcs0 \b\f1\fs20\cf1\insrsid6122943 1. Definitions}{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\cf1\insrsid6122943 .}{\rtlch\fcs1 \ab\af1\afs20 \ltrch\fcs0 \b\f1\fs20\cf1\insrsid6122943 -\par }{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\cf1\insrsid6122943 -\par "License" shall mean the terms and conditions for use, reproduction, -\par and distribution as defined by Sections 1 through 9 of this document. -\par -\par "Licensor" shall mean the copyright owner or entity authorized by -\par the copyright owner that is granting the License. -\par -\par "Legal Entity" shall mean the union of the acting entity and all -\par other entities that control, are controlled by, or are under common -\par control with that entity. For the purposes of this definition, -\par "control" means (i) the power, direct or indirect, to cause the -\par direction or management of such entity, whether by contract or -\par otherwise, or (ii) ownership of fifty percent (50%) or more of the -\par outstanding shares, or (iii) beneficial ownership of such entity. -\par -\par "You" (or "Your") shall mean an individual or Legal Entity -\par exercising permissions granted by this License. -\par -\par "Source" form shall mean the preferred form for making modifications, -\par including but not limited to software source code, documentation -\par source, and configuration files. -\par -\par "Object" form shall mean any form resulting from mechanical -\par transformation or translation of a Source form, including but -\par not limited to compiled object code, generated documentation, -\par and conversions to other media types. -\par -\par "Work" shall mean the work of authorship, whether in Source or -\par Object form, made available under the License, as indicated by a -\par copyright notice that is included in or attached to the work -\par (an example is provided in the Appendix below). -\par -\par "Derivative Works" shall mean any work, whether in Source or Object -\par form, that is based on (or derived from) the Work and for which the -\par editorial revisions, annotations, elaborations, or other modifications -\par represent, as a whole, an original work of authorship. For the purposes -\par of this License, Derivative Works shall not include works that remain -\par separable from, or merely link (or bind by name) to the interfaces of, -\par the Work and Derivative Works thereof. -\par -\par "Contribution" shall mean any work of authorship, including -\par the original version of the Work and any modifications or additions -\par to that Work or Derivative Works thereof, that is intentionally -\par submitted to Licensor for inclusion in the Work by the copyright owner -\par or by an individual or Legal Entity authorized to submit on behalf of -\par the copyright owner. For the purposes of this definition, "submitted" -\par means any form of electronic, verbal, or written communication sent -\par to the Licensor or its representatives, including but not limited to -\par communication on electronic mailing lists, source code control systems, -\par and issue tracking systems that are managed by, or on behalf of, the -\par Licensor for the purpose of discussing and improving the Work, but -\par excluding communication that is conspicuously marked or otherwise -\par designated in writing by the copyright owner as "Not a Contribution." -\par -\par "Contributor" shall mean Licensor and any individual or Legal Entity -\par on behalf of whom a Contribution has been received by Licensor and -\par subsequently incorporated within the Work. -\par -\par }{\rtlch\fcs1 \ab\af1\afs20 \ltrch\fcs0 \b\f1\fs20\cf1\insrsid6122943 2. Grant of Copyright License}{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\cf1\insrsid6122943 . Subject to the terms and conditions of -\par this License, each Contributor hereby grants to You a perpetual, -\par worldwide, non-exclusive, no-charge, royalty-free, irrevocable -\par copyright license to reproduce, prepare Derivative Works of, -\par publicly display, publicly perform, sublicense, and distribute the -\par Work and such Derivative Works in Source or Object form. -\par -\par }{\rtlch\fcs1 \ab\af1\afs20 \ltrch\fcs0 \b\f1\fs20\cf1\insrsid6122943 3. Grant of Patent License}{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\cf1\insrsid6122943 . Subject to the terms and conditions of -\par this License, each Contributor hereby grants to You a perpetual, -\par worldwide, non-exclusive, no-charge, royalty-free, irrevocable -\par (except as stated in this section) patent license to make, have made, -\par use, offer to sell, sell, import, and otherwise transfer the Work, -\par where such license applies only to those patent claims licensable -\par by such Contributor that are necessarily infringed by their -\par Contribution(s) alone or by combination of their Contribution(s) -\par with the Work to which such Contribution(s) was submitted. If You -\par institute patent litigation against any entity (including a -\par cross-claim or counterclaim in a lawsuit) alleging that the Work -\par or a Contribution incorporated within the Work constitutes direct -\par or contributory patent infringement, then any patent licenses -\par granted to You under this License for that Work shall terminate -\par as of the date such litigation is filed. -\par -\par }{\rtlch\fcs1 \ab\af1\afs20 \ltrch\fcs0 \b\f1\fs20\cf1\insrsid6122943 4. Redistribution}{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\cf1\insrsid6122943 . You may reproduce and distribute copies of the -\par Work or Derivative Works thereof in any medium, with or without -\par modifications, and in Source or Object form, provided that You -\par meet the following conditions: -\par -\par (a) You must give any other recipients of the Work or -\par Derivative Works a copy of this License; and -\par -\par (b) You must cause any modified files to carry prominent notices -\par stating that You changed the files; and -\par -\par (c) You must retain, in the Source form of any Derivative Works -\par that You distribute, all copyright, patent, trademark, and -\par attribution notices from the Source form of the Work, -\par excluding those notices that do not pertain to any part of -\par the Derivative Works; and -\par -\par (d) If the Work includes a "NOTICE" text file as part of its -\par distribution, then any Derivative Works that You distribute must -\par include a readable copy of the attribution notices contained -\par within such NOTICE file, excluding those notices that do not -\par pertain to any part of the Derivative Works, in at least one -\par of the following places: within a NOTICE text file distributed -\par as part of the Derivative Works; within the Source form or -\par documentation, if provided along with the Derivative Works; or, -\par within a display generated by the Derivative Works, if and -\par wherever such third-party notices normally appear. The contents -\par of the NOTICE file are for informational purposes only and -\par do not modify the License. You may add Your own attribution -\par notices within Derivative Works that You distribute, alongside -\par or as an addendum to the NOTICE text from the Work, provided -\par that such additional attribution notices cannot be construed -\par as modifying the License. -\par -\par You may add Your own copyright statement to Your modifications and -\par may provide additional or different license terms and conditions -\par for use, reproduction, or distribution of Your modifications, or -\par for any such Derivative Works as a whole, provided Your use, -\par reproduction, and distribution of the Work otherwise complies with -\par the conditions stated in this License. -\par -\par }{\rtlch\fcs1 \ab\af1\afs20 \ltrch\fcs0 \b\f1\fs20\cf1\insrsid6122943 5. Submission of Contributions}{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\cf1\insrsid6122943 . Unless You explicitly state otherwise, -\par any Contribution intentionally submitted for inclusion in the Work -\par by You to the Licensor shall be under the terms and conditions of -\par this License, without any additional terms or conditions. -\par Notwithstanding the above, nothing herein shall supersede or modify -\par the terms of any separate license agreement you may have executed -\par with Licensor regarding such Contributions. -\par -\par }{\rtlch\fcs1 \ab\af1\afs20 \ltrch\fcs0 \b\f1\fs20\cf1\insrsid6122943 6. Trademarks}{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\cf1\insrsid6122943 . This License does not grant permission to use the trade -\par names, trademarks, service marks, or product names of the Licensor, -\par except as required for reasonable and customary use in describing the -\par origin of the Work and reproducing the content of the NOTICE file. -\par -\par }{\rtlch\fcs1 \ab\af1\afs20 \ltrch\fcs0 \b\f1\fs20\cf1\insrsid6122943 7. Disclaimer of Warranty}{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\cf1\insrsid6122943 . Unless required by applicable law or -\par agreed to in writing, Licensor provides the Work (and each -\par Contributor provides its Contributions) on an "AS IS" BASIS, -\par WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or -\par implied, including, without limitation, any warranties or conditions -\par of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A -\par PARTICULAR PURPOSE. You are solely responsible for determining the -\par appropriateness of using or redistributing the Work and assume any -\par risks associated with Your exercise of permissions under this License. -\par -\par }{\rtlch\fcs1 \ab\af1\afs20 \ltrch\fcs0 \b\f1\fs20\cf1\insrsid6122943 8. Limitation of Liability}{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\cf1\insrsid6122943 . In no event and under no legal theory, -\par whether in tort (including negligence), contract, or otherwise, -\par unless required by applicable law (such as deliberate and grossly -\par negligent acts) or agreed to in writing, shall any Contributor be -\par liable to You for damages, including any direct, indirect, special, -\par incidental, or consequential damages of any character arising as a -\par result of this License or out of the use or inability to use the -\par Work (including but not limited to damages for loss of goodwill, -\par work stoppage, computer failure or malfunction, or any and all -\par other commercial damages or losses), even if such Contributor -\par has been advised of the possibility of such damages. -\par -\par }{\rtlch\fcs1 \ab\af1\afs20 \ltrch\fcs0 \b\f1\fs20\cf1\insrsid6122943 9. Accepting Warranty or Additional Liability}{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\cf1\insrsid6122943 . While redistributing -\par the Work or Derivative Works thereof, You may choose to offer, -\par and charge a fee for, acceptance of support, warranty, indemnity, -\par or other liability obligations and/or rights consistent with this -\par License. However, in accepting such obligations, You may act only -\par on Your own behalf and on Your sole responsibility, not on behalf -\par of any other Contributor, and only if You agree to indemnify, -\par defend, and hold each Contributor harmless for any liability -\par incurred by, or claims asserted against, such Contributor by reason -\par of your accepting any such warranty or additional liability. -\par -\par END OF TERMS AND CONDITIONS -\par -\par }} \ No newline at end of file diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/README.md b/README.md index 0b03229..2320015 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,60 @@ -Kajabity.Tools.Java GitHub Repository -==================================== +Kajabity.Tools.Java - Java Properties Utilities +=============================================== -[![Build status](https://ci.appveyor.com/api/projects/status/98ovyr22uy57gkp3/branch/main?svg=true)](https://ci.appveyor.com/project/Kajabity/kajabity-tools-java/branch/main) +[![CI](https://github.com/kajabity/Kajabity.Tools.Java/actions/workflows/ci.yml/badge.svg)](https://github.com/kajabity/Kajabity.Tools.Java/actions/workflows/ci.yml) +[![CodeQL](https://github.com/kajabity/Kajabity.Tools.Java/actions/workflows/codeql.yml/badge.svg)](https://github.com/kajabity/Kajabity.Tools.Java/actions/workflows/codeql.yml) +[![NuGet](https://img.shields.io/nuget/v/Kajabity.Tools.Java.svg)](https://www.nuget.org/packages/Kajabity.Tools.Java/) +[![NuGet Downloads](https://img.shields.io/nuget/dt/Kajabity.Tools.Java.svg)](https://www.nuget.org/packages/Kajabity.Tools.Java/) +[![GitHub Release](https://img.shields.io/github/v/release/kajabity/Kajabity.Tools.Java.svg)](https://github.com/kajabity/Kajabity.Tools.Java/releases) +[![License: Apache 2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE.txt) -Kajabity.Tools.Java is a collection of utility classes to read and write Java style “.properties” files in .NET applications. +Overview +-------- -Originally part of the Kajabity Tools collection, these classes are now refactored into their own -separate repository to reduce unnecessary code bloat. In particular, it removes the Windows Forms dependencies. +Kajabity.Tools.Java is a collection of utility classes for reading and writing Java-style +`.properties` files in .NET applications. This repository contains several sub-projects: -- **Kajabity.Tools.Java** - a DLL project providing the JavaProperties classes for .NET projects. -- **Kajabity.Tools.Java.Test** - NUnit tests for the Kajabity.Tools.Java classes. +- Kajabity.Tools.Java – a DLL project providing the JavaProperties classes for .NET projects. -See the Releases section on GitHub to download copies of code, DLL exe's and NuGets. +- Kajabity.Tools.Java.Test – NUnit tests for the Kajabity.Tools.Java classes. -Kajabity.Tools.Java DLL is a strongly named assembly and is available from nuget.org as Kajabity.Tools.Java. +See the Releases section on GitHub to download source code, DLLs, executables, and NuGet packages. -Full documentation is available at [http://www.kajabity.com/kajabity-tools/](http://www.kajabity.com/kajabity-tools/). +The Kajabity.Tools.Java DLL is a strongly named assembly and is available from nuget.org as Kajabity.Tools.Java. + +Features +-------- + +The JavaProperties class wraps a `Dictionary` to provide the following additional features: + +- Load Java properties from a Stream into a `Dictionary`. + +- Load Java properties from a Stream using an alternate encoding (e.g. Unicode), making it easier to + support languages with non-ASCII character sets. + +- Store Java properties from a `Dictionary` to a Stream. + +- Support default properties (as with the Java Properties class) using the second constructor, which +accepts a `Dictionary` of defaults. + +- Coerce property keys and values to strings, matching Java properties behaviour. + +Usage +----- + +Full documentation is available at: +https://www.kajabity.com/kajabity-tools/java-properties-classes/ + +Releases +-------- + +Latest GitHub Release: View on GitHub + +Latest NuGet Package: View on NuGet.org + +Feedback & Contributions +------------------------ + +Contributions and feedback are welcome if you notice anything that could be improved. \ No newline at end of file diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index b595091..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,113 +0,0 @@ -## -## Copyright 2009-20 Williams Technologies Limited. -## -## Licensed under the Apache License, Version 2.0 (the "License"); -## you may not use this file except in compliance with the License. -## You may obtain a copy of the License at -## -## http://www.apache.org/licenses/LICENSE-2.0 -## -## Unless required by applicable law or agreed to in writing, software -## distributed under the License is distributed on an "AS IS" BASIS, -## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -## See the License for the specific language governing permissions and -## limitations under the License. -## -## Kajabity is a trademark of Williams Technologies Limited. -## -## http://www.kajabity.com -## - -#---------------------------------# -# general configuration # -#---------------------------------# - -# tell appveyor to use MSBuild 15.0 or higher -# eventually move to Visual Studio 2026 when available -image: Visual Studio 2022 - -# version format -version: 0.3-{build} - -# branches to build -#branches - - -# Do not build on tags (GitHub only) -# This avoids the infinite build loop as Deploy to GitHub is set to create a tag each time. -skip_tags: true - -#---------------------------------# -# environment configuration # -#---------------------------------# - -# scripts that are called at very beginning, before repo cloning -init: -- git config --global core.autocrlf true - -# Automatically register private account and/or project AppVeyor NuGet feeds. -nuget: - account_feed: false - project_feed: true - disable_publish_on_pr: true # disable publishing of .nupkg artifacts to - # account/project feeds for pull request builds - -#---------------------------------# -# build configuration # -#---------------------------------# - -# build platform, i.e. x86, x64, Any CPU. This setting is optional. -# platform: - -# build Configuration, i.e. Debug, Release, etc. -before_build: - - cmd: dotnet restore "Kajabity.Tools.Java.sln" - -# build Configuration, i.e. Debug, Release, etc. -configuration: Release - -build: - publish_nuget: true # package projects with .nuspec files and push to artifacts - publish_nuget_symbols: true # generate and publish NuGet symbol packages - include_nuget_references: true # add -IncludeReferencedProjects option while packaging NuGet artifacts - -# MSBuild verbosity level - one of quiet|minimal|normal|detailed - verbosity: normal - -#---------------------------------# -# artifacts configuration # -#---------------------------------# - -# Artifacts picked up by nuget deployment and includes all DLL variants for each .NET version. -#artifacts: -# - path: Kajabity.Tools.Java\bin\$(configuration)\Kajabity.Tools.Java.dll - -#---------------------------------# -# deployment configuration # -#---------------------------------# - -# providers: Local, FTP, WebDeploy, AzureCS, AzureBlob, S3, NuGet, Environment -# provider names are case-sensitive! - -deploy: - # Secure tokens created using https://ci.appveyor.com/tools/encrypt - - # Deploying to NuGet feed - using API Key from NuGet.org. - - provider: NuGet - api_key: - secure: ZoR+8IeDz9PXvLWhZoEtPdLjyv7zXoyejU3XTmGZeFrOsJ3QgfVrisQeEdfC2mYF - skip_symbols: true - artifact: /.*\.nupkg/ - on: - #appveyor_repo_tag: true # deploy on tag push only - removed or won't deploy at all. - branch: main # release from main branch only - - # Deploy to GitHub Releases - - provider: GitHub - release: kajabity.tools.java-v$(appveyor_build_version) - description: 'Kajabity.Tools.Java Release v$(appveyor_build_version)' - auth_token: - secure: VRw5uPJq7zs0KwEF2hR8c9aSn5ZzA/SzJq4wNCR7fdYwMRrbwg+9sZDkAD30fsOY - draft: false - prerelease: false - #appveyor_repo_tag: true # deploy on tag push only diff --git a/kajabity.tools.java.logo.png b/kajabity.tools.java.logo.png new file mode 100644 index 0000000..72493db Binary files /dev/null and b/kajabity.tools.java.logo.png differ diff --git a/Kajabity.Tools.Java/Java/DuplicateKeyResolution.cs b/src/Kajabity.Tools.Java/Java/DuplicateKeyResolution.cs similarity index 98% rename from Kajabity.Tools.Java/Java/DuplicateKeyResolution.cs rename to src/Kajabity.Tools.Java/Java/DuplicateKeyResolution.cs index 4098d57..cec6cd4 100644 --- a/Kajabity.Tools.Java/Java/DuplicateKeyResolution.cs +++ b/src/Kajabity.Tools.Java/Java/DuplicateKeyResolution.cs @@ -27,7 +27,7 @@ public enum DuplicateKeyResolution { /// /// Overwrite the key with a new value. - /// + /// /// Last one wins. /// Overwrite = 1, diff --git a/Kajabity.Tools.Java/Java/JavaProperties.cs b/src/Kajabity.Tools.Java/Java/JavaProperties.cs similarity index 99% rename from Kajabity.Tools.Java/Java/JavaProperties.cs rename to src/Kajabity.Tools.Java/Java/JavaProperties.cs index 8511a62..65b3a61 100644 --- a/Kajabity.Tools.Java/Java/JavaProperties.cs +++ b/src/Kajabity.Tools.Java/Java/JavaProperties.cs @@ -67,7 +67,7 @@ public JavaProperties(Dictionary defaults) } /// - /// Load Java Properties from a stream with the specified encoding and + /// Load Java Properties from a stream with the specified encoding and /// expecting the format as described in . /// /// An input stream to read properties from. diff --git a/Kajabity.Tools.Java/Java/JavaPropertyReader.cs b/src/Kajabity.Tools.Java/Java/JavaPropertyReader.cs similarity index 97% rename from Kajabity.Tools.Java/Java/JavaPropertyReader.cs rename to src/Kajabity.Tools.Java/Java/JavaPropertyReader.cs index 239f417..c0e3d90 100644 --- a/Kajabity.Tools.Java/Java/JavaPropertyReader.cs +++ b/src/Kajabity.Tools.Java/Java/JavaPropertyReader.cs @@ -25,7 +25,7 @@ namespace Kajabity.Tools.Java { /// - /// This class reads Java style properties from an input stream. + /// This class reads Java style properties from an input stream. /// public class JavaPropertyReader { @@ -152,29 +152,29 @@ public JavaPropertyReader(Dictionary hashtable) { this.hashtable = hashtable; } - + /// - /// Load key value pairs (properties) from an input Stream. - /// The input stream (usually reading from a ".properties" file) consists of a series of lines (terminated + /// Load key value pairs (properties) from an input Stream. + /// The input stream (usually reading from a ".properties" file) consists of a series of lines (terminated /// by \r, \n or \r\n) each a key value pair, a comment or a blank line. - /// - /// Leading whitespace (spaces, tabs, formfeeds) are ignored at the start of any line - and a line that is empty or + /// + /// Leading whitespace (spaces, tabs, formfeeds) are ignored at the start of any line - and a line that is empty or /// contains only whitespace is blank and ignored. - /// - /// A line with the first non-whitespace character is a '#' or '!' is a comment line and the rest of the line is + /// + /// A line with the first non-whitespace character is a '#' or '!' is a comment line and the rest of the line is /// ignored. - /// + /// /// If the first non-whitespace character is not '#' or '!' then it is the start of a key. A key is all the /// characters up to the first whitespace or a key/value separator - '=' or ':'. - /// + /// /// The separator is optional. Any whitespace after the key or after the separator (if present) is ignored. - /// - /// The first non-whitespace character after the separator (or after the key if no separator) begins the value. + /// + /// The first non-whitespace character after the separator (or after the key if no separator) begins the value. /// The value may include whitespace, separators, or comment characters. - /// - /// Any unicode character may be included in either key or value by using escapes preceded by the escape + /// + /// Any unicode character may be included in either key or value by using escapes preceded by the escape /// character '\'. - /// + /// /// The following special cases are defined: /// /// '\t' - horizontal tab. @@ -182,20 +182,20 @@ public JavaPropertyReader(Dictionary hashtable) /// '\r' - return /// '\n' - new line /// '\\' - add escape character. - /// + /// /// '\ ' - add space in a key or at the start of a value. /// '\!', '\#' - add comment markers at the start of a key. /// '\=', '\:' - add a separator in a key. /// - /// + /// /// Any unicode character using the following escape: /// /// '\uXXXX' - where XXXX represents the unicode character code as 4 hexadecimal digits. /// - /// + /// /// Finally, longer lines can be broken by putting an escape at the very end of the line. Any leading space /// (unless escaped) is skipped at the beginning of the following line. - /// + /// /// Examples /// /// a-key = a-value @@ -203,24 +203,24 @@ public JavaPropertyReader(Dictionary hashtable) /// a-key=a-value /// a-key a-value /// - /// + /// /// All the above will result in the same key/value pair - key "a-key" and value "a-value". /// /// ! comment... /// # another comment... /// - /// + /// /// The above are two examples of comments. /// /// Honk\ Kong = Near China /// - /// + /// /// The above shows how to embed a space in a key - key is "Hong Kong", value is "Near China". /// /// a-longer-key-example = a really long value that is \ /// split over two lines. /// - /// + /// /// An example of a long line split into two. /// /// The input stream that the properties are read from. diff --git a/Kajabity.Tools.Java/Java/JavaPropertyWriter.cs b/src/Kajabity.Tools.Java/Java/JavaPropertyWriter.cs similarity index 100% rename from Kajabity.Tools.Java/Java/JavaPropertyWriter.cs rename to src/Kajabity.Tools.Java/Java/JavaPropertyWriter.cs diff --git a/Kajabity.Tools.Java/Java/ParseException.cs b/src/Kajabity.Tools.Java/Java/ParseException.cs similarity index 100% rename from Kajabity.Tools.Java/Java/ParseException.cs rename to src/Kajabity.Tools.Java/Java/ParseException.cs diff --git a/src/Kajabity.Tools.Java/Kajabity.Tools.Java.csproj b/src/Kajabity.Tools.Java/Kajabity.Tools.Java.csproj new file mode 100644 index 0000000..57d7026 --- /dev/null +++ b/src/Kajabity.Tools.Java/Kajabity.Tools.Java.csproj @@ -0,0 +1,51 @@ + + + + netstandard2.0;net48;net10.0 + + + Kajabity + Copyright © 2009-2026 $(AssemblyCompany). + Simon J. Williams + Classes to read and write Java style “.properties” files in .NET applications. + + + LICENSE.txt + http://kajabity.com/kajabity-tools/java-properties-classes/ + kajabity.tools.java.logo.png + Java Properties + https://github.com/Kajabity/Kajabity.Tools.Java + git + README.md + + + + true + true + true + + + + true + snupkg + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + + + true + Kajabity.Tools.Java.snk + + diff --git a/Kajabity.Tools.Java/Kajabity.Tools.Java.snk b/src/Kajabity.Tools.Java/Kajabity.Tools.Java.snk similarity index 100% rename from Kajabity.Tools.Java/Kajabity.Tools.Java.snk rename to src/Kajabity.Tools.Java/Kajabity.Tools.Java.snk diff --git a/Kajabity.Tools.Java/NOTICE.txt b/src/Kajabity.Tools.Java/NOTICE.txt similarity index 100% rename from Kajabity.Tools.Java/NOTICE.txt rename to src/Kajabity.Tools.Java/NOTICE.txt diff --git a/Kajabity.Tools.Java.Test/Java/JavaPropertyReaderTest.cs b/tests/Kajabity.Tools.Java.Test/Java/JavaPropertyReaderTest.cs similarity index 100% rename from Kajabity.Tools.Java.Test/Java/JavaPropertyReaderTest.cs rename to tests/Kajabity.Tools.Java.Test/Java/JavaPropertyReaderTest.cs diff --git a/Kajabity.Tools.Java.Test/Java/JavaPropertyWriterTest.cs b/tests/Kajabity.Tools.Java.Test/Java/JavaPropertyWriterTest.cs similarity index 99% rename from Kajabity.Tools.Java.Test/Java/JavaPropertyWriterTest.cs rename to tests/Kajabity.Tools.Java.Test/Java/JavaPropertyWriterTest.cs index f82c455..d28fc02 100644 --- a/Kajabity.Tools.Java.Test/Java/JavaPropertyWriterTest.cs +++ b/tests/Kajabity.Tools.Java.Test/Java/JavaPropertyWriterTest.cs @@ -27,7 +27,7 @@ namespace Kajabity.Tools.Java { /// /// The following tests are validated by converting to equivalent JUnit tests - for example: - /// + /// ///
     ///    @Test
     ///    public void test() throws IOException
diff --git a/Kajabity.Tools.Java.Test/Kajabity.Tools.Java.Test.csproj b/tests/Kajabity.Tools.Java.Test/Kajabity.Tools.Java.Test.csproj
similarity index 97%
rename from Kajabity.Tools.Java.Test/Kajabity.Tools.Java.Test.csproj
rename to tests/Kajabity.Tools.Java.Test/Kajabity.Tools.Java.Test.csproj
index 94272ad..b80a50d 100644
--- a/Kajabity.Tools.Java.Test/Kajabity.Tools.Java.Test.csproj
+++ b/tests/Kajabity.Tools.Java.Test/Kajabity.Tools.Java.Test.csproj
@@ -32,7 +32,7 @@
   
 
   
-    
+    
   
 
   
diff --git a/Kajabity.Tools.Java.Test/Test Data/Java/blank.properties b/tests/Kajabity.Tools.Java.Test/Test Data/Java/blank.properties
similarity index 100%
rename from Kajabity.Tools.Java.Test/Test Data/Java/blank.properties
rename to tests/Kajabity.Tools.Java.Test/Test Data/Java/blank.properties
diff --git a/Kajabity.Tools.Java.Test/Test Data/Java/comments.properties b/tests/Kajabity.Tools.Java.Test/Test Data/Java/comments.properties
similarity index 100%
rename from Kajabity.Tools.Java.Test/Test Data/Java/comments.properties
rename to tests/Kajabity.Tools.Java.Test/Test Data/Java/comments.properties
diff --git a/Kajabity.Tools.Java.Test/Test Data/Java/duplicate.properties b/tests/Kajabity.Tools.Java.Test/Test Data/Java/duplicate.properties
similarity index 100%
rename from Kajabity.Tools.Java.Test/Test Data/Java/duplicate.properties
rename to tests/Kajabity.Tools.Java.Test/Test Data/Java/duplicate.properties
diff --git a/Kajabity.Tools.Java.Test/Test Data/Java/empty.properties b/tests/Kajabity.Tools.Java.Test/Test Data/Java/empty.properties
similarity index 100%
rename from Kajabity.Tools.Java.Test/Test Data/Java/empty.properties
rename to tests/Kajabity.Tools.Java.Test/Test Data/Java/empty.properties
diff --git a/Kajabity.Tools.Java.Test/Test Data/Java/line-break-unicode.properties b/tests/Kajabity.Tools.Java.Test/Test Data/Java/line-break-unicode.properties
similarity index 100%
rename from Kajabity.Tools.Java.Test/Test Data/Java/line-break-unicode.properties
rename to tests/Kajabity.Tools.Java.Test/Test Data/Java/line-break-unicode.properties
diff --git a/Kajabity.Tools.Java.Test/Test Data/Java/line-breaks.properties b/tests/Kajabity.Tools.Java.Test/Test Data/Java/line-breaks.properties
similarity index 100%
rename from Kajabity.Tools.Java.Test/Test Data/Java/line-breaks.properties
rename to tests/Kajabity.Tools.Java.Test/Test Data/Java/line-breaks.properties
diff --git a/Kajabity.Tools.Java.Test/Test Data/Java/non-ascii-symbols-native2ascii.properties b/tests/Kajabity.Tools.Java.Test/Test Data/Java/non-ascii-symbols-native2ascii.properties
similarity index 100%
rename from Kajabity.Tools.Java.Test/Test Data/Java/non-ascii-symbols-native2ascii.properties
rename to tests/Kajabity.Tools.Java.Test/Test Data/Java/non-ascii-symbols-native2ascii.properties
diff --git a/Kajabity.Tools.Java.Test/Test Data/Java/non-ascii-symbols-utf8.properties b/tests/Kajabity.Tools.Java.Test/Test Data/Java/non-ascii-symbols-utf8.properties
similarity index 100%
rename from Kajabity.Tools.Java.Test/Test Data/Java/non-ascii-symbols-utf8.properties
rename to tests/Kajabity.Tools.Java.Test/Test Data/Java/non-ascii-symbols-utf8.properties
diff --git a/Kajabity.Tools.Java.Test/Test Data/Java/separators.properties b/tests/Kajabity.Tools.Java.Test/Test Data/Java/separators.properties
similarity index 100%
rename from Kajabity.Tools.Java.Test/Test Data/Java/separators.properties
rename to tests/Kajabity.Tools.Java.Test/Test Data/Java/separators.properties
diff --git a/Kajabity.Tools.Java.Test/Test Data/Java/special-characters.properties b/tests/Kajabity.Tools.Java.Test/Test Data/Java/special-characters.properties
similarity index 100%
rename from Kajabity.Tools.Java.Test/Test Data/Java/special-characters.properties
rename to tests/Kajabity.Tools.Java.Test/Test Data/Java/special-characters.properties
diff --git a/Kajabity.Tools.Java.Test/Test Data/Java/urls.properties b/tests/Kajabity.Tools.Java.Test/Test Data/Java/urls.properties
similarity index 100%
rename from Kajabity.Tools.Java.Test/Test Data/Java/urls.properties
rename to tests/Kajabity.Tools.Java.Test/Test Data/Java/urls.properties
diff --git a/Kajabity.Tools.Java.Test/Test Data/Java/utf8-with-BOM.properties b/tests/Kajabity.Tools.Java.Test/Test Data/Java/utf8-with-BOM.properties
similarity index 100%
rename from Kajabity.Tools.Java.Test/Test Data/Java/utf8-with-BOM.properties
rename to tests/Kajabity.Tools.Java.Test/Test Data/Java/utf8-with-BOM.properties