diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 00000000..526a9935 --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,137 @@ +# Contributing + +## Project Scope + +The Electron.NET project ultimately tries to provide a framework for developing cross-platform client applications on the basis of .NET and Electron. Anything that is related to this goal will be considered. The project aims to be as close to Electron with .NET as a basis as possible. If your contribution does not reflect that goal, the chances of accepting it are limited. + +## Code License + +This is an open source project falling under the [MIT License](../LICENSE). By using, distributing, or contributing to this project, you accept and agree that all code within the Electron.NET project and its libraries are licensed under MIT license. + +## Becoming a Contributor + +Usually appointing someone as a contributor follows this process: + +1. An individual contributes actively via discussions (reporting bugs, giving feedback to existing or opening new issues) and / or pull requests +2. The individual is either directly asked, invited or asks for contributor rights on the project +3. The individual uses the contribution rights to sustain or increase the active contributions + +Every contributor might have to sign the contributor's license agreement (CLA) to establish a legal trust between the project and its contributors. + +## Working on Electron.NET + +### Issue Discussion + +Discussion of issues should be placed transparently in the issue tracker here on GitHub. + +* [General issues, bugs, new features](https://github.com/ElectronNET/Electron.NET/issues) +* [General discussions, help, exchange of ideas](https://github.com/ElectronNET/Electron.NET/discussions) + +### Modifying the code + +Electron.NET and its libraries uses features from the latest versions of C# (e.g., C# 10). You will therefore need a C# compiler that is up for the job. + +1. Fork and clone the repo. +2. First try to build the ElectronNET.Core library and see if you get the tests running. +3. You will be required to resolve some dependencies via NuGet. + +The build system of Electron.NET uses NUKE. + +### Code Conventions + +Most parts in the Electron.NET project are fairly straight forward. Among these are: + +* Always use statement blocks for control statements, e.g., in a for-loop, if-condition, ... +* You may use a simple (throw) statement in case of enforcing contracts on argument +* Be explicit about modifiers (some files follow an older convention of the code base, but we settled on the explicit style) + +### Development Workflow + +1. If no issue already exists for the work you'll be doing, create one to document the problem(s) being solved and self-assign. +2. Otherwise please let us know that you are working on the problem. Regular status updates (e.g. "still in progress", "no time anymore", "practically done", "pull request issued") are highly welcome. +3. Create a new branch—please don't work in the `main` branch directly. It is reserved for releases. We recommend naming the branch to match the issue being addressed (`feature/#777` or `issue-777`). +4. Add failing tests for the change you want to make. Tests are crucial and should be taken from W3C (or other specification). +5. Fix stuff. Always go from edge case to edge case. +6. All tests should pass now. Also your new implementation should not break existing tests. +7. Update the documentation to reflect any changes. (or document such changes in the original issue) +8. Push to your fork or push your issue-specific branch to the main repository, then submit a pull request against `develop`. + +Just to illustrate the git workflow for Electron.NET a little bit more we've added the following graphs. + +Initially, Electron.NET starts at the `main` branch. This branch should contain the latest stable (or released) version. + +Here we now created a new branch called `develop`. This is the development branch. + +Now active work is supposed to be done. Therefore a new branch should be created. Let's create one: + +```sh +git checkout -b feature/#777 +``` + +There may be many of these feature branches. Most of them are also pushed to the server for discussion or synchronization. + +```sh +git push -u origin feature/#777 +``` + +Now feature branches may be closed when they are done. Here we simply merge with the feature branch(es). For instance the following command takes the `feature/#777` branch from the server and merges it with the `develop` branch. + +```sh +git checkout develop +git pull +git pull origin feature/#777 +git push +``` + +Finally, we may have all the features that are needed to release a new version of Electron.NET. Here we tag the release. For instance for the 1.0 release we use `v1.0`. + +```sh +git checkout main +git merge develop +git tag v1.0 +``` + +(The last part is automatically performed by our CI system. Don't tag manually.) + +### Versioning + +The rules of [semver](http://semver.org/) don't necessarily apply here, but we will try to stay quite close to them. + +Prior to version 1.0.0 we use the following scheme: + +1. MINOR versions for reaching a feature milestone potentially combined with dramatic API changes +2. PATCH versions for refinements (e.g. performance improvements, bug fixes) + +After releasing version 1.0.0 the scheme changes to become: + +1. MAJOR versions at maintainers' discretion following significant changes to the codebase (e.g., API changes) +2. MINOR versions for backwards-compatible enhancements (e.g., performance improvements) +3. PATCH versions for backwards-compatible bug fixes (e.g., spec compliance bugs, support issues) + +#### Code style + +Regarding code style like indentation and whitespace, **follow the conventions you see used in the source already.** In general most of the [C# coding guidelines from Microsoft](https://msdn.microsoft.com/en-us/library/ff926074.aspx) are followed. This project prefers type inference with `var` to explicitly stating (redundant) information. + +It is also important to keep a certain `async`-flow and to always use `ConfigureAwait(false)` in conjunction with an `await` expression. + +## Backwards Compatibility + +We always try to remain backwards compatible beyond the currently supported versions of .NET. + +For instance, in December 2025 there have been activity to remove .NET 6 support from the codebase. We rejected this. Key points: + +1. We have absolutely no need to drop `.net6` support. It doesn't hurt us in any way. +2. Many are still using `.net6`, including Electron.NET (non-Core) users. It doesn't make sense to force them to update two things at the same time (.NET + Electron.NET). +3. We MUST NOT and NEVER update `Microsoft.Build.Utilities.Core`. This will make Electron.NET stop working on older Visual Studio and MSBuild versions. There's are also no reasons to update it in the first place. + +It's important to note that the Microsoft label of "Out of support" on .NET has almost no practical meaning. We've rarely (if ever) seen any bugs fixed in the same .NET version which mattered. The bugs that all new .NET versions have are much worse than mature .NET versions which are declared as "out of support". Keep in mind that the LTS matters most for active development / ongoing supported projects. If, e.g., a TV has been released a decade ago it most likely won't be patched. Still, you might want to deploy applications to it, which then naturally would involve being based on "out of support" versions of the framework. + +TL;DR: Unless there is a technical reason (e.g., a crucial new API not being available) we should not drop "out of support" .NET versions. At the time of writing (December 2025) the minimum supported .NET version remains at `.net6`. + +## Timeline + +**All of this information is related to ElectronNET.Core pre-v1!** + +We pretty much release whenever we have something new (i.e., do fixes such as a 0.1.1, or add new features, such as a 0.2.0) quite quickly. + +We will go for a 1.0.0 release of this as early as ~mid of January 2026 (unless we find some critical things or want to extend the beta phase for ElectronNET.Core). This should be sufficient time to get some user input and have enough experience to call it stable. diff --git a/.github/workflows/ci.yml b/.github/workflows/Build and Publish.yml similarity index 63% rename from .github/workflows/ci.yml rename to .github/workflows/Build and Publish.yml index a9b81df7..17bd8ca0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/Build and Publish.yml @@ -1,33 +1,25 @@ -name: CI +name: Build and Publish -on: [push, pull_request] +on: [push] env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} -jobs: - # linux: - # runs-on: ubuntu-latest - # timeout-minutes: 10 - - # steps: - # - uses: actions/checkout@v4 +concurrency: + group: build-publish-${{ github.ref }} + cancel-in-progress: true - # - name: Setup dotnet - # uses: actions/setup-dotnet@v4 - # with: - # dotnet-version: | - # 6.0.x - # 8.0.x - # 10.0.x - - # - name: Build - # run: ./build.sh +jobs: + Integration-Tests: + uses: ./.github/workflows/integration-tests.yml + name: '1' - windows: + Publish: + needs: [Integration-Tests] runs-on: windows-latest timeout-minutes: 10 + name: '2 / Publish' steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/PR Validation.yml b/.github/workflows/PR Validation.yml new file mode 100644 index 00000000..540db15b --- /dev/null +++ b/.github/workflows/PR Validation.yml @@ -0,0 +1,39 @@ +name: PR Validation + +on: [pull_request] + +concurrency: + group: pr-validation-${{ github.ref }} + cancel-in-progress: true + +jobs: + Whitespace-Check: + uses: ./.github/workflows/trailing-whitespace-check.yml + secrets: inherit + name: '1' + + Tests: + needs: Whitespace-Check + uses: ./.github/workflows/integration-tests.yml + secrets: inherit + name: '2' + + build: + needs: [Whitespace-Check, Tests] + runs-on: windows-latest + timeout-minutes: 10 + name: '3 / Build' + + steps: + - uses: actions/checkout@v4 + + - name: Setup dotnet + uses: actions/setup-dotnet@v4 + with: + dotnet-version: | + 6.0.x + 8.0.x + 10.0.x + + - name: Build + run: .\build.ps1 diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index ea520a77..89ad3c95 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -1,10 +1,7 @@ -name: Tests +name: Tests on: - push: - branches: [ develop, main ] - pull_request: - branches: [ develop, main ] + workflow_call: concurrency: group: integration-tests-${{ github.ref }} @@ -12,18 +9,28 @@ concurrency: jobs: tests: - name: Integration Tests (${{ matrix.os }}) + name: ${{ matrix.os }} API-${{ matrix.electronVersion }} runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: + os: [ubuntu-22.04, ubuntu-24.04, windows-2022, windows-2025, macos-14, macos-15-intel, macos-26] + electronVersion: ['30.4.0', '38.2.2'] include: + - os: ubuntu-22.04 + rid: linux-x64 - os: ubuntu-24.04 rid: linux-x64 - os: windows-2022 rid: win-x64 + - os: windows-2025 + rid: win-x64 - os: macos-14 rid: osx-arm64 + - os: macos-15-intel + rid: osx-x64 + - os: macos-26 + rid: osx-arm64 env: DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 @@ -35,6 +42,13 @@ jobs: - name: Checkout uses: actions/checkout@v4 + - name: Random delay (0-20 seconds) + shell: bash + run: | + DELAY=$((RANDOM % 21)) + echo "Waiting for $DELAY seconds..." + sleep $DELAY + - name: Setup .NET uses: actions/setup-dotnet@v4 with: @@ -46,28 +60,30 @@ jobs: node-version: '22' - name: Restore - run: dotnet restore -r ${{ matrix.rid }} -p:RuntimeIdentifier=${{ matrix.rid }} src/ElectronNET.IntegrationTests/ElectronNET.IntegrationTests.csproj + run: dotnet restore -r ${{ matrix.rid }} -p:RuntimeIdentifier=${{ matrix.rid }} -p:ElectronVersion=${{ matrix.electronVersion }} src/ElectronNET.IntegrationTests/ElectronNET.IntegrationTests.csproj - name: Build - run: dotnet build --no-restore -c Release -r ${{ matrix.rid }} -p:RuntimeIdentifier=${{ matrix.rid }} src/ElectronNET.IntegrationTests/ElectronNET.IntegrationTests.csproj + run: dotnet build --no-restore -c Release -r ${{ matrix.rid }} -p:RuntimeIdentifier=${{ matrix.rid }} -p:ElectronVersion=${{ matrix.electronVersion }} src/ElectronNET.IntegrationTests/ElectronNET.IntegrationTests.csproj - name: Install Linux GUI dependencies if: runner.os == 'Linux' run: | set -e sudo apt-get update - # Core Electron dependencies + . /etc/os-release + if [ "$VERSION_ID" = "24.04" ]; then ALSA_PKG=libasound2t64; else ALSA_PKG=libasound2; fi + echo "Using ALSA package: $ALSA_PKG" sudo apt-get install -y xvfb \ - libgtk-3-0 libnss3 libgdk-pixbuf-2.0-0 libdrm2 libgbm1 libxss1 libxtst6 libatk-bridge2.0-0 libatk1.0-0 libatspi2.0-0 libx11-xcb1 libasound2t64 + libgtk-3-0 libnss3 libgdk-pixbuf-2.0-0 libdrm2 libgbm1 libxss1 libxtst6 libatk-bridge2.0-0 libatk1.0-0 libatspi2.0-0 libx11-xcb1 "$ALSA_PKG" - name: Run tests (Linux) if: runner.os == 'Linux' continue-on-error: true run: | - mkdir -p test-results/Ubuntu + mkdir -p test-results xvfb-run -a dotnet test src/ElectronNET.IntegrationTests/ElectronNET.IntegrationTests.csproj \ - -c Release --no-build -r ${{ matrix.rid }} -p:RuntimeIdentifier=${{ matrix.rid }} \ - --logger "trx;LogFileName=Ubuntu.trx" \ + -c Release --no-build -r ${{ matrix.rid }} -p:RuntimeIdentifier=${{ matrix.rid }} -p:ElectronVersion=${{ matrix.electronVersion }} \ + --logger "trx;LogFileName=${{ matrix.os }}-electron-${{ matrix.electronVersion }}.trx" \ --logger "console;verbosity=detailed" \ --results-directory test-results @@ -75,21 +91,21 @@ jobs: if: runner.os == 'Windows' continue-on-error: true run: | - New-Item -ItemType Directory -Force -Path test-results/Windows | Out-Null - dotnet test src/ElectronNET.IntegrationTests/ElectronNET.IntegrationTests.csproj -c Release --no-build -r ${{ matrix.rid }} -p:RuntimeIdentifier=${{ matrix.rid }} --logger "trx;LogFileName=Windows.trx" --logger "console;verbosity=detailed" --results-directory test-results + New-Item -ItemType Directory -Force -Path test-results | Out-Null + dotnet test src/ElectronNET.IntegrationTests/ElectronNET.IntegrationTests.csproj -c Release --no-build -r ${{ matrix.rid }} -p:RuntimeIdentifier=${{ matrix.rid }} -p:ElectronVersion=${{ matrix.electronVersion }} --logger "trx;LogFileName=${{ matrix.os }}-electron-${{ matrix.electronVersion }}.trx" --logger "console;verbosity=detailed" --results-directory test-results - name: Run tests (macOS) if: runner.os == 'macOS' continue-on-error: true run: | - mkdir -p test-results/macOS - dotnet test src/ElectronNET.IntegrationTests/ElectronNET.IntegrationTests.csproj -c Release --no-build -r ${{ matrix.rid }} -p:RuntimeIdentifier=${{ matrix.rid }} --logger "trx;LogFileName=macOS.trx" --logger "console;verbosity=detailed" --results-directory test-results + mkdir -p test-results + dotnet test src/ElectronNET.IntegrationTests/ElectronNET.IntegrationTests.csproj -c Release --no-build -r ${{ matrix.rid }} -p:RuntimeIdentifier=${{ matrix.rid }} -p:ElectronVersion=${{ matrix.electronVersion }} --logger "trx;LogFileName=${{ matrix.os }}-electron-${{ matrix.electronVersion }}.trx" --logger "console;verbosity=detailed" --results-directory test-results - name: Upload raw test results if: always() uses: actions/upload-artifact@v4 with: - name: test-results-${{ matrix.os }} + name: test-results-${{ matrix.os }}-electron-${{ matrix.electronVersion }} path: test-results/*.trx retention-days: 7 @@ -121,7 +137,7 @@ jobs: dotnet new tool-manifest dotnet tool install DotnetCtrfJsonReporter --local - - name: Convert TRX → CTRF and clean names (keep suites; set filePath=OS) + - name: Convert TRX → CTRF and clean names (filePath=OS|Electron X.Y.Z) shell: bash run: | set -euo pipefail @@ -129,28 +145,28 @@ jobs: shopt -s globstar nullglob conv=0 for trx in test-results/**/*.trx; do - fname="$(basename "$trx")" - os="${fname%.trx}" - outdir="ctrf/${os}" + base="$(basename "$trx" .trx)" # e.g. ubuntu-22.04-electron-30.4.0 + os="${base%%-electron-*}" + electron="${base#*-electron-}" + label="$os|Electron $electron" + outdir="ctrf/${label}" mkdir -p "$outdir" out="${outdir}/ctrf-report.json" dotnet tool run DotnetCtrfJsonReporter -p "$trx" -d "$outdir" -f "ctrf-report.json" - jq --arg os "$os" '.results.tests |= map(.filePath = $os)' "$out" > "${out}.tmp" && mv "${out}.tmp" "$out" + jq --arg fp "$label" '.results.tests |= map(.filePath = $fp)' "$out" > "${out}.tmp" && mv "${out}.tmp" "$out" echo "Converted & normalized $trx -> $out" conv=$((conv+1)) done echo "Processed $conv TRX file(s)" - - name: Publish Test Report if: always() uses: ctrf-io/github-test-reporter@v1 with: report-path: 'ctrf/**/*.json' - summary: true pull-request: false status-check: false @@ -163,7 +179,6 @@ jobs: group-by: 'suite' upload-artifact: true fetch-previous-results: true - summary-report: false summary-delta-report: true github-report: true @@ -181,29 +196,25 @@ jobs: flaky-rate-report: true fail-rate-report: false slowest-report: false - report-order: 'summary-delta-report,failed-report,skipped-report,suite-folded-report,file-report,previous-results-report,github-report' env: GITHUB_TOKEN: ${{ github.token }} + - name: Save PR Number + if: github.event_name == 'pull_request' + run: echo "PR_NUMBER=${{ github.event.pull_request.number }}" >> $GITHUB_ENV - - name: Create PR Comment - if: always() - uses: ctrf-io/github-test-reporter@v1 - with: - report-path: 'ctrf/**/*.json' - - summary: true - pull-request: true - use-suite-name: true - update-comment: true - always-group-by: true - overwrite-comment: true - upload-artifact: false + - name: Write PR Number to File + if: github.event_name == 'pull_request' + run: echo "$PR_NUMBER" > pr_number.txt + shell: bash - pull-request-report: true - env: - GITHUB_TOKEN: ${{ github.token }} + - name: Upload PR Number Artifact + if: github.event_name == 'pull_request' + uses: actions/upload-artifact@v4 + with: + name: pr_number + path: pr_number.txt - name: Summary - run: echo "All matrix test jobs completed." \ No newline at end of file + run: echo "All matrix test jobs completed." diff --git a/.github/workflows/pr-comment.yml b/.github/workflows/pr-comment.yml new file mode 100644 index 00000000..23dac1fc --- /dev/null +++ b/.github/workflows/pr-comment.yml @@ -0,0 +1,81 @@ +name: Create PR Comments + +on: + workflow_run: + workflows: [ "PR Validation" ] + types: [completed] + +permissions: + contents: read + actions: read + pull-requests: write + +jobs: + pr-comment: + name: Post Test Result as PR comment + runs-on: ubuntu-24.04 + if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion != 'cancelled' + + steps: + - name: Download CTRF artifact + uses: dawidd6/action-download-artifact@v8 + with: + github_token: ${{ github.token }} + run_id: ${{ github.event.workflow_run.id }} + name: ctrf-report + path: ctrf + + - name: Download PR Number Artifact + uses: dawidd6/action-download-artifact@v8 + with: + github_token: ${{ github.token }} + run_id: ${{ github.event.workflow_run.id }} + name: pr_number + path: pr_number + + - name: Read PR Number + run: | + set -Eeuo pipefail + FILE='pr_number/pr_number.txt' + + # Ensure file exists + if [ ! -f "$FILE" ] || [ -L "$FILE" ]; then + echo "Error: $FILE is missing or is not a regular file." >&2 + exit 1 + fi + + # Chec file size + if [ "$(wc -c < "$FILE" | tr -d ' ')" -gt 200 ]; then + echo "Error: $FILE is too large." >&2 + exit 1 + fi + + # Read first line + PR_NUMBER="" + IFS= read -r PR_NUMBER < "$FILE" || true + + # Validate whether it's a number + if ! [[ "$PR_NUMBER" =~ ^[0-9]{1,10}$ ]]; then + echo "Error: PR_NUMBER is not a valid integer on the first line." >&2 + exit 1 + fi + + printf 'PR_NUMBER=%s\n' "$PR_NUMBER" >> "$GITHUB_ENV" + + - name: Post PR Comment + uses: ctrf-io/github-test-reporter@v1 + with: + report-path: 'ctrf/**/*.json' + issue: ${{ env.PR_NUMBER }} + + summary: true + pull-request: true + use-suite-name: true + update-comment: true + always-group-by: true + overwrite-comment: true + upload-artifact: false + + pull-request-report: true + env: + GITHUB_TOKEN: ${{ github.token }} diff --git a/.github/workflows/retry-test-jobs.yml b/.github/workflows/retry-test-jobs.yml new file mode 100644 index 00000000..1fd0342c --- /dev/null +++ b/.github/workflows/retry-test-jobs.yml @@ -0,0 +1,50 @@ +name: Tests auto-rerun + +on: + workflow_run: + workflows: [ "PR Validation", "Build and Publish" ] + types: [ completed ] + +jobs: + rerun-failed-matrix-jobs-once: + if: > + ${{ + github.event.workflow_run.conclusion == 'failure' && + github.event.workflow_run.run_attempt == 1 + }} + runs-on: ubuntu-24.04 + + permissions: + actions: write + contents: read + + steps: + - name: Decide whether to rerun (only if matrix jobs failed) + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + REPO: ${{ github.repository }} + RUN_ID: ${{ github.event.workflow_run.id }} + run: | + echo "Inspecting jobs of workflow run $RUN_ID in $REPO" + + jobs_json="$(gh api repos/$REPO/actions/runs/$RUN_ID/jobs)" + + echo "Jobs and conclusions:" + echo "$jobs_json" | jq '.jobs[] | {name: .name, conclusion: .conclusion}' + + failed_matrix_jobs=$(echo "$jobs_json" | jq ' + [ .jobs[] + | select(.conclusion == "failure" + and (.name | contains(" API-"))) + ] + | length + ') + + echo "Failed Integration Tests matrix jobs: $failed_matrix_jobs" + + if [ "$failed_matrix_jobs" -gt 0 ]; then + echo "Detected failing Integration Tests jobs – re-running failed jobs for this run." + gh run rerun "$RUN_ID" --failed + else + echo "Only non-matrix jobs (like Test Results) failed – not auto-rerunning." + fi diff --git a/.github/workflows/trailing-whitespace-check.yml b/.github/workflows/trailing-whitespace-check.yml index 299bb98f..9b8c7799 100644 --- a/.github/workflows/trailing-whitespace-check.yml +++ b/.github/workflows/trailing-whitespace-check.yml @@ -1,11 +1,10 @@ -name: Trailing Whitespace Check +name: Whitespace Check on: - pull_request: - types: [opened, synchronize, reopened] + workflow_call: jobs: - check-trailing-whitespace: + check-whitespace: runs-on: ubuntu-latest permissions: contents: read diff --git a/Changelog.md b/Changelog.md index 42934363..2859e7b5 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,25 @@ +# 0.3.0 + +## ElectronNET.Core + +- Updated infrastructure (#937, #939) @softworkz +- Updated all model classes to Electron API 39.2 (#949) @softworkz +- Fixed output path for `electron-builder` (#942) @softworkz +- Fixed floating point display resolution (#944) @softworkz +- Fixed error in case of missing electron-host-hook (#978) +- Fixed previous API break using exposed `JsonElement` objects (#938) @softworkz +- Fixed and improved several test cases (#962) @softworkz +- Fixed startup of Electron.NET from VS Code Debug Adapter (#952) +- Fixed the `BrowserWindowOptions` (#945) @softworkz +- Fixed example for `AutoMenuHide` to reflect platform capabilities (#982) @markatosi +- Added several migration checks for publishing (#966) @softworkz +- Added more test runners for E2E tests (#950, #951) @agracio +- Added dynamic updates for tray menu (#973) @davidroth +- Added matrix tests with 6 runners and 2 electron version (#948) @softworkz +- Added additional APIs for WebContents (#958) @agracio +- Added documentation for MacOS package publish (#983) @markatosi +- Added sample application for `ElectronHostHook` (#967) @adityashirsatrao007 + # 0.2.0 ## ElectronNET.Core diff --git a/README.md b/README.md index 3fb436ba..c264e3be 100644 --- a/README.md +++ b/README.md @@ -14,9 +14,9 @@ Build cross platform desktop applications with .NET 6/8/10 - from console apps t ## Wait - how does that work exactly? -Well... there are lots of different approaches how to get a X-plat desktop app running. Electron.NET provides a range of ways to build .NET based solutions using Electron at the side of presentation. +Well... there are lots of different approaches how to get a X-plat desktop app running. Electron.NET provides a range of ways to build .NET-based solutions using Electron at the side of presentation. -While the classic Electron.NET setup, using an ASP.NET host ran by the Electron side is still the primary way, there's more flexibility now: both, dotnet and Electron are now able to launch the other for better lifetime management, and when you don't need a local web server - like when running content from files or remote servers, you can drop the ASP.NET stack altogether and got with a lightweight console app instead. +While the classic Electron.NET setup (using an ASP.NET host run by the Electron side) is still the primary way, there's more flexibility now. Both .NET and Electron are now able to launch the other for better lifetime management, and when you don't need a local web server (like when running content from files or remote servers), you can drop the ASP.NET stack altogether and go with a lightweight console app instead. ## 📦 NuGet @@ -133,9 +133,10 @@ builder.UseElectron(args, async () => { var options = new BrowserWindowOptions { Show = false, - AutoHideMenuBar = true, IsRunningBlazor = true, // <-- crucial }; + if (OperatingSystem.IsWindows() || OperatingSystem.IsLinux()) + options.AutoHideMenuBar = true; var browserWindow = await Electron.WindowManager.CreateWindowAsync(options); browserWindow.OnReadyToShow += () => browserWindow.Show(); }); @@ -169,7 +170,7 @@ Just press `F5` in Visual Studio or use dotnet for debugging. ## 📔 Usage of the Electron API -A complete documentation is available on the Wiki. +Complete documentation is available on the Wiki. In this YouTube video, we show you how you can create a new project, use the Electron.NET API, debug a application and build an executable desktop app for Windows: [Electron.NET - Getting Started](https://www.youtube.com/watch?v=nuM6AojRFHk) diff --git a/docs/Core/Migration-Checks.md b/docs/Core/Migration-Checks.md new file mode 100644 index 00000000..4464e6b9 --- /dev/null +++ b/docs/Core/Migration-Checks.md @@ -0,0 +1,235 @@ +# Migration Checks + +Electron.NET includes automatic build-time validation checks that help users migrating from previous versions avoid common configuration issues. These checks run automatically during the build process and provide helpful guidance when problems are detected. + +## Overview + +When you build an Electron.NET project, the following validation checks are performed: + +| Code | Check | Description | +|------|-------|-------------| +| [ELECTRON001](#1-packagejson-not-allowed) | package.json not allowed | Ensures no package.json exists outside ElectronHostHook | +| [ELECTRON002](#2-electron-manifestjson-not-allowed) | electron-manifest.json not allowed | Detects deprecated manifest files | +| [ELECTRON003](#3-electron-builderjson-location) | electron-builder.json location | Verifies electron-builder.json exists in Properties folder | +| [ELECTRON004](#3-electron-builderjson-location) | electron-builder.json wrong location | Warns if electron-builder.json is found in incorrect locations | +| [ELECTRON005](#4-parent-paths-not-allowed-in-electron-builderjson) | Parent paths not allowed | Checks for `..` references in config | +| [ELECTRON006](#5-publish-profile-validation) | ASP.NET publish profile mismatch | Warns when ASP.NET projects have console-style profiles | +| [ELECTRON007](#5-publish-profile-validation) | Console publish profile mismatch | Warns when console projects have ASP.NET-style profiles | + +--- + +## 1. package.json not allowed + +**Warning Code:** `ELECTRON001` + +### What is checked + +The build system scans for `package.json` and `package-lock.json` files in your project directory. These files should not exist in the project root or subdirectories (with one exception). + +### Why this matters + +In previous versions of Electron.NET, a `package.json` file was required in the project. The new version generates this file automatically from MSBuild properties defined in your `.csproj` file. + +### Exception + +A `package.json` file **is allowed** in the `ElectronHostHook` folder if you're using custom host hooks. This is the only valid location for a manually maintained package.json. + +### How to fix + +1. **Open your project's `.csproj` file** +2. **Add the required properties** to a PropertyGroup with the label `ElectronNetCommon`: + +```xml + + my-electron-app + My Electron App + 1.0.0 + My awesome Electron.NET application + My Company + Copyright © 2025 + 30.0.9 + +``` + +3. **Delete the old `package.json`** file from your project root + +> **See also:** [Migration Guide](Migration-Guide.md) for complete migration instructions. + +--- + +## 2. electron-manifest.json not allowed + +**Warning Code:** `ELECTRON002` + +### What is checked + +The build system checks for the presence of `electron.manifest.json` or `electron-manifest.json` files in your project. + +### Why this matters + +The `electron.manifest.json` file format is deprecated. All configuration should now be specified using: +- MSBuild properties in your `.csproj` file (for application metadata) +- The `electron-builder.json` file in the `Properties` folder (for build configuration) + +### How to fix + +1. **Migrate application properties** to your `.csproj` file (see [Migration Guide](Migration-Guide.md)) +2. **Move the `build` section** from `electron.manifest.json` to `Properties/electron-builder.json` +3. **Delete the old `electron.manifest.json`** file + +**Example electron-builder.json:** +```json +{ + "compression": "maximum", + "win": { + "icon": "Assets/app.ico", + "target": ["nsis", "portable"] + }, + "linux": { + "icon": "Assets/app.png", + "target": ["AppImage", "deb"] + }, + "mac": { + "icon": "Assets/app.icns", + "target": ["dmg", "zip"] + } +} +``` + +--- + +## 3. electron-builder.json Location + +**Warning Codes:** `ELECTRON003`, `ELECTRON004` + +### What is checked + +- `ELECTRON003`: Verifies that an `electron-builder.json` file exists in the `Properties` folder +- `ELECTRON004`: Warns if `electron-builder.json` is found in incorrect locations + +### Why this matters + +The `electron-builder.json` file must be located in the `Properties` folder so it can be properly copied to the output directory during publishing. + +### How to fix + +1. **Create the Properties folder** if it doesn't exist +2. **Move or create** `electron-builder.json` in `Properties/electron-builder.json` +3. **Remove** any `electron-builder.json` files from other locations + +**Expected structure:** +``` +MyProject/ +├── Properties/ +│ ├── electron-builder.json ✅ Correct location +│ ├── launchSettings.json +│ └── PublishProfiles/ +├── MyProject.csproj +└── Program.cs +``` + +--- + +## 4. Parent paths not allowed in electron-builder.json + +**Warning Code:** `ELECTRON005` + +### What is checked + +The build system scans the `electron-builder.json` file for parent-path references (`..`). + +### Why this matters + +During the publish process, the `electron-builder.json` file is copied to the build output directory. Any relative paths in this file are resolved from that location, not from your project directory. Parent-path references (`../`) will not work correctly because they would point outside the published application. + +### How to fix + +1. **Move resource files** (icons, installers, etc.) inside your project folder structure +2. **Configure the files** to be copied to the output directory in your `.csproj`: + +```xml + + + PreserveNewest + + +``` + +3. **Update paths** in `electron-builder.json` to use relative paths without `..`: + +**Before (incorrect):** +```json +{ + "win": { + "icon": "../SharedAssets/app.ico" + } +} +``` + +**After (correct):** +```json +{ + "win": { + "icon": "Assets/app.ico" + } +} +``` + +--- + +## 5. Publish Profile Validation + +**Warning Codes:** `ELECTRON006`, `ELECTRON007` + +### What is checked + +The build system examines `.pubxml` files in the `Properties/PublishProfiles` folder and validates that they match the project type: + +- **ELECTRON006**: For **ASP.NET projects** (using `Microsoft.NET.Sdk.Web`), checks that publish profiles include `WebPublishMethod`. This property is required for proper ASP.NET publishing. + +- **ELECTRON007**: For **console/other projects** (not using the Web SDK), checks that publish profiles do NOT include the `WebPublishMethod` property. These ASP.NET-specific properties are incorrect for non-web applications. + +### Why this matters + +Electron.NET supports both ASP.NET and console application project types, each requiring different publish profile configurations: + +| Project Type | SDK | Expected Properties | +|--------------|-----|---------------------| +| ASP.NET (Razor Pages, MVC, Blazor) | `Microsoft.NET.Sdk.Web` | `WebPublishMethod`, no `PublishProtocol` | +| Console Application | `Microsoft.NET.Sdk` | `PublishProtocol`, no `WebPublishMethod` | + +Using the wrong publish profile type can lead to incomplete or broken builds. + +### How to fix + +1. **Delete existing publish profiles** from `Properties/PublishProfiles/` +2. **Create new publish profiles** using the Visual Studio Publishing Wizard: + - Right-click on the project in Solution Explorer + - Select **Publish...** + - Follow the wizard to create a **Folder** publish profile + +For correct publish profile examples for both ASP.NET and Console applications, see **[Package Building](../Using/Package-Building.md#step-1-create-publish-profiles)**. + +--- + +## Disabling Migration Checks + +If you need to disable specific migration checks (not recommended), you can set the following properties in your `.csproj` file: + +```xml + + + true + +``` + +> ⚠️ **Warning:** Disabling migration checks may result in build or runtime errors. Only disable checks if you fully understand the implications. + +--- + +## See Also + +- [Migration Guide](Migration-Guide.md) - Complete step-by-step migration instructions +- [Advanced Migration Topics](Advanced-Migration-Topics.md) - Complex migration scenarios +- [Configuration](../Using/Configuration.md) - Project configuration options +- [Package Building](../Using/Package-Building.md) - Building distributable packages diff --git a/docs/GettingStarted/Console-App.md b/docs/GettingStarted/Console-App.md index 4a006713..1659e392 100644 --- a/docs/GettingStarted/Console-App.md +++ b/docs/GettingStarted/Console-App.md @@ -54,7 +54,7 @@ Add the Electron.NET configuration to your `.csproj` file: - + ``` diff --git a/docs/Using/Package-Building.md b/docs/Using/Package-Building.md index 28385959..6b6325e5 100644 --- a/docs/Using/Package-Building.md +++ b/docs/Using/Package-Building.md @@ -26,12 +26,15 @@ Add publish profiles to `Properties/PublishProfiles/`: Release Any CPU - publish\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\ - FileSystem + true + FileSystem + publish\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\ + FileSystem + <_TargetId>Folder net10.0 win-x64 + 48eff821-2f4d-60cc-aa44-be0f1d6e5f35 true - false ``` @@ -46,12 +49,61 @@ Add publish profiles to `Properties/PublishProfiles/`: Release Any CPU - publish\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\ - FileSystem + true + FileSystem + publish\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\ + FileSystem + <_TargetId>Folder net10.0 linux-x64 + 48eff821-2f4d-60cc-aa44-be0f1d6e5f35 + true + + +``` + +#### ASP.NET Application Profile (macOS Apple Silicon ARM64) + +**osx-arm64.pubxml:** + +```xml + + + + Release + Any CPU + true + FileSystem + publish\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\ + FileSystem + <_TargetId>Folder + net10.0 + osx-arm64 + 48eff821-2f4d-60cc-aa44-be0f1d6e5f35 + true + + +``` + +#### ASP.NET Application Profile (macOS Intel x64) + +**osx-x64.pubxml:** + +```xml + + + + Release + Any CPU + true + FileSystem + publish\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\ + FileSystem + <_TargetId>Folder + net10.0 + osx-x64 + 48eff821-2f4d-60cc-aa44-be0f1d6e5f35 true - false ``` @@ -97,6 +149,46 @@ Add publish profiles to `Properties/PublishProfiles/`: ``` +#### Console Application Profile (macOS Apple Silicon ARM64) + +**osx-arm64.pubxml:** + +```xml + + + + Release + Any CPU + publish\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\ + FileSystem + net10.0 + osx-arm64 + false + false + + +``` + +#### Console Application Profile (macOS Intel x64) + +**osx-x64.pubxml:** + +```xml + + + + Release + Any CPU + publish\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\ + FileSystem + net10.0 + osx-x64 + false + false + + +``` + ### Step 2: Configure Electron Builder ElectronNET.Core automatically adds a default `electron-builder.json` file under `Properties\electron-builder.json`. diff --git a/docs/_Sidebar.md b/docs/_Sidebar.md index b76d5afd..487f547f 100644 --- a/docs/_Sidebar.md +++ b/docs/_Sidebar.md @@ -9,6 +9,7 @@ - [What's new?](Core/What's-New.md) - [Migration Guide](Core/Migration-Guide.md) +- [Migration Checks](Core/Migration-Checks.md) - [Advanced Migration](Core/Advanced-Migration-Topics.md) # Getting Started diff --git a/nuke/_build.csproj b/nuke/_build.csproj index 78e4653a..47ebb0a1 100644 --- a/nuke/_build.csproj +++ b/nuke/_build.csproj @@ -2,7 +2,7 @@ Exe - net8.0 + net10.0 CS0649;CS0169 .. @@ -11,9 +11,9 @@ - - - + + + diff --git a/src/ElectronNET.API/API/ApiBase.cs b/src/ElectronNET.API/API/ApiBase.cs index 95231fe1..96f68313 100644 --- a/src/ElectronNET.API/API/ApiBase.cs +++ b/src/ElectronNET.API/API/ApiBase.cs @@ -31,7 +31,7 @@ protected enum SocketEventNameTypes CamelCase, } - private const int InvocationTimeout = 1000; + private static readonly TimeSpan InvocationTimeout = 1000.ms(); private readonly string objectName; private readonly ConcurrentDictionary invocators; @@ -116,6 +116,11 @@ protected void CallMethod3(object val1, object val2, object val3, [CallerMemberN } protected Task InvokeAsync(object arg = null, [CallerMemberName] string callerName = null) + { + return this.InvokeAsyncWithTimeout(InvocationTimeout, arg, callerName); + } + + protected Task InvokeAsyncWithTimeout(TimeSpan invocationTimeout, object arg = null, [CallerMemberName] string callerName = null) { Debug.Assert(callerName != null, nameof(callerName) + " != null"); @@ -123,7 +128,7 @@ protected Task InvokeAsync(object arg = null, [CallerMemberName] string ca { return this.invocators.GetOrAdd(callerName, _ => { - var getter = new Invocator(this, callerName, InvocationTimeout, arg); + var getter = new Invocator(this, callerName, invocationTimeout, arg); getter.Task().ContinueWith(_ => { @@ -240,7 +245,7 @@ internal class Invocator : Invocator private readonly Task tcsTask; private TaskCompletionSource tcs; - public Invocator(ApiBase apiBase, string callerName, int timeoutMs, object arg = null) + public Invocator(ApiBase apiBase, string callerName, TimeSpan timeout, object arg = null) { this.tcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); this.tcsTask = this.tcs.Task; @@ -301,7 +306,7 @@ public Invocator(ApiBase apiBase, string callerName, int timeoutMs, object arg = _ = apiBase.Id >= 0 ? BridgeConnector.Socket.Emit(messageName, apiBase.Id) : BridgeConnector.Socket.Emit(messageName); } - System.Threading.Tasks.Task.Delay(InvocationTimeout).ContinueWith(_ => + System.Threading.Tasks.Task.Delay(timeout).ContinueWith(_ => { if (this.tcs != null) { @@ -309,7 +314,7 @@ public Invocator(ApiBase apiBase, string callerName, int timeoutMs, object arg = { if (this.tcs != null) { - var ex = new TimeoutException($"No response after {timeoutMs:D}ms trying to retrieve value {apiBase.objectName}.{callerName}()"); + var ex = new TimeoutException($"No response after {timeout:D}ms trying to retrieve value {apiBase.objectName}.{callerName}()"); this.tcs.TrySetException(ex); this.tcs = null; } diff --git a/src/ElectronNET.API/API/App.cs b/src/ElectronNET.API/API/App.cs index c486f90a..a1843031 100644 --- a/src/ElectronNET.API/API/App.cs +++ b/src/ElectronNET.API/API/App.cs @@ -539,7 +539,7 @@ public async Task GetPathAsync(PathName pathName, CancellationToken canc using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled())) { BridgeConnector.Socket.Once("appGetPathCompleted", taskCompletionSource.SetResult); - BridgeConnector.Socket.Emit("appGetPath", pathName.GetDescription()); + BridgeConnector.Socket.Emit("appGetPath", pathName); return await taskCompletionSource.Task .ConfigureAwait(false); @@ -560,7 +560,7 @@ public async Task GetPathAsync(PathName pathName, CancellationToken canc /// public void SetPath(PathName name, string path) { - this.CallMethod2(name.GetDescription(), path); + this.CallMethod2(name, path); } /// diff --git a/src/ElectronNET.API/API/BrowserWindow.cs b/src/ElectronNET.API/API/BrowserWindow.cs index bd60b77d..bc863988 100644 --- a/src/ElectronNET.API/API/BrowserWindow.cs +++ b/src/ElectronNET.API/API/BrowserWindow.cs @@ -681,7 +681,7 @@ public void SetAspectRatio(int aspectRatio, Size extraSize) => /// Values include normal, floating, torn-off-menu, modal-panel, main-menu, /// status, pop-up-menu and screen-saver. The default is floating. /// See the macOS docs - public void SetAlwaysOnTop(bool flag, OnTopLevel level) => this.CallMethod2(flag, level.GetDescription()); + public void SetAlwaysOnTop(bool flag, OnTopLevel level) => this.CallMethod2(flag, level); /// /// Sets whether the window should show always on top of other windows. @@ -694,7 +694,7 @@ public void SetAspectRatio(int aspectRatio, Size extraSize) => /// See the macOS docs /// The number of layers higher to set this window relative to the given level. /// The default is 0. Note that Apple discourages setting levels higher than 1 above screen-saver. - public void SetAlwaysOnTop(bool flag, OnTopLevel level, int relativeLevel) => this.CallMethod3(flag, level.GetDescription(), relativeLevel); + public void SetAlwaysOnTop(bool flag, OnTopLevel level, int relativeLevel) => this.CallMethod3(flag, level, relativeLevel); /// /// Whether the window is always on top of other windows. @@ -1190,7 +1190,7 @@ public async Task> GetChildWindowsAsync() /// menu, popover, sidebar, medium-light or ultra-dark. /// See the macOS documentation for more details. [SupportedOSPlatform("macOS")] - public void SetVibrancy(Vibrancy type) => this.CallMethod1(type.GetDescription()); + public void SetVibrancy(Vibrancy type) => this.CallMethod1(type); /// /// Render and control web pages. diff --git a/src/ElectronNET.API/API/Dialog.cs b/src/ElectronNET.API/API/Dialog.cs index 21816463..3b9739d5 100644 --- a/src/ElectronNET.API/API/Dialog.cs +++ b/src/ElectronNET.API/API/Dialog.cs @@ -206,10 +206,10 @@ public Task ShowCertificateTrustDialogAsync(CertificateTrustDialogOptions option [SupportedOSPlatform("Windows")] public Task ShowCertificateTrustDialogAsync(BrowserWindow browserWindow, CertificateTrustDialogOptions options) { - var tcs = new TaskCompletionSource(); + var tcs = new TaskCompletionSource(); string guid = Guid.NewGuid().ToString(); - BridgeConnector.Socket.Once("showCertificateTrustDialogComplete" + guid, () => tcs.SetResult(null)); + BridgeConnector.Socket.Once("showCertificateTrustDialogComplete" + guid, () => tcs.SetResult()); BridgeConnector.Socket.Emit("showCertificateTrustDialog", browserWindow, options, diff --git a/src/ElectronNET.API/API/Dock.cs b/src/ElectronNET.API/API/Dock.cs index 1186d37a..e2577595 100644 --- a/src/ElectronNET.API/API/Dock.cs +++ b/src/ElectronNET.API/API/Dock.cs @@ -57,7 +57,7 @@ public async Task BounceAsync(DockBounceType type, CancellationToken cancel using (cancellationToken.Register(() => tcs.TrySetCanceled())) { BridgeConnector.Socket.Once("dock-bounce-completed", tcs.SetResult); - BridgeConnector.Socket.Emit("dock-bounce", type.GetDescription()); + BridgeConnector.Socket.Emit("dock-bounce", type); return await tcs.Task .ConfigureAwait(false); diff --git a/src/ElectronNET.API/API/Entities/AboutPanelOptions.cs b/src/ElectronNET.API/API/Entities/AboutPanelOptions.cs index 90aeb869..03bef1b6 100644 --- a/src/ElectronNET.API/API/Entities/AboutPanelOptions.cs +++ b/src/ElectronNET.API/API/Entities/AboutPanelOptions.cs @@ -1,8 +1,11 @@ -namespace ElectronNET.API.Entities +using System.Runtime.Versioning; + +namespace ElectronNET.API.Entities { /// /// About panel options. /// + /// Up-to-date with Electron API 39.2 public class AboutPanelOptions { /// @@ -21,28 +24,35 @@ public class AboutPanelOptions public string Copyright { get; set; } /// - /// The app's build version number. + /// The app's build version number (macOS). /// + [SupportedOSPlatform("macos")] public string Version { get; set; } /// - /// Credit information. + /// Credit information (macOS, Windows). /// + [SupportedOSPlatform("macos")] + [SupportedOSPlatform("windows")] public string Credits { get; set; } /// - /// List of app authors. + /// List of app authors (Linux). /// + [SupportedOSPlatform("linux")] public string[] Authors { get; set; } /// - /// The app's website. + /// The app's website (Linux). /// + [SupportedOSPlatform("linux")] public string Website { get; set; } /// - /// Path to the app's icon. On Linux, will be shown as 64x64 pixels while retaining aspect ratio. + /// Path to the app's icon in a JPEG or PNG file format. On Linux, will be shown as 64x64 pixels while retaining aspect ratio. On Windows, a 48x48 PNG will result in the best visual quality. /// + [SupportedOSPlatform("linux")] + [SupportedOSPlatform("windows")] public string IconPath { get; set; } } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/AddRepresentationOptions.cs b/src/ElectronNET.API/API/Entities/AddRepresentationOptions.cs index 96da0cb9..40338f0c 100644 --- a/src/ElectronNET.API/API/Entities/AddRepresentationOptions.cs +++ b/src/ElectronNET.API/API/Entities/AddRepresentationOptions.cs @@ -1,32 +1,35 @@ +using System.Text.Json.Serialization; + namespace ElectronNET.API.Entities { /// /// /// + /// Up-to-date with Electron API 39.2 public class AddRepresentationOptions { /// - /// Gets or sets the width + /// Gets or sets the width in pixels. Defaults to 0. Required if a bitmap buffer is specified as . /// public int? Width { get; set; } /// - /// Gets or sets the height + /// Gets or sets the height in pixels. Defaults to 0. Required if a bitmap buffer is specified as . /// public int? Height { get; set; } /// - /// Gets or sets the scalefactor + /// Gets or sets the image scale factor. Defaults to 1.0. /// public float ScaleFactor { get; set; } = 1.0f; /// - /// Gets or sets the buffer + /// Gets or sets the buffer containing the raw image data. /// public byte[] Buffer { get; set; } /// - /// Gets or sets the dataURL + /// Gets or sets the data URL containing a base 64 encoded PNG or JPEG image. /// public string DataUrl { get; set; } } diff --git a/src/ElectronNET.API/API/Entities/AppDetailsOptions.cs b/src/ElectronNET.API/API/Entities/AppDetailsOptions.cs index 55a92e91..bf2f12c6 100644 --- a/src/ElectronNET.API/API/Entities/AppDetailsOptions.cs +++ b/src/ElectronNET.API/API/Entities/AppDetailsOptions.cs @@ -1,32 +1,36 @@ -namespace ElectronNET.API.Entities +using System.Runtime.Versioning; + +namespace ElectronNET.API.Entities { /// /// /// + /// Up-to-date with Electron API 39.2 + [SupportedOSPlatform("windows")] public class AppDetailsOptions { /// - /// Window’s App User Model ID. It has to be set, otherwise the other options will have no effect. + /// Window's App User Model ID. It has to be set, otherwise the other options will have no effect. /// public string AppId { get; set; } /// - /// Window’s Relaunch Icon. + /// Window's relaunch icon resource path. /// public string AppIconPath { get; set; } /// - /// Index of the icon in appIconPath. Ignored when appIconPath is not set. Default is 0. + /// Index of the icon in . Ignored when is not set. Default is 0. /// public int AppIconIndex { get; set; } /// - /// Window’s Relaunch Command. + /// Window's relaunch command. /// public string RelaunchCommand { get; set; } /// - /// Window’s Relaunch Display Name. + /// Window's relaunch display name. /// public string RelaunchDisplayName { get; set; } } diff --git a/src/ElectronNET.API/API/Entities/AutoResizeOptions.cs b/src/ElectronNET.API/API/Entities/AutoResizeOptions.cs index e4b350d2..2244a7d4 100644 --- a/src/ElectronNET.API/API/Entities/AutoResizeOptions.cs +++ b/src/ElectronNET.API/API/Entities/AutoResizeOptions.cs @@ -5,6 +5,7 @@ namespace ElectronNET.API.Entities /// /// /// + /// Up-to-date with Electron API 39.2 public class AutoResizeOptions { /// diff --git a/src/ElectronNET.API/API/Entities/BitmapOptions.cs b/src/ElectronNET.API/API/Entities/BitmapOptions.cs index 6c7a463b..07d0c0ba 100644 --- a/src/ElectronNET.API/API/Entities/BitmapOptions.cs +++ b/src/ElectronNET.API/API/Entities/BitmapOptions.cs @@ -3,10 +3,11 @@ /// /// /// + /// Up-to-date with Electron API 39.2 public class BitmapOptions { /// - /// Gets or sets the scale factor + /// The image scale factor. Defaults to 1.0. /// public float ScaleFactor { get; set; } = 1.0f; } diff --git a/src/ElectronNET.API/API/Entities/Blob.cs b/src/ElectronNET.API/API/Entities/Blob.cs index e1a81b0d..3c7e3e81 100644 --- a/src/ElectronNET.API/API/Entities/Blob.cs +++ b/src/ElectronNET.API/API/Entities/Blob.cs @@ -3,6 +3,7 @@ /// /// /// + /// Up-to-date with Electron API 39.2 public class Blob : IPostData { /// diff --git a/src/ElectronNET.API/API/Entities/BrowserViewConstructorOptions.cs b/src/ElectronNET.API/API/Entities/BrowserViewConstructorOptions.cs index f9eb8ef3..346de4b6 100644 --- a/src/ElectronNET.API/API/Entities/BrowserViewConstructorOptions.cs +++ b/src/ElectronNET.API/API/Entities/BrowserViewConstructorOptions.cs @@ -3,23 +3,26 @@ /// /// /// + /// Up-to-date with Electron API 39.2 public class BrowserViewConstructorOptions { /// - /// See BrowserWindow. + /// Gets or sets the web preferences for the view (see WebPreferences). /// public WebPreferences WebPreferences { get; set; } /// - /// A proxy to set on creation in the format host:port. + /// Gets or sets a proxy to use on creation in the format host:port. /// The proxy can be alternatively set using the BrowserView.WebContents.SetProxyAsync function. /// + /// This is custom shortcut. Not part of the Electron API. public string Proxy { get; set; } /// - /// The credentials of the Proxy in the format username:password. + /// Gets or sets the credentials of the proxy in the format username:password. /// These will only be used if the Proxy field is also set. /// + /// This is custom shortcut. Not part of the Electron API. public string ProxyCredentials { get; set; } } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/BrowserWindowOptions.cs b/src/ElectronNET.API/API/Entities/BrowserWindowOptions.cs index 9b1e1fd8..dec474e0 100644 --- a/src/ElectronNET.API/API/Entities/BrowserWindowOptions.cs +++ b/src/ElectronNET.API/API/Entities/BrowserWindowOptions.cs @@ -1,6 +1,7 @@ using ElectronNET.Converter; using System.ComponentModel; using System.Text.Json.Serialization; +using System.Runtime.Versioning; namespace ElectronNET.API.Entities { @@ -72,24 +73,32 @@ public class BrowserWindowOptions /// /// Whether window is movable. This is not implemented on Linux. Default is true. /// + [SupportedOSPlatform("macos")] + [SupportedOSPlatform("windows")] [DefaultValue(true)] public bool Movable { get; set; } = true; /// /// Whether window is minimizable. This is not implemented on Linux. Default is true. /// + [SupportedOSPlatform("macos")] + [SupportedOSPlatform("windows")] [DefaultValue(true)] public bool Minimizable { get; set; } = true; /// /// Whether window is maximizable. This is not implemented on Linux. Default is true. /// + [SupportedOSPlatform("macos")] + [SupportedOSPlatform("windows")] [DefaultValue(true)] public bool Maximizable { get; set; } = true; /// /// Whether window is closable. This is not implemented on Linux. Default is true. /// + [SupportedOSPlatform("macos")] + [SupportedOSPlatform("windows")] [DefaultValue(true)] public bool Closable { get; set; } = true; @@ -115,14 +124,17 @@ public class BrowserWindowOptions /// /// Whether the window can be put into fullscreen mode. On macOS, also whether the - /// maximize/zoom button should toggle full screen mode or maximize window.Default - /// is true. + /// maximize/zoom button should toggle full screen mode or maximize window. Default + /// is true (Electron default). /// - public bool Fullscreenable { get; set; } + [DefaultValue(true)] + public bool Fullscreenable { get; set; } = true; // FIX: previously defaulted to false in C# /// /// Whether to show the window in taskbar. Default is false. /// + [SupportedOSPlatform("macos")] + [SupportedOSPlatform("windows")] public bool SkipTaskbar { get; set; } /// @@ -141,8 +153,7 @@ public class BrowserWindowOptions public string Title { get; set; } = "Electron.NET"; /// - /// The window icon. On Windows it is recommended to use ICO icons to get best - /// visual effects, you can also leave it undefined so the executable's icon will be used. + /// The window icon. Can be a NativeImage or a string path. On Windows it is recommended to use ICO icons; when undefined, the executable's icon will be used. /// public string Icon { get; set; } @@ -153,7 +164,7 @@ public class BrowserWindowOptions public bool Show { get; set; } = true; /// - /// Specify false to create a . Default is true. + /// Specify false to create a frameless window. Default is true. /// [DefaultValue(true)] public bool Frame { get; set; } = true; @@ -168,6 +179,7 @@ public class BrowserWindowOptions /// Whether the web view accepts a single mouse-down event that simultaneously /// activates the window.Default is false. /// + [SupportedOSPlatform("macos")] public bool AcceptFirstMouse { get; set; } /// @@ -178,28 +190,35 @@ public class BrowserWindowOptions /// /// Auto hide the menu bar unless the Alt key is pressed. Default is false. /// + [SupportedOSPlatform("windows")] + [SupportedOSPlatform("linux")] public bool AutoHideMenuBar { get; set; } /// /// Enable the window to be resized larger than screen. Default is false. /// + [SupportedOSPlatform("macos")] public bool EnableLargerThanScreen { get; set; } /// - /// Window's background color as Hexadecimal value, like #66CD00 or #FFF or - /// #80FFFFFF (alpha is supported). Default is #FFF (white). + /// The window's background color in Hex, RGB, RGBA, HSL, HSLA or named CSS color format. Alpha in #AARRGGBB format is supported if transparent is set to true. Default is #FFF (white). /// public string BackgroundColor { get; set; } /// - /// Whether window should have a shadow. This is only implemented on macOS. Default - /// is true. + /// Initial opacity of the window, between 0.0 (fully transparent) and 1.0 (fully opaque). Only implemented on Windows and macOS. + /// + [SupportedOSPlatform("windows")] + [SupportedOSPlatform("macos")] + public double? Opacity { get; set; } + + /// + /// Whether window should have a shadow. Default is true. /// public bool HasShadow { get; set; } /// - /// Forces using dark theme for the window, only works on some GTK+3 desktop - /// environments.Default is false. + /// Forces using dark theme for the window, only works on some GTK+3 desktop environments. Default is false. /// public bool DarkTheme { get; set; } @@ -219,6 +238,12 @@ public class BrowserWindowOptions /// public TitleBarStyle TitleBarStyle { get; set; } + /// + /// Set a custom position for the traffic light buttons in frameless windows (macOS). + /// + [SupportedOSPlatform("macos")] + public Point TrafficLightPosition { get; set; } + /// /// Configures the window's title bar overlay when using a frameless window. /// Can be either: @@ -232,9 +257,9 @@ public class BrowserWindowOptions public TitleBarOverlay TitleBarOverlay { get; set; } /// - /// Shows the title in the tile bar in full screen mode on macOS for all - /// titleBarStyle options.Default is false. + /// Shows the title in the title bar in full screen mode on macOS for all titleBarStyle options. Default is false. /// + /// Not documented by MCP base-window-options / browser-window-options. public bool FullscreenWindowTitle { get; set; } /// @@ -242,6 +267,7 @@ public class BrowserWindowOptions /// window frame.Setting it to false will remove window shadow and window /// animations. Default is true. /// + [SupportedOSPlatform("windows")] [DefaultValue(true)] public bool ThickFrame { get; set; } = true; @@ -251,14 +277,17 @@ public class BrowserWindowOptions /// Windows versions older than Windows 11 Build 22000 this property has no effect, and /// frameless windows will not have rounded corners. /// + [SupportedOSPlatform("macos")] + [SupportedOSPlatform("windows")] [DefaultValue(true)] public bool RoundedCorners { get; set; } = true; /// /// Add a type of vibrancy effect to the window, only on macOS. Can be - /// appearance-based, light, dark, titlebar, selection, menu, popover, sidebar, - /// medium-light or ultra-dark. + /// appearance-based, titlebar, selection, menu, popover, sidebar, header, sheet, + /// window, hud, fullscreen-ui, tooltip, content, under-window, or under-page. /// + [SupportedOSPlatform("macos")] public Vibrancy Vibrancy { get; set; } /// @@ -268,6 +297,7 @@ public class BrowserWindowOptions /// it to zoom to the width of the screen.This will also affect the behavior when /// calling maximize() directly.Default is false. /// + [SupportedOSPlatform("macos")] public bool ZoomToPageWidth { get; set; } /// @@ -276,6 +306,7 @@ public class BrowserWindowOptions /// adds a native new tab button to your window's tab bar and allows your app and /// window to receive the new-window-for-tab event. /// + [SupportedOSPlatform("macos")] public string TabbingIdentifier { get; set; } /// @@ -287,12 +318,39 @@ public class BrowserWindowOptions /// A proxy to set on creation in the format host:port. /// The proxy can be alternatively set using the BrowserWindow.WebContents.SetProxyAsync function. /// + /// Not documented by MCP base-window-options / browser-window-options. public string Proxy { get; set; } /// /// The credentials of the Proxy in the format username:password. /// These will only be used if the Proxy field is also set. /// + /// Not documented by MCP base-window-options / browser-window-options. public string ProxyCredentials { get; set; } + + /// + /// Gets or sets whether to use pre-Lion fullscreen on macOS. Default is false. + /// + [SupportedOSPlatform("macos")] + public bool SimpleFullscreen { get; set; } + + /// + /// Gets or sets whether the window should be hidden when the user toggles into mission control (macOS). + /// + [SupportedOSPlatform("macos")] + public bool HiddenInMissionControl { get; set; } + + /// + /// Gets or sets how the material appearance should reflect window activity state on macOS. Must be used with the vibrancy property. + /// Possible values: 'followWindow' (default), 'active', 'inactive'. + /// + [SupportedOSPlatform("macos")] + public string VisualEffectState { get; set; } + + /// + /// Gets or sets the system-drawn background material on Windows. Can be 'auto', 'none', 'mica', 'acrylic' or 'tabbed'. + /// + [SupportedOSPlatform("windows")] + public string BackgroundMaterial { get; set; } } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/CPUUsage.cs b/src/ElectronNET.API/API/Entities/CPUUsage.cs index acd4746f..c21d133e 100644 --- a/src/ElectronNET.API/API/Entities/CPUUsage.cs +++ b/src/ElectronNET.API/API/Entities/CPUUsage.cs @@ -3,6 +3,7 @@ /// /// /// + /// Up-to-date with Electron API 39.2 public class CPUUsage { /// @@ -11,9 +12,14 @@ public class CPUUsage public double PercentCPUUsage { get; set; } /// - /// The number of average idle cpu wakeups per second since the last call to - /// getCPUUsage.First call returns 0. + /// Total seconds of CPU time used since process startup, if available. /// - public int IdleWakeupsPerSecond { get; set; } + public double? CumulativeCPUUsage { get; set; } + + /// + /// The number of average idle CPU wakeups per second since the last call to + /// getCPUUsage. First call returns 0. Will always return 0 on Windows. + /// + public double IdleWakeupsPerSecond { get; set; } } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/Certificate.cs b/src/ElectronNET.API/API/Entities/Certificate.cs index 646c126f..937b4153 100644 --- a/src/ElectronNET.API/API/Entities/Certificate.cs +++ b/src/ElectronNET.API/API/Entities/Certificate.cs @@ -3,6 +3,7 @@ /// /// /// + /// Up-to-date with Electron API 39.2 public class Certificate { /// diff --git a/src/ElectronNET.API/API/Entities/CertificatePrincipal.cs b/src/ElectronNET.API/API/Entities/CertificatePrincipal.cs index 0b1245af..8b1b6b27 100644 --- a/src/ElectronNET.API/API/Entities/CertificatePrincipal.cs +++ b/src/ElectronNET.API/API/Entities/CertificatePrincipal.cs @@ -3,6 +3,7 @@ /// /// /// + /// Up-to-date with Electron API 39.2 public class CertificatePrincipal { /// diff --git a/src/ElectronNET.API/API/Entities/CertificateTrustDialogOptions.cs b/src/ElectronNET.API/API/Entities/CertificateTrustDialogOptions.cs index 9a3bfda9..04b0eab2 100644 --- a/src/ElectronNET.API/API/Entities/CertificateTrustDialogOptions.cs +++ b/src/ElectronNET.API/API/Entities/CertificateTrustDialogOptions.cs @@ -3,6 +3,7 @@ /// /// /// + /// Up-to-date with Electron API 39.2 public class CertificateTrustDialogOptions { /// diff --git a/src/ElectronNET.API/API/Entities/ChromeExtensionInfo.cs b/src/ElectronNET.API/API/Entities/ChromeExtensionInfo.cs index 36115a9f..b3d5e0a6 100644 --- a/src/ElectronNET.API/API/Entities/ChromeExtensionInfo.cs +++ b/src/ElectronNET.API/API/Entities/ChromeExtensionInfo.cs @@ -3,6 +3,7 @@ /// /// Provide metadata about the current loaded Chrome extension /// + /// Project-specific: no matching Electron structure found in MCP docs (electronjs). public class ChromeExtensionInfo { /// diff --git a/src/ElectronNET.API/API/Entities/ClearStorageDataOptions.cs b/src/ElectronNET.API/API/Entities/ClearStorageDataOptions.cs index d3940e7f..cf455e14 100644 --- a/src/ElectronNET.API/API/Entities/ClearStorageDataOptions.cs +++ b/src/ElectronNET.API/API/Entities/ClearStorageDataOptions.cs @@ -3,6 +3,7 @@ /// /// /// + /// Up-to-date with Electron API 39.2 public class ClearStorageDataOptions { /// @@ -11,13 +12,16 @@ public class ClearStorageDataOptions public string Origin { get; set; } /// - /// The types of storages to clear, can contain: appcache, cookies, filesystem, - /// indexdb, localstorage, shadercache, websql, serviceworkers, cachestorage. + /// The types of storages to clear. Can contain: cookies, filesystem, indexdb, + /// localstorage, shadercache, websql, serviceworkers, cachestorage. + /// If not specified, all storage types are cleared. /// public string[] Storages { get; set; } /// - /// The types of quotas to clear, can contain: temporary, persistent, syncable. + /// The types of quotas to clear. Can contain: temporary. If not specified, + /// all quotas are cleared. The quotas option is deprecated; + /// "temporary" is the only remaining supported quota type. /// public string[] Quotas { get; set; } } diff --git a/src/ElectronNET.API/API/Entities/Cookie.cs b/src/ElectronNET.API/API/Entities/Cookie.cs index d9b9b278..815c2865 100644 --- a/src/ElectronNET.API/API/Entities/Cookie.cs +++ b/src/ElectronNET.API/API/Entities/Cookie.cs @@ -1,53 +1,59 @@ namespace ElectronNET.API.Entities { /// - /// + /// Cookie structure as used by Electron session.cookies APIs. /// + /// Up-to-date with Electron API 39.2 public class Cookie { /// - /// The name of the cookie. + /// Gets or sets the name of the cookie. /// public string Name { get; set; } /// - /// The value of the cookie. + /// Gets or sets the value of the cookie. /// public string Value { get; set; } /// - /// (optional) - The domain of the cookie; this will be normalized with a preceding dot so that it's also valid for subdomains. + /// Gets or sets the domain of the cookie; this will be normalized with a preceding dot so that it's also valid for subdomains. /// public string Domain { get; set; } /// - /// (optional) - Whether the cookie is a host-only cookie; this will only be true if no domain was passed. + /// Gets or sets a value indicating whether the cookie is a host-only cookie; this will only be true if no domain was passed. /// public bool HostOnly { get; set; } /// - /// (optional) - The path of the cookie. + /// Gets or sets the path of the cookie. /// public string Path { get; set; } /// - /// (optional) - Whether the cookie is marked as secure. + /// Gets or sets a value indicating whether the cookie is marked as secure. /// public bool Secure { get; set; } /// - /// (optional) - Whether the cookie is marked as HTTP only. + /// Gets or sets a value indicating whether the cookie is marked as HTTP only. /// public bool HttpOnly { get; set; } /// - /// (optional) - Whether the cookie is a session cookie or a persistent cookie with an expiration date. + /// Gets or sets a value indicating whether the cookie is a session cookie or a persistent cookie with an expiration date. /// public bool Session { get; set; } /// - /// (optional) - The expiration date of the cookie as the number of seconds since the UNIX epoch. Not provided for session cookies. + /// Gets or sets the expiration date of the cookie as the number of seconds since the UNIX epoch. Not provided for session cookies. /// - public long ExpirationDate { get; set; } + public double ExpirationDate { get; set; } + + /// + /// Gets or sets the SameSite policy applied to this cookie. Can be "unspecified", "no_restriction", "lax" or "strict". + /// + public string SameSite { get; set; } } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/CookieChangedCause.cs b/src/ElectronNET.API/API/Entities/CookieChangedCause.cs index ae1a42db..fd65bfd4 100644 --- a/src/ElectronNET.API/API/Entities/CookieChangedCause.cs +++ b/src/ElectronNET.API/API/Entities/CookieChangedCause.cs @@ -1,16 +1,15 @@ -using System.Text.Json.Serialization; - namespace ElectronNET.API.Entities { + using System.Text.Json.Serialization; + /// - /// The cause of the change + /// The cause of the cookie change (per Electron Cookies 'changed' event). /// public enum CookieChangedCause { /// - ///The cookie was changed directly by a consumer's action. + /// The cookie was changed directly by a consumer's action. /// - [JsonPropertyName("explicit")] @explicit, /// @@ -19,17 +18,17 @@ public enum CookieChangedCause overwrite, /// - /// The cookie was automatically removed as it expired. + /// The cookie was automatically removed as it expired. /// expired, /// - /// The cookie was automatically evicted during garbage collection. + /// The cookie was automatically evicted during garbage collection. /// evicted, /// - /// The cookie was overwritten with an already-expired expiration date. + /// The cookie was overwritten with an already-expired expiration date. /// [JsonPropertyName("expired_overwrite")] expiredOverwrite diff --git a/src/ElectronNET.API/API/Entities/CookieDetails.cs b/src/ElectronNET.API/API/Entities/CookieDetails.cs index 389e8ce5..260edb98 100644 --- a/src/ElectronNET.API/API/Entities/CookieDetails.cs +++ b/src/ElectronNET.API/API/Entities/CookieDetails.cs @@ -5,54 +5,59 @@ namespace ElectronNET.API.Entities /// /// /// + /// Up-to-date with Electron API 39.2 public class CookieDetails { /// - /// The URL to associate the cookie with. The callback will be rejected if the URL is invalid. + /// Gets or sets the URL to associate the cookie with. The operation will be rejected if the URL is invalid. /// public string Url { get; set; } /// - /// (optional) - The name of the cookie. Empty by default if omitted. + /// Gets or sets the name of the cookie. Empty by default if omitted. /// [DefaultValue("")] public string Name { get; set; } /// - /// (optional) - The value of the cookie. Empty by default if omitted. + /// Gets or sets the value of the cookie. Empty by default if omitted. /// [DefaultValue("")] public string Value { get; set; } /// - /// (optional) - The domain of the cookie; this will be normalized with a preceding dot so that it's also valid for subdomains. Empty by default if omitted. + /// Gets or sets the domain of the cookie; this will be normalized with a preceding dot so that it's also valid for subdomains. Empty by default if omitted. /// [DefaultValue("")] public string Domain { get; set; } /// - /// (optional) - The path of the cookie. Empty by default if omitted. + /// Gets or sets the path of the cookie. Empty by default if omitted. /// [DefaultValue("")] public string Path { get; set; } /// - /// (optional) - Whether the cookie is marked as secure. Defaults to false. + /// Gets or sets a value indicating whether the cookie should be marked as secure. Defaults to false unless the SameSite policy is set to no_restriction (SameSite=None). /// [DefaultValue(false)] public bool Secure { get; set; } /// - /// (optional) - Whether the cookie is marked as HTTP only. Defaults to false. + /// Gets or sets a value indicating whether the cookie should be marked as HTTP only. Defaults to false. /// [DefaultValue(false)] public bool HttpOnly { get; set; } /// - /// (optional) - The expiration date of the cookie as the number of seconds since the UNIX epoch. - /// If omitted then the cookie becomes a session cookie and will not be retained between sessions. + /// Gets or sets the expiration date of the cookie as the number of seconds since the UNIX epoch. If omitted, the cookie becomes a session cookie and will not be retained between sessions. /// [DefaultValue(0)] - public long ExpirationDate { get; set; } + public double ExpirationDate { get; set; } + + /// + /// Gets or sets the SameSite policy to apply to this cookie. Can be "unspecified", "no_restriction", "lax" or "strict". Default is "lax". + /// + public string SameSite { get; set; } } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/CookieFilter.cs b/src/ElectronNET.API/API/Entities/CookieFilter.cs index ee5a51e4..7914fe80 100644 --- a/src/ElectronNET.API/API/Entities/CookieFilter.cs +++ b/src/ElectronNET.API/API/Entities/CookieFilter.cs @@ -3,10 +3,11 @@ /// /// /// + /// Up-to-date with Electron API 39.2 public class CookieFilter { /// - /// (optional) - Retrieves cookies which are associated with url.Empty implies retrieving cookies of all URLs. + /// (optional) - Retrieves cookies which are associated with url. Empty implies retrieving cookies of all URLs. /// public string Url { get; set; } @@ -34,5 +35,10 @@ public class CookieFilter /// (optional) - Filters out session or persistent cookies. /// public bool Session { get; set; } + + /// + /// (optional) - Filters cookies by httpOnly. + /// + public bool HttpOnly { get; set; } } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/CreateFromBitmapOptions.cs b/src/ElectronNET.API/API/Entities/CreateFromBitmapOptions.cs index b2239983..48ec8036 100644 --- a/src/ElectronNET.API/API/Entities/CreateFromBitmapOptions.cs +++ b/src/ElectronNET.API/API/Entities/CreateFromBitmapOptions.cs @@ -3,20 +3,21 @@ /// /// /// + /// Up-to-date with Electron API 39.2 public class CreateFromBitmapOptions { /// - /// Gets or sets the width + /// Gets or sets the width in pixels. Required for nativeImage.createFromBitmap(buffer, options). /// public int? Width { get; set; } /// - /// Gets or sets the height + /// Gets or sets the height in pixels. Required for nativeImage.createFromBitmap(buffer, options). /// public int? Height { get; set; } /// - /// Gets or sets the scalefactor + /// Gets or sets the image scale factor. Optional, defaults to 1.0. /// public float ScaleFactor { get; set; } = 1.0f; } diff --git a/src/ElectronNET.API/API/Entities/CreateFromBufferOptions.cs b/src/ElectronNET.API/API/Entities/CreateFromBufferOptions.cs index 206f5acd..0eef0f91 100644 --- a/src/ElectronNET.API/API/Entities/CreateFromBufferOptions.cs +++ b/src/ElectronNET.API/API/Entities/CreateFromBufferOptions.cs @@ -3,20 +3,21 @@ namespace ElectronNET.API.Entities /// /// /// + /// Up-to-date with Electron API 39.2 public class CreateFromBufferOptions { /// - /// Gets or sets the width + /// Gets or sets the width. Required for bitmap buffers passed to nativeImage.createFromBuffer. /// public int? Width { get; set; } /// - /// Gets or sets the height + /// Gets or sets the height. Required for bitmap buffers passed to nativeImage.createFromBuffer. /// public int? Height { get; set; } /// - /// Gets or sets the scalefactor + /// The image scale factor. Optional, defaults to 1.0. /// public float ScaleFactor { get; set; } = 1.0f; } diff --git a/src/ElectronNET.API/API/Entities/CreateInterruptedDownloadOptions.cs b/src/ElectronNET.API/API/Entities/CreateInterruptedDownloadOptions.cs index b28f6166..5221376e 100644 --- a/src/ElectronNET.API/API/Entities/CreateInterruptedDownloadOptions.cs +++ b/src/ElectronNET.API/API/Entities/CreateInterruptedDownloadOptions.cs @@ -3,6 +3,7 @@ /// /// /// + /// Up-to-date with Electron API 39.2 public class CreateInterruptedDownloadOptions { /// @@ -16,7 +17,7 @@ public class CreateInterruptedDownloadOptions public string[] UrlChain { get; set; } /// - /// + /// (optional) - MIME type of the download. /// public string MimeType { get; set; } @@ -41,9 +42,10 @@ public class CreateInterruptedDownloadOptions public string ETag { get; set; } /// - /// Time when download was started in number of seconds since UNIX epoch. + /// (optional) - Time when download was started in number of seconds since UNIX epoch. + /// Electron documents this as a Number (Double). /// - public int StartTime { get; set; } + public double? StartTime { get; set; } /// /// diff --git a/src/ElectronNET.API/API/Entities/Data.cs b/src/ElectronNET.API/API/Entities/Data.cs index 2dcca894..9dddf66d 100644 --- a/src/ElectronNET.API/API/Entities/Data.cs +++ b/src/ElectronNET.API/API/Entities/Data.cs @@ -21,6 +21,12 @@ public class Data /// public string Html { get; set; } + /// + /// Gets or sets the image. + /// Maps to clipboard.write({ image: NativeImage }). + /// + public NativeImage Image { get; set; } + /// /// Gets or sets the RTF. diff --git a/src/ElectronNET.API/API/Entities/DefaultFontFamily.cs b/src/ElectronNET.API/API/Entities/DefaultFontFamily.cs index 105d2053..95e081a3 100644 --- a/src/ElectronNET.API/API/Entities/DefaultFontFamily.cs +++ b/src/ElectronNET.API/API/Entities/DefaultFontFamily.cs @@ -34,5 +34,10 @@ public class DefaultFontFamily /// Defaults to Impact. /// public string Fantasy { get; set; } + + /// + /// Defaults to Latin Modern Math. + /// + public string Math { get; set; } } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/DevToolsMode.cs b/src/ElectronNET.API/API/Entities/DevToolsMode.cs index 7290d8ca..6d786a39 100644 --- a/src/ElectronNET.API/API/Entities/DevToolsMode.cs +++ b/src/ElectronNET.API/API/Entities/DevToolsMode.cs @@ -1,9 +1,9 @@ namespace ElectronNET.API.Entities { /// - /// Opens the devtools with specified dock state, can be right, bottom, undocked, - /// detach.Defaults to last used dock state.In undocked mode it's possible to dock - /// back.In detach mode it's not. + /// Opens the devtools with specified dock state, can be left, right, bottom, undocked, + /// detach. Defaults to last used dock state. In undocked mode it's possible to dock + /// back. In detach mode it's not. /// public enum DevToolsMode { @@ -25,6 +25,11 @@ public enum DevToolsMode /// /// The detach /// - detach + detach, + + /// + /// The left + /// + left, } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/Display.cs b/src/ElectronNET.API/API/Entities/Display.cs index ba2d8a79..258b6b84 100644 --- a/src/ElectronNET.API/API/Entities/Display.cs +++ b/src/ElectronNET.API/API/Entities/Display.cs @@ -3,10 +3,11 @@ /// /// /// + /// Up-to-date with Electron API 39.2 public class Display { /// - /// Can be available, unavailable, unknown. + /// Gets or sets the accelerometer support status; can be 'available', 'unavailable', or 'unknown'. /// public string AccelerometerSupport { get; set; } @@ -19,57 +20,72 @@ public class Display public Rectangle Bounds { get; set; } /// - /// The number of bits per pixel. + /// Gets or sets the number of bits per pixel. /// public int ColorDepth { get; set; } /// - /// Represent a color space (three-dimensional object which contains all realizable color combinations) for the purpose of color conversions. + /// Gets or sets the color space description used for color conversions. /// public string ColorSpace { get; set; } /// - /// The number of bits per color component. + /// Gets or sets the number of bits per color component. /// public int DepthPerComponent { get; set; } /// - /// The display refresh rate. + /// Gets or sets a value indicating whether the display is detected by the system. /// - public int DisplayFrequency { get; set; } + public bool Detected { get; set; } /// - /// Unique identifier associated with the display. + /// Gets or sets the display refresh rate. + /// + public double DisplayFrequency { get; set; } + + /// + /// Gets or sets the unique identifier associated with the display. A value of -1 means the display is invalid or the correct id is not yet known, and a value of -10 means the display is a virtual display assigned to a unified desktop. /// public long Id { get; set; } /// - /// true for an internal display and false for an external display. + /// Gets or sets a value indicating whether the display is internal (true) or external (false). /// public bool Internal { get; set; } /// - /// User-friendly label, determined by the platform. + /// Gets or sets the user-friendly label, determined by the platform. /// public string Label { get; set; } /// - /// Can be 0, 90, 180, 270, represents screen rotation in clock-wise degrees. + /// Gets or sets the maximum cursor size in native pixels. + /// + public Size MaximumCursorSize { get; set; } + + /// + /// Gets or sets the display's origin in pixel coordinates. Only available on windowing systems that position displays in pixel coordinates (e.g., X11). + /// + public Point NativeOrigin { get; set; } + + /// + /// Gets or sets the screen rotation in clock-wise degrees. Can be 0, 90, 180, or 270. /// public int Rotation { get; set; } /// - /// Output device's pixel scale factor. + /// Gets or sets the output device's pixel scale factor. /// public double ScaleFactor { get; set; } /// - /// Can be available, unavailable, unknown. + /// Gets or sets the touch support status; can be 'available', 'unavailable', or 'unknown'. /// public string TouchSupport { get; set; } /// - /// Whether or not the display is a monochrome display. + /// Gets or sets a value indicating whether the display is monochrome. /// public bool Monochrome { get; set; } @@ -82,10 +98,10 @@ public class Display public Size Size { get; set; } /// - /// Gets or sets the work area. + /// Gets or sets the work area of the display in DIP points. /// /// - /// The work area. + /// The work area of the display in DIP points. /// public Rectangle WorkArea { get; set; } diff --git a/src/ElectronNET.API/API/Entities/DisplayBalloonOptions.cs b/src/ElectronNET.API/API/Entities/DisplayBalloonOptions.cs index c2235111..66758b7d 100644 --- a/src/ElectronNET.API/API/Entities/DisplayBalloonOptions.cs +++ b/src/ElectronNET.API/API/Entities/DisplayBalloonOptions.cs @@ -1,8 +1,21 @@ -namespace ElectronNET.API +using System.Runtime.Versioning; + +namespace ElectronNET.API { /// /// /// + public enum DisplayBalloonIconType + { + none, + info, + warning, + error, + custom + } + + /// Up-to-date with Electron API 39.2 + [SupportedOSPlatform("Windows")] public class DisplayBalloonOptions { /// @@ -28,5 +41,29 @@ public class DisplayBalloonOptions /// The content. /// public string Content { get; set; } + + /// + /// (optional) - Icon type for the balloon: none, info, warning, error or custom. + /// Default is custom. + /// + public DisplayBalloonIconType IconType { get; set; } = DisplayBalloonIconType.custom; + + /// + /// (optional) - Use the large version of the icon. Default is true. + /// Maps to Windows NIIF_LARGE_ICON. + /// + public bool LargeIcon { get; set; } = true; + + /// + /// (optional) - Do not play the associated sound. Default is false. + /// Maps to Windows NIIF_NOSOUND. + /// + public bool NoSound { get; set; } + + /// + /// (optional) - Do not display the balloon if the current user is in "quiet time". + /// Default is false. Maps to Windows NIIF_RESPECT_QUIET_TIME. + /// + public bool RespectQuietTime { get; set; } } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/DockBounceType.cs b/src/ElectronNET.API/API/Entities/DockBounceType.cs index eedcaac3..611982b0 100644 --- a/src/ElectronNET.API/API/Entities/DockBounceType.cs +++ b/src/ElectronNET.API/API/Entities/DockBounceType.cs @@ -1,10 +1,13 @@ using System.ComponentModel; +using System.Runtime.Versioning; namespace ElectronNET.API.Entities { /// /// Defines the DockBounceType enumeration. /// + /// Up-to-date with Electron API 39.2 + [SupportedOSPlatform("macOS")] public enum DockBounceType { /// diff --git a/src/ElectronNET.API/API/Entities/EnableNetworkEmulationOptions.cs b/src/ElectronNET.API/API/Entities/EnableNetworkEmulationOptions.cs index 64fed7a1..d5a3e3d1 100644 --- a/src/ElectronNET.API/API/Entities/EnableNetworkEmulationOptions.cs +++ b/src/ElectronNET.API/API/Entities/EnableNetworkEmulationOptions.cs @@ -3,6 +3,7 @@ /// /// /// + /// Up-to-date with Electron API 39.2 public class EnableNetworkEmulationOptions { /// @@ -12,17 +13,20 @@ public class EnableNetworkEmulationOptions /// /// RTT in ms. Defaults to 0 which will disable latency throttling. + /// Electron documents this as a Number (Double). /// - public int Latency { get; set; } + public double Latency { get; set; } /// /// Download rate in Bps. Defaults to 0 which will disable download throttling. + /// Electron documents this as a Number (Double). /// - public int DownloadThroughput { get; set; } + public double DownloadThroughput { get; set; } /// /// Upload rate in Bps. Defaults to 0 which will disable upload throttling. + /// Electron documents this as a Number (Double). /// - public int UploadThroughput { get; set; } + public double UploadThroughput { get; set; } } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/Extension.cs b/src/ElectronNET.API/API/Entities/Extension.cs index d4edd975..af4da662 100644 --- a/src/ElectronNET.API/API/Entities/Extension.cs +++ b/src/ElectronNET.API/API/Entities/Extension.cs @@ -3,6 +3,7 @@ /// /// Docs: https://electronjs.org/docs/api/structures/extension /// + /// Up-to-date with Electron API 39.2 public class Extension { /// diff --git a/src/ElectronNET.API/API/Entities/FileFilter.cs b/src/ElectronNET.API/API/Entities/FileFilter.cs index 3f573ed3..4cae053a 100644 --- a/src/ElectronNET.API/API/Entities/FileFilter.cs +++ b/src/ElectronNET.API/API/Entities/FileFilter.cs @@ -3,6 +3,7 @@ /// /// /// + /// Up-to-date with Electron API 39.2 public class FileFilter { /// diff --git a/src/ElectronNET.API/API/Entities/FileIconOptions.cs b/src/ElectronNET.API/API/Entities/FileIconOptions.cs index f2e1d250..820d2140 100644 --- a/src/ElectronNET.API/API/Entities/FileIconOptions.cs +++ b/src/ElectronNET.API/API/Entities/FileIconOptions.cs @@ -3,14 +3,13 @@ /// /// /// + /// Up-to-date with Electron API 39.2 public class FileIconOptions { /// - /// Gets the size. + /// The requested icon size string passed to app.getFileIcon: + /// "small" (16x16), "normal" (32x32), or "large" (48x48 on Linux, 32x32 on Windows; unsupported on macOS). /// - /// - /// The size. - /// public string Size { get; private set; } /// diff --git a/src/ElectronNET.API/API/Entities/FileIconSize.cs b/src/ElectronNET.API/API/Entities/FileIconSize.cs index 75430d60..bb642b92 100644 --- a/src/ElectronNET.API/API/Entities/FileIconSize.cs +++ b/src/ElectronNET.API/API/Entities/FileIconSize.cs @@ -1,23 +1,28 @@ -namespace ElectronNET.API.Entities +using System.Runtime.Versioning; + +namespace ElectronNET.API.Entities { /// /// /// + /// Up-to-date with Electron API 39.2 public enum FileIconSize { /// - /// The small + /// small - 16x16 (per app.getFileIcon size mapping). /// small, /// - /// The normal + /// normal - 32x32 (per app.getFileIcon size mapping). /// normal, /// - /// The large + /// large - 48x48 on Linux, 32x32 on Windows, unsupported on macOS (per app.getFileIcon size mapping). /// + [SupportedOSPlatform("Linux")] + [SupportedOSPlatform("Windows")] large } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/FocusOptions.cs b/src/ElectronNET.API/API/Entities/FocusOptions.cs index 2520499f..56053a57 100644 --- a/src/ElectronNET.API/API/Entities/FocusOptions.cs +++ b/src/ElectronNET.API/API/Entities/FocusOptions.cs @@ -1,15 +1,18 @@ -namespace ElectronNET.API.Entities +using System.Runtime.Versioning; + +namespace ElectronNET.API.Entities { /// /// Controls the behavior of . /// + /// Up-to-date with Electron API 39.2 public class FocusOptions { /// /// Make the receiver the active app even if another app is currently active. - /// - /// You should seek to use the option as sparingly as possible. + /// You should seek to use the steal option as sparingly as possible. /// + [SupportedOSPlatform("macOS")] public bool Steal { get; set; } } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/GPUFeatureStatus.cs b/src/ElectronNET.API/API/Entities/GPUFeatureStatus.cs index 1904958c..01448e0f 100644 --- a/src/ElectronNET.API/API/Entities/GPUFeatureStatus.cs +++ b/src/ElectronNET.API/API/Entities/GPUFeatureStatus.cs @@ -3,82 +3,97 @@ namespace ElectronNET.API.Entities { /// + /// Graphics Feature Status from chrome://gpu/ as returned by app.getGPUFeatureStatus(). + /// Each field reflects the status of a GPU capability reported by Chromium. /// + /// Possible values for all fields: + /// - disabled_software: Software only. Hardware acceleration disabled (yellow) + /// - disabled_off: Disabled (red) + /// - disabled_off_ok: Disabled (yellow) + /// - unavailable_software: Software only, hardware acceleration unavailable (yellow) + /// - unavailable_off: Unavailable (red) + /// - unavailable_off_ok: Unavailable (yellow) + /// - enabled_readback: Hardware accelerated but at reduced performance (yellow) + /// - enabled_force: Hardware accelerated on all pages (green) + /// - enabled: Hardware accelerated (green) + /// - enabled_on: Enabled (green) + /// - enabled_force_on: Force enabled (green) /// + /// Up-to-date with Electron API 39.2 public class GPUFeatureStatus { /// - /// Canvas. + /// Gets or sets the status for Canvas. /// [JsonPropertyName("2d_canvas")] public string Canvas { get; set; } /// - /// Flash. + /// Gets or sets the status for Flash. /// [JsonPropertyName("flash_3d")] public string Flash3D { get; set; } /// - /// Flash Stage3D. + /// Gets or sets the status for Flash Stage3D. /// [JsonPropertyName("flash_stage3d")] public string FlashStage3D { get; set; } /// - /// Flash Stage3D Baseline profile. + /// Gets or sets the status for Flash Stage3D Baseline profile. /// [JsonPropertyName("flash_stage3d_baseline")] public string FlashStage3dBaseline { get; set; } /// - /// Compositing. + /// Gets or sets the status for Compositing. /// [JsonPropertyName("gpu_compositing")] public string GpuCompositing { get; set; } /// - /// Multiple Raster Threads. + /// Gets or sets the status for Multiple Raster Threads. /// [JsonPropertyName("multiple_raster_threads")] public string MultipleRasterThreads { get; set; } /// - /// Native GpuMemoryBuffers. + /// Gets or sets the status for Native GpuMemoryBuffers. /// [JsonPropertyName("native_gpu_memory_buffers")] public string NativeGpuMemoryBuffers { get; set; } /// - /// Rasterization. + /// Gets or sets the status for Rasterization. /// public string Rasterization { get; set; } /// - /// Video Decode. + /// Gets or sets the status for Video Decode. /// [JsonPropertyName("video_decode")] public string VideoDecode { get; set; } /// - /// Video Encode. + /// Gets or sets the status for Video Encode. /// [JsonPropertyName("video_encode")] public string VideoEncode { get; set; } /// - /// VPx Video Decode. + /// Gets or sets the status for VPx Video Decode. /// [JsonPropertyName("vpx_decode")] public string VpxDecode { get; set; } /// - /// WebGL. + /// Gets or sets the status for WebGL. /// public string Webgl { get; set; } /// - /// WebGL2. + /// Gets or sets the status for WebGL2. /// public string Webgl2 { get; set; } } diff --git a/src/ElectronNET.API/API/Entities/IPostData.cs b/src/ElectronNET.API/API/Entities/IPostData.cs index a8c9612e..8c5d2c9d 100644 --- a/src/ElectronNET.API/API/Entities/IPostData.cs +++ b/src/ElectronNET.API/API/Entities/IPostData.cs @@ -1,15 +1,17 @@ namespace ElectronNET.API.Entities { /// - /// Interface to use Electrons PostData Object + /// Represents a postData item for loadURL/webContents.loadURL options. + /// Valid types per Electron docs: 'rawData' and 'file'. /// + /// Up-to-date with Electron API 39.2 public interface IPostData { /// /// One of the following: - /// rawData - The data is available as a Buffer, in the rawData field. - /// file - The object represents a file. The filePath, offset, length and modificationTime fields will be used to describe the file. - /// blob - The object represents a Blob. The blobUUID field will be used to describe the Blob. + /// rawData - . + /// file - . + /// Based on Electron postData definitions. /// public string Type { get; } } diff --git a/src/ElectronNET.API/API/Entities/ImportCertificateOptions.cs b/src/ElectronNET.API/API/Entities/ImportCertificateOptions.cs index 3a93dc68..cabb91e0 100644 --- a/src/ElectronNET.API/API/Entities/ImportCertificateOptions.cs +++ b/src/ElectronNET.API/API/Entities/ImportCertificateOptions.cs @@ -1,8 +1,12 @@ -namespace ElectronNET.API.Entities +using System.Runtime.Versioning; + +namespace ElectronNET.API.Entities { /// - /// + /// Options for app.importCertificate(options) on Linux. /// + /// Up-to-date with Electron API 39.2 + [SupportedOSPlatform("linux")] public class ImportCertificateOptions { /// diff --git a/src/ElectronNET.API/API/Entities/InputEvent.cs b/src/ElectronNET.API/API/Entities/InputEvent.cs index 98370e5e..a39a50a3 100644 --- a/src/ElectronNET.API/API/Entities/InputEvent.cs +++ b/src/ElectronNET.API/API/Entities/InputEvent.cs @@ -6,8 +6,10 @@ namespace ElectronNET.API.Entities using System.Text.Json.Serialization; /// - /// + /// Input event payload as used by webContents 'input-event' and 'before-input-event'. + /// Fields map to KeyboardEvent properties where noted, and type/modifiers follow Electron's InputEvent structure. /// + /// Up-to-date with Electron API 39.2 public class InputEvent { /// @@ -57,15 +59,95 @@ public class InputEvent /// /// An array of modifiers of the event, can be `shift`, `control`, `ctrl`, `alt`, - /// `meta`, `command`, `cmd`, `isKeypad`, `isAutoRepeat`, `leftButtonDown`, - /// `middleButtonDown`, `rightButtonDown`, `capsLock`, `numLock`, `left`, `right` + /// `meta`, `command`, `cmd`, `iskeypad`, `isautorepeat`, `leftbuttondown`, + /// `middlebuttondown`, `rightbuttondown`, `capslock`, `numlock`, `left`, `right`. /// [JsonConverter(typeof(ModifierTypeListConverter))] public List Modifiers { get; set; } + /// + /// For MouseInputEvent: The x-coordinate of the event (Integer). + /// + public int? X { get; set; } + + /// + /// For MouseInputEvent: The y-coordinate of the event (Integer). + /// + public int? Y { get; set; } + + /// + /// For MouseInputEvent: The button pressed, can be 'left', 'middle', or 'right' (optional). + /// + public string Button { get; set; } + + /// + /// For MouseInputEvent: Global x in screen coordinates (Integer, optional). + /// + public int? GlobalX { get; set; } + + /// + /// For MouseInputEvent: Global y in screen coordinates (Integer, optional). + /// + public int? GlobalY { get; set; } + + /// + /// For MouseInputEvent: Movement delta on x-axis since last event (Integer, optional). + /// + public int? MovementX { get; set; } + + /// + /// For MouseInputEvent: Movement delta on y-axis since last event (Integer, optional). + /// + public int? MovementY { get; set; } + + /// + /// For MouseInputEvent: Click count (Integer, optional). + /// + public int? ClickCount { get; set; } + + /// + /// For MouseWheelInputEvent: Horizontal scroll delta (Integer, optional). + /// + public int? DeltaX { get; set; } + + /// + /// For MouseWheelInputEvent: Vertical scroll delta (Integer, optional). + /// + public int? DeltaY { get; set; } + + /// + /// For MouseWheelInputEvent: Horizontal wheel ticks (Integer, optional). + /// + public int? WheelTicksX { get; set; } + + /// + /// For MouseWheelInputEvent: Vertical wheel ticks (Integer, optional). + /// + public int? WheelTicksY { get; set; } + + /// + /// For MouseWheelInputEvent: Horizontal acceleration ratio (Integer, optional). + /// + public int? AccelerationRatioX { get; set; } + + /// + /// For MouseWheelInputEvent: Vertical acceleration ratio (Integer, optional). + /// + public int? AccelerationRatioY { get; set; } + + /// + /// For MouseWheelInputEvent: True if wheel deltas are precise (optional). + /// + public bool? HasPreciseScrollingDeltas { get; set; } + + /// + /// For MouseWheelInputEvent: True if the target can scroll (optional). + /// + public bool? CanScroll { get; set; } + /// /// Can be `undefined`, `mouseDown`, `mouseUp`, `mouseMove`, `mouseEnter`, - /// `mouseLeave`, `contextMenu`, `mouseWheel`, `rawKeyDown`, `keyDown`, `keyUp`, + /// `mouseLeave`, `contextMenu`, `mouseWheel`, `rawKeyDown`, `keyDown`, `keyUp`, `char`, /// `gestureScrollBegin`, `gestureScrollEnd`, `gestureScrollUpdate`, /// `gestureFlingStart`, `gestureFlingCancel`, `gesturePinchBegin`, /// `gesturePinchEnd`, `gesturePinchUpdate`, `gestureTapDown`, `gestureShowPress`, diff --git a/src/ElectronNET.API/API/Entities/InputEventType.cs b/src/ElectronNET.API/API/Entities/InputEventType.cs index a64f11d6..6df172b9 100644 --- a/src/ElectronNET.API/API/Entities/InputEventType.cs +++ b/src/ElectronNET.API/API/Entities/InputEventType.cs @@ -60,6 +60,11 @@ public enum InputEventType /// keyUp, + /// + /// + /// + @char, + /// /// /// diff --git a/src/ElectronNET.API/API/Entities/JumpListCategory.cs b/src/ElectronNET.API/API/Entities/JumpListCategory.cs index 660a7825..df01ee99 100644 --- a/src/ElectronNET.API/API/Entities/JumpListCategory.cs +++ b/src/ElectronNET.API/API/Entities/JumpListCategory.cs @@ -1,24 +1,28 @@ using System.Text.Json.Serialization; +using System.Runtime.Versioning; namespace ElectronNET.API.Entities { /// - /// + /// Jump List category definition used with app.setJumpList(categories). + /// Matches Electron's JumpListCategory structure. /// + /// Up-to-date with Electron API 39.2 + [SupportedOSPlatform("windows")] public class JumpListCategory { /// - /// Must be set if type is custom, otherwise it should be omitted. + /// Gets or sets the name; must be set if type is custom, otherwise it should be omitted. /// public string Name { get; set; } /// - /// Array of objects if type is tasks or custom, otherwise it should be omitted. + /// Gets or sets the array of objects if type is tasks or custom; otherwise it should be omitted. /// public JumpListItem[] Items { get; set; } /// - /// One of the following: "tasks" | "frequent" | "recent" | "custom" + /// Gets or sets the category type. One of: tasks | frequent | recent | custom. /// public JumpListCategoryType Type { get; set; } } diff --git a/src/ElectronNET.API/API/Entities/JumpListCategoryType.cs b/src/ElectronNET.API/API/Entities/JumpListCategoryType.cs index 56a18ddf..4211e4ec 100644 --- a/src/ElectronNET.API/API/Entities/JumpListCategoryType.cs +++ b/src/ElectronNET.API/API/Entities/JumpListCategoryType.cs @@ -1,8 +1,12 @@ -namespace ElectronNET.API.Entities +using System.Runtime.Versioning; + +namespace ElectronNET.API.Entities { /// - /// + /// Jump list category kinds for app.setJumpList (Windows). /// + /// Up-to-date with Electron API 39.2 + [SupportedOSPlatform("Windows")] public enum JumpListCategoryType { /// diff --git a/src/ElectronNET.API/API/Entities/JumpListItem.cs b/src/ElectronNET.API/API/Entities/JumpListItem.cs index 9c57ba82..6ff55c7e 100644 --- a/src/ElectronNET.API/API/Entities/JumpListItem.cs +++ b/src/ElectronNET.API/API/Entities/JumpListItem.cs @@ -1,56 +1,65 @@ using System.Text.Json.Serialization; +using System.Runtime.Versioning; namespace ElectronNET.API.Entities { /// - /// + /// Jump List item used in app.setJumpList(categories) on Windows. + /// Matches Electron's JumpListItem structure. /// + /// Up-to-date with Electron API 39.2 + [SupportedOSPlatform("windows")] public class JumpListItem { /// - /// The command line arguments when program is executed. Should only be set if type is task. + /// Gets or sets the command line arguments when program is executed. Should only be set if type is task. /// public string Args { get; set; } /// - /// Description of the task (displayed in a tooltip). Should only be set if type is task. + /// Gets or sets the description of the task (displayed in a tooltip). Should only be set if type is task. Maximum length 260 characters. /// public string Description { get; set; } /// - /// The index of the icon in the resource file. If a resource file contains multiple + /// Gets or sets the index of the icon in the resource file. If a resource file contains multiple /// icons this value can be used to specify the zero-based index of the icon that - /// should be displayed for this task.If a resource file contains only one icon, + /// should be displayed for this task. If a resource file contains only one icon, /// this property should be set to zero. /// public int IconIndex { get; set; } /// - /// The absolute path to an icon to be displayed in a Jump List, which can be an + /// Gets or sets the absolute path to an icon to be displayed in a Jump List, which can be an /// arbitrary resource file that contains an icon(e.g. .ico, .exe, .dll). You can /// usually specify process.execPath to show the program icon. /// public string IconPath { get; set; } /// - /// Path of the file to open, should only be set if type is file. + /// Gets or sets the path of the file to open; should only be set if type is file. /// public string Path { get; set; } /// - /// Path of the program to execute, usually you should specify process.execPath - /// which opens the current program.Should only be set if type is task. + /// Gets or sets the path of the program to execute, usually specify process.execPath + /// which opens the current program. Should only be set if type is task. /// public string Program { get; set; } /// - /// The text to be displayed for the item in the Jump List. Should only be set if type is task. + /// Gets or sets the text to be displayed for the item in the Jump List. Should only be set if type is task. /// public string Title { get; set; } /// - /// One of the following: "task" | "separator" | "file" + /// Gets or sets the item type. One of: task | separator | file. /// public JumpListItemType Type { get; set; } + + /// + /// Gets or sets the working directory. Default is empty. + /// + public string WorkingDirectory { get; set; } } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/JumpListItemType.cs b/src/ElectronNET.API/API/Entities/JumpListItemType.cs index 6bc23828..0b055c0a 100644 --- a/src/ElectronNET.API/API/Entities/JumpListItemType.cs +++ b/src/ElectronNET.API/API/Entities/JumpListItemType.cs @@ -1,8 +1,12 @@ -namespace ElectronNET.API.Entities +using System.Runtime.Versioning; + +namespace ElectronNET.API.Entities { /// - /// + /// Jump list item kinds for app.setJumpList (Windows). /// + /// Up-to-date with Electron API 39.2 + [SupportedOSPlatform("Windows")] public enum JumpListItemType { /// diff --git a/src/ElectronNET.API/API/Entities/JumpListSettings.cs b/src/ElectronNET.API/API/Entities/JumpListSettings.cs index 82184ed1..e340be24 100644 --- a/src/ElectronNET.API/API/Entities/JumpListSettings.cs +++ b/src/ElectronNET.API/API/Entities/JumpListSettings.cs @@ -1,20 +1,24 @@ -namespace ElectronNET.API.Entities +using System.Runtime.Versioning; + +namespace ElectronNET.API.Entities { /// - /// + /// Settings returned by app.getJumpListSettings() on Windows. + /// Matches Electron's JumpListSettings object. /// + /// Up-to-date with Electron API 39.2 + [SupportedOSPlatform("windows")] public class JumpListSettings { /// - /// The minimum number of items that will be shown in the Jump List (for a more detailed description of this value see the - /// MSDN docs). + /// The minimum number of items that will be shown in the Jump List. /// public int MinItems { get; set; } = 0; /// /// Array of JumpListItem objects that correspond to items that the user has explicitly removed from custom categories - /// in the Jump List. These items must not be re-added to the Jump List in the next call to , Windows will - /// not display any custom category that contains any of the removed items. + /// in the Jump List. These items must not be re-added to the Jump List in the next call to app.setJumpList(categories); + /// Windows will not display any custom category that contains any of the removed items. /// public JumpListItem[] RemovedItems { get; set; } = new JumpListItem[0]; } diff --git a/src/ElectronNET.API/API/Entities/LoadURLOptions.cs b/src/ElectronNET.API/API/Entities/LoadURLOptions.cs index f4e14781..e03c6ccb 100644 --- a/src/ElectronNET.API/API/Entities/LoadURLOptions.cs +++ b/src/ElectronNET.API/API/Entities/LoadURLOptions.cs @@ -1,12 +1,14 @@ namespace ElectronNET.API.Entities { /// - /// + /// Options for BrowserWindow.loadURL(url, options) / webContents.loadURL(url, options). + /// Matches Electron's loadURL options. /// + /// Up-to-date with Electron API 39.2 public class LoadURLOptions { /// - /// A HTTP Referrer url. + /// An HTTP Referrer URL. In Electron this may be a string or a Referrer object. /// public string HttpReferrer { get; set; } @@ -16,20 +18,18 @@ public class LoadURLOptions public string UserAgent { get; set; } /// - /// Base url (with trailing path separator) for files to be loaded by the data url. - /// This is needed only if the specified url is a data url and needs to load other - /// files. + /// Base URL (with trailing path separator) for files to be loaded by the data URL. + /// Needed only if the specified URL is a data URL and needs to load other files. /// public string BaseURLForDataURL { get; set; } /// - /// Extra headers for the request. + /// Extra headers separated by "\n". /// public string ExtraHeaders { get; set; } /// - /// PostData Object for the request. - /// Can be , or + /// Post data for the request. Matches Electron's postData: (UploadRawData | UploadFile)[] /// public IPostData[] PostData { get; set; } } diff --git a/src/ElectronNET.API/API/Entities/LoginItemLaunchItem.cs b/src/ElectronNET.API/API/Entities/LoginItemLaunchItem.cs new file mode 100644 index 00000000..1ad9660e --- /dev/null +++ b/src/ElectronNET.API/API/Entities/LoginItemLaunchItem.cs @@ -0,0 +1,37 @@ +using System.Runtime.Versioning; + +namespace ElectronNET.API.Entities +{ + /// + /// Windows launch entry as returned by app.getLoginItemSettings().launchItems. + /// + /// Up-to-date with Electron API 39.2 + [SupportedOSPlatform("windows")] + public class LoginItemLaunchItem + { + /// + /// Name value of a registry entry. + /// + public string Name { get; set; } + + /// + /// The executable to an app that corresponds to a registry entry. + /// + public string Path { get; set; } + + /// + /// The command-line arguments to pass to the executable. + /// + public string[] Args { get; set; } + + /// + /// One of user or machine. Indicates whether the registry entry is under HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE. + /// + public string Scope { get; set; } + + /// + /// True if the app registry key is startup approved and therefore shows as enabled in Task Manager and Windows settings. + /// + public bool Enabled { get; set; } + } +} \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/LoginItemSettings.cs b/src/ElectronNET.API/API/Entities/LoginItemSettings.cs index a744a624..037d3d72 100644 --- a/src/ElectronNET.API/API/Entities/LoginItemSettings.cs +++ b/src/ElectronNET.API/API/Entities/LoginItemSettings.cs @@ -1,8 +1,11 @@ -namespace ElectronNET.API.Entities +using System.Runtime.Versioning; + +namespace ElectronNET.API.Entities { /// - /// + /// Return object for app.getLoginItemSettings() on macOS and Windows. /// + /// Up-to-date with Electron API 39.2 public class LoginItemSettings { /// @@ -11,29 +14,52 @@ public class LoginItemSettings public bool OpenAtLogin { get; set; } /// - /// if the app is set to open as hidden at login. This setting is not available + /// if the app is set to open as hidden at login. Deprecated on macOS 13 and up; not available /// on MAS builds. /// + [SupportedOSPlatform("macos")] public bool OpenAsHidden { get; set; } /// /// if the app was opened at login automatically. This setting is not available /// on MAS builds. /// + [SupportedOSPlatform("macos")] public bool WasOpenedAtLogin { get; set; } /// /// if the app was opened as a hidden login item. This indicates that the app should not - /// open any windows at startup. This setting is not available on + /// open any windows at startup. Deprecated on macOS 13 and up; not available on /// MAS builds. /// + [SupportedOSPlatform("macos")] public bool WasOpenedAsHidden { get; set; } /// /// if the app was opened as a login item that should restore the state from the previous /// session. This indicates that the app should restore the windows that were open the last time the app was closed. - /// This setting is not available on MAS builds. + /// Deprecated on macOS 13 and up; not available on MAS builds. /// + [SupportedOSPlatform("macos")] public bool RestoreState { get; set; } + + /// + /// macOS status: one of not-registered, enabled, requires-approval, or not-found. + /// + [SupportedOSPlatform("macos")] + public string Status { get; set; } + + /// + /// Windows: true if app is set to open at login and its run key is not deactivated. + /// Differs from OpenAtLogin as it ignores the args option; this is true if the given executable would be launched at login with any arguments. + /// + [SupportedOSPlatform("windows")] + public bool ExecutableWillLaunchAtLogin { get; set; } + + /// + /// Windows launch entries found in registry. + /// + [SupportedOSPlatform("windows")] + public LoginItemLaunchItem[] LaunchItems { get; set; } } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/LoginItemSettingsOptions.cs b/src/ElectronNET.API/API/Entities/LoginItemSettingsOptions.cs index bd23d453..85e408f2 100644 --- a/src/ElectronNET.API/API/Entities/LoginItemSettingsOptions.cs +++ b/src/ElectronNET.API/API/Entities/LoginItemSettingsOptions.cs @@ -1,4 +1,6 @@ -namespace ElectronNET.API.Entities +using System.Runtime.Versioning; + +namespace ElectronNET.API.Entities { /// /// @@ -8,11 +10,25 @@ public class LoginItemSettingsOptions /// /// The executable path to compare against. Defaults to process.execPath. /// + [SupportedOSPlatform("windows")] public string Path { get; set; } /// /// The command-line arguments to compare against. Defaults to an empty array. /// + [SupportedOSPlatform("windows")] public string[] Args { get; set; } + + /// + /// The type of service to query on macOS 13+. Defaults to 'mainAppService'. Only available on macOS 13 and up. + /// + [SupportedOSPlatform("macos")] + public string Type { get; set; } + + /// + /// The name of the service. Required if type is non-default. Only available on macOS 13 and up. + /// + [SupportedOSPlatform("macos")] + public string ServiceName { get; set; } } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/LoginSettings.cs b/src/ElectronNET.API/API/Entities/LoginSettings.cs index 994a9941..05ba0209 100644 --- a/src/ElectronNET.API/API/Entities/LoginSettings.cs +++ b/src/ElectronNET.API/API/Entities/LoginSettings.cs @@ -1,8 +1,11 @@ -namespace ElectronNET.API.Entities +using System.Runtime.Versioning; + +namespace ElectronNET.API.Entities { /// - /// + /// Settings object for app.setLoginItemSettings() on macOS and Windows. /// + /// Up-to-date with Electron API 39.2 public class LoginSettings { /// @@ -14,19 +17,46 @@ public class LoginSettings /// /// to open the app as hidden. Defaults to . The user can edit this /// setting from the System Preferences so app.getLoginItemSettings().wasOpenedAsHidden should be checked when the app is - /// opened to know the current value. This setting is not available on MAS builds. + /// opened to know the current value. This setting is not available on MAS builds and does not work on macOS 13 and up. /// + [SupportedOSPlatform("macos")] public bool OpenAsHidden { get; set; } /// /// The executable to launch at login. Defaults to process.execPath. /// + [SupportedOSPlatform("windows")] public string Path { get; set; } /// /// The command-line arguments to pass to the executable. Defaults to an empty /// array.Take care to wrap paths in quotes. /// + [SupportedOSPlatform("windows")] public string[] Args { get; set; } + + /// + /// The type of service to add as a login item. Defaults to 'mainAppService'. Only available on macOS 13 and up. + /// + [SupportedOSPlatform("macos")] + public string Type { get; set; } + + /// + /// The name of the service. Required if Type is non-default. Only available on macOS 13 and up. + /// + [SupportedOSPlatform("macos")] + public string ServiceName { get; set; } + + /// + /// Change the startup approved registry key and enable/disable the app in Task Manager and Windows Settings. Defaults to true. + /// + [SupportedOSPlatform("windows")] + public bool Enabled { get; set; } = true; + + /// + /// Value name to write into registry. Defaults to the app's AppUserModelId(). + /// + [SupportedOSPlatform("windows")] + public string Name { get; set; } } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/Margins.cs b/src/ElectronNET.API/API/Entities/Margins.cs index b99bb681..e6da4efb 100644 --- a/src/ElectronNET.API/API/Entities/Margins.cs +++ b/src/ElectronNET.API/API/Entities/Margins.cs @@ -1,33 +1,42 @@ namespace ElectronNET.API.Entities; /// -/// +/// Margins object used by webContents.print options and webContents.printToPDF. /// +/// Up-to-date with Electron API 39.2 public class Margins { /// - /// Can be `default`, `none`, `printableArea`, or `custom`. If `custom` is chosen, + /// Gets or sets the margin type. Can be `default`, `none`, `printableArea`, or `custom`. If `custom` is chosen, /// you will also need to specify `top`, `bottom`, `left`, and `right`. /// public string MarginType { get; set; } /// - /// The top margin of the printed web page, in pixels. + /// Gets or sets the top margin of the printed web page. Units depend on API: + /// - webContents.print: pixels + /// - webContents.printToPDF: inches /// - public int Top { get; set; } + public double Top { get; set; } /// - /// The bottom margin of the printed web page, in pixels. + /// Gets or sets the bottom margin of the printed web page. Units depend on API: + /// - webContents.print: pixels + /// - webContents.printToPDF: inches /// - public int Bottom { get; set; } + public double Bottom { get; set; } /// - /// The left margin of the printed web page, in pixels. + /// Gets or sets the left margin of the printed web page. Units depend on API: + /// - webContents.print: pixels + /// - webContents.printToPDF: inches /// - public int Left { get; set; } + public double Left { get; set; } /// - /// The right margin of the printed web page, in pixels. + /// Gets or sets the right margin of the printed web page. Units depend on API: + /// - webContents.print: pixels + /// - webContents.printToPDF: inches /// - public int Right { get; set; } + public double Right { get; set; } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/MemoryInfo.cs b/src/ElectronNET.API/API/Entities/MemoryInfo.cs index a7eb0949..d8b11eb3 100644 --- a/src/ElectronNET.API/API/Entities/MemoryInfo.cs +++ b/src/ElectronNET.API/API/Entities/MemoryInfo.cs @@ -1,24 +1,28 @@ -namespace ElectronNET.API.Entities +using System.Runtime.Versioning; + +namespace ElectronNET.API.Entities { /// - /// + /// Process memory info as returned by process.getProcessMemoryInfo(). + /// Values are reported in Kilobytes. /// + /// Up-to-date with Electron API 39.2 public class MemoryInfo { /// - /// The amount of memory currently pinned to actual physical RAM. + /// Gets or sets the amount of memory currently pinned to actual physical RAM. /// public int WorkingSetSize { get; set; } /// - /// The maximum amount of memory that has ever been pinned to actual physical RAM. + /// Gets or sets the maximum amount of memory that has ever been pinned to actual physical RAM. /// public int PeakWorkingSetSize { get; set; } /// - /// The amount of memory not shared by other processes, such as JS heap or HTML - /// content. + /// Gets or sets the amount of memory not shared by other processes, such as JS heap or HTML content. Windows only. /// + [SupportedOSPlatform("windows")] public int PrivateBytes { get; set; } } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/MenuItem.cs b/src/ElectronNET.API/API/Entities/MenuItem.cs index b50b9658..13a6e195 100644 --- a/src/ElectronNET.API/API/Entities/MenuItem.cs +++ b/src/ElectronNET.API/API/Entities/MenuItem.cs @@ -1,11 +1,13 @@ using System; using System.Text.Json.Serialization; +using System.Runtime.Versioning; namespace ElectronNET.API.Entities { /// /// /// + /// Up-to-date with Electron API 39.2 public class MenuItem { /// @@ -16,13 +18,12 @@ public class MenuItem public Action Click { get; set; } /// - /// Define the action of the menu item, when specified the click property will be - /// ignored. + /// Gets or sets the action (role) of the menu item. When specified, the click property will be ignored. /// public MenuRole Role { get; set; } /// - /// Can be normal, separator, submenu, checkbox or radio. + /// Gets or sets the menu item type. Can be normal, separator, submenu, checkbox, radio, header (macOS 14+), or palette (macOS 14+). /// public MenuType Type { get; set; } @@ -42,8 +43,15 @@ public class MenuItem /// /// The sublabel. /// + [SupportedOSPlatform("macos")] public string Sublabel { get; set; } + /// + /// Hover text for this menu item (macOS). + /// + [SupportedOSPlatform("macos")] + public string ToolTip { get; set; } + /// /// Gets or sets the accelerator. @@ -63,17 +71,31 @@ public class MenuItem public string Icon { get; set; } /// - /// If false, the menu item will be greyed out and unclickable. + /// Gets or sets a value indicating whether the item is enabled. If false, the menu item will be greyed out and unclickable. /// public bool Enabled { get; set; } = true; /// - /// If false, the menu item will be entirely hidden. + /// Gets or sets a value indicating whether the item is visible. If false, the menu item will be entirely hidden. /// public bool Visible { get; set; } = true; /// - /// Should only be specified for checkbox or radio type menu items. + /// Gets or sets a value indicating whether the accelerator should work when the item is hidden. Default is true (macOS). + /// When false, prevents the accelerator from triggering the item if the item is not visible. + /// + [SupportedOSPlatform("macos")] + public bool? AcceleratorWorksWhenHidden { get; set; } + + /// + /// Gets or sets a value indicating whether the accelerator should be registered with the system or only displayed (Linux/Windows). Defaults to true. + /// + [SupportedOSPlatform("windows")] + [SupportedOSPlatform("linux")] + public bool? RegisterAccelerator { get; set; } + + /// + /// Gets or sets a value indicating whether the item is checked. Should only be specified for checkbox or radio items. /// public bool Checked { get; set; } @@ -85,15 +107,44 @@ public class MenuItem public MenuItem[] Submenu { get; set; } /// - /// Unique within a single menu. If defined then it can be used as a reference to - /// this item by the position attribute. + /// The item to share when the role is shareMenu (macOS). + /// + [SupportedOSPlatform("macos")] + public SharingItem SharingItem { get; set; } + + /// + /// Gets or sets a unique id within a single menu. If defined then it can be used as a reference for placement. /// public string Id { get; internal set; } /// - /// This field allows fine-grained definition of the specific location within a - /// given menu. + /// This field allows fine-grained definition of the specific location within a given menu. /// public string Position { get; set; } + + /// + /// Gets or sets a list of item ids. Inserts this item before the item(s) with the specified id(s). + /// If the referenced item doesn't exist the item will be inserted at the end of the menu. + /// Also implies that this item should be placed in the same group as the referenced item(s). + /// + public string[] Before { get; set; } + + /// + /// Gets or sets a list of item ids. Inserts this item after the item(s) with the specified id(s). + /// If the referenced item doesn't exist the item will be inserted at the end of the menu. + /// + public string[] After { get; set; } + + /// + /// Gets or sets a list of item ids. Places this item's containing group before the containing group + /// of the item(s) with the specified id(s). + /// + public string[] BeforeGroupContaining { get; set; } + + /// + /// Gets or sets a list of item ids. Places this item's containing group after the containing group + /// of the item(s) with the specified id(s). + /// + public string[] AfterGroupContaining { get; set; } } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/MenuRole.cs b/src/ElectronNET.API/API/Entities/MenuRole.cs index 37f10090..e2eed341 100644 --- a/src/ElectronNET.API/API/Entities/MenuRole.cs +++ b/src/ElectronNET.API/API/Entities/MenuRole.cs @@ -31,14 +31,14 @@ public enum MenuRole paste, /// - /// The pasteandmatchstyle + /// The pasteAndMatchStyle /// - pasteandmatchstyle, + pasteAndMatchStyle, /// - /// The selectall + /// The selectAll /// - selectall, + selectAll, /// /// The delete @@ -68,12 +68,12 @@ public enum MenuRole /// /// Reload the current window ignoring the cache. /// - forcereload, + forceReload, /// /// Toggle developer tools in the current window /// - toggledevtools, + toggleDevTools, /// /// Toggle full screen mode on the current window @@ -83,17 +83,17 @@ public enum MenuRole /// /// Reset the focused page’s zoom level to the original size /// - resetzoom, + resetZoom, /// /// Zoom in the focused page by 10% /// - zoomin, + zoomIn, /// /// Zoom out the focused page by 10% /// - zoomout, + zoomOut, /// /// Whole default “Edit” menu (Undo, Copy, etc.) @@ -118,7 +118,7 @@ public enum MenuRole /// /// Only macOS: Map to the hideOtherApplications action /// - hideothers, + hideOthers, /// /// Only macOS: Map to the unhideAllApplications action @@ -128,12 +128,12 @@ public enum MenuRole /// /// Only macOS: Map to the startSpeaking action /// - startspeaking, + startSpeaking, /// /// Only macOS: Map to the stopSpeaking action /// - stopspeaking, + stopSpeaking, /// /// Only macOS: Map to the arrangeInFront action @@ -158,6 +158,108 @@ public enum MenuRole /// /// Only macOS: The submenu is a “Services” menu /// - services + services, + + /// + /// Toggle built-in spellchecker. + /// + toggleSpellChecker, + + /// + /// The submenu is a "File" menu. + /// + fileMenu, + + /// + /// The submenu is a "View" menu. + /// + viewMenu, + + /// + /// The application menu. + /// + appMenu, + + /// + /// The submenu is a "Share" menu. + /// + shareMenu, + + /// + /// Displays a list of files recently opened by the app. + /// + recentDocuments, + + /// + /// Clear the recent documents list. + /// + clearRecentDocuments, + + /// + /// Toggle the tab bar (macOS). + /// + toggleTabBar, + + /// + /// Select the next tab (macOS). + /// + selectNextTab, + + /// + /// Select the previous tab (macOS). + /// + selectPreviousTab, + + /// + /// Show all tabs (macOS). + /// + showAllTabs, + + /// + /// Merge all windows (macOS). + /// + mergeAllWindows, + + /// + /// Move the current tab to a new window (macOS). + /// + moveTabToNewWindow, + + /// + /// Show substitutions panel (macOS). + /// + showSubstitutions, + + /// + /// Toggle smart quotes (macOS). + /// + toggleSmartQuotes, + + /// + /// Toggle smart dashes (macOS). + /// + toggleSmartDashes, + + /// + /// Toggle text replacement (macOS). + /// + toggleTextReplacement, + + // Backwards-compatibility aliases (old identifiers) to avoid breaking existing code. + // These map to the same enum values as their official values. + pasteandmatchstyle = pasteAndMatchStyle, + selectall = selectAll, + forcereload = forceReload, + toggledevtools = toggleDevTools, + resetzoom = resetZoom, + zoomin = zoomIn, + zoomout = zoomOut, + hideothers = hideOthers, + startspeaking = startSpeaking, + stopspeaking = stopSpeaking, + togglespellchecker = toggleSpellChecker, + togglesmartquotes = toggleSmartQuotes, + togglesmartdashes = toggleSmartDashes, + toggletextreplacement = toggleTextReplacement } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/MenuType.cs b/src/ElectronNET.API/API/Entities/MenuType.cs index 9da110cd..86682818 100644 --- a/src/ElectronNET.API/API/Entities/MenuType.cs +++ b/src/ElectronNET.API/API/Entities/MenuType.cs @@ -1,33 +1,48 @@ -namespace ElectronNET.API.Entities +using System.Runtime.Versioning; + +namespace ElectronNET.API.Entities { /// - /// + /// Menu item types matching Electron's MenuItem.type values. /// + /// Up-to-date with Electron API 39.2 public enum MenuType { /// - /// The normal + /// Normal menu item. /// normal, /// - /// The separator + /// Separator between items. /// separator, /// - /// The submenu + /// Submenu container. /// submenu, /// - /// The checkbox + /// Checkbox item. /// checkbox, /// - /// The radio + /// Radio item. + /// + radio, + + /// + /// Header item (macOS 14+). + /// + [SupportedOSPlatform("macos")] + header, + + /// + /// Palette item (macOS 14+). /// - radio + [SupportedOSPlatform("macos")] + palette } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/MessageBoxOptions.cs b/src/ElectronNET.API/API/Entities/MessageBoxOptions.cs index b4f7e09d..09ce56a7 100644 --- a/src/ElectronNET.API/API/Entities/MessageBoxOptions.cs +++ b/src/ElectronNET.API/API/Entities/MessageBoxOptions.cs @@ -1,88 +1,82 @@ using System.Text.Json.Serialization; +using System.Runtime.Versioning; namespace ElectronNET.API.Entities { /// - /// + /// Options for dialog.showMessageBox / dialog.showMessageBoxSync. /// + /// Up-to-date with Electron API 39.2 public class MessageBoxOptions { /// - /// Can be "none", "info", "error", "question" or "warning". On Windows, "question" - /// displays the same icon as "info", unless you set an icon using the "icon" - /// option. On macOS, both "warning" and "error" display the same warning icon. + /// Gets or sets the type. Can be "none", "info", "error", "question" or "warning". On Windows, "question" displays the same icon as "info", unless you set an icon using the "icon" option. On macOS, both "warning" and "error" display the same warning icon. /// public MessageBoxType Type { get; set; } /// - /// Array of texts for buttons. On Windows, an empty array will result in one button - /// labeled "OK". + /// Gets or sets the array of texts for buttons. On Windows, an empty array will result in one button labeled "OK". /// public string[] Buttons { get; set; } /// - /// Index of the button in the buttons array which will be selected by default when - /// the message box opens. + /// Gets or sets the index of the button in the buttons array which will be selected by default when the message box opens. /// public int DefaultId { get; set; } /// - /// Title of the message box, some platforms will not show it. + /// Gets or sets the title of the message box; some platforms will not show it. /// public string Title { get; set; } /// - /// Content of the message box. + /// Gets or sets the content of the message box. /// public string Message { get; set; } /// - /// Extra information of the message. + /// Gets or sets the extra information of the message. /// public string Detail { get; set; } /// - /// If provided, the message box will include a checkbox with the given label. The - /// checkbox state can be inspected only when using callback. + /// Gets or sets the checkbox label. If provided, the message box will include a checkbox with the given label. /// public string CheckboxLabel { get; set; } /// - /// Initial checked state of the checkbox. false by default. + /// Gets or sets the initial checked state of the checkbox. Defaults to false. /// public bool CheckboxChecked { get; set; } /// - /// Gets or sets the icon. + /// Gets or sets the icon for the message box. /// - /// - /// The icon. - /// public string Icon { get; set; } /// - /// The index of the button to be used to cancel the dialog, via the Esc key. By - /// default this is assigned to the first button with "cancel" or "no" as the label. - /// If no such labeled buttons exist and this option is not set, 0 will be used as - /// the return value or callback response. This option is ignored on Windows. + /// Gets or sets the custom width of the text in the message box. + /// + [SupportedOSPlatform("macos")] + public int? TextWidth { get; set; } + + /// + /// Gets or sets the index of the button to be used to cancel the dialog via the Esc key. By default this is assigned to the first button with "cancel" or "no" as the label. If no such labeled buttons exist and this option is not set, 0 will be used. /// public int CancelId { get; set; } /// - /// On Windows Electron will try to figure out which one of the buttons are common - /// buttons(like "Cancel" or "Yes"), and show the others as command links in the - /// dialog.This can make the dialog appear in the style of modern Windows apps. If - /// you don't like this behavior, you can set noLink to true. + /// Gets or sets a value indicating whether to disable Windows command-links behavior (noLink). + /// On Windows Electron will try to figure out which one of the buttons are common buttons (like "Cancel" or "Yes"), and show the others as command links in the dialog. Set to true to disable this behavior. /// + [SupportedOSPlatform("windows")] public bool NoLink { get; set; } /// - /// Normalize the keyboard access keys across platforms. Default is false. Enabling - /// this assumes AND character is used in the button labels for the placement of the keyboard + /// Gets or sets a value indicating whether to normalize the keyboard access keys across platforms. Default is false. Enabling this assumes '&' is used in the button labels for the placement of the keyboard /// shortcut access key and labels will be converted so they work correctly on each - /// platform, AND characters are removed on macOS, converted to _ on Linux, and left - /// untouched on Windows.For example, a button label of VieANDw will be converted to - /// Vie_w on Linux and View on macOS and can be selected via Alt-W on Windows and + /// platform, '&' characters are removed on macOS, converted to '_' on Linux, and left + /// untouched on Windows. For example, a button label of "View" will be converted to "Vie_w" on Linux and "View" on macOS and can be selected via Alt-W on Windows and /// Linux. /// public bool NormalizeAccessKeys { get; set; } diff --git a/src/ElectronNET.API/API/Entities/MessageBoxResult.cs b/src/ElectronNET.API/API/Entities/MessageBoxResult.cs index 1894c09c..dd44c24a 100644 --- a/src/ElectronNET.API/API/Entities/MessageBoxResult.cs +++ b/src/ElectronNET.API/API/Entities/MessageBoxResult.cs @@ -1,24 +1,19 @@ namespace ElectronNET.API.Entities { /// - /// + /// Result returned by dialog.showMessageBox / dialog.showMessageBoxSync. /// + /// Up-to-date with Electron API 39.2 public class MessageBoxResult { /// - /// Gets or sets the response. + /// The index of the clicked button. /// - /// - /// The response. - /// public int Response { get; set; } /// - /// Gets or sets a value indicating whether [checkbox checked]. + /// The checked state of the checkbox if CheckboxLabel was set; otherwise false. /// - /// - /// true if [checkbox checked]; otherwise, false. - /// public bool CheckboxChecked { get; set; } } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/MessageBoxType.cs b/src/ElectronNET.API/API/Entities/MessageBoxType.cs index 09fb3b0b..3490bad9 100644 --- a/src/ElectronNET.API/API/Entities/MessageBoxType.cs +++ b/src/ElectronNET.API/API/Entities/MessageBoxType.cs @@ -1,8 +1,9 @@ namespace ElectronNET.API.Entities { /// - /// + /// Message box type for dialog.showMessageBox/showMessageBoxSync. /// + /// Up-to-date with Electron API 39.2 public enum MessageBoxType { /// diff --git a/src/ElectronNET.API/API/Entities/ModifierType.cs b/src/ElectronNET.API/API/Entities/ModifierType.cs index d7b37458..664d40f5 100644 --- a/src/ElectronNET.API/API/Entities/ModifierType.cs +++ b/src/ElectronNET.API/API/Entities/ModifierType.cs @@ -1,8 +1,9 @@ namespace ElectronNET.API.Entities; /// -/// Specifies the possible modifier keys for a keyboard input. +/// Specifies the possible modifier keys for a keyboard input (maps to InputEvent.modifiers). /// +/// Up-to-date with Electron API 39.2 public enum ModifierType { /// diff --git a/src/ElectronNET.API/API/Entities/NativeImage.cs b/src/ElectronNET.API/API/Entities/NativeImage.cs index bf087919..e974d41a 100644 --- a/src/ElectronNET.API/API/Entities/NativeImage.cs +++ b/src/ElectronNET.API/API/Entities/NativeImage.cs @@ -7,6 +7,7 @@ using System.Linq; using System.Text.Json.Serialization; using System.Text.RegularExpressions; +using System.Runtime.Versioning; namespace ElectronNET.API.Entities { @@ -268,6 +269,12 @@ public bool IsEmpty() /// public bool IsTemplateImage => _isTemplateImage; + /// + /// Whether the image is considered a macOS template image. + /// + [SupportedOSPlatform("macos")] + public bool IsMacTemplateImage => _isTemplateImage; + /// /// Deprecated. Marks the image as a template image. /// diff --git a/src/ElectronNET.API/API/Entities/NativeImageJsonConverter.cs b/src/ElectronNET.API/API/Entities/NativeImageJsonConverter.cs index dddcbccc..140e6d1c 100644 --- a/src/ElectronNET.API/API/Entities/NativeImageJsonConverter.cs +++ b/src/ElectronNET.API/API/Entities/NativeImageJsonConverter.cs @@ -8,6 +8,7 @@ namespace ElectronNET.API.Entities { + /// Project-specific: JSON converter for NativeImage; no MCP structure equivalent. internal class NativeImageJsonConverter : JsonConverter { public override void Write(Utf8JsonWriter writer, NativeImage value, JsonSerializerOptions options) diff --git a/src/ElectronNET.API/API/Entities/NotificationAction.cs b/src/ElectronNET.API/API/Entities/NotificationAction.cs index c7194cd0..71e681cf 100644 --- a/src/ElectronNET.API/API/Entities/NotificationAction.cs +++ b/src/ElectronNET.API/API/Entities/NotificationAction.cs @@ -1,17 +1,21 @@ -namespace ElectronNET.API.Entities +using System.Runtime.Versioning; + +namespace ElectronNET.API.Entities { /// /// /// + /// Up-to-date with Electron API 39.2 + [SupportedOSPlatform("macos")] public class NotificationAction { /// - /// The label for the given action. + /// Gets or sets the label for the action. /// public string Text { get; set; } /// - /// The type of action, can be button. + /// Gets or sets the type of action; can be 'button'. /// public string Type { get; set; } } diff --git a/src/ElectronNET.API/API/Entities/NotificationOptions.cs b/src/ElectronNET.API/API/Entities/NotificationOptions.cs index 4093f523..cd17dfac 100644 --- a/src/ElectronNET.API/API/Entities/NotificationOptions.cs +++ b/src/ElectronNET.API/API/Entities/NotificationOptions.cs @@ -7,75 +7,85 @@ namespace ElectronNET.API.Entities /// /// /// + /// Up-to-date with Electron API 39.2 public class NotificationOptions { /// - /// A title for the notification, which will be shown at the top of the notification - /// window when it is shown. + /// Gets or sets the title for the notification, which will be shown at the top of the notification window when it is shown. /// public string Title { get; set; } /// - /// A subtitle for the notification, which will be displayed below the title. + /// Gets or sets the subtitle for the notification, which will be displayed below the title. /// - public string SubTitle { get; set; } + [SupportedOSPlatform("macos")] + [JsonPropertyName("subtitle")] + public string Subtitle { get; set; } /// - /// The body text of the notification, which will be displayed below the title or - /// subtitle. + /// Gets or sets the body text of the notification, which will be displayed below the title or subtitle. /// public string Body { get; set; } /// - /// Whether or not to emit an OS notification noise when showing the notification. + /// Gets or sets a value indicating whether to suppress the OS notification noise when showing the notification. /// public bool Silent { get; set; } /// - /// An icon to use in the notification. + /// Gets or sets an icon to use in the notification. Can be a string path or a NativeImage. If a string is passed, it must be a valid path to a local icon file. /// public string Icon { get; set; } /// - /// Whether or not to add an inline reply option to the notification. + /// Gets or sets a value indicating whether to add an inline reply option to the notification. /// + [SupportedOSPlatform("macos")] public bool HasReply { get; set; } /// - /// The timeout duration of the notification. Can be 'default' or 'never'. + /// Gets or sets the timeout duration of the notification. Can be 'default' or 'never'. /// - [SupportedOSPlatform("Linux")] - [SupportedOSPlatform("Windows")] + [SupportedOSPlatform("linux")] + [SupportedOSPlatform("windows")] public string TimeoutType { get; set; } /// - /// The placeholder to write in the inline reply input field. + /// Gets or sets the placeholder to write in the inline reply input field. /// + [SupportedOSPlatform("macos")] public string ReplyPlaceholder { get; set; } /// - /// The name of the sound file to play when the notification is shown. + /// Gets or sets the name of the sound file to play when the notification is shown. /// + [SupportedOSPlatform("macos")] public string Sound { get; set; } /// - /// The urgency level of the notification. Can be 'normal', 'critical', or 'low'. + /// Gets or sets the urgency level of the notification. Can be 'normal', 'critical', or 'low'. /// - [SupportedOSPlatform("Linux")] + [SupportedOSPlatform("linux")] public string Urgency { get; set; } /// - /// Actions to add to the notification. Please read the available actions and - /// limitations in the NotificationAction documentation. + /// Gets or sets the actions to add to the notification. Please read the available actions and limitations in the NotificationAction documentation. /// - public NotificationAction Actions { get; set; } + [SupportedOSPlatform("macos")] + public NotificationAction[] Actions { get; set; } /// - /// A custom title for the close button of an alert. An empty string will cause the - /// default localized text to be used. + /// Gets or sets a custom title for the close button of an alert. An empty string will cause the default localized text to be used. /// + [SupportedOSPlatform("macos")] public string CloseButtonText { get; set; } + /// + /// Gets or sets a custom description of the Notification on Windows superseding all properties above. Provides full customization of design and behavior of the notification. + /// + [SupportedOSPlatform("windows")] + public string ToastXml { get; set; } + /// /// Emitted when the notification is shown to the user, note this could be fired /// multiple times as a notification can be shown multiple times through the Show() @@ -131,7 +141,7 @@ public class NotificationOptions /// The string the user entered into the inline reply field /// [JsonIgnore] - [SupportedOSPlatform("macOS")] + [SupportedOSPlatform("macos")] public Action OnReply { get; set; } /// @@ -144,11 +154,11 @@ public class NotificationOptions internal string ReplyID { get; set; } /// - /// macOS only - The index of the action that was activated + /// macOS only - The index of the action that was activated. /// [JsonIgnore] - [SupportedOSPlatform("macOS")] - public Action OnAction { get; set; } + [SupportedOSPlatform("macos")] + public Action OnAction { get; set; } /// /// Gets or sets the action identifier. @@ -159,6 +169,14 @@ public class NotificationOptions [JsonInclude] internal string ActionID { get; set; } + /// + /// Windows only: Emitted when an error is encountered while creating and showing the native notification. + /// Corresponds to the 'failed' event on Notification. + /// + [JsonIgnore] + [SupportedOSPlatform("windows")] + public Action OnFailed { get; set; } + /// /// Initializes a new instance of the class. /// @@ -170,4 +188,4 @@ public NotificationOptions(string title, string body) Body = body; } } -} +} \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/OnDidFailLoadInfo.cs b/src/ElectronNET.API/API/Entities/OnDidFailLoadInfo.cs index 2a57182f..d6fdcc3f 100644 --- a/src/ElectronNET.API/API/Entities/OnDidFailLoadInfo.cs +++ b/src/ElectronNET.API/API/Entities/OnDidFailLoadInfo.cs @@ -15,4 +15,24 @@ public class OnDidFailLoadInfo /// Validated URL. /// public string ValidatedUrl { get; set; } + + /// + /// Error description string. + /// + public string ErrorDescription { get; set; } + + /// + /// True if the event pertains to the main frame. + /// + public bool IsMainFrame { get; set; } + + /// + /// The process id for the frame. + /// + public int FrameProcessId { get; set; } + + /// + /// The routing id for the frame. + /// + public int FrameRoutingId { get; set; } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/OnDidNavigateInfo.cs b/src/ElectronNET.API/API/Entities/OnDidNavigateInfo.cs index 52c2b149..6094ca51 100644 --- a/src/ElectronNET.API/API/Entities/OnDidNavigateInfo.cs +++ b/src/ElectronNET.API/API/Entities/OnDidNavigateInfo.cs @@ -1,17 +1,23 @@ namespace ElectronNET.API.Entities; /// -/// 'OnDidNavigate' event details. +/// 'did-navigate' event details for main frame navigation. /// +/// Up-to-date with Electron API 39.2 public class OnDidNavigateInfo { /// - /// Navigated URL. + /// The URL navigated to. /// public string Url { get; set; } /// - /// HTTP response code. + /// HTTP response code (-1 for non-HTTP navigations). /// public int HttpResponseCode { get; set; } + + /// + /// HTTP status text (empty for non-HTTP navigations). + /// + public string HttpStatusText { get; set; } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/OnTopLevel.cs b/src/ElectronNET.API/API/Entities/OnTopLevel.cs index f2a125c3..0165f53b 100644 --- a/src/ElectronNET.API/API/Entities/OnTopLevel.cs +++ b/src/ElectronNET.API/API/Entities/OnTopLevel.cs @@ -1,10 +1,14 @@ using System.ComponentModel; +using System.Runtime.Versioning; namespace ElectronNET.API.Entities { /// - /// + /// String values for the 'level' parameter of BrowserWindow.setAlwaysOnTop. /// + /// Up-to-date with Electron API 39.2 + [SupportedOSPlatform("macOS")] + [SupportedOSPlatform("Windows")] public enum OnTopLevel { /// diff --git a/src/ElectronNET.API/API/Entities/OpenDevToolsOptions.cs b/src/ElectronNET.API/API/Entities/OpenDevToolsOptions.cs index b94da91f..6bea1d80 100644 --- a/src/ElectronNET.API/API/Entities/OpenDevToolsOptions.cs +++ b/src/ElectronNET.API/API/Entities/OpenDevToolsOptions.cs @@ -8,10 +8,19 @@ namespace ElectronNET.API.Entities public class OpenDevToolsOptions { /// - /// Opens the devtools with specified dock state, can be right, bottom, undocked, - /// detach.Defaults to last used dock state.In undocked mode it's possible to dock - /// back.In detach mode it's not. + /// Opens the DevTools with specified dock state. Can be left, right, bottom, undocked, or detach. + /// Defaults to the last used dock state. In undocked mode it's possible to dock back; in detach mode it's not. /// public DevToolsMode Mode { get; set; } + + /// + /// Whether to bring the opened DevTools window to the foreground. Default is true. + /// + public bool Activate { get; set; } = true; + + /// + /// A title for the DevTools window (only visible in undocked or detach mode). + /// + public string Title { get; set; } } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/OpenDialogOptions.cs b/src/ElectronNET.API/API/Entities/OpenDialogOptions.cs index 26cd6ecc..1e6899ce 100644 --- a/src/ElectronNET.API/API/Entities/OpenDialogOptions.cs +++ b/src/ElectronNET.API/API/Entities/OpenDialogOptions.cs @@ -2,9 +2,12 @@ namespace ElectronNET.API.Entities { + using System.Runtime.Versioning; + /// /// /// + /// Up-to-date with Electron API 39.2 public class OpenDialogOptions { /// @@ -29,18 +32,19 @@ public class OpenDialogOptions public string ButtonLabel { get; set; } /// - /// Contains which features the dialog should use. The following values are supported: + /// Gets or sets which features the dialog should use. The following values are supported: /// 'openFile' | 'openDirectory' | 'multiSelections' | 'showHiddenFiles' | 'createDirectory' | 'promptToCreate' | 'noResolveAliases' | 'treatPackageAsDirectory' /// public OpenDialogProperty[] Properties { get; set; } /// - /// Message to display above input boxes. + /// Gets or sets the message to display above input boxes. /// + [SupportedOSPlatform("macos")] public string Message { get; set; } /// - /// The filters specifies an array of file types that can be displayed or + /// Gets or sets the filters specifying an array of file types that can be displayed or /// selected when you want to limit the user to a specific type. For example: /// /// @@ -55,5 +59,11 @@ public class OpenDialogOptions /// /// public FileFilter[] Filters { get; set; } + + /// + /// Create security scoped bookmarks when packaged for the Mac App Store. + /// + [SupportedOSPlatform("macos")] + public bool SecurityScopedBookmarks { get; set; } } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/OpenDialogProperty.cs b/src/ElectronNET.API/API/Entities/OpenDialogProperty.cs index 44a16b15..42ecd037 100644 --- a/src/ElectronNET.API/API/Entities/OpenDialogProperty.cs +++ b/src/ElectronNET.API/API/Entities/OpenDialogProperty.cs @@ -1,5 +1,7 @@ namespace ElectronNET.API.Entities { + using System.Runtime.Versioning; + /// /// /// @@ -28,21 +30,31 @@ public enum OpenDialogProperty /// /// The create directory /// + [SupportedOSPlatform("macos")] createDirectory, /// /// The prompt to create /// + [SupportedOSPlatform("windows")] promptToCreate, /// /// The no resolve aliases /// + [SupportedOSPlatform("macos")] noResolveAliases, /// /// The treat package as directory /// - treatPackageAsDirectory + [SupportedOSPlatform("macos")] + treatPackageAsDirectory, + + /// + /// Do not add the item being opened to the recent documents list (Windows). + /// + [SupportedOSPlatform("windows")] + dontAddToRecent } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/OpenExternalOptions.cs b/src/ElectronNET.API/API/Entities/OpenExternalOptions.cs index f648cd19..1d3f3f5b 100644 --- a/src/ElectronNET.API/API/Entities/OpenExternalOptions.cs +++ b/src/ElectronNET.API/API/Entities/OpenExternalOptions.cs @@ -1,21 +1,32 @@ using System.ComponentModel; +using System.Runtime.Versioning; namespace ElectronNET.API.Entities { /// /// Controls the behavior of OpenExternal. /// + /// Up-to-date with Electron API 39.2 public class OpenExternalOptions { /// - /// to bring the opened application to the foreground. The default is . + /// Gets or sets whether to bring the opened application to the foreground. The default is . /// + [SupportedOSPlatform("macos")] [DefaultValue(true)] public bool Activate { get; set; } = true; /// - /// The working directory. + /// Gets or sets the working directory. /// + [SupportedOSPlatform("windows")] public string WorkingDirectory { get; set; } + + /// + /// Gets or sets a value indicating a user-initiated launch that enables tracking of frequently used programs and other behaviors. The default is . + /// + [SupportedOSPlatform("windows")] + [DefaultValue(false)] + public bool LogUsage { get; set; } = false; } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/PageSize.cs b/src/ElectronNET.API/API/Entities/PageSize.cs index 42562256..4b83e15e 100644 --- a/src/ElectronNET.API/API/Entities/PageSize.cs +++ b/src/ElectronNET.API/API/Entities/PageSize.cs @@ -4,17 +4,35 @@ public class PageSize { private readonly string _value; + /// + /// Represents the page size for printing/PDF. + /// Matches Electron semantics: either a named size (e.g. 'A4', 'Letter', 'Legal', 'Tabloid', 'Ledger', etc.) + /// or a custom size specified by Height and Width in inches. + /// + /// Up-to-date with Electron API 39.2 public PageSize() { } private PageSize(string value) : this() => _value = value; + /// + /// Gets or sets the custom page height in inches (when using object form instead of a named size). + /// public double Height { get; set; } + /// + /// Gets or sets the custom page width in inches (when using object form instead of a named size). + /// public double Width { get; set; } + /// + /// Implicit conversion to string to represent named page sizes (e.g. 'A4', 'Letter'). + /// public static implicit operator string(PageSize pageSize) => pageSize?._value; + /// + /// Implicit conversion from string to represent named page sizes (e.g. 'A4', 'Letter'). + /// public static implicit operator PageSize(string value) => new(value); } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/PathName.cs b/src/ElectronNET.API/API/Entities/PathName.cs index e83ba8b0..6fe8ab89 100644 --- a/src/ElectronNET.API/API/Entities/PathName.cs +++ b/src/ElectronNET.API/API/Entities/PathName.cs @@ -1,95 +1,102 @@ using System.ComponentModel; +using System.Runtime.Versioning; namespace ElectronNET.API.Entities { /// - /// Defines the PathName enumeration. + /// Names for app.getPath(name). Aligned with Electron docs. /// + /// Up-to-date with Electron API 39.2 public enum PathName { /// - /// User’s home directory. + /// User's home directory. /// - [Description("home")] Home, /// /// Per-user application data directory. /// - [Description("appData")] AppData, /// - /// The directory for storing your app’s configuration files, - /// which by default it is the appData directory appended with your app’s name. + /// The directory for storing your app's configuration files, which by default is the appData directory appended with your app's name. /// - [Description("userData")] UserData, + /// + /// The directory for storing data generated by Session, such as localStorage, cookies, disk cache, downloaded dictionaries, network state, devtools files. + /// By default this points to userData. + /// + SessionData, + /// /// Temporary directory. /// - [Description("temp")] Temp, /// /// The current executable file. /// - [Description("exe")] Exe, /// - /// The libchromiumcontent library. + /// The location of the Chromium module. By default this is synonymous with exe. /// - [Description("Module")] Module, /// - /// The current user’s Desktop directory. + /// The current user's Desktop directory. /// - [Description("desktop")] Desktop, /// - /// Directory for a user’s “My Documents”. + /// Directory for a user's "My Documents". /// - [Description("documents")] Documents, /// - /// Directory for a user’s downloads. + /// Directory for a user's downloads. /// - [Description("downloads")] Downloads, /// - /// Directory for a user’s music. + /// Directory for a user's music. /// - [Description("music")] Music, /// - /// Directory for a user’s pictures. + /// Directory for a user's pictures. /// - [Description("pictures")] Pictures, /// - /// Directory for a user’s videos. + /// Directory for a user's videos. /// - [Description("videos")] Videos, /// - /// The logs. + /// Directory for the user's recent files. Windows only. + /// + [SupportedOSPlatform("windows")] + Recent, + + /// + /// Directory for your app's log folder. /// - [Description("logs")] Logs, /// - /// Full path to the system version of the Pepper Flash plugin. + /// Directory where crash dumps are stored. + /// + CrashDumps, + + /// + /// The directory where app assets such as resources.pak are stored. + /// Available on Windows and Linux only. /// - [Description("PepperFlashSystemPlugin")] - PepperFlashSystemPlugin + [SupportedOSPlatform("windows")] + [SupportedOSPlatform("linux")] + Assets } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/Point.cs b/src/ElectronNET.API/API/Entities/Point.cs index 9b3bed8a..c88f6db4 100644 --- a/src/ElectronNET.API/API/Entities/Point.cs +++ b/src/ElectronNET.API/API/Entities/Point.cs @@ -3,6 +3,7 @@ /// /// /// + /// Up-to-date with Electron API 39.2 public class Point { /// diff --git a/src/ElectronNET.API/API/Entities/PrintOptions.cs b/src/ElectronNET.API/API/Entities/PrintOptions.cs index bb3f6188..d0070ffb 100644 --- a/src/ElectronNET.API/API/Entities/PrintOptions.cs +++ b/src/ElectronNET.API/API/Entities/PrintOptions.cs @@ -3,15 +3,16 @@ namespace ElectronNET.API.Entities /// /// Print dpi /// + /// Up-to-date with Electron API 39.2 public class PrintDpi { /// - /// The horizontal dpi + /// Gets or sets the horizontal DPI. /// public float Horizontal { get; set; } /// - /// The vertical dpi + /// Gets or sets the vertical DPI. /// public float Vertical { get; set; } } @@ -19,15 +20,16 @@ public class PrintDpi /// /// The page range to print /// + /// Up-to-date with Electron API 39.2 public class PrintPageRange { /// - /// From + /// Gets or sets the starting page index (0-based). /// public int From { get; set; } /// - /// To + /// Gets or sets the ending page index (inclusive, 0-based). /// public int To { get; set; } } @@ -35,72 +37,89 @@ public class PrintPageRange /// /// Print options /// + /// Up-to-date with Electron API 39.2 public class PrintOptions { /// - /// Don't ask user for print settings + /// Gets or sets a value indicating whether to suppress print settings prompts. /// public bool Silent { get; set; } /// - /// Prints the background color and image of the web page + /// Gets or sets a value indicating whether to print background graphics. /// public bool PrintBackground { get; set; } /// - /// Set the printer device name to use + /// Gets or sets the printer device name to use. /// public string DeviceName { get; set; } /// - /// Set whether the printed web page will be in color or grayscale + /// Gets or sets a value indicating whether the page will be printed in color. /// public bool Color { get; set; } /// - /// Specifies the type of margins to use. Uses 0 for default margin, 1 for no - /// margin, and 2 for minimum margin. + /// Gets or sets the margins for the print job. Use MarginType plus top/bottom/left/right for custom. + /// Units for margins with webContents.print are pixels (per MCP); for webContents.printToPDF, inches. /// - public int MarginsType { get; set; } + public Margins Margins { get; set; } /// - /// true for landscape, false for portrait. + /// Gets or sets a value indicating whether to print in landscape orientation. /// public bool Landscape { get; set; } /// - /// The scale factor of the web page + /// Gets or sets the scale factor of the web page. /// public float ScaleFactor { get; set; } /// - /// The number of pages to print per page sheet + /// Gets or sets the number of pages to print per sheet. /// public int PagesPerSheet { get; set; } /// - /// The number of copies of the web page to print + /// Gets or sets the number of copies to print. /// - public bool Copies { get; set; } + public int Copies { get; set; } /// - /// Whether the web page should be collated + /// Gets or sets a value indicating whether pages should be collated. /// public bool Collate { get; set; } /// - /// The page range to print + /// Gets or sets the page range(s) to print. On macOS, only one range is honored. /// - public PrintPageRange PageRanges { get; set; } + public PrintPageRange[] PageRanges { get; set; } /// - /// Set the duplex mode of the printed web page. Can be simplex, shortEdge, or longEdge. + /// Gets or sets the duplex mode of the printed web page. Can be simplex, shortEdge, or longEdge. /// public string DuplexMode { get; set; } /// - /// Dpi + /// Gets or sets the DPI settings for the print job. /// public PrintDpi Dpi { get; set; } + + /// + /// Gets or sets the string to be printed as page header. + /// + public string Header { get; set; } + + /// + /// Gets or sets the string to be printed as page footer. + /// + public string Footer { get; set; } + + /// + /// Gets or sets the page size of the printed document. Can be A0–A6, Legal, Letter, Tabloid, + /// or an object. For webContents.print, custom sizes use microns (Chromium validates width_microns/height_microns). + /// + public PageSize PageSize { get; set; } } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/PrintToPDFOptions.cs b/src/ElectronNET.API/API/Entities/PrintToPDFOptions.cs index 714bca0b..1200274b 100644 --- a/src/ElectronNET.API/API/Entities/PrintToPDFOptions.cs +++ b/src/ElectronNET.API/API/Entities/PrintToPDFOptions.cs @@ -6,30 +6,31 @@ namespace ElectronNET.API.Entities; /// /// /// +/// Up-to-date with Electron API 39.2 public class PrintToPDFOptions { /// - /// Paper orientation. `true` for landscape, `false` for portrait. Defaults to false. + /// Gets or sets the paper orientation. `true` for landscape, `false` for portrait. Defaults to false. /// public bool Landscape { get; set; } = false; /// - /// Whether to display header and footer. Defaults to false. + /// Gets or sets whether to display header and footer. Defaults to false. /// public bool DisplayHeaderFooter { get; set; } = false; /// - /// Whether to print background graphics. Defaults to false. + /// Gets or sets whether to print background graphics. Defaults to false. /// public bool PrintBackground { get; set; } = false; /// - /// Scale of the webpage rendering. Defaults to 1. + /// Gets or sets the scale of the webpage rendering. Defaults to 1. /// public double Scale { get; set; } = 1; /// - /// Specify page size of the generated PDF. Can be `A0`, `A1`, `A2`, `A3`, `A4`, + /// Gets or sets the page size of the generated PDF. Can be `A0`, `A1`, `A2`, `A3`, `A4`, /// `A5`, `A6`, `Legal`, `Letter`, `Tabloid`, `Ledger`, or an Object containing /// `height` and `width` in inches. Defaults to `Letter`. /// @@ -37,13 +38,13 @@ public class PrintToPDFOptions public PageSize PageSize { get; set; } = "Letter"; /// - /// Paper ranges to print, e.g., '1-5, 8, 11-13'. Defaults to the empty string, + /// Gets or sets the paper ranges to print, e.g., '1-5, 8, 11-13'. Defaults to the empty string, /// which means print all pages. /// public string PageRanges { get; set; } = ""; /// - /// HTML template for the print header. Should be valid HTML markup with following + /// Gets or sets the HTML template for the print header. Should be valid HTML markup with following /// classes used to inject printing values into them: `date` (formatted print date), /// `title` (document title), `url` (document location), `pageNumber` (current page /// number) and `totalPages` (total pages in the document). For example, `` @@ -52,16 +53,28 @@ public class PrintToPDFOptions public string HeaderTemplate { get; set; } /// - /// HTML template for the print footer. Should use the same format as the + /// Gets or sets the HTML template for the print footer. Should use the same format as the /// `headerTemplate`. /// public string FooterTemplate { get; set; } /// - /// Whether or not to prefer page size as defined by css. Defaults to false, in + /// Gets or sets whether to prefer page size as defined by css. Defaults to false, in /// which case the content will be scaled to fit the paper size. /// public bool PreferCSSPageSize { get; set; } = false; + /// + /// Gets or sets whether to generate a tagged (accessible) PDF. Defaults to false. + /// Experimental per Electron docs; the generated PDF may not adhere fully to PDF/UA and WCAG standards. + /// + public bool GenerateTaggedPDF { get; set; } = false; + + /// + /// Gets or sets whether to generate a PDF document outline from content headers. Defaults to false. + /// Experimental per Electron docs. + /// + public bool GenerateDocumentOutline { get; set; } = false; + public Margins Margins { get; set; } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/PrinterInfo.cs b/src/ElectronNET.API/API/Entities/PrinterInfo.cs index 88b2f44a..f612eeb0 100644 --- a/src/ElectronNET.API/API/Entities/PrinterInfo.cs +++ b/src/ElectronNET.API/API/Entities/PrinterInfo.cs @@ -1,28 +1,43 @@ +using System.Collections.Generic; + namespace ElectronNET.API.Entities { /// - /// Printer info + /// PrinterInfo structure as returned by webContents.getPrintersAsync(). Fields backed by MCP: name, displayName, description, options. /// + /// Up-to-date with Electron API 39.2 public class PrinterInfo { /// - /// Name + /// Gets or sets the name of the printer as understood by the OS. /// public string Name { get; set; } /// - /// Name + /// Gets or sets the name of the printer as shown in Print Preview. + /// + public string DisplayName { get; set; } + + /// + /// Gets or sets a longer description of the printer's type. /// public string Description { get; set; } /// - /// Status + /// Gets or sets the status code reported by the OS. Semantics are platform-specific. + /// Not MCP-backed: this field is not listed in Electron's PrinterInfo structure. /// public int Status { get; set; } /// - /// Is default + /// Gets or sets a value indicating whether this printer is the system default. + /// Not MCP-backed: this field is not listed in Electron's PrinterInfo structure. /// public bool IsDefault { get; set; } + + /// + /// Gets or sets the platform-specific printer information as an object (keys/values vary by OS). + /// + public Dictionary Options { get; set; } } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/ProcessMetric.cs b/src/ElectronNET.API/API/Entities/ProcessMetric.cs index 30ef1c34..0bbde730 100644 --- a/src/ElectronNET.API/API/Entities/ProcessMetric.cs +++ b/src/ElectronNET.API/API/Entities/ProcessMetric.cs @@ -1,54 +1,58 @@ -namespace ElectronNET.API.Entities +using System.Runtime.Versioning; + +namespace ElectronNET.API.Entities { /// /// Process metrics information. /// + /// Up-to-date with Electron API 39.2 public class ProcessMetric { /// - /// Process id of the process. + /// Gets or sets the process id of the process. /// public int PId { get; set; } /// - /// Process type (Browser or Tab or GPU etc). + /// Gets or sets the process type. One of: Browser | Tab | Utility | Zygote | Sandbox helper | GPU | Pepper Plugin | Pepper Plugin Broker | Unknown. /// public string Type { get; set; } /// - /// CPU usage of the process. + /// Gets or sets the CPU usage of the process. /// public CPUUsage Cpu { get; set; } /// - /// Creation time for this process in milliseconds since Unix epoch. Can exceed Int32 range and may contain fractional milliseconds. + /// Gets or sets the creation time for this process, represented as the number of milliseconds since the UNIX epoch. Since the pid can be reused after a process dies, use both pid and creationTime to uniquely identify a process. /// public double CreationTime { get; set; } /// - /// Memory information for the process. + /// Gets or sets the memory information for the process. /// public MemoryInfo Memory { get; set; } /// - /// Whether the process is sandboxed on OS level. + /// Gets or sets a value indicating whether the process is sandboxed on OS level. /// + [SupportedOSPlatform("macos")] + [SupportedOSPlatform("windows")] public bool Sandboxed { get; set; } /// - /// One of the following values: - /// untrusted | low | medium | high | unknown + /// Gets or sets the integrity level. One of: untrusted | low | medium | high | unknown. /// + [SupportedOSPlatform("windows")] public string IntegrityLevel { get; set; } /// - /// The name of the process. - /// Examples for utility: Audio Service, Content Decryption Module Service, Network Service, Video Capture, etc. + /// Gets or sets the name of the process. Examples for utility: Audio Service, Content Decryption Module Service, Network Service, Video Capture, etc. /// public string Name { get; set; } /// - /// The non-localized name of the process. + /// Gets or sets the non-localized name of the process. /// public string ServiceName { get; set; } } diff --git a/src/ElectronNET.API/API/Entities/ProcessVersions.cs b/src/ElectronNET.API/API/Entities/ProcessVersions.cs index d7d3c012..11c76e64 100644 --- a/src/ElectronNET.API/API/Entities/ProcessVersions.cs +++ b/src/ElectronNET.API/API/Entities/ProcessVersions.cs @@ -3,6 +3,7 @@ namespace ElectronNET.API.Entities /// /// An object listing the version strings specific to Electron /// + /// Project-specific: no matching Electron structure found in MCP docs (electronjs). /// Value representing Chrome's version string /// Value representing Electron's version string /// diff --git a/src/ElectronNET.API/API/Entities/ProgressBarMode.cs b/src/ElectronNET.API/API/Entities/ProgressBarMode.cs index b9fed428..260355d8 100644 --- a/src/ElectronNET.API/API/Entities/ProgressBarMode.cs +++ b/src/ElectronNET.API/API/Entities/ProgressBarMode.cs @@ -1,8 +1,12 @@ -namespace ElectronNET.API.Entities +using System.Runtime.Versioning; + +namespace ElectronNET.API.Entities { /// - /// + /// Mode for BrowserWindow/BaseWindow setProgressBar on Windows. /// + /// Up-to-date with Electron API 39.2 + [SupportedOSPlatform("Windows")] public enum ProgressBarMode { /// diff --git a/src/ElectronNET.API/API/Entities/ProgressBarOptions.cs b/src/ElectronNET.API/API/Entities/ProgressBarOptions.cs index ee01720a..6967f45d 100644 --- a/src/ElectronNET.API/API/Entities/ProgressBarOptions.cs +++ b/src/ElectronNET.API/API/Entities/ProgressBarOptions.cs @@ -1,15 +1,18 @@ using System.Text.Json.Serialization; +using System.Runtime.Versioning; namespace ElectronNET.API.Entities { /// - /// + /// Options for BrowserWindow.setProgressBar(progress, options). /// + /// Up-to-date with Electron API 39.2 public class ProgressBarOptions { /// - /// Mode for the progress bar. Can be 'none' | 'normal' | 'indeterminate' | 'error' | 'paused'. + /// Mode for the progress bar on Windows. Can be 'none' | 'normal' | 'indeterminate' | 'error' | 'paused'. /// - public ProgressBarMode Mode { get; set; } + [SupportedOSPlatform("windows")] + public ProgressBarMode Mode { get; set; } = ProgressBarMode.normal; } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/ProgressInfo.cs b/src/ElectronNET.API/API/Entities/ProgressInfo.cs index 1427cf8c..3055ed0e 100644 --- a/src/ElectronNET.API/API/Entities/ProgressInfo.cs +++ b/src/ElectronNET.API/API/Entities/ProgressInfo.cs @@ -3,31 +3,30 @@ /// /// /// + /// Up-to-date with electron-updater 6.7.2 public class ProgressInfo { - /// - /// - /// + /// Gets or sets the progress. public string Progress { get; set; } /// - /// + /// Gets or sets bytes processed per second. /// - public string BytesPerSecond { get; set; } + public long BytesPerSecond { get; set; } /// - /// + /// Gets or sets the percentage completed (0–100). /// - public string Percent { get; set; } + public double Percent { get; set; } /// - /// + /// Gets or sets the total number of bytes to download. /// - public string Total { get; set; } + public long Total { get; set; } /// - /// + /// Gets or sets the number of bytes transferred so far. /// - public string Transferred { get; set; } + public long Transferred { get; set; } } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/ProxyConfig.cs b/src/ElectronNET.API/API/Entities/ProxyConfig.cs index c9df6475..529b7449 100644 --- a/src/ElectronNET.API/API/Entities/ProxyConfig.cs +++ b/src/ElectronNET.API/API/Entities/ProxyConfig.cs @@ -1,10 +1,16 @@ namespace ElectronNET.API.Entities { /// - /// + /// Proxy configuration for app.setProxy / session.setProxy. Matches Electron's ProxyConfig structure. /// public class ProxyConfig { + /// + /// The proxy mode. One of: 'direct' | 'auto_detect' | 'pac_script' | 'fixed_servers' | 'system'. + /// Defaults to 'pac_script' if 'PacScript' is specified, otherwise defaults to 'fixed_servers'. + /// + public string Mode { get; set; } + /// /// The URL associated with the PAC file. /// diff --git a/src/ElectronNET.API/API/Entities/ReadBookmark.cs b/src/ElectronNET.API/API/Entities/ReadBookmark.cs index fd5b665c..29443e23 100644 --- a/src/ElectronNET.API/API/Entities/ReadBookmark.cs +++ b/src/ElectronNET.API/API/Entities/ReadBookmark.cs @@ -1,8 +1,13 @@ -namespace ElectronNET.API.Entities +using System.Runtime.Versioning; + +namespace ElectronNET.API.Entities { /// - /// + /// Result of clipboard.readBookmark(): title and url. /// + /// Up-to-date with Electron API 39.2 + [SupportedOSPlatform("macOS")] + [SupportedOSPlatform("Windows")] public class ReadBookmark { /// diff --git a/src/ElectronNET.API/API/Entities/Rectangle.cs b/src/ElectronNET.API/API/Entities/Rectangle.cs index b0622725..738ba863 100644 --- a/src/ElectronNET.API/API/Entities/Rectangle.cs +++ b/src/ElectronNET.API/API/Entities/Rectangle.cs @@ -3,6 +3,7 @@ /// /// /// + /// Up-to-date with Electron API 39.2 public class Rectangle { /// diff --git a/src/ElectronNET.API/API/Entities/RelaunchOptions.cs b/src/ElectronNET.API/API/Entities/RelaunchOptions.cs index 5fc8517a..15854788 100644 --- a/src/ElectronNET.API/API/Entities/RelaunchOptions.cs +++ b/src/ElectronNET.API/API/Entities/RelaunchOptions.cs @@ -1,24 +1,19 @@ namespace ElectronNET.API.Entities { /// - /// Controls the behavior of . + /// Options for app.relaunch: optional args array and execPath. /// + /// Up-to-date with Electron API 39.2 public class RelaunchOptions { /// - /// Gets or sets the arguments. + /// Command-line arguments for the relaunched instance. /// - /// - /// The arguments. - /// public string[] Args { get; set; } /// - /// Gets or sets the execute path. + /// Executable path to relaunch instead of the current app. /// - /// - /// The execute path. - /// public string ExecPath { get; set; } } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/ReleaseNoteInfo.cs b/src/ElectronNET.API/API/Entities/ReleaseNoteInfo.cs index 6b0c9777..b2a3d19e 100644 --- a/src/ElectronNET.API/API/Entities/ReleaseNoteInfo.cs +++ b/src/ElectronNET.API/API/Entities/ReleaseNoteInfo.cs @@ -3,15 +3,16 @@ /// /// /// + /// Up-to-date with electron-updater 6.7.2 public class ReleaseNoteInfo { /// - /// The version. + /// Gets or sets the version. /// public string Version { get; set; } /// - /// The note. + /// Gets or sets the note text. /// public string Note { get; set; } } diff --git a/src/ElectronNET.API/API/Entities/RemovePassword.cs b/src/ElectronNET.API/API/Entities/RemovePassword.cs index b2afb415..92690e9d 100644 --- a/src/ElectronNET.API/API/Entities/RemovePassword.cs +++ b/src/ElectronNET.API/API/Entities/RemovePassword.cs @@ -5,6 +5,7 @@ namespace ElectronNET.API.Entities /// /// /// + /// Undecidable from MCP: no typed structure for session.clearAuthCache parameters. public class RemovePassword { /// diff --git a/src/ElectronNET.API/API/Entities/ResizeOptions.cs b/src/ElectronNET.API/API/Entities/ResizeOptions.cs index e506cb82..02976541 100644 --- a/src/ElectronNET.API/API/Entities/ResizeOptions.cs +++ b/src/ElectronNET.API/API/Entities/ResizeOptions.cs @@ -1,8 +1,9 @@ namespace ElectronNET.API.Entities { /// - /// + /// Options for NativeImage.resize: optional width/height and quality. /// + /// Up-to-date with Electron API 39.2 public class ResizeOptions { /// @@ -16,7 +17,7 @@ public class ResizeOptions public int? Height { get; set; } /// - /// good, better, or best. Default is "best"; + /// 'good', 'better', or 'best'. Default is 'best'. /// public string Quality { get; set; } = "best"; } diff --git a/src/ElectronNET.API/API/Entities/SaveDialogOptions.cs b/src/ElectronNET.API/API/Entities/SaveDialogOptions.cs index 9c549a7f..1772c144 100644 --- a/src/ElectronNET.API/API/Entities/SaveDialogOptions.cs +++ b/src/ElectronNET.API/API/Entities/SaveDialogOptions.cs @@ -1,10 +1,12 @@ using ElectronNET.API.Entities; +using System.Runtime.Versioning; namespace ElectronNET.API { /// - /// + /// Options for dialog.showSaveDialog / dialog.showSaveDialogSync. /// + /// Up-to-date with Electron API 39.2 public class SaveDialogOptions { /// @@ -21,13 +23,18 @@ public class SaveDialogOptions public string DefaultPath { get; set; } /// - /// Custom label for the confirmation button, when left empty the default label will - /// be used. + /// Gets or sets the custom label for the confirmation button; when left empty the default label will be used. /// public string ButtonLabel { get; set; } /// - /// The filters specifies an array of file types that can be displayed or + /// Properties for the save dialog. Supported values: + /// showHiddenFiles | createDirectory (macOS) | treatPackageAsDirectory (macOS) | showOverwriteConfirmation (Linux) | dontAddToRecent (Windows) + /// + public SaveDialogProperty[] Properties { get; set; } + + /// + /// Gets or sets the filters specifying an array of file types that can be displayed or /// selected when you want to limit the user to a specific type. For example: /// /// @@ -44,18 +51,27 @@ public class SaveDialogOptions public FileFilter[] Filters { get; set; } /// - /// Message to display above text fields. + /// Gets or sets the message to display above text fields. /// + [SupportedOSPlatform("macos")] public string Message { get; set; } /// - /// Custom label for the text displayed in front of the filename text field. + /// Gets or sets the custom label for the text displayed in front of the filename text field. /// + [SupportedOSPlatform("macos")] public string NameFieldLabel { get; set; } /// - /// Show the tags input box, defaults to true. + /// Gets or sets a value indicating whether to show the tags input box. Defaults to true. /// + [SupportedOSPlatform("macos")] public bool ShowsTagField { get; set; } + + /// + /// Gets or sets a value indicating whether to create a security scoped bookmark when packaged for the Mac App Store. If enabled and the file doesn't already exist a blank file will be created at the chosen path. + /// + [SupportedOSPlatform("macos")] + public bool SecurityScopedBookmarks { get; set; } } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/SaveDialogProperty.cs b/src/ElectronNET.API/API/Entities/SaveDialogProperty.cs new file mode 100644 index 00000000..633e65e8 --- /dev/null +++ b/src/ElectronNET.API/API/Entities/SaveDialogProperty.cs @@ -0,0 +1,40 @@ +using System.Runtime.Versioning; + +namespace ElectronNET.API.Entities +{ + /// + /// Properties supported by dialog.showSaveDialog / showSaveDialogSync. + /// + /// Up-to-date with Electron API 39.2 + public enum SaveDialogProperty + { + /// + /// Show hidden files in dialog. + /// + showHiddenFiles, + + /// + /// Allow creating new directories from dialog (macOS). + /// + [SupportedOSPlatform("macos")] + createDirectory, + + /// + /// Treat packages, such as .app folders, as a directory instead of a file (macOS). + /// + [SupportedOSPlatform("macos")] + treatPackageAsDirectory, + + /// + /// Sets whether the user will be presented a confirmation dialog if the user types a file name that already exists (Linux). + /// + [SupportedOSPlatform("linux")] + showOverwriteConfirmation, + + /// + /// Do not add the item being saved to the recent documents list (Windows). + /// + [SupportedOSPlatform("windows")] + dontAddToRecent + } +} \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/Scheme.cs b/src/ElectronNET.API/API/Entities/Scheme.cs index a1daf100..4eb0b468 100644 --- a/src/ElectronNET.API/API/Entities/Scheme.cs +++ b/src/ElectronNET.API/API/Entities/Scheme.cs @@ -1,8 +1,9 @@ namespace ElectronNET.API.Entities { /// - /// + /// Authentication scheme names used by webContents 'login' authInfo.scheme. /// + /// Undecidable from MCP: no typed enum is defined in docs; kept as project enum to reflect commonly observed values. public enum Scheme { /// diff --git a/src/ElectronNET.API/API/Entities/SemVer.cs b/src/ElectronNET.API/API/Entities/SemVer.cs index abac145a..4e3f8c84 100644 --- a/src/ElectronNET.API/API/Entities/SemVer.cs +++ b/src/ElectronNET.API/API/Entities/SemVer.cs @@ -3,6 +3,7 @@ /// /// /// + /// Project-specific: no matching Electron structure found in MCP docs (electronjs). public class SemVer { /// @@ -54,6 +55,7 @@ public class SemVer /// /// /// + /// Project-specific: no matching Electron structure found in MCP docs (electronjs). public class SemVerOptions { /// diff --git a/src/ElectronNET.API/API/Entities/SharingItem.cs b/src/ElectronNET.API/API/Entities/SharingItem.cs new file mode 100644 index 00000000..38bfb107 --- /dev/null +++ b/src/ElectronNET.API/API/Entities/SharingItem.cs @@ -0,0 +1,27 @@ +using System.Runtime.Versioning; + +namespace ElectronNET.API.Entities +{ + /// + /// SharingItem for MenuItem role 'shareMenu' (macOS). + /// + /// Up-to-date with Electron API 39.2 + [SupportedOSPlatform("macos")] + public class SharingItem + { + /// + /// An array of text to share. + /// + public string[] Texts { get; set; } + + /// + /// An array of files to share. + /// + public string[] FilePaths { get; set; } + + /// + /// An array of URLs to share. + /// + public string[] Urls { get; set; } + } +} \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/ShortcutDetails.cs b/src/ElectronNET.API/API/Entities/ShortcutDetails.cs index 90235661..01db6715 100644 --- a/src/ElectronNET.API/API/Entities/ShortcutDetails.cs +++ b/src/ElectronNET.API/API/Entities/ShortcutDetails.cs @@ -1,8 +1,12 @@ -namespace ElectronNET.API.Entities +using System.Runtime.Versioning; + +namespace ElectronNET.API.Entities { /// /// Structure of a shortcut. /// + /// Up-to-date with Electron API 39.2 + [SupportedOSPlatform("windows")] public class ShortcutDetails { /// @@ -36,6 +40,12 @@ public class ShortcutDetails /// public int IconIndex { get; set; } + /// + /// The Application Toast Activator CLSID. Needed for participating in Action Center. + /// + [SupportedOSPlatform("windows")] + public string ToastActivatorClsid { get; set; } + /// /// The target to launch from this shortcut. /// diff --git a/src/ElectronNET.API/API/Entities/ShortcutLinkOperation.cs b/src/ElectronNET.API/API/Entities/ShortcutLinkOperation.cs index c2b6d3f9..69ed7751 100644 --- a/src/ElectronNET.API/API/Entities/ShortcutLinkOperation.cs +++ b/src/ElectronNET.API/API/Entities/ShortcutLinkOperation.cs @@ -1,28 +1,28 @@ using System.ComponentModel; +using System.Runtime.Versioning; namespace ElectronNET.API.Entities { /// /// Defines the ShortcutLinkOperation enumeration. /// + /// Up-to-date with Electron API 39.2 + [SupportedOSPlatform("Windows")] public enum ShortcutLinkOperation { /// /// Creates a new shortcut, overwriting if necessary. /// - [Description("create")] Create, /// /// Updates specified properties only on an existing shortcut. /// - [Description("update")] Update, /// /// Overwrites an existing shortcut, fails if the shortcut doesn't exist. /// - [Description("replace")] Replace } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/Size.cs b/src/ElectronNET.API/API/Entities/Size.cs index 61bbd122..7dbd771e 100644 --- a/src/ElectronNET.API/API/Entities/Size.cs +++ b/src/ElectronNET.API/API/Entities/Size.cs @@ -3,6 +3,7 @@ /// /// /// + /// Up-to-date with Electron API 39.2 public class Size { /// diff --git a/src/ElectronNET.API/API/Entities/ThemeSourceMode.cs b/src/ElectronNET.API/API/Entities/ThemeSourceMode.cs index 53fa23ed..b1f1fda8 100644 --- a/src/ElectronNET.API/API/Entities/ThemeSourceMode.cs +++ b/src/ElectronNET.API/API/Entities/ThemeSourceMode.cs @@ -5,24 +5,22 @@ namespace ElectronNET.API.Entities /// /// Defines the ThemeSourceMode enumeration. /// + /// Up-to-date with Electron API 39.2 public enum ThemeSourceMode { /// /// Operating system default. /// - [Description("system")] System, /// /// Light theme. /// - [Description("light")] Light, /// /// Dark theme. /// - [Description("dark")] Dark } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/ThumbarButton.cs b/src/ElectronNET.API/API/Entities/ThumbarButton.cs index af9bcce7..dbfd03b5 100644 --- a/src/ElectronNET.API/API/Entities/ThumbarButton.cs +++ b/src/ElectronNET.API/API/Entities/ThumbarButton.cs @@ -1,11 +1,14 @@ using System; using System.Text.Json.Serialization; +using System.Runtime.Versioning; namespace ElectronNET.API.Entities { /// - /// + /// Thumbnail toolbar button for Windows taskbar. /// + /// Up-to-date with Electron API 39.2 + [SupportedOSPlatform("windows")] public class ThumbarButton { /// diff --git a/src/ElectronNET.API/API/Entities/ThumbarButtonFlag.cs b/src/ElectronNET.API/API/Entities/ThumbarButtonFlag.cs index e68ca860..0c4c9c3a 100644 --- a/src/ElectronNET.API/API/Entities/ThumbarButtonFlag.cs +++ b/src/ElectronNET.API/API/Entities/ThumbarButtonFlag.cs @@ -1,8 +1,12 @@ -namespace ElectronNET.API.Entities +using System.Runtime.Versioning; + +namespace ElectronNET.API.Entities { /// - /// + /// Flags for Windows taskbar thumbnail toolbar buttons. /// + /// Up-to-date with Electron API 39.2 + [SupportedOSPlatform("windows")] public enum ThumbarButtonFlag { /// diff --git a/src/ElectronNET.API/API/Entities/TitleBarOverlay.cs b/src/ElectronNET.API/API/Entities/TitleBarOverlay.cs index 34c8ab87..ae0bb2e0 100644 --- a/src/ElectronNET.API/API/Entities/TitleBarOverlay.cs +++ b/src/ElectronNET.API/API/Entities/TitleBarOverlay.cs @@ -1,5 +1,11 @@ -namespace ElectronNET.API.Entities; +using System.Runtime.Versioning; +namespace ElectronNET.API.Entities; + +/// +/// Configures the window's title bar overlay when using a frameless window. +/// +/// Up-to-date with Electron API 39.2 public class TitleBarOverlay { private readonly bool? _value; @@ -10,13 +16,34 @@ public TitleBarOverlay() private TitleBarOverlay(bool value) : this() => _value = value; + /// + /// Gets or sets the CSS color of the Window Controls Overlay when enabled. + /// OS-specific per MCP: available on Windows and Linux. + /// + [SupportedOSPlatform("windows")] + [SupportedOSPlatform("linux")] public string Color { get; set; } - public double Height { get; set; } - + /// + /// Gets or sets the height of the title bar and Window Controls Overlay in pixels. Default is system height. + /// + public int Height { get; set; } + + /// + /// Gets or sets the CSS color of the symbols on the Window Controls Overlay when enabled. + /// OS-specific per MCP: available on Windows and Linux. + /// + [SupportedOSPlatform("windows")] + [SupportedOSPlatform("linux")] public string SymbolColor { get; set; } + /// + /// Allows using a bare boolean for titleBarOverlay in options (true/false). + /// public static implicit operator bool?(TitleBarOverlay titleBarOverlay) => titleBarOverlay?._value; + /// + /// Allows constructing from a bare boolean (true/false) for titleBarOverlay. + /// public static implicit operator TitleBarOverlay(bool value) => new(value); } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/TitleBarStyle.cs b/src/ElectronNET.API/API/Entities/TitleBarStyle.cs index 7d117f30..7bd5f167 100644 --- a/src/ElectronNET.API/API/Entities/TitleBarStyle.cs +++ b/src/ElectronNET.API/API/Entities/TitleBarStyle.cs @@ -1,4 +1,5 @@ using System.Text.Json.Serialization; +using System.Runtime.Versioning; namespace ElectronNET.API.Entities { @@ -21,11 +22,13 @@ public enum TitleBarStyle /// /// The hidden inset /// + [SupportedOSPlatform("macos")] hiddenInset, /// /// The custom buttons on hover /// + [SupportedOSPlatform("macos")] customButtonsOnHover } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/ToBitmapOptions.cs b/src/ElectronNET.API/API/Entities/ToBitmapOptions.cs index 98593fa7..f280f300 100644 --- a/src/ElectronNET.API/API/Entities/ToBitmapOptions.cs +++ b/src/ElectronNET.API/API/Entities/ToBitmapOptions.cs @@ -1,12 +1,13 @@ namespace ElectronNET.API.Entities { /// - /// + /// Options for nativeImage.toBitmap; supports optional scaleFactor (defaults to 1.0) per MCP. /// + /// Up-to-date with Electron API 39.2 public class ToBitmapOptions { /// - /// Gets or sets the scalefactor + /// Gets or sets the image scale factor. Defaults to 1.0. /// public float ScaleFactor { get; set; } = 1.0f; } diff --git a/src/ElectronNET.API/API/Entities/ToDataUrlOptions.cs b/src/ElectronNET.API/API/Entities/ToDataUrlOptions.cs index 748b206a..ccdb437d 100644 --- a/src/ElectronNET.API/API/Entities/ToDataUrlOptions.cs +++ b/src/ElectronNET.API/API/Entities/ToDataUrlOptions.cs @@ -3,10 +3,11 @@ /// /// /// + /// Up-to-date with Electron API 39.2 public class ToDataUrlOptions { /// - /// Gets or sets the scalefactor + /// Gets or sets the image scale factor. Defaults to 1.0. /// public float ScaleFactor { get; set; } = 1.0f; } diff --git a/src/ElectronNET.API/API/Entities/ToPNGOptions.cs b/src/ElectronNET.API/API/Entities/ToPNGOptions.cs index 47a2cd0b..8d0e6831 100644 --- a/src/ElectronNET.API/API/Entities/ToPNGOptions.cs +++ b/src/ElectronNET.API/API/Entities/ToPNGOptions.cs @@ -3,10 +3,11 @@ /// /// /// + /// Up-to-date with Electron API 39.2 public class ToPNGOptions { /// - /// Gets or sets the scalefactor + /// Gets or sets the image scale factor. Defaults to 1.0. /// public float ScaleFactor { get; set; } = 1.0f; } diff --git a/src/ElectronNET.API/API/Entities/TrayClickEventArgs.cs b/src/ElectronNET.API/API/Entities/TrayClickEventArgs.cs index 516e192a..6ac9da16 100644 --- a/src/ElectronNET.API/API/Entities/TrayClickEventArgs.cs +++ b/src/ElectronNET.API/API/Entities/TrayClickEventArgs.cs @@ -1,4 +1,6 @@ -namespace ElectronNET.API +using ElectronNET.API.Entities; + +namespace ElectronNET.API { /// /// @@ -36,5 +38,15 @@ public class TrayClickEventArgs /// true if [meta key]; otherwise, false. /// public bool MetaKey { get; set; } + + /// + /// The bounds of tray icon. + /// + public Rectangle Bounds { get; set; } + + /// + /// The position of the event. + /// + public Point Position { get; set; } } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/UpdateCancellationToken.cs b/src/ElectronNET.API/API/Entities/UpdateCancellationToken.cs index 84b9c3c7..7345d2d6 100644 --- a/src/ElectronNET.API/API/Entities/UpdateCancellationToken.cs +++ b/src/ElectronNET.API/API/Entities/UpdateCancellationToken.cs @@ -3,22 +3,23 @@ /// /// /// + /// Up-to-date with electron-updater 6.7.2 public class UpdateCancellationToken { /// - /// + /// Gets or sets a value indicating whether cancellation has been requested. /// public bool Cancelled { get; set; } /// - /// + /// Requests cancellation of the update process. /// public void Cancel() { } /// - /// + /// Disposes the underlying cancellation token (if applicable). /// public void Dispose() { diff --git a/src/ElectronNET.API/API/Entities/UpdateCheckResult.cs b/src/ElectronNET.API/API/Entities/UpdateCheckResult.cs index ed3b4097..3a902c77 100644 --- a/src/ElectronNET.API/API/Entities/UpdateCheckResult.cs +++ b/src/ElectronNET.API/API/Entities/UpdateCheckResult.cs @@ -3,20 +3,21 @@ /// /// /// + /// Up-to-date with electron-updater 6.7.2 public class UpdateCheckResult { /// - /// + /// Gets or sets the update information discovered by the check. /// public UpdateInfo UpdateInfo { get; set; } = new UpdateInfo(); /// - /// + /// Gets or sets the download artifacts (if provided by the updater). /// public string[] Download { get; set; } /// - /// + /// Gets or sets the cancellation token for the update process. /// public UpdateCancellationToken CancellationToken { get; set; } } diff --git a/src/ElectronNET.API/API/Entities/UpdateFileInfo.cs b/src/ElectronNET.API/API/Entities/UpdateFileInfo.cs index 4163ac1f..dc1708cc 100644 --- a/src/ElectronNET.API/API/Entities/UpdateFileInfo.cs +++ b/src/ElectronNET.API/API/Entities/UpdateFileInfo.cs @@ -3,10 +3,11 @@ /// /// /// + /// Up-to-date with electron-updater 6.7.2 public class UpdateFileInfo : BlockMapDataHolder { /// - /// + /// Gets or sets the URL of the update file. /// public string Url { get; set; } } diff --git a/src/ElectronNET.API/API/Entities/UpdateInfo.cs b/src/ElectronNET.API/API/Entities/UpdateInfo.cs index 5b33bf0b..c3b6a457 100644 --- a/src/ElectronNET.API/API/Entities/UpdateInfo.cs +++ b/src/ElectronNET.API/API/Entities/UpdateInfo.cs @@ -3,36 +3,37 @@ /// /// /// + /// Up-to-date with electron-updater 6.7.2 public class UpdateInfo { /// - /// The version. + /// Gets or sets the version. /// public string Version { get; set; } /// - /// + /// Gets or sets the files included in this update. /// public UpdateFileInfo[] Files { get; set; } = new UpdateFileInfo[0]; /// - /// The release name. + /// Gets or sets the release name. /// public string ReleaseName { get; set; } /// - /// The release notes. + /// Gets or sets the release notes. /// public ReleaseNoteInfo[] ReleaseNotes { get; set; } = new ReleaseNoteInfo[0]; /// - /// + /// Gets or sets the release date. /// public string ReleaseDate { get; set; } /// - /// The staged rollout percentage, 0-100. + /// Gets or sets the staged rollout percentage, 0-100. /// - public int StagingPercentage { get; set; } + public double StagingPercentage { get; set; } } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/UploadFile.cs b/src/ElectronNET.API/API/Entities/UploadFile.cs index adff7df8..d542c355 100644 --- a/src/ElectronNET.API/API/Entities/UploadFile.cs +++ b/src/ElectronNET.API/API/Entities/UploadFile.cs @@ -3,32 +3,32 @@ /// /// /// + /// Up-to-date with Electron API 39.2 public class UploadFile : IPostData { /// - /// The object represents a file. + /// Gets the type discriminator; constant 'file'. /// public string Type { get; } = "file"; /// - /// The path of the file being uploaded. + /// Gets or sets the path of the file to be uploaded. /// public string FilePath { get; set; } /// - /// The offset from the beginning of the file being uploaded, in bytes. Defaults to 0. + /// Gets or sets the offset from the beginning of the file being uploaded, in bytes. Defaults to 0. /// public long Offset { get; set; } = 0; /// - /// The length of the file being uploaded, . Defaults to 0. - /// If set to -1, the whole file will be uploaded. + /// Gets or sets the number of bytes to read from offset. Defaults to 0. /// public long Length { get; set; } = 0; /// - /// The modification time of the file represented by a double, which is the number of seconds since the UNIX Epoch (Jan 1, 1970) + /// Gets or sets the last modification time in number of seconds since the UNIX epoch. Defaults to 0. /// - public double ModificationTime { get; set; } + public double ModificationTime { get; set; } = 0; } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/UploadRawData.cs b/src/ElectronNET.API/API/Entities/UploadRawData.cs index c1577978..96a91ac9 100644 --- a/src/ElectronNET.API/API/Entities/UploadRawData.cs +++ b/src/ElectronNET.API/API/Entities/UploadRawData.cs @@ -3,15 +3,16 @@ /// /// /// + /// Up-to-date with Electron API 39.2 public class UploadRawData : IPostData { /// - /// The data is available as a Buffer, in the rawData field. + /// Gets the type discriminator; constant 'rawData'. /// public string Type { get; } = "rawData"; /// - /// The raw bytes of the post data in a Buffer. + /// Gets or sets the data to be uploaded as raw bytes (Electron Buffer). /// public byte[] Bytes { get; set; } } diff --git a/src/ElectronNET.API/API/Entities/UserTask.cs b/src/ElectronNET.API/API/Entities/UserTask.cs index 020910dc..65443b14 100644 --- a/src/ElectronNET.API/API/Entities/UserTask.cs +++ b/src/ElectronNET.API/API/Entities/UserTask.cs @@ -1,8 +1,12 @@ -namespace ElectronNET.API.Entities +using System.Runtime.Versioning; + +namespace ElectronNET.API.Entities { /// - /// + /// Windows Task item used by app.setUserTasks. /// + /// Up-to-date with Electron API 39.2 + [SupportedOSPlatform("Windows")] public class UserTask { /// diff --git a/src/ElectronNET.API/API/Entities/Vibrancy.cs b/src/ElectronNET.API/API/Entities/Vibrancy.cs index 2e8bec85..8e35607e 100644 --- a/src/ElectronNET.API/API/Entities/Vibrancy.cs +++ b/src/ElectronNET.API/API/Entities/Vibrancy.cs @@ -1,63 +1,92 @@ using System.Runtime.Serialization; +using System.Runtime.Versioning; namespace ElectronNET.API.Entities { /// - /// + /// Vibrancy types for BrowserWindow on macOS. /// + /// Up-to-date with Electron API 39.2 + [SupportedOSPlatform("macos")] public enum Vibrancy { /// - /// The appearance based + /// Appearance-based vibrancy. /// [EnumMember(Value = "appearance-based")] appearanceBased, /// - /// The light + /// Title bar area. /// - light, + titlebar, /// - /// The dark + /// Selection highlight. /// - dark, + selection, /// - /// The titlebar + /// Menu background. /// - titlebar, + menu, /// - /// The selection + /// Popover background. /// - selection, + popover, /// - /// The menu + /// Sidebar background. /// - menu, + sidebar, /// - /// The popover + /// Header background. /// - popover, + header, /// - /// The sidebar + /// Sheet background. /// - sidebar, + sheet, + + /// + /// Window background. + /// + window, + + /// + /// Heads-up display. + /// + hud, + + /// + /// Fullscreen UI background. + /// + [EnumMember(Value = "fullscreen-ui")] + fullscreenUi, + + /// + /// Tooltip background. + /// + tooltip, + + /// + /// Content background. + /// + content, /// - /// The medium light + /// Under-window background. /// - [EnumMember(Value = "medium-light")] - mediumLight, + [EnumMember(Value = "under-window")] + underWindow, /// - /// The ultra dark + /// Under-page background. /// - [EnumMember(Value = "ultra-dark")] - ultraDark + [EnumMember(Value = "under-page")] + underPage } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/WebPreferences.cs b/src/ElectronNET.API/API/Entities/WebPreferences.cs index 07f51001..385d3474 100644 --- a/src/ElectronNET.API/API/Entities/WebPreferences.cs +++ b/src/ElectronNET.API/API/Entities/WebPreferences.cs @@ -1,10 +1,12 @@ using System.ComponentModel; +using System.Runtime.Versioning; namespace ElectronNET.API.Entities { /// /// /// + /// Up-to-date with Electron API 39.2 public class WebPreferences { /// @@ -25,6 +27,11 @@ public class WebPreferences /// public bool NodeIntegrationInWorker { get; set; } + /// + /// Experimental option for enabling Node.js support in sub-frames such as iframes and child windows. + /// + public bool NodeIntegrationInSubFrames { get; set; } + /// /// Specifies a script that will be loaded before other scripts run in the page. /// This script will always have access to node APIs no matter whether node @@ -35,11 +42,7 @@ public class WebPreferences public string Preload { get; set; } /// - /// If set, this will sandbox the renderer associated with the window, making it - /// compatible with the Chromium OS-level sandbox and disabling the Node.js engine. - /// This is not the same as the nodeIntegration option and the APIs available to the - /// preload script are more limited. Read more about the option.This option is - /// currently experimental and may change or be removed in future Electron releases. + /// If set, this will sandbox the renderer associated with the window, making it compatible with the Chromium OS-level sandbox and disabling the Node.js engine. This is not the same as the nodeIntegration option and the APIs available to the preload script are more limited. Default is true since Electron 20. The sandbox will automatically be disabled when nodeIntegration is set to true. /// public bool Sandbox { get; set; } @@ -56,7 +59,8 @@ public class WebPreferences /// /// The default zoom factor of the page, 3.0 represents 300%. Default is 1.0. /// - public double ZoomFactor { get; set; } + [DefaultValue(1.0)] + public double ZoomFactor { get; set; } = 1.0; /// /// Enables JavaScript support. Default is true. @@ -84,6 +88,11 @@ public class WebPreferences [DefaultValue(true)] public bool Images { get; set; } = true; + /// + /// Specifies how to run image animations (e.g. GIFs). Can be 'animate', 'animateOnce' or 'noAnimation'. Default is 'animate'. + /// + public string ImageAnimationPolicy { get; set; } + /// /// Make TextArea elements resizable. Default is true. /// @@ -115,11 +124,13 @@ public class WebPreferences /// /// Enables Chromium's experimental canvas features. Default is false. /// + /// Not documented by MCP electronjs web-preferences. public bool ExperimentalCanvasFeatures { get; set; } /// /// Enables scroll bounce (rubber banding) effect on macOS. Default is false. /// + [SupportedOSPlatform("macos")] public bool ScrollBounce { get; set; } /// @@ -147,16 +158,19 @@ public class WebPreferences /// /// Defaults to 13. /// - public int DefaultMonospaceFontSize { get; set; } + [DefaultValue(13)] + public int DefaultMonospaceFontSize { get; set; } = 13; /// /// Defaults to 0. /// - public int MinimumFontSize { get; set; } + [DefaultValue(0)] + public int MinimumFontSize { get; set; } = 0; /// /// Defaults to ISO-8859-1. /// + /// Not documented by MCP electronjs web-preferences. public string DefaultEncoding { get; set; } /// @@ -212,5 +226,25 @@ public class WebPreferences /// [DefaultValue(false)] public bool EnableRemoteModule { get; set; } = false; + + /// + /// Gets or sets a value indicating whether to enable preferred size mode. The preferred size is the minimum size needed to contain the layout of the document—without requiring scrolling. Enabling this will cause the 'preferred-size-changed' event to be emitted on the WebContents when the preferred size changes. Default is false. + /// + [DefaultValue(false)] + public bool EnablePreferredSizeMode { get; set; } + + /// + /// Gets or sets a value indicating whether to enable background transparency for the guest page. Default is true. + /// Note: The guest page's text and background colors are derived from the color scheme of its root element. When transparency is enabled, the text color will still change accordingly but the background will remain transparent. + /// + [DefaultValue(true)] + public bool Transparent { get; set; } = true; + + /// + /// Gets or sets a value indicating whether to enable the 'paste' execCommand. Deprecated. Default is false. + /// + [DefaultValue(false)] + [System.Obsolete("enableDeprecatedPaste is deprecated in Electron; avoid using.")] + public bool EnableDeprecatedPaste { get; set; } } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Extensions/EnumExtensions.cs b/src/ElectronNET.API/API/Extensions/EnumExtensions.cs deleted file mode 100644 index 42604586..00000000 --- a/src/ElectronNET.API/API/Extensions/EnumExtensions.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System; -using System.ComponentModel; -using System.Reflection; - -namespace ElectronNET.API.Extensions -{ - internal static class EnumExtensions - { - public static string GetDescription(this T enumerationValue) where T : struct - { - Type type = enumerationValue.GetType(); - if (!type.IsEnum) - { - throw new ArgumentException("EnumerationValue must be of Enum type", "enumerationValue"); - } - - //Tries to find a DescriptionAttribute for a potential friendly name - //for the enum - MemberInfo[] memberInfo = type.GetMember(enumerationValue.ToString()); - if (memberInfo != null && memberInfo.Length > 0) - { - object[] attrs = memberInfo[0].GetCustomAttributes(typeof(DescriptionAttribute), false); - - if (attrs != null && attrs.Length > 0) - { - //Pull out the description value - return ((DescriptionAttribute)attrs[0]).Description; - } - } - - //If we have no description attribute, just return the ToString of the enum - return enumerationValue.ToString(); - } - } -} \ No newline at end of file diff --git a/src/ElectronNET.API/API/IpcMain.cs b/src/ElectronNET.API/API/IpcMain.cs index 239098b8..0260a889 100644 --- a/src/ElectronNET.API/API/IpcMain.cs +++ b/src/ElectronNET.API/API/IpcMain.cs @@ -1,12 +1,13 @@ -using ElectronNET.API.Serialization; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text.Json; -using System.Threading.Tasks; - namespace ElectronNET.API { + using System; + using System.Diagnostics; + using System.Linq; + using System.Text.Json; + using System.Text.Json.Serialization; + using System.Threading.Tasks; + using ElectronNET.Serialization; + /// /// Communicate asynchronously from the main process to renderer processes. /// @@ -14,6 +15,18 @@ public sealed class IpcMain { private static IpcMain _ipcMain; private static object _syncRoot = new object(); + private static readonly JsonSerializerOptions BoxedObjectSerializationOptions = new JsonSerializerOptions + { + PropertyNamingPolicy = JsonNamingPolicy.CamelCase, + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull, + WriteIndented = false, + Converters = + { + new JsonStringEnumConverter(JsonNamingPolicy.CamelCase), + new JsonToBoxedPrimitivesConverter(), + } + }; + internal IpcMain() { @@ -50,24 +63,23 @@ public async Task On(string channel, Action listener) BridgeConnector.Socket.Off(channel); BridgeConnector.Socket.On(channel, (args) => { - List objectArray = FormatArguments(args); - - if (objectArray.Count == 1) - { - listener(objectArray.First()); - } - else - { - listener(objectArray); - } + var arg = FormatArguments(args); + listener(arg); }); } - private static List FormatArguments(JsonElement args) + private static object FormatArguments(JsonElement args) { - var objectArray = args.Deserialize(ElectronJson.Options).ToList(); - objectArray.RemoveAll(item => item is null); - return objectArray; + var objectArray = args.Deserialize(BoxedObjectSerializationOptions).ToList(); + + Debug.Assert(objectArray.Count <= 2); + + if (objectArray.Count == 2) + { + return objectArray[1]; + } + + return null; } /// @@ -84,18 +96,8 @@ public void OnSync(string channel, Func listener) BridgeConnector.Socket.Emit("registerSyncIpcMainChannel", channel); BridgeConnector.Socket.On(channel, (args) => { - List objectArray = FormatArguments(args); - object parameter; - if (objectArray.Count == 1) - { - parameter = objectArray.First(); - } - else - { - parameter = objectArray; - } - - var result = listener(parameter); + var arg = FormatArguments(args); + var result = listener(arg); BridgeConnector.Socket.Emit(channel + "Sync", result); }); } @@ -111,16 +113,8 @@ public void Once(string channel, Action listener) BridgeConnector.Socket.Emit("registerOnceIpcMainChannel", channel); BridgeConnector.Socket.Once(channel, (args) => { - List objectArray = FormatArguments(args); - - if (objectArray.Count == 1) - { - listener(objectArray.First()); - } - else - { - listener(objectArray); - } + var arg = FormatArguments(args); + listener(arg); }); } diff --git a/src/ElectronNET.API/API/NativeTheme.cs b/src/ElectronNET.API/API/NativeTheme.cs index 71b35cf5..620e0861 100644 --- a/src/ElectronNET.API/API/NativeTheme.cs +++ b/src/ElectronNET.API/API/NativeTheme.cs @@ -99,7 +99,7 @@ internal static NativeTheme Instance /// The new ThemeSource. public void SetThemeSource(ThemeSourceMode themeSourceMode) { - var themeSource = themeSourceMode.GetDescription(); + var themeSource = themeSourceMode; BridgeConnector.Socket.Emit("nativeTheme-themeSource", themeSource); } diff --git a/src/ElectronNET.API/API/Notification.cs b/src/ElectronNET.API/API/Notification.cs index a5f03f94..e0e9f80b 100644 --- a/src/ElectronNET.API/API/Notification.cs +++ b/src/ElectronNET.API/API/Notification.cs @@ -97,7 +97,14 @@ private static void GenerateIDsForDefinedActions(NotificationOptions notificatio isActionDefined = true; BridgeConnector.Socket.Off("NotificationEventAction"); - BridgeConnector.Socket.On("NotificationEventAction", (args) => { _notificationOptions.Single(x => x.ActionID == args[0]).OnAction(args[1]); }); + BridgeConnector.Socket.On("NotificationEventAction", (args) => + { + var opt = _notificationOptions.Single(x => x.ActionID == args[0]); + if (int.TryParse(args[1], out var index)) + { + opt.OnAction(index); + } + }); } if (isActionDefined) diff --git a/src/ElectronNET.API/API/Session.cs b/src/ElectronNET.API/API/Session.cs index ef3b44df..a7459cb4 100644 --- a/src/ElectronNET.API/API/Session.cs +++ b/src/ElectronNET.API/API/Session.cs @@ -47,10 +47,10 @@ public void AllowNTLMCredentialsForDomains(string domains) /// public Task ClearAuthCacheAsync(RemovePassword options) { - var tcs = new TaskCompletionSource(); + var tcs = new TaskCompletionSource(); string guid = Guid.NewGuid().ToString(); - BridgeConnector.Socket.Once("webContents-session-clearAuthCache-completed" + guid, () => tcs.SetResult(null)); + BridgeConnector.Socket.Once("webContents-session-clearAuthCache-completed" + guid, () => tcs.SetResult()); BridgeConnector.Socket.Emit("webContents-session-clearAuthCache", Id, options, guid); return tcs.Task; @@ -61,10 +61,10 @@ public Task ClearAuthCacheAsync(RemovePassword options) /// public Task ClearAuthCacheAsync() { - var tcs = new TaskCompletionSource(); + var tcs = new TaskCompletionSource(); string guid = Guid.NewGuid().ToString(); - BridgeConnector.Socket.Once("webContents-session-clearAuthCache-completed" + guid, () => tcs.SetResult(null)); + BridgeConnector.Socket.Once("webContents-session-clearAuthCache-completed" + guid, () => tcs.SetResult()); BridgeConnector.Socket.Emit("webContents-session-clearAuthCache", Id, guid); return tcs.Task; @@ -76,10 +76,10 @@ public Task ClearAuthCacheAsync() /// public Task ClearCacheAsync() { - var tcs = new TaskCompletionSource(); + var tcs = new TaskCompletionSource(); string guid = Guid.NewGuid().ToString(); - BridgeConnector.Socket.Once("webContents-session-clearCache-completed" + guid, () => tcs.SetResult(null)); + BridgeConnector.Socket.Once("webContents-session-clearCache-completed" + guid, () => tcs.SetResult()); BridgeConnector.Socket.Emit("webContents-session-clearCache", Id, guid); return tcs.Task; @@ -91,10 +91,10 @@ public Task ClearCacheAsync() /// public Task ClearHostResolverCacheAsync() { - var tcs = new TaskCompletionSource(); + var tcs = new TaskCompletionSource(); string guid = Guid.NewGuid().ToString(); - BridgeConnector.Socket.Once("webContents-session-clearHostResolverCache-completed" + guid, () => tcs.SetResult(null)); + BridgeConnector.Socket.Once("webContents-session-clearHostResolverCache-completed" + guid, () => tcs.SetResult()); BridgeConnector.Socket.Emit("webContents-session-clearHostResolverCache", Id, guid); return tcs.Task; @@ -106,10 +106,10 @@ public Task ClearHostResolverCacheAsync() /// public Task ClearStorageDataAsync() { - var tcs = new TaskCompletionSource(); + var tcs = new TaskCompletionSource(); string guid = Guid.NewGuid().ToString(); - BridgeConnector.Socket.Once("webContents-session-clearStorageData-completed" + guid, () => tcs.SetResult(null)); + BridgeConnector.Socket.Once("webContents-session-clearStorageData-completed" + guid, () => tcs.SetResult()); BridgeConnector.Socket.Emit("webContents-session-clearStorageData", Id, guid); return tcs.Task; @@ -122,10 +122,10 @@ public Task ClearStorageDataAsync() /// public Task ClearStorageDataAsync(ClearStorageDataOptions options) { - var tcs = new TaskCompletionSource(); + var tcs = new TaskCompletionSource(); string guid = Guid.NewGuid().ToString(); - BridgeConnector.Socket.Once("webContents-session-clearStorageData-options-completed" + guid, () => tcs.SetResult(null)); + BridgeConnector.Socket.Once("webContents-session-clearStorageData-options-completed" + guid, () => tcs.SetResult()); BridgeConnector.Socket.Emit("webContents-session-clearStorageData-options", Id, options, guid); return tcs.Task; @@ -276,10 +276,10 @@ public void SetPreloads(string[] preloads) /// public Task SetProxyAsync(ProxyConfig config) { - var tcs = new TaskCompletionSource(); + var tcs = new TaskCompletionSource(); string guid = Guid.NewGuid().ToString(); - BridgeConnector.Socket.Once("webContents-session-setProxy-completed" + guid, () => tcs.SetResult(null)); + BridgeConnector.Socket.Once("webContents-session-setProxy-completed" + guid, () => tcs.SetResult()); BridgeConnector.Socket.Emit("webContents-session-setProxy", Id, config, guid); return tcs.Task; diff --git a/src/ElectronNET.API/API/Shell.cs b/src/ElectronNET.API/API/Shell.cs index e8acb0ee..888b3097 100644 --- a/src/ElectronNET.API/API/Shell.cs +++ b/src/ElectronNET.API/API/Shell.cs @@ -42,13 +42,9 @@ internal static Shell Instance /// The full path to the directory / file. public Task ShowItemInFolderAsync(string fullPath) { - var tcs = new TaskCompletionSource(); - - // Is this really useful? - BridgeConnector.Socket.Once("shell-showItemInFolderCompleted", () => { }); BridgeConnector.Socket.Emit("shell-showItemInFolder", fullPath); - return tcs.Task; + return Task.CompletedTask; } /// @@ -138,7 +134,7 @@ public Task WriteShortcutLinkAsync(string shortcutPath, ShortcutLinkOperat var tcs = new TaskCompletionSource(); BridgeConnector.Socket.Once("shell-writeShortcutLinkCompleted", tcs.SetResult); - BridgeConnector.Socket.Emit("shell-writeShortcutLink", shortcutPath, operation.GetDescription(), options); + BridgeConnector.Socket.Emit("shell-writeShortcutLink", shortcutPath, operation, options); return tcs.Task; } diff --git a/src/ElectronNET.API/API/Tray.cs b/src/ElectronNET.API/API/Tray.cs index b31edd64..4a0e84c6 100644 --- a/src/ElectronNET.API/API/Tray.cs +++ b/src/ElectronNET.API/API/Tray.cs @@ -220,11 +220,33 @@ public async Task Show(string image, MenuItem[] menuItems) _items.Clear(); _items.AddRange(menuItems); + RegisterMenuItemClickedHandler(); + } + + /// + /// Sets the tray menu items. + /// + /// Calling this method updates the context menu with the specified items. Any previously + /// set menu items will be replaced. + /// An array of objects representing the menu items to display in the tray menu. + /// Cannot be null. + public async Task SetMenuItems(MenuItem[] menuItems) + { + menuItems.AddMenuItemsId(); + await BridgeConnector.Socket.Emit("set-contextMenu", new object[] { menuItems }).ConfigureAwait(false); + _items.Clear(); + _items.AddRange(menuItems); + + RegisterMenuItemClickedHandler(); + } + + private void RegisterMenuItemClickedHandler() + { BridgeConnector.Socket.Off("trayMenuItemClicked"); BridgeConnector.Socket.On("trayMenuItemClicked", (id) => { MenuItem menuItem = _items.GetMenuItem(id); - menuItem?.Click(); + menuItem?.Click?.Invoke(); }); } @@ -343,4 +365,4 @@ public void Once(string eventName, Action action) public async Task Once(string eventName, Action action) => await Events.Instance.Once(ModuleName, eventName, action).ConfigureAwait(false); } -} \ No newline at end of file +} diff --git a/src/ElectronNET.API/API/WebContents.cs b/src/ElectronNET.API/API/WebContents.cs index 2ded9f60..7657b413 100644 --- a/src/ElectronNET.API/API/WebContents.cs +++ b/src/ElectronNET.API/API/WebContents.cs @@ -1,6 +1,7 @@ -using ElectronNET.API.Entities; using System; using System.Threading.Tasks; +using ElectronNET.API.Entities; +using ElectronNET.Common; // ReSharper disable InconsistentNaming @@ -123,7 +124,7 @@ internal WebContents(int id) /// public void OpenDevTools() { - BridgeConnector.Socket.Emit("webContentsOpenDevTools", Id); + BridgeConnector.Socket.Emit("webContents-openDevTools", Id); } /// @@ -132,14 +133,48 @@ public void OpenDevTools() /// public void OpenDevTools(OpenDevToolsOptions openDevToolsOptions) { - BridgeConnector.Socket.Emit("webContentsOpenDevTools", Id, openDevToolsOptions); + BridgeConnector.Socket.Emit("webContents-openDevTools", Id, openDevToolsOptions); + } + + /// + /// Toggles the devtools. + /// + public void ToggleDevTools() + { + BridgeConnector.Socket.Emit("webContents-toggleDevTools", Id); + } + + /// + /// Closes the devtools. + /// + public void CloseDevTools() + { + BridgeConnector.Socket.Emit("webContents-closeDevTools", Id); + } + + /// + /// Returns boolean - Whether the devtools is opened. + /// + /// + public bool IsDevToolsOpened() + { + return Task.Run(() => InvokeAsync()).Result; + } + + /// + /// Returns boolean - Whether the devtools view is focused. + /// + /// + public bool IsDevToolsFocused() + { + return Task.Run(() => InvokeAsync()).Result; } /// /// Get system printers. /// /// printers - public Task GetPrintersAsync() => this.InvokeAsync(); + public Task GetPrintersAsync() => this.InvokeAsyncWithTimeout(8.seconds()); /// /// Prints window's web page. @@ -254,12 +289,12 @@ public Task LoadURLAsync(string url) /// public Task LoadURLAsync(string url, LoadURLOptions options) { - var tcs = new TaskCompletionSource(); + var tcs = new TaskCompletionSource(); BridgeConnector.Socket.Once("webContents-loadURL-complete" + Id, () => { BridgeConnector.Socket.Off("webContents-loadURL-error" + Id); - tcs.SetResult(null); + tcs.SetResult(); }); BridgeConnector.Socket.Once("webContents-loadURL-error" + Id, (error) => { tcs.SetException(new InvalidOperationException(error)); }); @@ -280,4 +315,88 @@ public void InsertCSS(bool isBrowserWindow, string path) { BridgeConnector.Socket.Emit("webContents-insertCSS", Id, isBrowserWindow, path); } + + /// + /// Returns number - The current zoom factor. + /// + /// + public Task GetZoomFactorAsync() => InvokeAsync(); + + /// + /// Changes the zoom factor to the specified factor. + /// Zoom factor is zoom percent divided by 100, so 300% = 3.0. + /// The factor must be greater than 0.0. + /// + /// + public void SetZoomFactor(double factor) + { + BridgeConnector.Socket.Emit("webContents-setZoomFactor", Id, factor); + } + + /// + /// Returns number - The current zoom level. + /// + /// + public Task GetZoomLevelAsync() => InvokeAsync(); + + /// + /// Changes the zoom level to the specified level. + /// The original size is 0 and each increment above or below represents zooming 20% larger or smaller to default limits of 300% and 50% of original size, respectively. + /// + /// + public void SetZoomLevel(int level) + { + BridgeConnector.Socket.Emit("webContents-setZoomLevel", Id, level); + } + + /// + /// Sets the maximum and minimum pinch-to-zoom level. + /// + /// + /// + public Task SetVisualZoomLevelLimitsAsync(int minimumLevel, int maximumLevel) + { + var tcs = new TaskCompletionSource(); + + BridgeConnector.Socket.Once("webContents-setVisualZoomLevelLimits-completed", tcs.SetResult); + BridgeConnector.Socket.Emit("webContents-setVisualZoomLevelLimits", Id, minimumLevel, maximumLevel); + + return tcs.Task; + } + + /// + /// Returns boolean - Whether this page has been muted. + /// + /// + public Task IsAudioMutedAsync() => InvokeAsync(); + + /// + /// Returns boolean - Whether audio is currently playing. + /// + /// + public Task IsCurrentlyAudibleAsync() => InvokeAsync(); + + /// + /// Mute the audio on the current web page. + /// + /// + public void SetAudioMuted(bool muted) + { + BridgeConnector.Socket.Emit("webContents-setAudioMuted", Id, muted); + } + + /// + /// Returns string - The user agent for this web page. + /// + /// + public Task GetUserAgentAsync() => InvokeAsyncWithTimeout(3.seconds()); + + /// + /// Overrides the user agent for this web page. + /// + /// + public void SetUserAgent(string userAgent) + { + BridgeConnector.Socket.Emit("webContents-setUserAgent", Id, userAgent); + } } \ No newline at end of file diff --git a/src/ElectronNET.API/Bridge/SocketIOFacade.cs b/src/ElectronNET.API/Bridge/SocketIOFacade.cs index 06015a0a..4db0a0b7 100644 --- a/src/ElectronNET.API/Bridge/SocketIOFacade.cs +++ b/src/ElectronNET.API/Bridge/SocketIOFacade.cs @@ -2,12 +2,10 @@ // ReSharper disable once CheckNamespace namespace ElectronNET.API; -using ElectronNET.API.Serialization; -using SocketIO.Serializer.SystemTextJson; using System; -using System.Linq; -using System.Text.Json; using System.Threading.Tasks; +using ElectronNET.API.Serialization; +using SocketIO.Serializer.SystemTextJson; using SocketIO = SocketIOClient.SocketIO; internal class SocketIoFacade @@ -66,20 +64,6 @@ public void On(string eventName, Action action) } } - // Keep object overload for compatibility; value will be a JsonElement boxed as object. - public void On(string eventName, Action action) - { - lock (_lockObj) - { - _socket.On(eventName, response => - { - var value = (object)response.GetValue(); - ////Console.WriteLine($"Called Event {eventName} - data {value}"); - Task.Run(() => action(value)); - }); - } - } - public void Once(string eventName, Action action) { lock (_lockObj) diff --git a/src/ElectronNET.API/Common/TimeSpanExtensions.cs b/src/ElectronNET.API/Common/TimeSpanExtensions.cs new file mode 100644 index 00000000..b4883a0a --- /dev/null +++ b/src/ElectronNET.API/Common/TimeSpanExtensions.cs @@ -0,0 +1,74 @@ +// +// Copyright © Emby LLC. All rights reserved. +// + +namespace ElectronNET.Common +{ + using System; + using System.Diagnostics.CodeAnalysis; + + /// + /// The TimeSpanExtensions class. + /// + [SuppressMessage("StyleCop.CSharp.NamingRules", "SA1300:Element should begin with upper-case letter", Justification = "OK")] + [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:Elements should be documented", Justification = "OK")] + [SuppressMessage("ReSharper", "StyleCop.SA1300", Justification = "OK")] + [SuppressMessage("ReSharper", "InconsistentNaming", Justification = "OK")] + internal static class TimeSpanExtensions + { + public static TimeSpan ms(this int value) + { + return TimeSpan.FromMilliseconds(value); + } + + public static TimeSpan ms(this long value) + { + return TimeSpan.FromMilliseconds(value); + } + + public static TimeSpan seconds(this int value) + { + return TimeSpan.FromSeconds(value); + } + + public static TimeSpan minutes(this int value) + { + return TimeSpan.FromMinutes(value); + } + + public static TimeSpan hours(this int value) + { + return TimeSpan.FromHours(value); + } + + public static TimeSpan days(this int value) + { + return TimeSpan.FromDays(value); + } + + public static TimeSpan ms(this double value) + { + return TimeSpan.FromMilliseconds(value); + } + + public static TimeSpan seconds(this double value) + { + return TimeSpan.FromSeconds(value); + } + + public static TimeSpan minutes(this double value) + { + return TimeSpan.FromMinutes(value); + } + + public static TimeSpan hours(this double value) + { + return TimeSpan.FromHours(value); + } + + public static TimeSpan days(this double value) + { + return TimeSpan.FromDays(value); + } + } +} diff --git a/src/ElectronNET.API/Converter/ModifierTypeListConverter.cs b/src/ElectronNET.API/Converter/ModifierTypeListConverter.cs index c9f77848..371f71a3 100644 --- a/src/ElectronNET.API/Converter/ModifierTypeListConverter.cs +++ b/src/ElectronNET.API/Converter/ModifierTypeListConverter.cs @@ -40,7 +40,7 @@ public override void Write(Utf8JsonWriter writer, List value, Json writer.WriteStartArray(); foreach (var modifier in value) { - writer.WriteStringValue(modifier.ToString()); + writer.WriteStringValue(modifier.ToString().ToLowerInvariant()); } writer.WriteEndArray(); diff --git a/src/ElectronNET.API/ElectronNET.API.csproj b/src/ElectronNET.API/ElectronNET.API.csproj index 3a500110..7a1cda19 100644 --- a/src/ElectronNET.API/ElectronNET.API.csproj +++ b/src/ElectronNET.API/ElectronNET.API.csproj @@ -28,12 +28,13 @@ runtime; build; native; contentfiles; analyzers - - + + + diff --git a/src/ElectronNET.API/Runtime/Services/ElectronProcess/ElectronProcessActive.cs b/src/ElectronNET.API/Runtime/Services/ElectronProcess/ElectronProcessActive.cs index 0cf21c54..61cae062 100644 --- a/src/ElectronNET.API/Runtime/Services/ElectronProcess/ElectronProcessActive.cs +++ b/src/ElectronNET.API/Runtime/Services/ElectronProcess/ElectronProcessActive.cs @@ -76,7 +76,7 @@ private async Task StartInternal(string startCmd, string args, string directoriy { try { - await Task.Delay(10).ConfigureAwait(false); + await Task.Delay(10.ms()).ConfigureAwait(false); Console.Error.WriteLine("[StartInternal]: startCmd: {0}", startCmd); Console.Error.WriteLine("[StartInternal]: args: {0}", args); @@ -85,7 +85,7 @@ private async Task StartInternal(string startCmd, string args, string directoriy this.process.ProcessExited += this.Process_Exited; this.process.Run(startCmd, args, directoriy); - await Task.Delay(500).ConfigureAwait(false); + await Task.Delay(500.ms()).ConfigureAwait(false); Console.Error.WriteLine("[StartInternal]: after run:"); diff --git a/src/ElectronNET.API/Serialization/JsonToBoxedPrimitivesConverter.cs b/src/ElectronNET.API/Serialization/JsonToBoxedPrimitivesConverter.cs new file mode 100644 index 00000000..5db53047 --- /dev/null +++ b/src/ElectronNET.API/Serialization/JsonToBoxedPrimitivesConverter.cs @@ -0,0 +1,126 @@ +namespace ElectronNET.Serialization +{ + using System; + using System.Collections.Generic; + using System.Text.Json; + using System.Text.Json.Serialization; + + public sealed class JsonToBoxedPrimitivesConverter : JsonConverter + { + public override object Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + return ReadValue(ref reader); + } + + private static object ReadValue(ref Utf8JsonReader r) + { + switch (r.TokenType) + { + case JsonTokenType.StartObject: + + var obj = new Dictionary(); + while (r.Read()) + { + if (r.TokenType == JsonTokenType.EndObject) + { + return obj; + } + + if (r.TokenType != JsonTokenType.PropertyName) + { + throw new JsonException("Expected property name."); + } + + string name = r.GetString()!; + if (!r.Read()) + { + throw new JsonException("Unexpected end while reading property value."); + } + + obj[name] = ReadValue(ref r); + } + + throw new JsonException("Unexpected end while reading object."); + + case JsonTokenType.StartArray: + + var list = new List(); + while (r.Read()) + { + if (r.TokenType == JsonTokenType.EndArray) + { + return list; + } + + list.Add(ReadValue(ref r)); + } + + throw new JsonException("Unexpected end while reading array."); + + case JsonTokenType.True: return true; + case JsonTokenType.False: return false; + case JsonTokenType.Null: return null; + + case JsonTokenType.Number: + + if (r.TryGetInt32(out int i)) + { + return i; + } + + if (r.TryGetInt64(out long l)) + { + return l; + } + + if (r.TryGetDouble(out double d)) + { + return d; + } + + return r.GetDecimal(); + + case JsonTokenType.String: + + string s = r.GetString()!; + + if (DateTimeOffset.TryParse(s, out var dto)) + { + return dto; + } + + if (DateTime.TryParse(s, out var dt)) + { + return dt; + } + + if (TimeSpan.TryParse(s, out var ts)) + { + return ts; + } + + if (Guid.TryParse(s, out var g)) + { + return g; + } + + return s; + + default: + throw new JsonException($"Unsupported token {r.TokenType}"); + } + } + + public override void Write(Utf8JsonWriter writer, object value, JsonSerializerOptions options) + { + if (value is null) + { + writer.WriteNullValue(); + return; + } + + writer.WriteStartObject(); + writer.WriteEndObject(); + } + } +} \ No newline at end of file diff --git a/src/ElectronNET.AspNet/API/WebHostBuilderExtensions.cs b/src/ElectronNET.AspNet/API/WebHostBuilderExtensions.cs index c6078365..26d524f7 100644 --- a/src/ElectronNET.AspNet/API/WebHostBuilderExtensions.cs +++ b/src/ElectronNET.AspNet/API/WebHostBuilderExtensions.cs @@ -61,6 +61,11 @@ public static IWebHostBuilder UseElectron(this IWebHostBuilder builder, string[] { ElectronNetRuntime.OnAppReadyCallback = onAppReadyCallback; + // no matter how this is set - let's unset to prevent Electron not starting as expected + // e.g., VS Code sets this env variable, but this will cause `require("electron")` to not + // work as expected, see issue #952 + Environment.SetEnvironmentVariable("ELECTRON_RUN_AS_NODE", null); + var webPort = PortHelper.GetFreePort(ElectronNetRuntime.AspNetWebPort ?? ElectronNetRuntime.DefaultWebPort); ElectronNetRuntime.AspNetWebPort = webPort; diff --git a/src/ElectronNET.ConsoleApp/ElectronNET.ConsoleApp.csproj b/src/ElectronNET.ConsoleApp/ElectronNET.ConsoleApp.csproj index 11ad090d..caf726c6 100644 --- a/src/ElectronNET.ConsoleApp/ElectronNET.ConsoleApp.csproj +++ b/src/ElectronNET.ConsoleApp/ElectronNET.ConsoleApp.csproj @@ -8,7 +8,7 @@ - net8.0 + net10.0 exe @@ -16,6 +16,7 @@ false False false + disable 128.png @@ -69,7 +70,7 @@ - + diff --git a/src/ElectronNET.ConsoleApp/Properties/PublishProfiles/linux-x64.pubxml b/src/ElectronNET.ConsoleApp/Properties/PublishProfiles/linux-x64.pubxml index c92d1b50..2c9cd897 100644 --- a/src/ElectronNET.ConsoleApp/Properties/PublishProfiles/linux-x64.pubxml +++ b/src/ElectronNET.ConsoleApp/Properties/PublishProfiles/linux-x64.pubxml @@ -7,7 +7,7 @@ publish\Release\net8.0\linux-x64 FileSystem <_TargetId>Folder - net8.0 + net10.0 linux-x64 false false diff --git a/src/ElectronNET.ConsoleApp/Properties/PublishProfiles/publish-win-x64.pubxml b/src/ElectronNET.ConsoleApp/Properties/PublishProfiles/publish-win-x64.pubxml index 01940b38..cf6e6e09 100644 --- a/src/ElectronNET.ConsoleApp/Properties/PublishProfiles/publish-win-x64.pubxml +++ b/src/ElectronNET.ConsoleApp/Properties/PublishProfiles/publish-win-x64.pubxml @@ -12,7 +12,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121. publish\Release\net8.0\win-x64\ FileSystem <_TargetId>Folder - net8.0 + net10.0 win-x64 true diff --git a/src/ElectronNET.ConsoleApp/Properties/PublishProfiles/win-x64.pubxml b/src/ElectronNET.ConsoleApp/Properties/PublishProfiles/win-x64.pubxml index fbd20075..bda8dcc7 100644 --- a/src/ElectronNET.ConsoleApp/Properties/PublishProfiles/win-x64.pubxml +++ b/src/ElectronNET.ConsoleApp/Properties/PublishProfiles/win-x64.pubxml @@ -7,7 +7,7 @@ publish\Release\net8.0\win-x64 FileSystem <_TargetId>Folder - net8.0 + net10.0 win-x64 false false diff --git a/src/ElectronNET.Host/ElectronNET.Host.esproj b/src/ElectronNET.Host/ElectronNET.Host.esproj index 0f56fbfb..25d35af7 100644 --- a/src/ElectronNET.Host/ElectronNET.Host.esproj +++ b/src/ElectronNET.Host/ElectronNET.Host.esproj @@ -1,4 +1,4 @@ - + diff --git a/src/ElectronNET.Host/api/tray.js b/src/ElectronNET.Host/api/tray.js index 103acfbf..ae20b505 100644 --- a/src/ElectronNET.Host/api/tray.js +++ b/src/ElectronNET.Host/api/tray.js @@ -50,11 +50,7 @@ module.exports = (socket) => { const trayIcon = electron_1.nativeImage.createFromPath(image); tray.value = new electron_1.Tray(trayIcon); if (menuItems) { - const menu = electron_1.Menu.buildFromTemplate(menuItems); - addMenuItemClickConnector(menu.items, (id) => { - electronSocket.emit('trayMenuItemClicked', id); - }); - tray.value.setContextMenu(menu); + applyContextMenu(menuItems); } }); socket.on('tray-destroy', () => { @@ -62,6 +58,11 @@ module.exports = (socket) => { tray.value.destroy(); } }); + socket.on('set-contextMenu', (menuItems) => { + if (menuItems && tray.value) { + applyContextMenu(menuItems); + } + }); socket.on('tray-setImage', (image) => { if (tray.value) { tray.value.setImage(image); @@ -118,6 +119,13 @@ module.exports = (socket) => { }); } }); + function applyContextMenu(menuItems) { + const menu = electron_1.Menu.buildFromTemplate(menuItems); + addMenuItemClickConnector(menu.items, (id) => { + electronSocket.emit('trayMenuItemClicked', id); + }); + tray.value.setContextMenu(menu); + } function addMenuItemClickConnector(menuItems, callback) { menuItems.forEach((item) => { if (item.submenu && item.submenu.items.length > 0) { diff --git a/src/ElectronNET.Host/api/tray.js.map b/src/ElectronNET.Host/api/tray.js.map index 8d6584ba..3634cb9f 100644 --- a/src/ElectronNET.Host/api/tray.js.map +++ b/src/ElectronNET.Host/api/tray.js.map @@ -1 +1 @@ -{"version":3,"file":"tray.js","sourceRoot":"","sources":["tray.ts"],"names":[],"mappings":";AACA,uCAAmD;AACnD,IAAI,IAAI,GAA6B,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC3F,IAAI,cAAc,CAAC;AAEnB,iBAAS,CAAC,MAAc,EAAE,EAAE;IACxB,cAAc,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,CAAC,qBAAqB,EAAE,CAAC,EAAE,EAAE,EAAE;QACpC,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACb,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;gBACrC,cAAc,CAAC,IAAI,CAAC,YAAY,GAAG,EAAE,EAAE,CAAO,KAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;YAC7E,CAAC,CAAC,CAAC;QACP,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,2BAA2B,EAAE,CAAC,EAAE,EAAE,EAAE;QAC1C,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACb,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;gBAC3C,cAAc,CAAC,IAAI,CAAC,kBAAkB,GAAG,EAAE,EAAE,CAAO,KAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;YACnF,CAAC,CAAC,CAAC;QACP,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,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CAAC"} \ No newline at end of file diff --git a/src/ElectronNET.Host/api/tray.ts b/src/ElectronNET.Host/api/tray.ts index 1481f9a6..9c101022 100644 --- a/src/ElectronNET.Host/api/tray.ts +++ b/src/ElectronNET.Host/api/tray.ts @@ -59,12 +59,7 @@ export = (socket: Socket) => { tray.value = new Tray(trayIcon); if (menuItems) { - const menu = Menu.buildFromTemplate(menuItems); - - addMenuItemClickConnector(menu.items, (id) => { - electronSocket.emit('trayMenuItemClicked', id); - }); - tray.value.setContextMenu(menu); + applyContextMenu(menuItems); } }); @@ -74,6 +69,12 @@ export = (socket: Socket) => { } }); + socket.on('set-contextMenu', (menuItems) => { + if (menuItems && tray.value) { + applyContextMenu(menuItems); + } + }); + socket.on('tray-setImage', (image) => { if (tray.value) { tray.value.setImage(image); @@ -136,6 +137,14 @@ export = (socket: Socket) => { } }); + function applyContextMenu(menuItems) { + const menu = Menu.buildFromTemplate(menuItems); + addMenuItemClickConnector(menu.items, (id) => { + electronSocket.emit('trayMenuItemClicked', id); + }); + tray.value.setContextMenu(menu); + } + function addMenuItemClickConnector(menuItems, callback) { menuItems.forEach((item) => { if (item.submenu && item.submenu.items.length > 0) { diff --git a/src/ElectronNET.Host/api/webContents.js b/src/ElectronNET.Host/api/webContents.js index 3d0c8b0e..add58233 100644 --- a/src/ElectronNET.Host/api/webContents.js +++ b/src/ElectronNET.Host/api/webContents.js @@ -78,7 +78,7 @@ module.exports = (socket) => { electronSocket.emit("webContents-domReady" + id); }); }); - socket.on("webContentsOpenDevTools", (id, options) => { + socket.on("webContents-openDevTools", (id, options) => { if (options) { getWindowById(id).webContents.openDevTools(options); } @@ -315,6 +315,61 @@ module.exports = (socket) => { const extension = await browserWindow.webContents.session.loadExtension(path, { allowFileAccess: allowFileAccess }); electronSocket.emit("webContents-session-loadExtension-completed", extension); }); + socket.on('webContents-getZoomFactor', (id) => { + const browserWindow = getWindowById(id); + const text = browserWindow.webContents.getZoomFactor(); + electronSocket.emit('webContents-getZoomFactor-completed', text); + }); + socket.on('webContents-setZoomFactor', (id, factor) => { + const browserWindow = getWindowById(id); + browserWindow.webContents.setZoomFactor(factor); + }); + socket.on('webContents-getZoomLevel', (id) => { + const browserWindow = getWindowById(id); + const content = browserWindow.webContents.getZoomLevel(); + electronSocket.emit('webContents-getZoomLevel-completed', content); + }); + socket.on('webContents-setZoomLevel', (id, level) => { + const browserWindow = getWindowById(id); + browserWindow.webContents.setZoomLevel(level); + }); + socket.on('webContents-setVisualZoomLevelLimits', async (id, minimumLevel, maximumLevel) => { + const browserWindow = getWindowById(id); + await browserWindow.webContents.setVisualZoomLevelLimits(minimumLevel, maximumLevel); + electronSocket.emit('webContents-setVisualZoomLevelLimits-completed'); + }); + socket.on("webContents-toggleDevTools", (id) => { + getWindowById(id).webContents.toggleDevTools(); + }); + socket.on("webContents-closeDevTools", (id) => { + getWindowById(id).webContents.closeDevTools(); + }); + socket.on("webContents-isDevToolsOpened", function (id) { + const browserWindow = getWindowById(id); + electronSocket.emit('webContents-isDevToolsOpened-completed', browserWindow.webContents.isDevToolsOpened()); + }); + socket.on("webContents-isDevToolsFocused", function (id) { + const browserWindow = getWindowById(id); + electronSocket.emit('webContents-isDevToolsFocused-completed', browserWindow.webContents.isDevToolsFocused()); + }); + socket.on("webContents-setAudioMuted", (id, muted) => { + getWindowById(id).webContents.setAudioMuted(muted); + }); + socket.on("webContents-isAudioMuted", function (id) { + const browserWindow = getWindowById(id); + electronSocket.emit('webContents-isAudioMuted-completed', browserWindow.webContents.isAudioMuted()); + }); + socket.on("webContents-isCurrentlyAudible", function (id) { + const browserWindow = getWindowById(id); + electronSocket.emit('webContents-isCurrentlyAudible-completed', browserWindow.webContents.isCurrentlyAudible()); + }); + socket.on("webContents-getUserAgent", function (id) { + const browserWindow = getWindowById(id); + electronSocket.emit('webContents-getUserAgent-completed', browserWindow.webContents.getUserAgent()); + }); + socket.on("webContents-setUserAgent", (id, userAgent) => { + getWindowById(id).webContents.setUserAgent(userAgent); + }); function getWindowById(id) { if (id >= 1000) { return (0, browserView_1.browserViewMediateService)(id - 1000); diff --git a/src/ElectronNET.Host/api/webContents.js.map b/src/ElectronNET.Host/api/webContents.js.map index c3f3e451..f914af82 100644 --- a/src/ElectronNET.Host/api/webContents.js.map +++ b/src/ElectronNET.Host/api/webContents.js.map @@ -1 +1 @@ -{"version":3,"file":"webContents.js","sourceRoot":"","sources":["webContents.ts"],"names":[],"mappings":";AACA,uCAAsD;AACtD,+CAA0D;AAC1D,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AACzB,IAAI,cAAc,CAAC;AAEnB,iBAAS,CAAC,MAAc,EAAE,EAAE;IAC1B,cAAc,GAAG,MAAM,CAAC;IAExB,oDAAoD;IACpD,MAAM,CAAC,EAAE,CAAC,8BAA8B,EAAE,CAAC,EAAE,EAAE,EAAE;QAC/C,MAAM,aAAa,GAAG,aAAa,CAAC,EAAE,CAAC,CAAC;QAExC,aAAa,CAAC,WAAW,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC;QACxD,iDAAiD;QACjD,aAAa,CAAC,WAAW,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;YACxD,cAAc,CAAC,IAAI,CAAC,qBAAqB,GAAG,EAAE,EAAE,MAAM,CAAC,CAAC;QAC1D,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,oCAAoC,EAAE,CAAC,EAAE,EAAE,EAAE;QACrD,MAAM,aAAa,GAAG,aAAa,CAAC,EAAE,CAAC,CAAC;QAExC,aAAa,CAAC,WAAW,CAAC,kBAAkB,CAAC,iBAAiB,CAAC,CAAC;QAChE,aAAa,CAAC,WAAW,CAAC,EAAE,CAAC,iBAAiB,EAAE,GAAG,EAAE;YACnD,cAAc,CAAC,IAAI,CAAC,2BAA2B,GAAG,EAAE,CAAC,CAAC;QACxD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH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G,aAAa,CAAC,EAAE,CAAC,CAAC;QACxC,cAAc,CAAC,IAAI,CAAC,oCAAoC,EAAE,aAAa,CAAC,WAAW,CAAC,YAAY,EAAE,CAAC,CAAC;IACxG,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,0BAA0B,EAAE,CAAC,EAAE,EAAE,SAAS,EAAE,EAAE;QACpD,aAAa,CAAC,EAAE,CAAC,CAAC,WAAW,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;IAC1D,CAAC,CAAC,CAAC;IAEH,SAAS,aAAa,CACtB,EAAU;QAEV,IAAI,EAAE,IAAI,IAAI,EAAE,CAAC;YACf,OAAO,IAAA,uCAAyB,EAAC,EAAE,GAAG,IAAI,CAAC,CAAC;QAC9C,CAAC;QAED,OAAO,wBAAa,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAClC,CAAC;AACH,CAAC,CAAC"} \ No newline at end of file diff --git a/src/ElectronNET.Host/api/webContents.ts b/src/ElectronNET.Host/api/webContents.ts index 2d156619..fe54a521 100644 --- a/src/ElectronNET.Host/api/webContents.ts +++ b/src/ElectronNET.Host/api/webContents.ts @@ -1,5 +1,5 @@ import { Socket } from "net"; -import { BrowserWindow, BrowserView } from "electron"; +import {BrowserWindow, BrowserView} from "electron"; import { browserViewMediateService } from "./browserView"; const fs = require("fs"); let electronSocket; @@ -101,7 +101,7 @@ export = (socket: Socket) => { }); }); - socket.on("webContentsOpenDevTools", (id, options) => { + socket.on("webContents-openDevTools", (id, options) => { if (options) { getWindowById(id).webContents.openDevTools(options); } else { @@ -466,7 +466,76 @@ export = (socket: Socket) => { } ); - function getWindowById( + socket.on('webContents-getZoomFactor', (id) => { + const browserWindow = getWindowById(id); + const text = browserWindow.webContents.getZoomFactor(); + electronSocket.emit('webContents-getZoomFactor-completed', text); + }); + + socket.on('webContents-setZoomFactor', (id, factor) => { + const browserWindow = getWindowById(id); + browserWindow.webContents.setZoomFactor(factor); + }); + + socket.on('webContents-getZoomLevel', (id) => { + const browserWindow = getWindowById(id); + const content = browserWindow.webContents.getZoomLevel(); + electronSocket.emit('webContents-getZoomLevel-completed', content); + }); + + socket.on('webContents-setZoomLevel', (id, level) => { + const browserWindow = getWindowById(id); + browserWindow.webContents.setZoomLevel(level); + }); + + socket.on('webContents-setVisualZoomLevelLimits', async (id, minimumLevel, maximumLevel) => { + const browserWindow = getWindowById(id); + await browserWindow.webContents.setVisualZoomLevelLimits(minimumLevel, maximumLevel); + electronSocket.emit('webContents-setVisualZoomLevelLimits-completed'); + }); + + socket.on("webContents-toggleDevTools", (id) => { + getWindowById(id).webContents.toggleDevTools(); + }); + + socket.on("webContents-closeDevTools", (id) => { + getWindowById(id).webContents.closeDevTools(); + }); + + socket.on("webContents-isDevToolsOpened", function (id) { + const browserWindow = getWindowById(id); + electronSocket.emit('webContents-isDevToolsOpened-completed', browserWindow.webContents.isDevToolsOpened()); + }); + + socket.on("webContents-isDevToolsFocused", function (id) { + const browserWindow = getWindowById(id); + electronSocket.emit('webContents-isDevToolsFocused-completed', browserWindow.webContents.isDevToolsFocused()); + }); + + socket.on("webContents-setAudioMuted", (id, muted) => { + getWindowById(id).webContents.setAudioMuted(muted); + }); + + socket.on("webContents-isAudioMuted", function (id) { + const browserWindow = getWindowById(id); + electronSocket.emit('webContents-isAudioMuted-completed', browserWindow.webContents.isAudioMuted()); + }); + + socket.on("webContents-isCurrentlyAudible", function (id) { + const browserWindow = getWindowById(id); + electronSocket.emit('webContents-isCurrentlyAudible-completed', browserWindow.webContents.isCurrentlyAudible()); + }); + + socket.on("webContents-getUserAgent", function (id) { + const browserWindow = getWindowById(id); + electronSocket.emit('webContents-getUserAgent-completed', browserWindow.webContents.getUserAgent()); + }); + + socket.on("webContents-setUserAgent", (id, userAgent) => { + getWindowById(id).webContents.setUserAgent(userAgent); + }); + + function getWindowById( id: number ): Electron.BrowserWindow | Electron.BrowserView { if (id >= 1000) { diff --git a/src/ElectronNET.Host/main.js b/src/ElectronNET.Host/main.js index 1cddaa5a..2562ca7b 100644 --- a/src/ElectronNET.Host/main.js +++ b/src/ElectronNET.Host/main.js @@ -5,14 +5,13 @@ const path = require('path'); const cProcess = require('child_process').spawn; const portscanner = require('portscanner'); const { imageSize } = require('image-size'); -const { HookService } = require('electron-host-hook'); let io, server, browserWindows, ipc, apiProcess, loadURL; let appApi, menu, dialogApi, notification, tray, webContents; let globalShortcut, shellApi, screen, clipboard, autoUpdater; let commandLine, browserView; let powerMonitor; let processInfo; -let splashScreen, hostHook; +let splashScreen; let nativeTheme; let dock; let launchFile; @@ -263,6 +262,7 @@ function startSocketApiBridge(port) { console.log('Electron Socket: starting...'); server = require('http').createServer(); const { Server } = require('socket.io'); + let hostHook; io = new Server({ pingTimeout: 60000, // in ms, default is 5000 pingInterval: 10000, // in ms, default is 25000 @@ -359,6 +359,8 @@ function startSocketApiBridge(port) { }); try { + const { HookService } = require('electron-host-hook'); + if (hostHook === undefined) { hostHook = new HookService(socket, app); hostHook.onHostReady(); @@ -366,6 +368,7 @@ function startSocketApiBridge(port) { } catch (error) { console.error(error.message); } + console.log('Electron Socket: startup complete.'); }); } @@ -373,7 +376,7 @@ function startSocketApiBridge(port) { function startAspCoreBackend(electronPort) { startBackend(); - function startBackend() { + function startBackend() { loadURL = `about:blank`; const envParam = getEnvironmentParameter(); const parameters = [ diff --git a/src/ElectronNET.IntegrationTests/Common/IntegrationFactAttribute.cs b/src/ElectronNET.IntegrationTests/Common/IntegrationFactAttribute.cs new file mode 100644 index 00000000..6142bdfd --- /dev/null +++ b/src/ElectronNET.IntegrationTests/Common/IntegrationFactAttribute.cs @@ -0,0 +1,101 @@ +namespace ElectronNET.IntegrationTests.Common +{ + using System.Runtime.InteropServices; + using Xunit.Sdk; + + /// + /// Custom fact attribute with a default timeout of 20 seconds, allowing tests to be skipped on specific environments. + /// + /// + [AttributeUsage(AttributeTargets.Method)] + [XunitTestCaseDiscoverer("Xunit.Sdk.SkippableFactDiscoverer", "Xunit.SkippableFact")] + internal sealed class IntegrationFactAttribute : FactAttribute + { + private static readonly bool IsOnWsl; + + private static readonly bool IsOnCI; + + static IntegrationFactAttribute() + { + IsOnWsl = DetectWsl(); + IsOnCI = DetectCI(); + } + + /// + /// Initializes a new instance of the class. + /// + public IntegrationFactAttribute() + { + this.Timeout = 20_000; + } + + public bool SkipOnWsl { get; set; } + + public bool SkipOnCI { get; set; } + + /// + /// Marks the test so that it will not be run, and gets or sets the skip reason + /// + public override string Skip { + get + { + if (IsOnWsl && this.SkipOnWsl) + { + return "Skipping test on WSL environment."; + } + + if (IsOnCI && this.SkipOnCI) + { + return "Skipping test on CI environment."; + } + + return base.Skip; + } + set + { + base.Skip = value; + } + } + + private static bool DetectWsl() + { + try + { + if (!RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) + { + return false; + } + + if (!string.IsNullOrEmpty(Environment.GetEnvironmentVariable("WSL_DISTRO_NAME")) || + !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("WSL_INTEROP"))) + { + return true; + } + + return false; + } + catch + { + return false; + } + } + + private static bool DetectCI() + { + try + { + if (!string.IsNullOrEmpty(Environment.GetEnvironmentVariable("TF_BUILD")) || + !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("GITHUB_ACTIONS"))) + { + return true; + } + + return false; + } + catch + { + return false; + } + } + } +} diff --git a/src/ElectronNET.IntegrationTests/Common/IntegrationTestBase.cs b/src/ElectronNET.IntegrationTests/Common/IntegrationTestBase.cs new file mode 100644 index 00000000..5a6407fa --- /dev/null +++ b/src/ElectronNET.IntegrationTests/Common/IntegrationTestBase.cs @@ -0,0 +1,23 @@ +namespace ElectronNET.IntegrationTests.Common +{ + using ElectronNET.API; + using ElectronNET.API.Entities; + + // Base class for integration tests providing shared access to MainWindow and OS platform constants + public abstract class IntegrationTestBase + { + protected IntegrationTestBase(ElectronFixture fixture) + { + Fixture = fixture; + MainWindow = fixture.MainWindow; + } + + protected ElectronFixture Fixture { get; } + protected BrowserWindow MainWindow { get; } + + // Constants for SupportedOSPlatform attributes + public const string Windows = "Windows"; + public const string MacOS = "macOS"; + public const string Linux = "Linux"; + } +} diff --git a/src/ElectronNET.IntegrationTests/Common/SkipOnWslFactAttribute.cs b/src/ElectronNET.IntegrationTests/Common/SkipOnWslFactAttribute.cs deleted file mode 100644 index 8c1a3d02..00000000 --- a/src/ElectronNET.IntegrationTests/Common/SkipOnWslFactAttribute.cs +++ /dev/null @@ -1,49 +0,0 @@ -namespace ElectronNET.IntegrationTests.Common -{ - using System.Runtime.InteropServices; - - [AttributeUsage(AttributeTargets.Method)] - internal sealed class SkipOnWslFactAttribute : FactAttribute - { - private static readonly bool IsOnWsl; - - static SkipOnWslFactAttribute() - { - IsOnWsl = DetectWsl(); - } - - /// - /// Initializes a new instance of the class. - /// - public SkipOnWslFactAttribute() - { - if (IsOnWsl) - { - this.Skip = "Skipping test on WSL environment."; - } - } - - private static bool DetectWsl() - { - try - { - if (!RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) - { - return false; - } - - if (!string.IsNullOrEmpty(Environment.GetEnvironmentVariable("WSL_DISTRO_NAME")) || - !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("WSL_INTEROP"))) - { - return true; - } - - return false; - } - catch - { - return false; - } - } - } -} diff --git a/src/ElectronNET.IntegrationTests/ElectronFixture.cs b/src/ElectronNET.IntegrationTests/ElectronFixture.cs index cfaf8df2..59be6c95 100644 --- a/src/ElectronNET.IntegrationTests/ElectronFixture.cs +++ b/src/ElectronNET.IntegrationTests/ElectronFixture.cs @@ -4,6 +4,7 @@ namespace ElectronNET.IntegrationTests using System.Reflection; using ElectronNET.API; using ElectronNET.API.Entities; + using ElectronNET.Common; // Shared fixture that starts Electron runtime once [SuppressMessage("ReSharper", "MethodHasAsyncOverload")] @@ -26,7 +27,7 @@ public async Task InitializeAsync() await runtimeController.Start(); Console.Error.WriteLine("[ElectronFixture] Waiting for Ready..."); - await Task.WhenAny(runtimeController.WaitReadyTask, Task.Delay(TimeSpan.FromSeconds(10))); + await Task.WhenAny(runtimeController.WaitReadyTask, Task.Delay(10.seconds())); if (!runtimeController.WaitReadyTask.IsCompleted) { diff --git a/src/ElectronNET.IntegrationTests/ElectronNET.IntegrationTests.csproj b/src/ElectronNET.IntegrationTests/ElectronNET.IntegrationTests.csproj index c12d1e57..ad9d60c3 100644 --- a/src/ElectronNET.IntegrationTests/ElectronNET.IntegrationTests.csproj +++ b/src/ElectronNET.IntegrationTests/ElectronNET.IntegrationTests.csproj @@ -10,7 +10,7 @@ net10.0 enable - enable + disable false true diff --git a/src/ElectronNET.IntegrationTests/Tests/AppTests.cs b/src/ElectronNET.IntegrationTests/Tests/AppTests.cs index 1a15efdb..6d962f25 100644 --- a/src/ElectronNET.IntegrationTests/Tests/AppTests.cs +++ b/src/ElectronNET.IntegrationTests/Tests/AppTests.cs @@ -6,19 +6,16 @@ namespace ElectronNET.IntegrationTests.Tests using System.IO; using System.Runtime.Versioning; using System.Threading.Tasks; + using ElectronNET.IntegrationTests.Common; [Collection("ElectronCollection")] - public class AppTests + public class AppTests : IntegrationTestBase { - // ReSharper disable once NotAccessedField.Local - private readonly ElectronFixture fx; - - public AppTests(ElectronFixture fx) + public AppTests(ElectronFixture fx) : base(fx) { - this.fx = fx; } - [Fact(Timeout = 20000)] + [IntegrationFact] public async Task Can_get_app_path() { var path = await Electron.App.GetAppPathAsync(); @@ -26,7 +23,7 @@ public async Task Can_get_app_path() Directory.Exists(path).Should().BeTrue(); } - [Fact(Timeout = 20000)] + [IntegrationFact] public async Task Can_get_version_and_locale() { var version = await Electron.App.GetVersionAsync(); @@ -35,7 +32,7 @@ public async Task Can_get_version_and_locale() locale.Should().NotBeNullOrWhiteSpace(); } - [Fact(Timeout = 20000)] + [IntegrationFact] public async Task Can_get_special_paths() { var userData = await Electron.App.GetPathAsync(PathName.UserData); @@ -47,7 +44,7 @@ public async Task Can_get_special_paths() Directory.Exists(temp).Should().BeTrue(); } - [Fact(Timeout = 20000)] + [IntegrationFact] public async Task Can_get_app_metrics() { var metrics = await Electron.App.GetAppMetricsAsync(); @@ -55,23 +52,23 @@ public async Task Can_get_app_metrics() metrics.Length.Should().BeGreaterThan(0); } - [Fact(Timeout = 20000)] + [IntegrationFact] public async Task Can_get_gpu_feature_status() { var status = await Electron.App.GetGpuFeatureStatusAsync(); status.Should().NotBeNull(); } - [SkippableFact(Timeout = 20000)] - [SupportedOSPlatform("macOS")] - [SupportedOSPlatform("Windows")] + [IntegrationFact] + [SupportedOSPlatform(MacOS)] + [SupportedOSPlatform(Windows)] public async Task Can_get_login_item_settings() { var settings = await Electron.App.GetLoginItemSettingsAsync(); settings.Should().NotBeNull(); } - [Fact(Timeout = 20000)] + [IntegrationFact] public async Task CommandLine_append_and_query_switch() { var switchName = "integration-switch"; @@ -80,9 +77,9 @@ public async Task CommandLine_append_and_query_switch() (await Electron.App.CommandLine.GetSwitchValueAsync(switchName)).Should().Be("value123"); } - [SkippableFact(Timeout = 20000)] - [SupportedOSPlatform("macOS")] - [SupportedOSPlatform("Windows")] + [IntegrationFact] + [SupportedOSPlatform(MacOS)] + [SupportedOSPlatform(Windows)] public async Task Accessibility_support_toggle() { Electron.App.SetAccessibilitySupportEnabled(true); @@ -91,7 +88,7 @@ public async Task Accessibility_support_toggle() Electron.App.SetAccessibilitySupportEnabled(false); } - [Fact(Timeout = 20000)] + [IntegrationFact] public async Task UserAgentFallback_roundtrip() { var original = await Electron.App.UserAgentFallbackAsync; @@ -101,9 +98,9 @@ public async Task UserAgentFallback_roundtrip() Electron.App.UserAgentFallback = original; // restore } - [SkippableFact(Timeout = 20000)] - [SupportedOSPlatform("Linux")] - [SupportedOSPlatform("macOS")] + [IntegrationFact] + [SupportedOSPlatform(Linux)] + [SupportedOSPlatform(MacOS)] public async Task BadgeCount_set_and_reset_where_supported() { await Electron.App.SetBadgeCountAsync(2); @@ -113,14 +110,14 @@ public async Task BadgeCount_set_and_reset_where_supported() await Electron.App.SetBadgeCountAsync(0); } - [Fact(Timeout = 20000)] + [IntegrationFact] public async Task App_metrics_have_cpu_info() { var metrics = await Electron.App.GetAppMetricsAsync(); metrics[0].Cpu.Should().NotBeNull(); } - [Fact(Timeout = 20000)] + [IntegrationFact] public async Task App_gpu_feature_status_has_some_fields() { var status = await Electron.App.GetGpuFeatureStatusAsync(); diff --git a/src/ElectronNET.IntegrationTests/Tests/AutoUpdaterTests.cs b/src/ElectronNET.IntegrationTests/Tests/AutoUpdaterTests.cs index 1bcb3c04..65279a89 100644 --- a/src/ElectronNET.IntegrationTests/Tests/AutoUpdaterTests.cs +++ b/src/ElectronNET.IntegrationTests/Tests/AutoUpdaterTests.cs @@ -2,18 +2,17 @@ { using API; using System.Threading.Tasks; + using ElectronNET.Common; + using ElectronNET.IntegrationTests.Common; [Collection("ElectronCollection")] - public class AutoUpdaterTests + public class AutoUpdaterTests : IntegrationTestBase { - private readonly ElectronFixture fx; - - public AutoUpdaterTests(ElectronFixture fx) + public AutoUpdaterTests(ElectronFixture fx) : base(fx) { - this.fx = fx; } - [Fact(Timeout = 20000)] + [IntegrationFact] public async Task AutoDownload_check() { Electron.AutoUpdater.AutoDownload = false; @@ -24,7 +23,7 @@ public async Task AutoDownload_check() test2.Should().BeTrue(); } - [Fact(Timeout = 20000)] + [IntegrationFact] public async Task AutoInstallOnAppQuit_check() { Electron.AutoUpdater.AutoInstallOnAppQuit = false; @@ -35,7 +34,7 @@ public async Task AutoInstallOnAppQuit_check() test2.Should().BeTrue(); } - [Fact(Timeout = 20000)] + [IntegrationFact] public async Task AllowPrerelease_check() { Electron.AutoUpdater.AllowPrerelease = false; @@ -46,7 +45,7 @@ public async Task AllowPrerelease_check() test2.Should().BeTrue(); } - [Fact(Timeout = 20000)] + [IntegrationFact] public async Task FullChangelog_check() { Electron.AutoUpdater.FullChangelog = false; @@ -57,7 +56,7 @@ public async Task FullChangelog_check() test2.Should().BeTrue(); } - [Fact(Timeout = 20000)] + [IntegrationFact] public async Task AllowDowngrade_check() { Electron.AutoUpdater.AllowDowngrade = false; @@ -68,14 +67,14 @@ public async Task AllowDowngrade_check() test2.Should().BeTrue(); } - [Fact(Timeout = 20000)] + [IntegrationFact] public async Task UpdateConfigPath_check() { var test1 = Electron.AutoUpdater.UpdateConfigPath; test1.Should().Be(string.Empty); } - [Fact(Timeout = 20000)] + [IntegrationFact] public async Task CurrentVersionAsync_check() { var semver = await Electron.AutoUpdater.CurrentVersionAsync; @@ -83,18 +82,18 @@ public async Task CurrentVersionAsync_check() semver.Major.Should().BeGreaterThan(0); } - [Fact(Timeout = 20000)] + [IntegrationFact] public async Task ChannelAsync_check() { var test = await Electron.AutoUpdater.ChannelAsync; test.Should().Be(string.Empty); Electron.AutoUpdater.SetChannel = "beta"; - await Task.Delay(500); + await Task.Delay(500.ms()); test = await Electron.AutoUpdater.ChannelAsync; test.Should().Be("beta"); } - [Fact(Timeout = 20000)] + [IntegrationFact] public async Task RequestHeadersAsync_check() { var headers = new Dictionary @@ -104,27 +103,28 @@ public async Task RequestHeadersAsync_check() var test = await Electron.AutoUpdater.RequestHeadersAsync; test.Should().BeNull(); Electron.AutoUpdater.RequestHeaders = headers; + await Task.Delay(500.ms()); test = await Electron.AutoUpdater.RequestHeadersAsync; test.Should().NotBeNull(); test.Count.Should().Be(1); test["key1"].Should().Be("value1"); } - [Fact(Timeout = 20000)] + [IntegrationFact] public async Task CheckForUpdatesAsync_check() { var test = await Electron.AutoUpdater.CheckForUpdatesAsync(); test.Should().BeNull(); } - [Fact(Timeout = 20000)] + [IntegrationFact] public async Task CheckForUpdatesAndNotifyAsync_check() { var test = await Electron.AutoUpdater.CheckForUpdatesAsync(); test.Should().BeNull(); } - [Fact(Timeout = 20000)] + [IntegrationFact] public async Task GetFeedURLAsync_check() { var test = await Electron.AutoUpdater.GetFeedURLAsync(); diff --git a/src/ElectronNET.IntegrationTests/Tests/BrowserViewTests.cs b/src/ElectronNET.IntegrationTests/Tests/BrowserViewTests.cs index 8405da75..6fa25c0b 100644 --- a/src/ElectronNET.IntegrationTests/Tests/BrowserViewTests.cs +++ b/src/ElectronNET.IntegrationTests/Tests/BrowserViewTests.cs @@ -2,22 +2,20 @@ namespace ElectronNET.IntegrationTests.Tests { using ElectronNET.API; using ElectronNET.API.Entities; + using ElectronNET.IntegrationTests.Common; [Collection("ElectronCollection")] - public class BrowserViewTests + public class BrowserViewTests : IntegrationTestBase { - private readonly ElectronFixture fx; - - public BrowserViewTests(ElectronFixture fx) + public BrowserViewTests(ElectronFixture fx) : base(fx) { - this.fx = fx; } - [Fact(Timeout = 20000)] + [IntegrationFact] public async Task Create_browser_view_and_adjust_bounds() { var view = await Electron.WindowManager.CreateBrowserViewAsync(new BrowserViewConstructorOptions()); - this.fx.MainWindow.SetBrowserView(view); + this.MainWindow.SetBrowserView(view); view.Bounds = new Rectangle { X = 0, Y = 0, Width = 300, Height = 200 }; // Access bounds again (synchronous property fetch) var current = view.Bounds; diff --git a/src/ElectronNET.IntegrationTests/Tests/BrowserWindowTests.cs b/src/ElectronNET.IntegrationTests/Tests/BrowserWindowTests.cs index 6c0bd7e2..c22b8908 100644 --- a/src/ElectronNET.IntegrationTests/Tests/BrowserWindowTests.cs +++ b/src/ElectronNET.IntegrationTests/Tests/BrowserWindowTests.cs @@ -1,144 +1,163 @@ namespace ElectronNET.IntegrationTests.Tests { - using System.Runtime.InteropServices; using System.Runtime.Versioning; using ElectronNET.API; using ElectronNET.API.Entities; + using ElectronNET.Common; using ElectronNET.IntegrationTests.Common; [Collection("ElectronCollection")] - public class BrowserWindowTests + public class BrowserWindowTests : IntegrationTestBase { - private readonly ElectronFixture fx; - - public BrowserWindowTests(ElectronFixture fx) + public BrowserWindowTests(ElectronFixture fx) : base(fx) { - this.fx = fx; } - [Fact(Timeout = 20000)] + [IntegrationFact] public async Task Can_set_and_get_title() { const string title = "Integration Test Title"; - this.fx.MainWindow.SetTitle(title); - await Task.Delay(500); - var roundTrip = await this.fx.MainWindow.GetTitleAsync(); + this.MainWindow.SetTitle(title); + await Task.Delay(500.ms()); + var roundTrip = await this.MainWindow.GetTitleAsync(); roundTrip.Should().Be(title); } - [Fact(Timeout = 20000)] + [IntegrationFact] public async Task Can_resize_and_get_size() { - this.fx.MainWindow.SetSize(643, 482); - await Task.Delay(500); - var size = await this.fx.MainWindow.GetSizeAsync(); + this.MainWindow.SetSize(643, 482); + await Task.Delay(500.ms()); + var size = await this.MainWindow.GetSizeAsync(); size.Should().HaveCount(2); size[0].Should().Be(643); size[1].Should().Be(482); } - [Fact(Timeout = 20000)] + [IntegrationFact] public async Task Can_set_progress_bar_and_clear() { - this.fx.MainWindow.SetProgressBar(0.5); + this.MainWindow.SetProgressBar(0.5); // No direct getter; rely on absence of error. Try changing again. - this.fx.MainWindow.SetProgressBar(-1); // clears - await Task.Delay(50); + this.MainWindow.SetProgressBar(-1); // clears + await Task.Delay(50.ms()); } - [SkipOnWslFact(Timeout = 20000)] + [IntegrationFact(SkipOnWsl = true)] public async Task Can_set_and_get_position() { - this.fx.MainWindow.SetPosition(134, 246); - await Task.Delay(500); - var pos = await this.fx.MainWindow.GetPositionAsync(); + this.MainWindow.SetPosition(134, 246); + await Task.Delay(500.ms()); + var pos = await this.MainWindow.GetPositionAsync(); pos.Should().BeEquivalentTo([134, 246]); } - [Fact(Timeout = 20000)] + [IntegrationFact] public async Task Can_set_and_get_bounds() { var bounds = new Rectangle { X = 10, Y = 20, Width = 400, Height = 300 }; - this.fx.MainWindow.SetBounds(bounds); - await Task.Delay(500); - var round = await this.fx.MainWindow.GetBoundsAsync(); + this.MainWindow.SetBounds(bounds); + await Task.Delay(500.ms()); + var round = await this.MainWindow.GetBoundsAsync(); round.Should().BeEquivalentTo(bounds); round.Width.Should().Be(400); round.Height.Should().Be(300); } - [Fact(Timeout = 20000)] + [IntegrationFact] public async Task Can_set_and_get_content_bounds() { var bounds = new Rectangle { X = 0, Y = 0, Width = 300, Height = 200 }; - this.fx.MainWindow.SetContentBounds(bounds); - await Task.Delay(500); - var round = await this.fx.MainWindow.GetContentBoundsAsync(); + this.MainWindow.SetContentBounds(bounds); + await Task.Delay(500.ms()); + var round = await this.MainWindow.GetContentBoundsAsync(); round.Width.Should().BeGreaterThan(0); round.Height.Should().BeGreaterThan(0); } - [Fact(Timeout = 20000)] + [IntegrationFact] public async Task Show_hide_visibility_roundtrip() { - this.fx.MainWindow.Show(); - await Task.Delay(500); - (await this.fx.MainWindow.IsVisibleAsync()).Should().BeTrue(); - this.fx.MainWindow.Hide(); - await Task.Delay(500); - (await this.fx.MainWindow.IsVisibleAsync()).Should().BeFalse(); + BrowserWindow window = null; + + try + { + window = await Electron.WindowManager.CreateWindowAsync(new BrowserWindowOptions { Show = true }, "about:blank"); + + await Task.Delay(100.ms()); + + window.Show(); + + await Task.Delay(500.ms()); + (await window.IsVisibleAsync()).Should().BeTrue(); + + window.Hide(); + await Task.Delay(500.ms()); + + (await window.IsVisibleAsync()).Should().BeFalse(); + } + finally + { + window?.Destroy(); + } } - [Fact(Timeout = 20000)] + [IntegrationFact] public async Task AlwaysOnTop_toggle_and_query() { - this.fx.MainWindow.SetAlwaysOnTop(true); - await Task.Delay(500); - (await this.fx.MainWindow.IsAlwaysOnTopAsync()).Should().BeTrue(); - this.fx.MainWindow.SetAlwaysOnTop(false); - await Task.Delay(500); - (await this.fx.MainWindow.IsAlwaysOnTopAsync()).Should().BeFalse(); + this.MainWindow.SetAlwaysOnTop(true); + await Task.Delay(500.ms()); + (await this.MainWindow.IsAlwaysOnTopAsync()).Should().BeTrue(); + this.MainWindow.SetAlwaysOnTop(false); + await Task.Delay(500.ms()); + (await this.MainWindow.IsAlwaysOnTopAsync()).Should().BeFalse(); } - [SkippableFact(Timeout = 20000)] - [SupportedOSPlatform("Linux")] - [SupportedOSPlatform("Windows")] + [IntegrationFact] + [SupportedOSPlatform(Linux)] + [SupportedOSPlatform(Windows)] public async Task MenuBar_auto_hide_and_visibility() { - this.fx.MainWindow.SetAutoHideMenuBar(true); - await Task.Delay(500); - (await this.fx.MainWindow.IsMenuBarAutoHideAsync()).Should().BeTrue(); - this.fx.MainWindow.SetMenuBarVisibility(false); - await Task.Delay(500); - (await this.fx.MainWindow.IsMenuBarVisibleAsync()).Should().BeFalse(); - this.fx.MainWindow.SetMenuBarVisibility(true); - await Task.Delay(500); - (await this.fx.MainWindow.IsMenuBarVisibleAsync()).Should().BeTrue(); + this.MainWindow.SetAutoHideMenuBar(true); + await Task.Delay(500.ms()); + (await this.MainWindow.IsMenuBarAutoHideAsync()).Should().BeTrue(); + this.MainWindow.SetMenuBarVisibility(false); + await Task.Delay(500.ms()); + (await this.MainWindow.IsMenuBarVisibleAsync()).Should().BeFalse(); + this.MainWindow.SetMenuBarVisibility(true); + await Task.Delay(500.ms()); + (await this.MainWindow.IsMenuBarVisibleAsync()).Should().BeTrue(); } - [Fact(Timeout = 20000)] + [IntegrationFact] public async Task ReadyToShow_event_fires_after_content_ready() { - var window = await Electron.WindowManager.CreateWindowAsync(new BrowserWindowOptions { Show = false }, "about:blank"); - var tcs = new TaskCompletionSource(); - window.OnReadyToShow += () => tcs.TrySetResult(); + BrowserWindow window = null; - // Trigger a navigation and wait for DOM ready so the renderer paints, which emits ready-to-show - var domReadyTcs = new TaskCompletionSource(); - window.WebContents.OnDomReady += () => domReadyTcs.TrySetResult(); - await Task.Delay(500); - await window.WebContents.LoadURLAsync("about:blank"); - await domReadyTcs.Task; + try + { + window = await Electron.WindowManager.CreateWindowAsync(new BrowserWindowOptions { Show = false }, "about:blank"); + var tcs = new TaskCompletionSource(); + window.OnReadyToShow += () => tcs.TrySetResult(); - var completed = await Task.WhenAny(tcs.Task, Task.Delay(3000)); - completed.Should().Be(tcs.Task); + // Trigger a navigation and wait for DOM ready so the renderer paints, which emits ready-to-show + var domReadyTcs = new TaskCompletionSource(); + window.WebContents.OnDomReady += () => domReadyTcs.TrySetResult(); + await Task.Delay(500.ms()); + await window.WebContents.LoadURLAsync("about:blank"); + await domReadyTcs.Task; - // Typical usage is to show once ready - window.Show(); + var completed = await Task.WhenAny(tcs.Task, Task.Delay(3.seconds())); + completed.Should().Be(tcs.Task); + } + finally + { + window?.Destroy(); + } } - [Fact(Timeout = 20000)] + [IntegrationFact] public async Task PageTitleUpdated_event_fires_on_title_change() { var window = await Electron.WindowManager.CreateWindowAsync(new BrowserWindowOptions { Show = true }, "about:blank"); @@ -148,90 +167,90 @@ public async Task PageTitleUpdated_event_fires_on_title_change() // Navigate and wait for DOM ready, then change the document.title to trigger the event var domReadyTcs = new TaskCompletionSource(); window.WebContents.OnDomReady += () => domReadyTcs.TrySetResult(); - await Task.Delay(500); + await Task.Delay(500.ms()); await window.WebContents.LoadURLAsync("about:blank"); await domReadyTcs.Task; await window.WebContents.ExecuteJavaScriptAsync("document.title='NewTitle';"); // Wait for event up to a short timeout - var completed2 = await Task.WhenAny(tcs.Task, Task.Delay(3000)); + var completed2 = await Task.WhenAny(tcs.Task, Task.Delay(3.seconds())); completed2.Should().Be(tcs.Task); (await tcs.Task).Should().Be("NewTitle"); } - [Fact(Timeout = 20000)] + [IntegrationFact] public async Task Resize_event_fires_on_size_change() { var window = await Electron.WindowManager.CreateWindowAsync(new BrowserWindowOptions { Show = false }, "about:blank"); var resized = false; window.OnResize += () => resized = true; - await Task.Delay(500); + await Task.Delay(500.ms()); window.SetSize(500, 400); - await Task.Delay(300); + await Task.Delay(300.ms()); resized.Should().BeTrue(); } - [Fact(Timeout = 20000)] + [IntegrationFact] public async Task Progress_bar_and_always_on_top_toggle() { - var win = this.fx.MainWindow; + var win = this.MainWindow; win.SetProgressBar(0.5); - await Task.Delay(50); - win.SetProgressBar(0.8, new ProgressBarOptions { Mode = ProgressBarMode.normal }); - await Task.Delay(50); + await Task.Delay(50.ms()); + win.SetProgressBar(0.8, new ProgressBarOptions()); + await Task.Delay(50.ms()); win.SetAlwaysOnTop(true); - await Task.Delay(500); + await Task.Delay(500.ms()); (await win.IsAlwaysOnTopAsync()).Should().BeTrue(); win.SetAlwaysOnTop(false); - await Task.Delay(500); + await Task.Delay(500.ms()); (await win.IsAlwaysOnTopAsync()).Should().BeFalse(); } - [SkippableFact(Timeout = 20000)] - [SupportedOSPlatform("Linux")] - [SupportedOSPlatform("Windows")] + [IntegrationFact] + [SupportedOSPlatform(Linux)] + [SupportedOSPlatform(Windows)] public async Task Menu_bar_visibility_and_auto_hide() { - var win = this.fx.MainWindow; + var win = this.MainWindow; win.SetAutoHideMenuBar(true); - await Task.Delay(500); + await Task.Delay(500.ms()); (await win.IsMenuBarAutoHideAsync()).Should().BeTrue(); win.SetMenuBarVisibility(true); - await Task.Delay(500); + await Task.Delay(500.ms()); (await win.IsMenuBarVisibleAsync()).Should().BeTrue(); } - [Fact(Timeout = 20000)] + [IntegrationFact] public async Task Parent_child_relationship_roundtrip() { var child = await Electron.WindowManager.CreateWindowAsync(new BrowserWindowOptions { Show = false, Width = 300, Height = 200 }, "about:blank"); - this.fx.MainWindow.SetParentWindow(null); // ensure top-level - child.SetParentWindow(this.fx.MainWindow); - await Task.Delay(500); + this.MainWindow.SetParentWindow(null); // ensure top-level + child.SetParentWindow(this.MainWindow); + await Task.Delay(500.ms()); var parent = await child.GetParentWindowAsync(); - parent.Id.Should().Be(this.fx.MainWindow.Id); - var kids = await this.fx.MainWindow.GetChildWindowsAsync(); + parent.Id.Should().Be(this.MainWindow.Id); + var kids = await this.MainWindow.GetChildWindowsAsync(); kids.Select(k => k.Id).Should().Contain(child.Id); child.Destroy(); } - [SkippableFact(Timeout = 20000)] - [SupportedOSPlatform("macOS")] + [IntegrationFact] + [SupportedOSPlatform(MacOS)] public async Task Represented_filename_and_edited_flags() { - var win = this.fx.MainWindow; + var win = this.MainWindow; var temp = Path.Combine(Path.GetTempPath(), "electronnet_test.txt"); File.WriteAllText(temp, "test"); win.SetRepresentedFilename(temp); - await Task.Delay(500); + await Task.Delay(500.ms()); var represented = await win.GetRepresentedFilenameAsync(); represented.Should().Be(temp); win.SetDocumentEdited(true); - await Task.Delay(500); + await Task.Delay(500.ms()); var edited = await win.IsDocumentEditedAsync(); edited.Should().BeTrue(); diff --git a/src/ElectronNET.IntegrationTests/Tests/ClipboardTests.cs b/src/ElectronNET.IntegrationTests/Tests/ClipboardTests.cs index 17ff0dd6..4ef2a991 100644 --- a/src/ElectronNET.IntegrationTests/Tests/ClipboardTests.cs +++ b/src/ElectronNET.IntegrationTests/Tests/ClipboardTests.cs @@ -2,19 +2,16 @@ namespace ElectronNET.IntegrationTests.Tests { using System.Runtime.Versioning; using ElectronNET.API; + using ElectronNET.IntegrationTests.Common; [Collection("ElectronCollection")] - public class ClipboardTests + public class ClipboardTests : IntegrationTestBase { - // ReSharper disable once NotAccessedField.Local - private readonly ElectronFixture fx; - - public ClipboardTests(ElectronFixture fx) + public ClipboardTests(ElectronFixture fx) : base(fx) { - this.fx = fx; } - [Fact(Timeout = 20000)] + [IntegrationFact] public async Task Clipboard_text_roundtrip() { var text = $"Hello Electron {Guid.NewGuid()}"; @@ -23,7 +20,7 @@ public async Task Clipboard_text_roundtrip() read.Should().Be(text); } - [Fact(Timeout = 20000)] + [IntegrationFact] public async Task Available_formats_contains_text_after_write() { var text = "FormatsTest"; @@ -32,9 +29,9 @@ public async Task Available_formats_contains_text_after_write() formats.Should().Contain(f => f.Contains("text") || f.Contains("TEXT") || f.Contains("plain")); } - [SkippableFact(Timeout = 20000)] - [SupportedOSPlatform("macOS")] - [SupportedOSPlatform("Windows")] + [IntegrationFact] + [SupportedOSPlatform(MacOS)] + [SupportedOSPlatform(Windows)] public async Task Bookmark_write_and_read() { var url = "https://electron-test.com"; diff --git a/src/ElectronNET.IntegrationTests/Tests/CookiesTests.cs b/src/ElectronNET.IntegrationTests/Tests/CookiesTests.cs index 1cba009b..1bb6cc92 100644 --- a/src/ElectronNET.IntegrationTests/Tests/CookiesTests.cs +++ b/src/ElectronNET.IntegrationTests/Tests/CookiesTests.cs @@ -1,26 +1,26 @@ namespace ElectronNET.IntegrationTests.Tests { + using ElectronNET.Common; + using ElectronNET.IntegrationTests.Common; + [Collection("ElectronCollection")] - public class CookiesTests + public class CookiesTests : IntegrationTestBase { - private readonly ElectronFixture fx; - - public CookiesTests(ElectronFixture fx) + public CookiesTests(ElectronFixture fx) : base(fx) { - this.fx = fx; } - [Fact(Skip = "Cookie set/get requires navigation to domain; skipping until test harness serves page")] + [IntegrationFact(Skip = "Cookie set/get requires navigation to domain; skipping until test harness serves page")] public async Task Cookie_set_get_remove_sequence() { - var session = this.fx.MainWindow.WebContents.Session; + var session = this.MainWindow.WebContents.Session; var changed = false; session.Cookies.OnChanged += (cookie, cause, removed) => changed = true; // Navigate to example.com so cookie domain matches - await this.fx.MainWindow.WebContents.LoadURLAsync("https://example.com"); + await this.MainWindow.WebContents.LoadURLAsync("https://example.com"); // Set via renderer for now - await this.fx.MainWindow.WebContents.ExecuteJavaScriptAsync("document.cookie='integration_cookie=1;path=/';"); - await Task.Delay(500); + await this.MainWindow.WebContents.ExecuteJavaScriptAsync("document.cookie='integration_cookie=1;path=/';"); + await Task.Delay(500.ms()); changed.Should().BeTrue(); } } diff --git a/src/ElectronNET.IntegrationTests/Tests/GlobalShortcutTests.cs b/src/ElectronNET.IntegrationTests/Tests/GlobalShortcutTests.cs index 625618f3..942e6311 100644 --- a/src/ElectronNET.IntegrationTests/Tests/GlobalShortcutTests.cs +++ b/src/ElectronNET.IntegrationTests/Tests/GlobalShortcutTests.cs @@ -2,11 +2,16 @@ namespace ElectronNET.IntegrationTests.Tests { using System.Runtime.InteropServices; using ElectronNET.API; + using ElectronNET.IntegrationTests.Common; [Collection("ElectronCollection")] - public class GlobalShortcutTests + public class GlobalShortcutTests : IntegrationTestBase { - [Fact(Timeout = 20000)] + public GlobalShortcutTests(ElectronFixture fx) : base(fx) + { + } + + [IntegrationFact] public async Task Can_register_and_unregister() { var accel = RuntimeInformation.IsOSPlatform(OSPlatform.OSX) ? "Cmd+Alt+G" : "Ctrl+Alt+G"; diff --git a/src/ElectronNET.IntegrationTests/Tests/HostHookTests.cs b/src/ElectronNET.IntegrationTests/Tests/HostHookTests.cs index 254f7aa4..05b15495 100644 --- a/src/ElectronNET.IntegrationTests/Tests/HostHookTests.cs +++ b/src/ElectronNET.IntegrationTests/Tests/HostHookTests.cs @@ -1,11 +1,16 @@ namespace ElectronNET.IntegrationTests.Tests { using ElectronNET.API; + using ElectronNET.IntegrationTests.Common; [Collection("ElectronCollection")] - public class HostHookTests + public class HostHookTests : IntegrationTestBase { - [Fact(Skip = "Requires HostHook setup; skipping")] + public HostHookTests(ElectronFixture fx) : base(fx) + { + } + + [IntegrationFact(Skip = "Requires HostHook setup; skipping")] public async Task HostHook_call_returns_value() { var result = await Electron.HostHook.CallAsync("create-excel-file", "."); diff --git a/src/ElectronNET.IntegrationTests/Tests/IpcMainTests.cs b/src/ElectronNET.IntegrationTests/Tests/IpcMainTests.cs index 2596e9bd..6136fa0a 100644 --- a/src/ElectronNET.IntegrationTests/Tests/IpcMainTests.cs +++ b/src/ElectronNET.IntegrationTests/Tests/IpcMainTests.cs @@ -1,77 +1,93 @@ namespace ElectronNET.IntegrationTests.Tests { using ElectronNET.API; + using ElectronNET.Common; + using ElectronNET.IntegrationTests.Common; [Collection("ElectronCollection")] - public class IpcMainTests + public class IpcMainTests : IntegrationTestBase { - private readonly ElectronFixture fx; - - public IpcMainTests(ElectronFixture fx) + public IpcMainTests(ElectronFixture fx) : base(fx) { - this.fx = fx; } - [Fact(Timeout = 20000)] + [IntegrationFact] public async Task Ipc_On_receives_message_from_renderer() { + object received = null; + var tcs = new TaskCompletionSource(); - await Electron.IpcMain.On("ipc-on-test", obj => tcs.TrySetResult(obj?.ToString() ?? string.Empty)); - await this.fx.MainWindow.WebContents.ExecuteJavaScriptAsync("require('electron').ipcRenderer.send('ipc-on-test','payload123')"); + await Electron.IpcMain.On("ipc-on-test", obj => + { + received = obj; + tcs.TrySetResult(obj as string); + }); + + await this.MainWindow.WebContents.ExecuteJavaScriptAsync("require('electron').ipcRenderer.send('ipc-on-test','payload123')"); + var result = await tcs.Task.WaitAsync(TimeSpan.FromSeconds(5)); + + received.Should().BeOfType(); + received.Should().Be("payload123"); result.Should().Be("payload123"); } - [Fact(Timeout = 20000)] + [IntegrationFact] public async Task Ipc_Once_only_fires_once() { var count = 0; Electron.IpcMain.Once("ipc-once-test", _ => count++); - await this.fx.MainWindow.WebContents.ExecuteJavaScriptAsync("const {ipcRenderer}=require('electron'); ipcRenderer.send('ipc-once-test','a'); ipcRenderer.send('ipc-once-test','b');"); - await Task.Delay(500); + await this.MainWindow.WebContents.ExecuteJavaScriptAsync("const {ipcRenderer}=require('electron'); ipcRenderer.send('ipc-once-test','a'); ipcRenderer.send('ipc-once-test','b');"); + await Task.Delay(500.ms()); count.Should().Be(1); } - [Fact(Timeout = 20000)] + [IntegrationFact] public async Task Ipc_RemoveAllListeners_stops_receiving() { var fired = false; await Electron.IpcMain.On("ipc-remove-test", _ => fired = true); Electron.IpcMain.RemoveAllListeners("ipc-remove-test"); - await this.fx.MainWindow.WebContents.ExecuteJavaScriptAsync("require('electron').ipcRenderer.send('ipc-remove-test','x')"); - await Task.Delay(400); + await this.MainWindow.WebContents.ExecuteJavaScriptAsync("require('electron').ipcRenderer.send('ipc-remove-test','x')"); + await Task.Delay(400.ms()); fired.Should().BeFalse(); } - [Fact(Timeout = 20000)] + [IntegrationFact] public async Task Ipc_OnSync_returns_value() { + object received = null; + Electron.IpcMain.OnSync("ipc-sync-test", (obj) => { - obj.Should().NotBeNull(); + received = obj; return "pong"; }); - var ret = await this.fx.MainWindow.WebContents.ExecuteJavaScriptAsync("require('electron').ipcRenderer.sendSync('ipc-sync-test','ping')"); + var ret = await this.MainWindow.WebContents.ExecuteJavaScriptAsync("require('electron').ipcRenderer.sendSync('ipc-sync-test','ping')"); + + received.Should().BeOfType(); + received.Should().Be("ping"); + ret.Should().Be("pong"); } - [Fact(Timeout = 20000)] + [IntegrationFact] public async Task Ipc_Send_from_main_reaches_renderer() { // Listener: store raw arg; if Electron packs differently we will normalize later - await this.fx.MainWindow.WebContents.ExecuteJavaScriptAsync(@"(function(){ const {ipcRenderer}=require('electron'); ipcRenderer.once('main-to-render',(e,arg)=>{ globalThis.__mainToRender = arg;}); return 'ready'; })();"); - Electron.IpcMain.Send(this.fx.MainWindow, "main-to-render", "hello-msg"); + await this.MainWindow.WebContents.ExecuteJavaScriptAsync(@"(function(){ const {ipcRenderer}=require('electron'); ipcRenderer.once('main-to-render',(e,arg)=>{ globalThis.__mainToRender = arg;}); return 'ready'; })();"); + Electron.IpcMain.Send(this.MainWindow, "main-to-render", "hello-msg"); string value = ""; for (int i = 0; i < 20; i++) { - var jsVal = await this.fx.MainWindow.WebContents.ExecuteJavaScriptAsync("globalThis.__mainToRender === undefined ? '' : (typeof globalThis.__mainToRender === 'string' ? globalThis.__mainToRender : JSON.stringify(globalThis.__mainToRender))"); + var jsVal = await this.MainWindow.WebContents.ExecuteJavaScriptAsync("globalThis.__mainToRender === undefined ? '' : (typeof globalThis.__mainToRender === 'string' ? globalThis.__mainToRender : JSON.stringify(globalThis.__mainToRender))"); value = jsVal?.ToString() ?? ""; if (!string.IsNullOrEmpty(value)) { break; } - await Task.Delay(100); + await Task.Delay(100.ms()); } // Normalize possible JSON array ["hello-msg"] case diff --git a/src/ElectronNET.IntegrationTests/Tests/MenuTests.cs b/src/ElectronNET.IntegrationTests/Tests/MenuTests.cs index 85a9d847..7c9a900d 100644 --- a/src/ElectronNET.IntegrationTests/Tests/MenuTests.cs +++ b/src/ElectronNET.IntegrationTests/Tests/MenuTests.cs @@ -2,18 +2,17 @@ namespace ElectronNET.IntegrationTests.Tests { using ElectronNET.API; using ElectronNET.API.Entities; + using ElectronNET.Common; + using ElectronNET.IntegrationTests.Common; [Collection("ElectronCollection")] - public class MenuTests + public class MenuTests : IntegrationTestBase { - private readonly ElectronFixture fx; - - public MenuTests(ElectronFixture fx) + public MenuTests(ElectronFixture fx) : base(fx) { - this.fx = fx; } - [Fact(Timeout = 20000)] + [IntegrationFact] public async Task ApplicationMenu_click_invokes_handler() { var clicked = false; @@ -30,29 +29,29 @@ public async Task ApplicationMenu_click_invokes_handler() }; Electron.Menu.SetApplicationMenu(items); var targetId = items[0].Submenu[0].Id; - await this.fx.MainWindow.WebContents.ExecuteJavaScriptAsync($"require('electron').ipcRenderer.send('integration-click-application-menu','{targetId}')"); + await this.MainWindow.WebContents.ExecuteJavaScriptAsync($"require('electron').ipcRenderer.send('integration-click-application-menu','{targetId}')"); for (int i = 0; i < 20 && !clicked; i++) { - await Task.Delay(100); + await Task.Delay(100.ms()); } clicked.Should().BeTrue(); } - [Fact(Timeout = 20000)] + [IntegrationFact] public async Task ContextMenu_popup_registers_items() { - var win = this.fx.MainWindow; + var win = this.MainWindow; var ctxClicked = false; var ctxItems = new[] { new MenuItem { Label = "Ctx", Click = () => ctxClicked = true } }; Electron.Menu.SetContextMenu(win, ctxItems); var ctxId = ctxItems[0].Id; // simulate popup then click Electron.Menu.ContextMenuPopup(win); - await this.fx.MainWindow.WebContents.ExecuteJavaScriptAsync($"require('electron').ipcRenderer.send('integration-click-context-menu',{win.Id},'{ctxId}')"); + await this.MainWindow.WebContents.ExecuteJavaScriptAsync($"require('electron').ipcRenderer.send('integration-click-context-menu',{win.Id},'{ctxId}')"); for (int i = 0; i < 20 && !ctxClicked; i++) { - await Task.Delay(100); + await Task.Delay(100.ms()); } ctxClicked.Should().BeTrue(); diff --git a/src/ElectronNET.IntegrationTests/Tests/MultiEventRegistrationTests.cs b/src/ElectronNET.IntegrationTests/Tests/MultiEventRegistrationTests.cs index e00c8509..3d4c421b 100644 --- a/src/ElectronNET.IntegrationTests/Tests/MultiEventRegistrationTests.cs +++ b/src/ElectronNET.IntegrationTests/Tests/MultiEventRegistrationTests.cs @@ -1,13 +1,12 @@ namespace ElectronNET.IntegrationTests.Tests { + using ElectronNET.IntegrationTests.Common; + [Collection("ElectronCollection")] - public class MultiEventRegistrationTests + public class MultiEventRegistrationTests : IntegrationTestBase { - private readonly ElectronFixture fx; - - public MultiEventRegistrationTests(ElectronFixture fx) + public MultiEventRegistrationTests(ElectronFixture fx) : base(fx) { - this.fx = fx; } private static async Task WaitAllOrTimeout(TimeSpan timeout, params Task[] tasks) @@ -17,10 +16,10 @@ private static async Task WaitAllOrTimeout(TimeSpan timeout, params Task[] return ReferenceEquals(completed, all) && all.IsCompletedSuccessfully; } - [Fact(Timeout = 20000)] + [IntegrationFact] public async Task BrowserWindow_OnResize_multiple_handlers_called() { - var win = this.fx.MainWindow; + var win = this.MainWindow; var h1 = new TaskCompletionSource(); var h2 = new TaskCompletionSource(); var h3 = new TaskCompletionSource(); @@ -41,10 +40,10 @@ public async Task BrowserWindow_OnResize_multiple_handlers_called() } } - [Fact(Timeout = 20000)] + [IntegrationFact] public async Task WebContents_OnDomReady_multiple_handlers_called() { - var wc = this.fx.MainWindow.WebContents; + var wc = this.MainWindow.WebContents; var r1 = new TaskCompletionSource(); var r2 = new TaskCompletionSource(); diff --git a/src/ElectronNET.IntegrationTests/Tests/NativeImageTests.cs b/src/ElectronNET.IntegrationTests/Tests/NativeImageTests.cs index fd8cac8a..e7a09b0c 100644 --- a/src/ElectronNET.IntegrationTests/Tests/NativeImageTests.cs +++ b/src/ElectronNET.IntegrationTests/Tests/NativeImageTests.cs @@ -1,15 +1,20 @@ +using System.Drawing; +using ElectronNET.API.Entities; +using ElectronNET.IntegrationTests.Common; using System.Runtime.Versioning; using RectangleEntity = ElectronNET.API.Entities.Rectangle; namespace ElectronNET.IntegrationTests.Tests { - using System.Drawing; - using ElectronNET.API.Entities; - - [SupportedOSPlatform("Windows")] - public class NativeImageTests + [Collection("ElectronCollection")] + [SupportedOSPlatform(Windows)] + public class NativeImageTests : IntegrationTestBase { - [SkippableFact(Timeout = 20000)] + public NativeImageTests(ElectronFixture fx) : base(fx) + { + } + + [IntegrationFact] public async Task Create_from_bitmap_and_to_png() { using var bmp = new Bitmap(10, 10); @@ -27,7 +32,7 @@ public async Task Create_from_bitmap_and_to_png() png!.Length.Should().BeGreaterThan(0); } - [SkippableFact(Timeout = 20000)] + [IntegrationFact] public async Task Create_from_buffer_and_to_data_url() { // Prepare PNG bytes @@ -46,7 +51,7 @@ public async Task Create_from_buffer_and_to_data_url() dataUrl!.StartsWith("data:image/", StringComparison.Ordinal).Should().BeTrue(); } - [SkippableFact(Timeout = 20000)] + [IntegrationFact] public async Task Resize_and_crop_produce_expected_sizes() { using var bmp = new Bitmap(12, 10); @@ -66,7 +71,7 @@ public async Task Resize_and_crop_produce_expected_sizes() csize.Height.Should().Be(3); } - [SkippableFact(Timeout = 20000)] + [IntegrationFact] public async Task Add_representation_for_scale_factor() { using var bmp = new Bitmap(5, 5); diff --git a/src/ElectronNET.IntegrationTests/Tests/NativeThemeTests.cs b/src/ElectronNET.IntegrationTests/Tests/NativeThemeTests.cs index 4128a223..9e9bb615 100644 --- a/src/ElectronNET.IntegrationTests/Tests/NativeThemeTests.cs +++ b/src/ElectronNET.IntegrationTests/Tests/NativeThemeTests.cs @@ -3,29 +3,35 @@ namespace ElectronNET.IntegrationTests.Tests using System.Runtime.Versioning; using ElectronNET.API; using ElectronNET.API.Entities; + using ElectronNET.Common; + using ElectronNET.IntegrationTests.Common; [Collection("ElectronCollection")] - public class NativeThemeTests + public class NativeThemeTests : IntegrationTestBase { - [Fact(Timeout = 20000)] + public NativeThemeTests(ElectronFixture fx) : base(fx) + { + } + + [IntegrationFact] public async Task ThemeSource_roundtrip() { // Capture initial _ = await Electron.NativeTheme.ShouldUseDarkColorsAsync(); // Force light - await Task.Delay(50); + await Task.Delay(50.ms()); Electron.NativeTheme.SetThemeSource(ThemeSourceMode.Light); - await Task.Delay(500); + await Task.Delay(500.ms()); var useDarkAfterLight = await Electron.NativeTheme.ShouldUseDarkColorsAsync(); var themeSourceLight = await Electron.NativeTheme.GetThemeSourceAsync(); // Force dark Electron.NativeTheme.SetThemeSource(ThemeSourceMode.Dark); - await Task.Delay(500); + await Task.Delay(500.ms()); var useDarkAfterDark = await Electron.NativeTheme.ShouldUseDarkColorsAsync(); var themeSourceDark = await Electron.NativeTheme.GetThemeSourceAsync(); // Restore system Electron.NativeTheme.SetThemeSource(ThemeSourceMode.System); - await Task.Delay(500); + await Task.Delay(500.ms()); var themeSourceSystem = await Electron.NativeTheme.GetThemeSourceAsync(); // Assertions are tolerant (platform dependent) useDarkAfterLight.Should().BeFalse("forcing Light should result in light colors"); @@ -35,34 +41,34 @@ public async Task ThemeSource_roundtrip() themeSourceSystem.Should().Be(ThemeSourceMode.System); } - [Fact(Timeout = 20000)] + [IntegrationFact] public async Task Updated_event_fires_on_change() { var fired = false; Electron.NativeTheme.Updated += () => fired = true; Electron.NativeTheme.SetThemeSource(ThemeSourceMode.Dark); - await Task.Delay(400); + await Task.Delay(400.ms()); Electron.NativeTheme.SetThemeSource(ThemeSourceMode.Light); for (int i = 0; i < 10 && !fired; i++) { - await Task.Delay(100); + await Task.Delay(100.ms()); } fired.Should().BeTrue(); } - [SkippableFact(Timeout = 20000)] - [SupportedOSPlatform("macOS")] - [SupportedOSPlatform("Windows")] + [IntegrationFact] + [SupportedOSPlatform(MacOS)] + [SupportedOSPlatform(Windows)] public async Task Should_use_high_contrast_colors_check() { var metrics = await Electron.NativeTheme.ShouldUseHighContrastColorsAsync(); metrics.Should().Be(false); } - [SkippableFact(Timeout = 20000)] - [SupportedOSPlatform("macOS")] - [SupportedOSPlatform("Windows")] + [IntegrationFact] + [SupportedOSPlatform(MacOS)] + [SupportedOSPlatform(Windows)] public async Task Should_use_inverted_colors_check() { var metrics = await Electron.NativeTheme.ShouldUseInvertedColorSchemeAsync(); diff --git a/src/ElectronNET.IntegrationTests/Tests/NotificationTests.cs b/src/ElectronNET.IntegrationTests/Tests/NotificationTests.cs index a974bdc2..9f8772f4 100644 --- a/src/ElectronNET.IntegrationTests/Tests/NotificationTests.cs +++ b/src/ElectronNET.IntegrationTests/Tests/NotificationTests.cs @@ -3,11 +3,17 @@ namespace ElectronNET.IntegrationTests.Tests using System.Runtime.InteropServices; using ElectronNET.API; using ElectronNET.API.Entities; + using ElectronNET.Common; + using ElectronNET.IntegrationTests.Common; [Collection("ElectronCollection")] - public class NotificationTests + public class NotificationTests : IntegrationTestBase { - [SkippableFact(Timeout = 20000)] + public NotificationTests(ElectronFixture fx) : base(fx) + { + } + + [IntegrationFact] public async Task Notification_create_check() { Skip.If(RuntimeInformation.IsOSPlatform(OSPlatform.Linux), "Always returns false. Might need full-blown desktop environment"); @@ -17,16 +23,16 @@ public async Task Notification_create_check() var options = new NotificationOptions("Notification Title", "Notification test 123"); options.OnShow = () => tcs.SetResult(); - await Task.Delay(500); + await Task.Delay(500.ms()); Electron.Notification.Show(options); - await Task.WhenAny(tcs.Task, Task.Delay(5_000)); + await Task.WhenAny(tcs.Task, Task.Delay(5.seconds())); tcs.Task.IsCompletedSuccessfully.Should().BeTrue(); } - [SkippableFact(Timeout = 20000)] + [IntegrationFact] public async Task Notification_is_supported_check() { Skip.If(RuntimeInformation.IsOSPlatform(OSPlatform.Linux), "Always returns false. Might need full-blown desktop environment"); diff --git a/src/ElectronNET.IntegrationTests/Tests/ProcessTests.cs b/src/ElectronNET.IntegrationTests/Tests/ProcessTests.cs index 3fe27248..f5a9f485 100644 --- a/src/ElectronNET.IntegrationTests/Tests/ProcessTests.cs +++ b/src/ElectronNET.IntegrationTests/Tests/ProcessTests.cs @@ -1,11 +1,16 @@ namespace ElectronNET.IntegrationTests.Tests { using ElectronNET.API; + using ElectronNET.IntegrationTests.Common; [Collection("ElectronCollection")] - public class ProcessTests + public class ProcessTests : IntegrationTestBase { - [Fact(Timeout = 20000)] + public ProcessTests(ElectronFixture fx) : base(fx) + { + } + + [IntegrationFact] public async Task Process_info_is_accessible() { // Use renderer to fetch process info and round-trip @@ -14,7 +19,7 @@ public async Task Process_info_is_accessible() result.Should().Be("ok"); } - [Fact(Timeout = 20000)] + [IntegrationFact] public async Task Process_properties_are_populated() { var execPath = await Electron.Process.ExecPathAsync; diff --git a/src/ElectronNET.IntegrationTests/Tests/ScreenTests.cs b/src/ElectronNET.IntegrationTests/Tests/ScreenTests.cs index 2ecf9ecb..1ccf1f8b 100644 --- a/src/ElectronNET.IntegrationTests/Tests/ScreenTests.cs +++ b/src/ElectronNET.IntegrationTests/Tests/ScreenTests.cs @@ -6,17 +6,13 @@ namespace ElectronNET.IntegrationTests.Tests using ElectronNET.IntegrationTests.Common; [Collection("ElectronCollection")] - public class ScreenTests + public class ScreenTests : IntegrationTestBase { - // ReSharper disable once NotAccessedField.Local - private readonly ElectronFixture fx; - - public ScreenTests(ElectronFixture fx) + public ScreenTests(ElectronFixture fx) : base(fx) { - this.fx = fx; } - [SkipOnWslFact(Timeout = 20000)] + [IntegrationFact(SkipOnWsl = true)] public async Task Primary_display_has_positive_dimensions() { var display = await Electron.Screen.GetPrimaryDisplayAsync(); @@ -24,7 +20,7 @@ public async Task Primary_display_has_positive_dimensions() display.Size.Height.Should().BeGreaterThan(0); } - [SkipOnWslFact(Timeout = 20000)] + [IntegrationFact(SkipOnWsl = true)] public async Task GetAllDisplays_returns_at_least_one() { var displays = await Electron.Screen.GetAllDisplaysAsync(); @@ -32,17 +28,15 @@ public async Task GetAllDisplays_returns_at_least_one() displays.Length.Should().BeGreaterThan(0); } - [Fact(Timeout = 20000)] + [IntegrationFact] public async Task GetCursorScreenPoint_check() { var point = await Electron.Screen.GetCursorScreenPointAsync(); point.Should().NotBeNull(); - point.X.Should().BeGreaterThanOrEqualTo(0); - point.Y.Should().BeGreaterThanOrEqualTo(0); } - [SkippableFact(Timeout = 20000)] - [SupportedOSPlatform("macOS")] + [IntegrationFact] + [SupportedOSPlatform(MacOS)] public async Task GetMenuBarWorkArea_check() { var area = await Electron.Screen.GetMenuBarWorkAreaAsync(); @@ -53,7 +47,7 @@ public async Task GetMenuBarWorkArea_check() area.Width.Should().BeGreaterThan(0); } - [SkipOnWslFact(Timeout = 20000)] + [IntegrationFact(SkipOnWsl = true)] public async Task GetDisplayNearestPoint_check() { var point = new Point @@ -67,7 +61,7 @@ public async Task GetDisplayNearestPoint_check() display.Size.Height.Should().BeGreaterThan(0); } - [SkipOnWslFact(Timeout = 20000)] + [IntegrationFact(SkipOnWsl = true)] public async Task GetDisplayMatching_check() { var rectangle = new Rectangle diff --git a/src/ElectronNET.IntegrationTests/Tests/SessionTests.cs b/src/ElectronNET.IntegrationTests/Tests/SessionTests.cs index 50243a97..53dad7bb 100644 --- a/src/ElectronNET.IntegrationTests/Tests/SessionTests.cs +++ b/src/ElectronNET.IntegrationTests/Tests/SessionTests.cs @@ -1,21 +1,19 @@ namespace ElectronNET.IntegrationTests.Tests { using ElectronNET.API.Entities; + using ElectronNET.IntegrationTests.Common; [Collection("ElectronCollection")] - public class SessionTests + public class SessionTests : IntegrationTestBase { - private readonly ElectronFixture fx; - - public SessionTests(ElectronFixture fx) + public SessionTests(ElectronFixture fx) : base(fx) { - this.fx = fx; } - [Fact(Timeout = 20000)] + [IntegrationFact] public async Task Session_preloads_roundtrip() { - var session = this.fx.MainWindow.WebContents.Session; + var session = this.MainWindow.WebContents.Session; _ = await session.GetPreloadsAsync(); // Use a dummy path; API should store value session.SetPreloads(new[] { "/tmp/preload_dummy.js" }); @@ -23,10 +21,10 @@ public async Task Session_preloads_roundtrip() preloadsAfter.Should().Contain("/tmp/preload_dummy.js"); } - [Fact(Timeout = 20000)] + [IntegrationFact] public async Task Session_proxy_set_and_resolve() { - var session = this.fx.MainWindow.WebContents.Session; + var session = this.MainWindow.WebContents.Session; // Provide all ctor args (pacScript empty to ignore, proxyRules direct, bypass empty) await session.SetProxyAsync(new ProxyConfig("", "direct://", "")); var proxy = await session.ResolveProxyAsync("https://example.com"); @@ -34,10 +32,10 @@ public async Task Session_proxy_set_and_resolve() } - [Fact(Timeout = 20000)] + [IntegrationFact] public async Task Session_clear_cache_and_storage_completes() { - var session = this.fx.MainWindow.WebContents.Session; + var session = this.MainWindow.WebContents.Session; await session.ClearCacheAsync(); await session.ClearStorageDataAsync(); await session.ClearHostResolverCacheAsync(); @@ -46,10 +44,10 @@ public async Task Session_clear_cache_and_storage_completes() ua.Should().NotBeNullOrWhiteSpace(); } - [Fact(Timeout = 20000)] + [IntegrationFact] public async Task Session_preloads_set_multiple_and_clear() { - var session = this.fx.MainWindow.WebContents.Session; + var session = this.MainWindow.WebContents.Session; session.SetPreloads(new[] { "/tmp/a.js", "/tmp/b.js" }); var after = await session.GetPreloadsAsync(); after.Should().Contain("/tmp/a.js").And.Contain("/tmp/b.js"); @@ -59,40 +57,40 @@ public async Task Session_preloads_set_multiple_and_clear() empty.Should().NotContain("/tmp/a.js"); } - [Fact(Timeout = 20000)] + [IntegrationFact] public async Task Clear_auth_cache_overloads() { - var session = this.fx.MainWindow.WebContents.Session; + var session = this.MainWindow.WebContents.Session; await session.ClearAuthCacheAsync(); await session.ClearAuthCacheAsync(new RemovePassword("password") { Origin = "https://example.com", Username = "user", Password = "pw", Realm = "realm", Scheme = Scheme.basic }); } - [Fact(Timeout = 20000)] + [IntegrationFact] public async Task Clear_storage_with_options() { - var session = this.fx.MainWindow.WebContents.Session; + var session = this.MainWindow.WebContents.Session; await session.ClearStorageDataAsync(new ClearStorageDataOptions { Storages = new[] { "cookies" }, Quotas = new[] { "temporary" } }); } - [Fact(Timeout = 20000)] + [IntegrationFact] public async Task Enable_disable_network_emulation() { - var session = this.fx.MainWindow.WebContents.Session; + var session = this.MainWindow.WebContents.Session; session.EnableNetworkEmulation(new EnableNetworkEmulationOptions { Offline = false, Latency = 10, DownloadThroughput = 50000, UploadThroughput = 20000 }); session.DisableNetworkEmulation(); } - [Fact(Timeout = 20000)] + [IntegrationFact] public async Task Flush_storage_data_does_not_throw() { - var session = this.fx.MainWindow.WebContents.Session; + var session = this.MainWindow.WebContents.Session; session.FlushStorageData(); } - [Fact(Timeout = 20000)] + [IntegrationFact] public async Task Set_user_agent_affects_new_navigation() { - var session = this.fx.MainWindow.WebContents.Session; + var session = this.MainWindow.WebContents.Session; // Set UA and verify via session API (navigator.userAgent on existing WebContents may not reflect the override) session.SetUserAgent("IntegrationAgent/1.0"); var ua = await session.GetUserAgent(); diff --git a/src/ElectronNET.IntegrationTests/Tests/ShellTests.cs b/src/ElectronNET.IntegrationTests/Tests/ShellTests.cs index ff185db1..3a71ad8e 100644 --- a/src/ElectronNET.IntegrationTests/Tests/ShellTests.cs +++ b/src/ElectronNET.IntegrationTests/Tests/ShellTests.cs @@ -1,11 +1,16 @@ namespace ElectronNET.IntegrationTests.Tests { using ElectronNET.API; + using ElectronNET.IntegrationTests.Common; [Collection("ElectronCollection")] - public class ShellTests + public class ShellTests : IntegrationTestBase { - [Fact(Skip = "This can keep the test process hanging until the e-mail window is closed")] + public ShellTests(ElectronFixture fx) : base(fx) + { + } + + [IntegrationFact(Skip = "This can keep the test process hanging until the e-mail window is closed")] public async Task OpenExternal_invalid_scheme_returns_error_or_empty() { var error = await Electron.Shell.OpenExternalAsync("mailto:test@example.com"); diff --git a/src/ElectronNET.IntegrationTests/Tests/ThumbarButtonTests.cs b/src/ElectronNET.IntegrationTests/Tests/ThumbarButtonTests.cs index 15253bd5..fbbd6981 100644 --- a/src/ElectronNET.IntegrationTests/Tests/ThumbarButtonTests.cs +++ b/src/ElectronNET.IntegrationTests/Tests/ThumbarButtonTests.cs @@ -2,28 +2,26 @@ namespace ElectronNET.IntegrationTests.Tests { using System.Runtime.Versioning; using ElectronNET.API.Entities; + using ElectronNET.IntegrationTests.Common; [Collection("ElectronCollection")] - public class ThumbarButtonTests + public class ThumbarButtonTests : IntegrationTestBase { - private readonly ElectronFixture fx; - - public ThumbarButtonTests(ElectronFixture fx) + public ThumbarButtonTests(ElectronFixture fx) : base(fx) { - this.fx = fx; } - [SkippableFact(Timeout = 20000)] - [SupportedOSPlatform("Windows")] + [IntegrationFact] + [SupportedOSPlatform(Windows)] public async Task SetThumbarButtons_returns_success() { var btn = new ThumbarButton("icon.png") { Tooltip = "Test" }; - var success = await this.fx.MainWindow.SetThumbarButtonsAsync(new[] { btn }); + var success = await this.MainWindow.SetThumbarButtonsAsync(new[] { btn }); success.Should().BeTrue(); } - [SkippableFact(Timeout = 20000)] - [SupportedOSPlatform("Windows")] + [IntegrationFact] + [SupportedOSPlatform(Windows)] public async Task Thumbar_button_click_invokes_callback() { var icon = Path.Combine(Directory.GetCurrentDirectory(), "ElectronNET.WebApp", "wwwroot", "icon.png"); @@ -34,7 +32,7 @@ public async Task Thumbar_button_click_invokes_callback() var tcs = new TaskCompletionSource(); var btn = new ThumbarButton(icon) { Tooltip = "Test", Flags = new[] { ThumbarButtonFlag.enabled }, Click = () => tcs.TrySetResult(true) }; - var ok = await this.fx.MainWindow.SetThumbarButtonsAsync(new[] { btn }); + var ok = await this.MainWindow.SetThumbarButtonsAsync(new[] { btn }); ok.Should().BeTrue(); } } diff --git a/src/ElectronNET.IntegrationTests/Tests/TrayTests.cs b/src/ElectronNET.IntegrationTests/Tests/TrayTests.cs index f5b07ff1..324534e2 100644 --- a/src/ElectronNET.IntegrationTests/Tests/TrayTests.cs +++ b/src/ElectronNET.IntegrationTests/Tests/TrayTests.cs @@ -1,19 +1,16 @@ namespace ElectronNET.IntegrationTests.Tests { using ElectronNET.API; + using ElectronNET.IntegrationTests.Common; [Collection("ElectronCollection")] - public class TrayTests + public class TrayTests : IntegrationTestBase { - // ReSharper disable once NotAccessedField.Local - private readonly ElectronFixture fx; - - public TrayTests(ElectronFixture fx) + public TrayTests(ElectronFixture fx) : base(fx) { - this.fx = fx; } - [Fact(Timeout = 20000)] + [IntegrationFact] public async Task Can_create_tray_and_destroy() { //await Electron.Tray.Show("assets/icon.png"); diff --git a/src/ElectronNET.IntegrationTests/Tests/WebContentsTests.cs b/src/ElectronNET.IntegrationTests/Tests/WebContentsTests.cs index a3d62b29..7afae016 100644 --- a/src/ElectronNET.IntegrationTests/Tests/WebContentsTests.cs +++ b/src/ElectronNET.IntegrationTests/Tests/WebContentsTests.cs @@ -1,55 +1,57 @@ +using System.Runtime.InteropServices; + namespace ElectronNET.IntegrationTests.Tests { + using ElectronNET.API; using ElectronNET.API.Entities; + using ElectronNET.Common; + using ElectronNET.IntegrationTests.Common; [Collection("ElectronCollection")] - public class WebContentsTests + public class WebContentsTests : IntegrationTestBase { - private readonly ElectronFixture fx; - - public WebContentsTests(ElectronFixture fx) + public WebContentsTests(ElectronFixture fx) : base(fx) { - this.fx = fx; } - [Fact(Timeout = 20000)] + [IntegrationFact] public async Task Can_get_url_after_navigation() { - var wc = this.fx.MainWindow.WebContents; + var wc = this.MainWindow.WebContents; await wc.LoadURLAsync("https://example.com"); var url = await wc.GetUrl(); url.Should().Contain("example.com"); } - [Fact(Timeout = 20000)] + [IntegrationFact] public async Task ExecuteJavaScript_returns_title() { - var wc = this.fx.MainWindow.WebContents; + var wc = this.MainWindow.WebContents; await wc.LoadURLAsync("https://example.com"); var title = await wc.ExecuteJavaScriptAsync("document.title"); title.Should().NotBeNull(); } - [Fact(Timeout = 20000)] + [IntegrationFact] public async Task DomReady_event_fires() { - var wc = this.fx.MainWindow.WebContents; + var wc = this.MainWindow.WebContents; var fired = false; wc.OnDomReady += () => fired = true; await wc.LoadURLAsync("https://example.com"); - await Task.Delay(500); + await Task.Delay(500.ms()); fired.Should().BeTrue(); } - [Fact(Timeout = 20000)] + [IntegrationFact] public async Task Can_print_to_pdf() { var html = "data:text/html,

PDF Test

Electron.NET

"; - await this.fx.MainWindow.WebContents.LoadURLAsync(html); + await this.MainWindow.WebContents.LoadURLAsync(html); var tmp = Path.Combine(Path.GetTempPath(), $"electronnet_pdf_{Guid.NewGuid():N}.pdf"); try { - var ok = await this.fx.MainWindow.WebContents.PrintToPDFAsync(tmp); + var ok = await this.MainWindow.WebContents.PrintToPDFAsync(tmp); ok.Should().BeTrue(); File.Exists(tmp).Should().BeTrue(); new FileInfo(tmp).Length.Should().BeGreaterThan(0); @@ -63,21 +65,131 @@ public async Task Can_print_to_pdf() } } - [Fact(Timeout = 20000)] + [IntegrationFact] public async Task Can_basic_print() { var html = "data:text/html,

Print Test

"; - await this.fx.MainWindow.WebContents.LoadURLAsync(html); - var ok = await this.fx.MainWindow.WebContents.PrintAsync(new PrintOptions { Silent = true, PrintBackground = true }); + await this.MainWindow.WebContents.LoadURLAsync(html); + var ok = await this.MainWindow.WebContents.PrintAsync(new PrintOptions { Silent = true, PrintBackground = true }); ok.Should().BeTrue(); } - [SkippableFact(Timeout = 20000)] + [IntegrationFact] public async Task GetPrintersAsync_check() { - Skip.If(Environment.GetEnvironmentVariable("GITHUB_TOKEN") != null, "Skipping printer test in CI environment."); - var info = await fx.MainWindow.WebContents.GetPrintersAsync(); + var info = await this.MainWindow.WebContents.GetPrintersAsync(); info.Should().NotBeNull(); } + + [IntegrationFact] + public async Task GetSetZoomFactor_check() + { + await this.MainWindow.WebContents.GetZoomFactorAsync(); + var ok = await this.MainWindow.WebContents.GetZoomFactorAsync(); + ok.Should().BeGreaterThan(0.0); + this.MainWindow.WebContents.SetZoomFactor(2.0); + await Task.Delay(500.ms()); + ok = await this.MainWindow.WebContents.GetZoomFactorAsync(); + ok.Should().Be(2.0); + } + + [IntegrationFact] + public async Task GetSetZoomLevel_check() + { + BrowserWindow window = null; + + try + { + window = await Electron.WindowManager.CreateWindowAsync(new BrowserWindowOptions { Show = true }, "about:blank"); + + await Task.Delay(100.ms()); + + window.WebContents.SetZoomLevel(0); + await Task.Delay(500.ms()); + + var ok = await window.WebContents.GetZoomLevelAsync(); + ok.Should().Be(0); + + window.WebContents.SetZoomLevel(2); + await Task.Delay(500.ms()); + + ok = await window.WebContents.GetZoomLevelAsync(); + ok.Should().Be(2); + } + finally + { + window?.Destroy(); + } + } + + [IntegrationFact] + public async Task DevTools_check() + { + BrowserWindow window = null; + + try + { + window = await Electron.WindowManager.CreateWindowAsync(new BrowserWindowOptions { Show = true }, "about:blank"); + + await Task.Delay(3.seconds()); + + window.WebContents.IsDevToolsOpened().Should().BeFalse(); + window.WebContents.OpenDevTools(); + await Task.Delay(5.seconds()); + + window.WebContents.IsDevToolsOpened().Should().BeTrue(); + window.WebContents.CloseDevTools(); + await Task.Delay(2.seconds()); + + window.WebContents.IsDevToolsOpened().Should().BeFalse(); + } + finally + { + window?.Destroy(); + } + } + + [IntegrationFact] + public async Task GetSetAudioMuted_check() + { + this.MainWindow.WebContents.SetAudioMuted(true); + await Task.Delay(500.ms()); + var ok = await this.MainWindow.WebContents.IsAudioMutedAsync(); + ok.Should().BeTrue(); + this.MainWindow.WebContents.SetAudioMuted(false); + await Task.Delay(500.ms()); + ok = await this.MainWindow.WebContents.IsAudioMutedAsync(); + ok.Should().BeFalse(); + + // Assuming no audio is playing, IsCurrentlyAudibleAsync should return false + // there is no way to play audio in this test + ok = await this.MainWindow.WebContents.IsCurrentlyAudibleAsync(); + ok.Should().BeFalse(); + } + + [IntegrationFact] + public async Task GetSetUserAgent_check() + { + BrowserWindow window = null; + + try + { + window = await Electron.WindowManager.CreateWindowAsync(new BrowserWindowOptions { Show = true }, "about:blank"); + + await Task.Delay(3.seconds()); + + window.WebContents.SetUserAgent("MyUserAgent/1.0"); + + await Task.Delay(1.seconds()); + + var ok = await window.WebContents.GetUserAgentAsync(); + ok.Should().Be("MyUserAgent/1.0"); + } + finally + { + window?.Destroy(); + } + } + } } \ No newline at end of file diff --git a/src/ElectronNET.Samples.ElectronHostHook/Controllers/HomeController.cs b/src/ElectronNET.Samples.ElectronHostHook/Controllers/HomeController.cs index 10c10596..f71aadb0 100644 --- a/src/ElectronNET.Samples.ElectronHostHook/Controllers/HomeController.cs +++ b/src/ElectronNET.Samples.ElectronHostHook/Controllers/HomeController.cs @@ -1,5 +1,6 @@ using ElectronNET.API; using Microsoft.AspNetCore.Mvc; +using System.Threading.Tasks; namespace ElectronNET.Samples.ElectronHostHook.Controllers { diff --git a/src/ElectronNET.Samples.ElectronHostHook/ElectronNET.Samples.ElectronHostHook.csproj b/src/ElectronNET.Samples.ElectronHostHook/ElectronNET.Samples.ElectronHostHook.csproj index 70eb4366..802cdab6 100644 --- a/src/ElectronNET.Samples.ElectronHostHook/ElectronNET.Samples.ElectronHostHook.csproj +++ b/src/ElectronNET.Samples.ElectronHostHook/ElectronNET.Samples.ElectronHostHook.csproj @@ -6,7 +6,7 @@ - net8.0 + net10.0 OutOfProcess AspNetCoreModule false diff --git a/src/ElectronNET.Samples.ElectronHostHook/Program.cs b/src/ElectronNET.Samples.ElectronHostHook/Program.cs index ee8fa812..c3825ed5 100644 --- a/src/ElectronNET.Samples.ElectronHostHook/Program.cs +++ b/src/ElectronNET.Samples.ElectronHostHook/Program.cs @@ -1,4 +1,6 @@ using ElectronNET.API; +using Microsoft.AspNetCore.Builder; +using Microsoft.Extensions.DependencyInjection; namespace ElectronNET.Samples.ElectronHostHook { diff --git a/src/ElectronNET.WebApp/ElectronNET.WebApp.csproj b/src/ElectronNET.WebApp/ElectronNET.WebApp.csproj index 9b849f89..65a7cbb5 100644 --- a/src/ElectronNET.WebApp/ElectronNET.WebApp.csproj +++ b/src/ElectronNET.WebApp/ElectronNET.WebApp.csproj @@ -8,7 +8,7 @@ - net8.0 + net10.0 OutOfProcess AspNetCoreModule @@ -45,6 +45,7 @@ true true + disable @@ -75,8 +76,8 @@ - - + + diff --git a/src/ElectronNET.WebApp/Properties/PublishProfiles/linux-x64.pubxml b/src/ElectronNET.WebApp/Properties/PublishProfiles/linux-x64.pubxml index 3c9c8310..770648d1 100644 --- a/src/ElectronNET.WebApp/Properties/PublishProfiles/linux-x64.pubxml +++ b/src/ElectronNET.WebApp/Properties/PublishProfiles/linux-x64.pubxml @@ -11,7 +11,7 @@ FileSystem <_TargetId>Folder - net8.0 + net10.0 linux-x64 6ea447d9-343f-46b8-b456-66557bddbb9f true diff --git a/src/ElectronNET.WebApp/Properties/PublishProfiles/win-x64.pubxml b/src/ElectronNET.WebApp/Properties/PublishProfiles/win-x64.pubxml index 04d7a390..874b3803 100644 --- a/src/ElectronNET.WebApp/Properties/PublishProfiles/win-x64.pubxml +++ b/src/ElectronNET.WebApp/Properties/PublishProfiles/win-x64.pubxml @@ -11,7 +11,7 @@ FileSystem <_TargetId>Folder - net8.0 + net10.0 win-x64 6ea447d9-343f-46b8-b456-66557bddbb9f true diff --git a/src/ElectronNET.sln b/src/ElectronNET.sln index ef64ab18..eb20f10e 100644 --- a/src/ElectronNET.sln +++ b/src/ElectronNET.sln @@ -41,7 +41,13 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test Apps", "Test Apps", "{ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{985D39A7-5216-4945-8167-2FD0CB387BD8}" ProjectSection(SolutionItems) = preProject - ..\.github\workflows\ci.yml = ..\.github\workflows\ci.yml + ..\.github\workflows\Build and Publish.yml = ..\.github\workflows\Build and Publish.yml + ..\.github\workflows\integration-tests.yml = ..\.github\workflows\integration-tests.yml + ..\.github\workflows\PR Validation.yml = ..\.github\workflows\PR Validation.yml + ..\.github\workflows\pr-comment.yml = ..\.github\workflows\pr-comment.yml + ..\.github\workflows\publish-wiki.yml = ..\.github\workflows\publish-wiki.yml + ..\.github\workflows\retry-test-jobs.yml = ..\.github\workflows\retry-test-jobs.yml + ..\.github\workflows\trailing-whitespace-check.yml = ..\.github\workflows\trailing-whitespace-check.yml EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "_build", "..\nuke\_build.csproj", "{015CB06B-6CAE-209F-E050-21C3ACA5FE9F}" diff --git a/src/ElectronNET.sln.DotSettings b/src/ElectronNET.sln.DotSettings index 1eab21f2..fd98f554 100644 --- a/src/ElectronNET.sln.DotSettings +++ b/src/ElectronNET.sln.DotSettings @@ -1,6 +1,8 @@  + DO_NOT_SHOW False False + CI True True True diff --git a/src/ElectronNET/ElectronNET.csproj b/src/ElectronNET/ElectronNET.csproj index 48abf453..2298cd7e 100644 --- a/src/ElectronNET/ElectronNET.csproj +++ b/src/ElectronNET/ElectronNET.csproj @@ -10,6 +10,7 @@ $(DescriptionFirstPart) This package contains the ElectronNET project system. false false + disable diff --git a/src/ElectronNET/build/ElectronNET.Core.targets b/src/ElectronNET/build/ElectronNET.Core.targets index 04022f71..39da417a 100644 --- a/src/ElectronNET/build/ElectronNET.Core.targets +++ b/src/ElectronNET/build/ElectronNET.Core.targets @@ -23,4 +23,7 @@ + + +
\ No newline at end of file diff --git a/src/ElectronNET/build/ElectronNET.LateImport.targets b/src/ElectronNET/build/ElectronNET.LateImport.targets index f25493e9..d82dcbd8 100644 --- a/src/ElectronNET/build/ElectronNET.LateImport.targets +++ b/src/ElectronNET/build/ElectronNET.LateImport.targets @@ -344,7 +344,6 @@ <_OriginalPublishDir>$(PublishDir) $(_OriginalPublishDir)bin\ - $(PublishDir) true @@ -460,7 +459,7 @@ - <_NpxCmd>npx electron-builder --config=./$(ElectronBuilderJson) --$(ElectronPlatform) --$(ElectronArch) -c.electronVersion=$(ElectronVersion) $(ElectronPaParams) + <_NpxCmd>npx electron-builder --config=./$(ElectronBuilderJson) --$(ElectronPlatform) --$(ElectronArch) -c.electronVersion=$(ElectronVersion) -c.directories.output "$(ElectronPublishUrlFullPath)" $(ElectronPaParams) <_NpxCmd Condition="'$(IsLinuxWsl)' == 'true'">wsl bash -ic '$(_NpxCmd)' diff --git a/src/ElectronNET/build/ElectronNET.MigrationChecks.targets b/src/ElectronNET/build/ElectronNET.MigrationChecks.targets new file mode 100644 index 00000000..df2336fe --- /dev/null +++ b/src/ElectronNET/build/ElectronNET.MigrationChecks.targets @@ -0,0 +1,280 @@ + + + + + + ElectronCheckNoPackageJson; + ElectronCheckNoManifestJson; + ElectronCheckElectronBuilderJson; + ElectronCheckNoParentPaths; + ElectronCheckPubxmlFiles + + + + + + + + + + + + + <_InvalidPackageJson Include="$(MSBuildProjectDirectory)\**\package.json" + Exclude="$(MSBuildProjectDirectory)\ElectronHostHook\**\package.json; + $(MSBuildProjectDirectory)\bin\**\package.json; + $(MSBuildProjectDirectory)\obj\**\package.json; + $(MSBuildProjectDirectory)\publish\**\package.json; + $(MSBuildProjectDirectory)\node_modules\**\package.json" /> + <_InvalidPackageLockJson Include="$(MSBuildProjectDirectory)\**\package-lock.json" + Exclude="$(MSBuildProjectDirectory)\ElectronHostHook\**\package-lock.json; + $(MSBuildProjectDirectory)\bin\**\package-lock.json; + $(MSBuildProjectDirectory)\obj\**\package-lock.json; + $(MSBuildProjectDirectory)\publish\**\package-lock.json; + $(MSBuildProjectDirectory)\node_modules\**\package-lock.json" /> + + + + <_HasInvalidPackageJson>false + <_HasInvalidPackageJson Condition="@(_InvalidPackageJson->Count()) > 0 OR @(_InvalidPackageLockJson->Count()) > 0">true + + + + + + + + + + + <_InvalidManifestJson Include="$(MSBuildProjectDirectory)\**\electron.manifest.json;$(MSBuildProjectDirectory)\**\electron-manifest.json" + Exclude="$(MSBuildProjectDirectory)\bin\**\*; + $(MSBuildProjectDirectory)\obj\**\*; + $(MSBuildProjectDirectory)\publish\**\*; + $(MSBuildProjectDirectory)\node_modules\**\*" /> + + + + <_HasInvalidManifestJson>false + <_HasInvalidManifestJson Condition="@(_InvalidManifestJson->Count()) > 0">true + + + + + + + + + + + + <_ElectronBuilderJsonInProperties Include="$(MSBuildProjectDirectory)\Properties\electron-builder.json" /> + + + + <_HasElectronBuilderJsonInProperties>false + <_HasElectronBuilderJsonInProperties Condition="Exists('$(MSBuildProjectDirectory)\Properties\electron-builder.json')">true + + + + + <_ElectronBuilderJsonWrongLocation Include="$(MSBuildProjectDirectory)\**\electron-builder.json" + Exclude="$(MSBuildProjectDirectory)\Properties\electron-builder.json; + $(MSBuildProjectDirectory)\bin\**\*; + $(MSBuildProjectDirectory)\obj\**\*; + $(MSBuildProjectDirectory)\publish\**\*; + $(MSBuildProjectDirectory)\node_modules\**\*" /> + + + + <_HasElectronBuilderJsonWrongLocation>false + <_HasElectronBuilderJsonWrongLocation Condition="@(_ElectronBuilderJsonWrongLocation->Count()) > 0">true + + + + + + + + + + + + + <_ElectronBuilderJsonPath>$(MSBuildProjectDirectory)\Properties\electron-builder.json + + + + + + + + + + <_ElectronBuilderJsonContent>@(_ElectronBuilderJsonLines, ' ') + <_HasParentPathReference>false + <_HasParentPathReference Condition="$(_ElectronBuilderJsonContent.Contains('../')) OR $(_ElectronBuilderJsonContent.Contains('..\\'))" >true + + + + + + + + + + + + <_PubxmlFiles Include="$(MSBuildProjectDirectory)\Properties\PublishProfiles\*.pubxml" /> + + + + + <_IsAspNetProject>false + <_IsAspNetProject Condition="'$(UsingMicrosoftNETSdkWeb)' == 'true'">true + <_HasPubxmlFiles>false + <_HasPubxmlFiles Condition="@(_PubxmlFiles->Count()) > 0">true + + + + + <_PubxmlFileInfo Include="@(_PubxmlFiles)" Condition="'%(Identity)' != ''"> + $([System.IO.File]::ReadAllText('%(Identity)')) + + + + + + <_PubxmlFileInfoWithFlags Include="@(_PubxmlFileInfo)" Condition="'%(Identity)' != ''"> + $([System.Text.RegularExpressions.Regex]::IsMatch('%(FileContent)', '<WebPublishMethod>')) + + + + + + <_AspNetMissingWebPublishMethod Include="@(_PubxmlFileInfoWithFlags)" + Condition="'$(_IsAspNetProject)' == 'true' AND '%(HasWebPublishMethod)' == 'False'" /> + + + + + <_ConsolePubxmlWithAspNetProperties Include="@(_PubxmlFileInfoWithFlags)" + Condition="'$(_IsAspNetProject)' != 'true' AND '%(HasWebPublishMethod)' == 'True'" /> + + + + + + + + + + + diff --git a/src/common.props b/src/common.props index 554f4bf8..9026afa7 100644 --- a/src/common.props +++ b/src/common.props @@ -1,6 +1,6 @@ - 0.2.0 + 0.3.0 ElectronNET.Core Gregor Biswanger, Florian Rappl, softworkz Electron.NET