├── .gitattributes
├── .github
├── dependabot.yml
└── workflows
│ └── publish-nuget.yml
├── .gitignore
├── .vscode
├── launch.json
└── tasks.json
├── Directory.Build.props
├── Extras
├── Release Notes Template
│ ├── rnotes.css
│ └── rnotes.html
├── Sample Appcast.xml
├── Sample Update AppCast
│ ├── MetaData
│ │ ├── NetSparklTestApp-1.0.1.dsa
│ │ ├── NetSparklTestApp-1.0.2.dsa
│ │ ├── NetSparkle_DSA.priv
│ │ └── NetSparkle_DSA.pub
│ └── Server Root
│ │ ├── 1.0.1
│ │ ├── rnotes.css
│ │ └── rnotes.html
│ │ ├── 1.0.2
│ │ ├── rnotes.css
│ │ └── rnotes.html
│ │ └── versioninfo.xml
└── SampleReleaseNotes.md
├── LICENSE.md
├── NetSparkleUpdater.sln
├── OLD_CHANGELOG.md
├── README.md
├── TestAppFiles
├── 2.0-release-notes.md
├── GenerateHashForDemoSoftware.bat
├── GenerateHashForDemoXMLUpdates.bat
├── GenerateHashForReleaseNotes.bat
├── NetSparkle_DSA.priv
├── NetSparkle_DSA.pub
└── appcast.xml
├── UPGRADING.md
├── doc
├── Comments.txt
├── Languages.txt
├── Project.txt
└── generated
│ └── git.folder
├── nuget.config
├── nuget
├── NuGet.exe
└── winformsnetframework
│ └── NetSparkleUpdater.UI.WinForms.NetFramework.nuspec
└── src
├── NetSparkle.Samples.Avalonia.MacOS
├── App.axaml
├── App.axaml.cs
├── Assets
│ └── software-update-available.png
├── CustomSparkleUpdater.cs
├── MainWindow.axaml
├── MainWindow.axaml.cs
├── NetSparkle.Samples.Avalonia.MacOS.csproj
├── NetSparkle_DSA.pub
├── Program.cs
├── nuget.config
└── software-update-available.ico
├── NetSparkle.Samples.Avalonia.MacOSZip
├── App.axaml
├── App.axaml.cs
├── Assets
│ └── software-update-available.png
├── CustomSparkleUpdater.cs
├── MainWindow.axaml
├── MainWindow.axaml.cs
├── NetSparkle.Samples.Avalonia.MacOSZip.csproj
├── Program.cs
├── nuget.config
└── software-update-available.ico
├── NetSparkle.Samples.Avalonia.Rollback
├── App.axaml
├── App.axaml.cs
├── Assets
│ └── software-update-available.png
├── CustomSparkleUpdater.cs
├── MainWindow.axaml
├── MainWindow.axaml.cs
├── NetSparkle.Samples.Avalonia.Rollback.csproj
├── OSAppCastFilter.cs
├── Program.cs
├── nuget.config
└── software-update-available.ico
├── NetSparkle.Samples.Avalonia
├── App.axaml
├── App.axaml.cs
├── Assets
│ └── software-update-available.png
├── MainWindow.axaml
├── MainWindow.axaml.cs
├── NetSparkle.Samples.Avalonia.csproj
├── NetSparkle_DSA.pub
├── Program.cs
├── nuget.config
└── software-update-available.ico
├── NetSparkle.Samples.DownloadedExe
├── App.config
├── Form1.Designer.cs
├── Form1.cs
├── Form1.resx
├── NetSparkle.Samples.UpdateExe.csproj
├── Program.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
└── app.manifest
├── NetSparkle.Samples.Forms.Multithread
├── Form1.Designer.cs
├── Form1.cs
├── Form1.resx
├── NetSparkle.Samples.Forms.Multithread.csproj
├── NetSparkle.Samples.Forms.Multithread.csproj.user
├── NetSparkle_DSA.pub
├── Program.cs
└── software-update-available.ico
├── NetSparkle.Samples.HandleEventsYourself
├── App.xaml
├── App.xaml.cs
├── AssemblyInfo.cs
├── MainWindow.xaml
├── MainWindow.xaml.cs
├── NetSparkle.Samples.HandleEventsYourself.csproj
├── NetSparkle.Samples.HandleEventsYourself.csproj.user
└── NetSparkle_DSA.pub
├── NetSparkle.Samples.NetCore.WPF
├── App.xaml
├── App.xaml.cs
├── AssemblyInfo.cs
├── MainWindow.xaml
├── MainWindow.xaml.cs
├── NetSparkle.Samples.NetCore.WPF.csproj
├── NetSparkle.Samples.NetCore.WPF.csproj.user
├── NetSparkle_DSA.pub
└── software-update-available.ico
├── NetSparkle.Samples.NetCore.WinForms
├── Form1.Designer.cs
├── Form1.cs
├── Form1.resx
├── NetSparkle.Samples.NetCore.WinForms.csproj
├── NetSparkle.Samples.NetCore.WinForms.csproj.user
├── NetSparkle_DSA.pub
├── Program.cs
└── software-update-available.ico
├── NetSparkle.Samples.NetFramework.WPF
├── App.xaml
├── App.xaml.cs
├── MainWindow.xaml
├── MainWindow.xaml.cs
├── NetSparkle.Samples.NetFramework.WPF.csproj
├── NetSparkleTestAppWPF.csproj.vspscc
├── NetSparkle_DSA.pub
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── app.config
└── software-update-available.ico
├── NetSparkle.Samples.NetFramework.WinForms
├── Form1.Designer.cs
├── Form1.cs
├── Form1.resx
├── NetSparkle.Samples.NetFramework.WinForms.csproj
├── NetSparkle.Samples.NetFramework.WinForms.csproj.user
├── NetSparkle_DSA.pub
├── Program.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── app.config
├── app.manifest
└── software-update-available.ico
├── NetSparkle.Samples.SimpleConsoleApp
├── .gitignore
├── BuildAppCast.sh
├── CreateAppCast.sh
├── NetSparkle.Samples.SimpleConsoleApp.csproj
└── Program.cs
├── NetSparkle.Shared
├── NetSparkle.Shared.shproj
├── NetSparkleUtilities.projitems
└── Utilities.cs
├── NetSparkle.Tests.AppCastGenerator
├── AppCastMakerTests.cs
├── AppCastTestCollection.cs
├── EmptyTestDataConfiguration.cs
├── FakeTestDataAssemblyAccessor.cs
├── NetSparkle.Tests.AppCastGenerator.csproj
├── SignatureManagerFixture.cs
├── SignatureManagerTests.cs
└── URLEncodeTests.cs
├── NetSparkle.Tests.Trimming
├── NetSparkle.Tests.Trimming.csproj
└── Program.cs
├── NetSparkle.Tests
├── AlwaysSucceedSignatureChecker.cs
├── AppCastGeneratorTests.cs
├── AppCastItemTests.cs
├── AppCastReducersTests.cs
├── AssemblyAccessorTests.cs
├── ChannelAppCastFilterTests.cs
├── ConfigurationTests.cs
├── Ed25519Tests.cs
├── EmptyTestDataConfiguration.cs
├── FakeTestDataAssemblyAccessor.cs
├── NetSparkle.Tests.csproj
├── Properties
│ └── AssemblyInfo.cs
├── SemVerLikeTests.cs
├── SparkleUpdaterFixture.cs
├── SparkleUpdaterTestCollection.cs
├── SparkleUpdaterTests.cs
├── StringCastDataDownloader.cs
├── UtilitiesTests.cs
├── VersionTrimmersTests.cs
├── appcast_simple.xml
└── appcast_with_beta_items.xml
├── NetSparkle.Tools.AppCastGenerator
├── App.config
├── AppCastMaker.cs
├── JsonAppCastMaker.cs
├── NetSparkle.Tools.AppCastGenerator.csproj
├── Options.cs
├── Program.cs
├── Properties
│ └── AssemblyInfo.cs
├── SignatureManager.cs
└── XMLAppCastMaker.cs
├── NetSparkle.Tools.DSAHelper
├── NetSparkle.Tools.DSAHelper.csproj
├── NetSparkleDSAHelper.csproj.vspscc
├── Program.cs
├── Properties
│ └── AssemblyInfo.cs
└── app.config
├── NetSparkle.UI.Avalonia
├── CheckingForUpdatesWindow.axaml
├── CheckingForUpdatesWindow.axaml.cs
├── Controls
│ └── BaseWindow.cs
├── DownloadProgressWindow.axaml
├── DownloadProgressWindow.axaml.cs
├── Helpers
│ ├── ChangeNotifier.cs
│ └── RelayCommand.cs
├── Interfaces
│ ├── IBackgroundColorChanger.cs
│ ├── IReleaseNotesDisplayer.cs
│ └── IUserRespondedToUpdateCheck.cs
├── MessageNotificationWindow.axaml
├── MessageNotificationWindow.axaml.cs
├── NetSparkle.UI.Avalonia.csproj
├── UIFactory.cs
├── UpdateAvailableWindow.axaml
├── UpdateAvailableWindow.axaml.cs
└── ViewModels
│ ├── DownloadProgressWindowViewModel.cs
│ ├── MessageNotificationWindowViewModel.cs
│ └── UpdateAvailableWindowViewModel.cs
├── NetSparkle.UI.WPF
├── CheckingForUpdatesWindow.xaml
├── CheckingForUpdatesWindow.xaml.cs
├── Controls
│ └── BaseWindow.cs
├── DownloadProgressWindow.xaml
├── DownloadProgressWindow.xaml.cs
├── Helpers
│ ├── ChangeNotifier.cs
│ └── RelayCommand.cs
├── IconUtilities.cs
├── Interfaces
│ ├── IReleaseNotesDisplayer.cs
│ └── IUserRespondedToUpdateCheck.cs
├── MessageNotificationWindow.xaml
├── MessageNotificationWindow.xaml.cs
├── NetSparkle.UI.WPF.csproj
├── Properties
│ └── AssemblyInfo.cs
├── ToastNotification.xaml
├── ToastNotification.xaml.cs
├── UIFactory.cs
├── UpdateAvailableWindow.xaml
├── UpdateAvailableWindow.xaml.cs
└── ViewModels
│ ├── DownloadProgressWindowViewModel.cs
│ ├── MessageNotificationWindowViewModel.cs
│ └── UpdateAvailableWindowViewModel.cs
├── NetSparkle.UI.WinForms.NetCore
├── CheckingForUpdatesWindow.Designer.cs
├── CheckingForUpdatesWindow.cs
├── CheckingForUpdatesWindow.resx
├── DownloadProgressWindow.Designer.cs
├── DownloadProgressWindow.JA.resx
├── DownloadProgressWindow.bg.resx
├── DownloadProgressWindow.cs
├── DownloadProgressWindow.de.resx
├── DownloadProgressWindow.es-MX.resx
├── DownloadProgressWindow.fr.resx
├── DownloadProgressWindow.it.resx
├── DownloadProgressWindow.lt.resx
├── DownloadProgressWindow.nl.resx
├── DownloadProgressWindow.pt-BR.resx
├── DownloadProgressWindow.resx
├── DownloadProgressWindow.ru.resx
├── DownloadProgressWindow.zh-CN.resx
├── DownloadProgressWindow.zh-TW.resx
├── MessageNotificationWindow.Designer.cs
├── MessageNotificationWindow.cs
├── MessageNotificationWindow.resx
├── NetSparkle.UI.WinForms.NetCore.csproj
├── ToastNotifier.cs
├── ToastNotifier.designer.cs
├── ToastNotifier.resx
├── UIFactory.cs
├── UpdateAvailableWindow.Designer.cs
├── UpdateAvailableWindow.JA.resx
├── UpdateAvailableWindow.bg.resx
├── UpdateAvailableWindow.cs
├── UpdateAvailableWindow.de.resx
├── UpdateAvailableWindow.es-MX.resx
├── UpdateAvailableWindow.fr.resx
├── UpdateAvailableWindow.it.resx
├── UpdateAvailableWindow.lt.resx
├── UpdateAvailableWindow.nl.resx
├── UpdateAvailableWindow.pt-BR.resx
├── UpdateAvailableWindow.resx
├── UpdateAvailableWindow.ru.resx
├── UpdateAvailableWindow.zh-CN.resx
└── UpdateAvailableWindow.zh-TW.resx
├── NetSparkle.UI.WinForms.NetFramework
├── CheckingForUpdatesWindow.Designer.cs
├── CheckingForUpdatesWindow.cs
├── CheckingForUpdatesWindow.resx
├── DownloadProgressWindow.Designer.cs
├── DownloadProgressWindow.JA.resx
├── DownloadProgressWindow.bg.resx
├── DownloadProgressWindow.cs
├── DownloadProgressWindow.de.resx
├── DownloadProgressWindow.es-MX.resx
├── DownloadProgressWindow.fr.resx
├── DownloadProgressWindow.it.resx
├── DownloadProgressWindow.lt.resx
├── DownloadProgressWindow.nl.resx
├── DownloadProgressWindow.pt-BR.resx
├── DownloadProgressWindow.resx
├── DownloadProgressWindow.ru.resx
├── DownloadProgressWindow.zh-CN.resx
├── DownloadProgressWindow.zh-TW.resx
├── MessageNotificationWindow.Designer.cs
├── MessageNotificationWindow.cs
├── MessageNotificationWindow.resx
├── NetSparkle.UI.WinForms.NetFramework.csproj
├── NetSparkle.UI.WinForms.NetFramework.csproj.user
├── Properties
│ └── AssemblyInfo.cs
├── ToastNotifier.cs
├── ToastNotifier.designer.cs
├── ToastNotifier.resx
├── UIFactory.cs
├── UpdateAvailableWindow.Designer.cs
├── UpdateAvailableWindow.JA.resx
├── UpdateAvailableWindow.bg.resx
├── UpdateAvailableWindow.cs
├── UpdateAvailableWindow.de.resx
├── UpdateAvailableWindow.es-MX.resx
├── UpdateAvailableWindow.fr.resx
├── UpdateAvailableWindow.it.resx
├── UpdateAvailableWindow.lt.resx
├── UpdateAvailableWindow.nl.resx
├── UpdateAvailableWindow.pt-BR.resx
├── UpdateAvailableWindow.resx
├── UpdateAvailableWindow.ru.resx
├── UpdateAvailableWindow.zh-CN.resx
└── UpdateAvailableWindow.zh-TW.resx
├── NetSparkle.Unused
└── AsmResolverAccessor.cs
└── NetSparkle
├── AppCast.cs
├── AppCastHandlers
├── AppCastHelper.cs
├── AppCastReducerDelegate.cs
├── AppCastReducers.cs
├── ChannelAppCastFilter.cs
├── JsonAppCastGenerator.cs
├── SemVerLike.cs
├── VersionTrimmerDelegate.cs
├── VersionTrimmers.cs
└── XMLAppCastGenerator.cs
├── AppCastItem.cs
├── ArtWork
├── software-update-available-old.ico
├── software-update-available-old.png
├── software-update-available.ico
├── software-update-available.png
└── software-update-available.svg
├── AssemblyAccessors
├── AssemblyDiagnosticsAccessor.cs
└── AssemblyReflectionAccessor.cs
├── Configurations
├── Configuration.cs
├── DefaultConfiguration.cs
├── JSONConfiguration.cs
├── RegistryConfiguration.cs
└── SavedConfigurationData.cs
├── Downloaders
├── AsyncHelper.cs
├── LocalFileAppCastDownloader.cs
├── LocalFileDownloader.cs
├── WebFileDownloader.cs
└── WebRequestAppCastDataDownloader.cs
├── Enums
├── FilterItemResult.cs
├── InstallUpdateFailureReason.cs
├── LogWriterOutputMode.cs
├── NextUpdateAction.cs
├── SecurityMode.cs
├── UpdateAvailableResult.cs
├── UpdateStatus.cs
├── UserInteractionMode.cs
└── ValidationResult.cs
├── Events
├── DownloadInstallEventArgs.cs
├── ItemDownloadProgressEventArgs.cs
├── UpdateDetectedEventArgs.cs
└── UpdateResponseEventArgs.cs
├── Interfaces
├── IAppCastDataDownloader.cs
├── IAppCastFilter.cs
├── IAppCastGenerator.cs
├── IAssemblyAccessor.cs
├── ICheckingForUpdates.cs
├── IDownloadProgress.cs
├── ILogger.cs
├── ISignatureVerifier.cs
├── IUIFactory.cs
├── IUpdateAvailable.cs
└── IUpdateDownloader.cs
├── Libraries
└── MarkdownSharp.cs
├── LogWriter.cs
├── NetSparkle.csproj
├── NetSparkleDelegates.cs
├── NetSparkleException.cs
├── Properties
├── Resources.Designer.cs
└── Resources.resx
├── ReleaseNotesGrabber.cs
├── SignatureVerifiers
├── DSAChecker.cs
└── Ed25519Checker.cs
├── SourceGenerationContext.cs
├── SparkleUpdater.cs
├── SparkleUpdaterEvents.cs
├── UpdateInfo.cs
└── Utilities.cs
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Automatically normalize line endings in the working directory
2 | * text=auto
3 |
4 | # Use CRLF in working directory on all platforms for Visual Studio project files
5 | *.sln text eol=crlf
6 | *.csproj text eol=crlf
7 | *.vbproj text eol=crlf
8 | *.vcxproj text eol=crlf
9 | *.vcproj text eol=crlf
10 | *.dbproj text eol=crlf
11 | *.fsproj text eol=crlf
12 | *.lsproj text eol=crlf
13 | *.wixproj text eol=crlf
14 | *.modelproj text eol=crlf
15 | *.sqlproj text eol=crlf
16 | *.wmaproj text eol=crlf
17 |
18 | *.xproj text eol=crlf
19 | *.props text eol=crlf
20 | *.filters text eol=crlf
21 | *.vcxitems text eol=crlf
22 |
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | # To get started with Dependabot version updates, you'll need to specify which
2 | # package ecosystems to update and where the package manifests are located.
3 | # Please see the documentation for all configuration options:
4 | # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5 |
6 | version: 2
7 | updates:
8 | - package-ecosystem: "github-actions"
9 | directory: "/"
10 | schedule:
11 | interval: "daily"
12 | - package-ecosystem: "nuget" # See documentation for possible values
13 | directory: "/src/NetSparkle" # Location of package manifests
14 | schedule:
15 | interval: "daily"
16 | #assignees:
17 | # - "Deadpikle"
18 | target-branch: "develop"
19 | commit-message:
20 | # Prefix all commit messages with "npm"
21 | prefix: "[Dependabot]"
22 | labels:
23 | - "dependabot"
24 | - "awaiting triage"
25 | #reviewers:
26 | # - "Deadpikle"
27 | - package-ecosystem: "nuget" # See documentation for possible values
28 | directory: "/src/NetSparkle.UI.Avalonia" # Location of package manifests
29 | schedule:
30 | interval: "daily"
31 | #assignees:
32 | # - "Deadpikle"
33 | target-branch: "develop"
34 | commit-message:
35 | # Prefix all commit messages with "npm"
36 | prefix: "[Dependabot]"
37 | labels:
38 | - "dependabot"
39 | - "awaiting triage"
40 | #reviewers:
41 | # - "Deadpikle"
42 | - package-ecosystem: "nuget" # See documentation for possible values
43 | directory: "/src/NetSparkle.Samples.Avalonia" # Location of package manifests
44 | schedule:
45 | interval: "daily"
46 | #assignees:
47 | # - "Deadpikle"
48 | target-branch: "develop"
49 | commit-message:
50 | # Prefix all commit messages with "npm"
51 | prefix: "[Dependabot]"
52 | labels:
53 | - "dependabot"
54 | - "awaiting triage"
55 | #reviewers:
56 | # - "Deadpikle"
57 | - package-ecosystem: "nuget" # See documentation for possible values
58 | directory: "/src/NetSparkle.Tools.AppCastGenerator" # Location of package manifests
59 | schedule:
60 | interval: "daily"
61 | #assignees:
62 | # - "Deadpikle"
63 | target-branch: "develop"
64 | commit-message:
65 | # Prefix all commit messages with "npm"
66 | prefix: "[Dependabot]"
67 | labels:
68 | - "dependabot"
69 | - "awaiting triage"
70 | #reviewers:
71 | # - "Deadpikle"
72 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.suo
2 | *.exe
3 | *.dll
4 | *.obj
5 | *.pdb
6 | NetSparkle.Net40.XML
7 | bin/
8 | obj/
9 | _ReSharper*/
10 | *.ncrunchsolution
11 | /nuget/core/content
12 | /nuget/core/lib
13 | /nuget/core/tools
14 | /nuget/tools/content
15 | /nuget/tools/lib
16 | /nuget/tools/tools
17 | *.nupkg
18 | *.DotSettings.user
19 | TestAppFiles/*.txt
20 | TestAppFiles/*.dsa
21 | .vs/*
22 | src/NetSparkleGenerator/NetSparkleGenerator.csproj.user
23 | !src/NetSparkle.UI.Avalonia/Lib/*
24 | !src/NetSparkle.UI.Avalonia/Lib/**
25 | src/NetSparkle.Tools.AppCastGenerator/NetSparkle.Tools.AppCastGenerator.csproj.user
26 |
27 | # OS generated files #
28 | .DS_Store*
29 |
30 | doc/generated/*
31 | doc/Working Data
32 | !git.folder
33 |
34 | /.idea
35 | UpgradeLog.htm
--------------------------------------------------------------------------------
/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 | // Use IntelliSense to learn about possible attributes.
3 | // Hover to view descriptions of existing attributes.
4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5 | "version": "0.2.0",
6 | "configurations": [
7 | {
8 | "name": ".NET Core Launch (console)",
9 | "type": "coreclr",
10 | "request": "launch",
11 | "preLaunchTask": "build",
12 | "program": "${workspaceFolder}/src/NetSparkle.Samples.Avalonia.MacOS/bin/Debug/net8.0/NetSparkleUpdater.Samples.Avalonia.dll",
13 | "args": [],
14 | "cwd": "${workspaceFolder}/src/NetSparkle.Samples.Avalonia.MacOS",
15 | "console": "internalConsole",
16 | "stopAtEntry": false
17 | },
18 | {
19 | "name": ".NET Core Attach",
20 | "type": "coreclr",
21 | "request": "attach"
22 | }
23 | ]
24 | }
--------------------------------------------------------------------------------
/.vscode/tasks.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "2.0.0",
3 | "tasks": [
4 | {
5 | "label": "build",
6 | "command": "dotnet",
7 | "type": "process",
8 | "args": [
9 | "build",
10 | "${workspaceFolder}/src/NetSparkle.Samples.Avalonia.MacOS/NetSparkle.Samples.Avalonia.MacOS.csproj",
11 | "/property:GenerateFullPaths=true",
12 | "/consoleloggerparameters:NoSummary"
13 | ],
14 | "problemMatcher": "$msCompile"
15 | },
16 | {
17 | "label": "publish",
18 | "command": "dotnet",
19 | "type": "process",
20 | "args": [
21 | "publish",
22 | "${workspaceFolder}/src/NetSparkle.Samples.Avalonia.MacOS/NetSparkle.Samples.Avalonia.MacOS.csproj",
23 | "/property:GenerateFullPaths=true",
24 | "/consoleloggerparameters:NoSummary"
25 | ],
26 | "problemMatcher": "$msCompile"
27 | },
28 | {
29 | "label": "watch",
30 | "command": "dotnet",
31 | "type": "process",
32 | "args": [
33 | "watch",
34 | "run",
35 | "--project",
36 | "${workspaceFolder}/src/NetSparkle.Samples.Avalonia.MacOS/NetSparkle.Samples.Avalonia.MacOS.csproj"
37 | ],
38 | "problemMatcher": "$msCompile"
39 | }
40 | ]
41 | }
--------------------------------------------------------------------------------
/Directory.Build.props:
--------------------------------------------------------------------------------
1 |
2 |
3 | 11.2.8
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Extras/Release Notes Template/rnotes.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | What's new in YOUR APP?
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | NEW THING.
16 |
17 |
18 |
19 |
20 |
21 | Fusce lorem risus, eleifend et, gravida a, consectetuer venenatis, neque. In hac habitasse platea dictumst. Etiam scelerisque tempus nulla. Mauris vitae pede in mi luctus accumsan. Suspendisse potenti. Sed at pede. Quisque luctus. Nullam diam velit, ultrices quis, sodales vitae, iaculis sit amet, neque. Nam ut diam. Donec consectetuer. Nulla a sapien.
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 | NEW THING #2.
30 |
31 |
32 |
33 |
34 |
35 | Fusce lorem risus, eleifend et, gravida a, consectetuer venenatis, neque. In hac habitasse platea dictumst. Etiam scelerisque tempus nulla. Mauris vitae pede in mi luctus accumsan. Suspendisse potenti. Sed at pede. Quisque luctus. Nullam diam velit, ultrices quis, sodales vitae, iaculis sit amet, neque. Nam ut diam. Donec consectetuer. Nulla a sapien.
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/Extras/Sample Appcast.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Your Great App's Changelog
5 | http://you.com/app/appcast.xml
6 | Most recent changes with links to updates.
7 | en
8 | -
9 |
Version 2.0 (2 bugs fixed; 3 new features)
10 |
11 | file://../../../Extras/SampleReleaseNotes.md
12 |
13 | Wed, 09 Jan 2006 19:20:11 +0000
14 |
15 |
16 |
17 | -
18 |
Version 1.5 (8 bugs fixed; 2 new features)
19 |
20 | http://you.com/app/1.5.html
21 |
22 | Wed, 01 Jan 2006 12:20:11 +0000
23 |
24 |
25 |
26 |
27 | -
28 |
Version 1.4 (5 bugs fixed; 2 new features)
29 |
30 | http://you.com/app/1.4.html
31 |
32 | Wed, 25 Dec 2005 12:20:11 +0000
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/Extras/Sample Update AppCast/MetaData/NetSparklTestApp-1.0.1.dsa:
--------------------------------------------------------------------------------
1 | ngnGYS1ELmGWlhWp0FAzwjmc8VdAFkyIuoybSUwPkpmt+HusArTINQ==
--------------------------------------------------------------------------------
/Extras/Sample Update AppCast/MetaData/NetSparklTestApp-1.0.2.dsa:
--------------------------------------------------------------------------------
1 | R0Umm343UUfeJ15fV0nDQ2Gg0AsHbGUU76GpsWv2H+agMWXADXpg2g==
--------------------------------------------------------------------------------
/Extras/Sample Update AppCast/MetaData/NetSparkle_DSA.priv:
--------------------------------------------------------------------------------
1 | 7Pdtp3UvfCNy9gzcUnpuB0YbCcqhkhtdsRkyp+LRmzwoNMcXSUf2kN02XmMZM2nOr0hGTJxFWEk353tUP6d3UDxO2+1yoo5NX4Nsx+BKSAviab1t/HoDxKEIkLjNvYq+inIIIwNxUsZXyDrNmuuMTwwJDL+A0Nzyupp2CkeEa/s=
zNQzrJNIZrJPaa8yRV0l9LPdB3M= IDVPPVuHxe85068vbpf54IpnTKF181D/THpc1/TsOVh3+TTV5xriCUZrfHksLujZjRkXbVpcjuiamrWpb8hYAXqeHRcPqC1dPo4Dwwbh/5oASEn3NEkrSDFag7kqh+RlS6xjh1VAY9YR5LTt4iGSRLxTeteRLcK/e7Lfl63MbCI= jHF2xEGl0pWQVGssr4ugj4VgLdTh+FfeNDm4ESRDmoLG2vT5TjReSLM4ZU7H++5FAdr4qzpbsb06k9XkQBypY73Sw1si33tCXpR6P1pBqwSkooR/HnWVStggluze3LfY+fE8S885P5GwlQSltloZvsWBooh4Xt4YShON76eJhik= AAAAASgqlNfrkwju6RyZ7I4pPMP+awEKZ8EcPLAiueXhyCYLo9ngJEvIpkWW8kZPh1F3hBOWGlNeTrJBt0wlbMNZbRc75kJyswpEav4BRWuCzlZ4Ne8QmAftXgQIvZok7v44ghTh8/4FSzZl60whng== mioCbtAjjcvTU1puBFQSsuI4AGE= A08= cJGpQIGW3/u1DvguAO3SG3yrm7c=
--------------------------------------------------------------------------------
/Extras/Sample Update AppCast/MetaData/NetSparkle_DSA.pub:
--------------------------------------------------------------------------------
1 | 7Pdtp3UvfCNy9gzcUnpuB0YbCcqhkhtdsRkyp+LRmzwoNMcXSUf2kN02XmMZM2nOr0hGTJxFWEk353tUP6d3UDxO2+1yoo5NX4Nsx+BKSAviab1t/HoDxKEIkLjNvYq+inIIIwNxUsZXyDrNmuuMTwwJDL+A0Nzyupp2CkeEa/s=
zNQzrJNIZrJPaa8yRV0l9LPdB3M= IDVPPVuHxe85068vbpf54IpnTKF181D/THpc1/TsOVh3+TTV5xriCUZrfHksLujZjRkXbVpcjuiamrWpb8hYAXqeHRcPqC1dPo4Dwwbh/5oASEn3NEkrSDFag7kqh+RlS6xjh1VAY9YR5LTt4iGSRLxTeteRLcK/e7Lfl63MbCI= jHF2xEGl0pWQVGssr4ugj4VgLdTh+FfeNDm4ESRDmoLG2vT5TjReSLM4ZU7H++5FAdr4qzpbsb06k9XkQBypY73Sw1si33tCXpR6P1pBqwSkooR/HnWVStggluze3LfY+fE8S885P5GwlQSltloZvsWBooh4Xt4YShON76eJhik= AAAAASgqlNfrkwju6RyZ7I4pPMP+awEKZ8EcPLAiueXhyCYLo9ngJEvIpkWW8kZPh1F3hBOWGlNeTrJBt0wlbMNZbRc75kJyswpEav4BRWuCzlZ4Ne8QmAftXgQIvZok7v44ghTh8/4FSzZl60whng== mioCbtAjjcvTU1puBFQSsuI4AGE= A08=
--------------------------------------------------------------------------------
/Extras/Sample Update AppCast/Server Root/1.0.1/rnotes.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | What's new in YOUR APP?
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | NEW THING.
16 |
17 |
18 |
19 |
20 |
21 | Fusce lorem risus, eleifend et, gravida a, consectetuer venenatis, neque. In hac habitasse platea dictumst. Etiam scelerisque tempus nulla. Mauris vitae pede in mi luctus accumsan. Suspendisse potenti. Sed at pede. Quisque luctus. Nullam diam velit, ultrices quis, sodales vitae, iaculis sit amet, neque. Nam ut diam. Donec consectetuer. Nulla a sapien.
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 | NEW THING #2.
30 |
31 |
32 |
33 |
34 |
35 | Fusce lorem risus, eleifend et, gravida a, consectetuer venenatis, neque. In hac habitasse platea dictumst. Etiam scelerisque tempus nulla. Mauris vitae pede in mi luctus accumsan. Suspendisse potenti. Sed at pede. Quisque luctus. Nullam diam velit, ultrices quis, sodales vitae, iaculis sit amet, neque. Nam ut diam. Donec consectetuer. Nulla a sapien.
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/Extras/Sample Update AppCast/Server Root/1.0.2/rnotes.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | What's new in YOUR APP?
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | NEW THING.
16 |
17 |
18 |
19 |
20 |
21 | Fusce lorem risus, eleifend et, gravida a, consectetuer venenatis, neque. In hac habitasse platea dictumst. Etiam scelerisque tempus nulla. Mauris vitae pede in mi luctus accumsan. Suspendisse potenti. Sed at pede. Quisque luctus. Nullam diam velit, ultrices quis, sodales vitae, iaculis sit amet, neque. Nam ut diam. Donec consectetuer. Nulla a sapien.
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 | NEW THING #2.
30 |
31 |
32 |
33 |
34 |
35 | Fusce lorem risus, eleifend et, gravida a, consectetuer venenatis, neque. In hac habitasse platea dictumst. Etiam scelerisque tempus nulla. Mauris vitae pede in mi luctus accumsan. Suspendisse potenti. Sed at pede. Quisque luctus. Nullam diam velit, ultrices quis, sodales vitae, iaculis sit amet, neque. Nam ut diam. Donec consectetuer. Nulla a sapien.
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/Extras/Sample Update AppCast/Server Root/versioninfo.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | NetSparkle TestCase
6 | http://update.applimit.com/netsparkle/versioninfo.xml
7 |
8 | en
9 | -
10 |
Version 1.0.1
11 | http://update.applimit.com/netsparkle/1.0.1/rnotes.html
12 | Sun, 31 Oct 2010 10:21:11 +0000
13 |
20 |
21 | -
22 |
Version 1.0.2
23 | http://update.applimit.com/netsparkle/1.0.2/rnotes.html
24 | Sun, 31 Dec 2010 10:31:11 +0000
25 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/Extras/SampleReleaseNotes.md:
--------------------------------------------------------------------------------
1 | # Sample Application Release Notes
2 |
3 | ## 104.1
4 |
5 | * Fixed bug where ExecuteAsync sometimes doesn't send data
6 |
7 | ## 104.0
8 |
9 | * Fixed Windows Phone and Silverlight to use culture when calling Convert.ChangeType() (thanks trydis)
10 | * Added support for non-standard HTTP methods (thanks jhoerr)
11 | New API methods include:
12 | * `IRestClient.ExecuteAsyncGet()`
13 | * `IRestClient.ExecuteAsyncPost()`
14 | * `IRestClient.ExecuteAsyncGet()`
15 | * `IRestClient.ExecuteAsyncPost()`
16 |
17 | See [groups discussion](https://groups.google.com/forum/?fromgroups=#!topic/restsharp/FCLGE5By7AU) for more info
18 |
19 | * Resolved an xAuth support issue in the OAuth1Authenticator (thanks artema)
20 | * Change AddDefaultParameter methods to be extension methods (thanks haacked)
21 | Added `RestClientExtensions.AddDefaultParameter()` with 4 overloads. See pull request [#311](https://github.com/restsharp/RestSharp/pull/311) for more info
22 |
23 | * Adding support for deserializing enums from integer representations (thanks dontjee)
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | The MIT License
2 |
3 | Copyright (c) 2025 Deadpikle
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
--------------------------------------------------------------------------------
/TestAppFiles/2.0-release-notes.md:
--------------------------------------------------------------------------------
1 | # Sample Application Release Notes
2 |
3 | ## 104.1
4 |
5 | * Fixed bug where ExecuteAsync sometimes doesn't send data
6 |
7 | ## 104.0
8 |
9 | * Fixed Windows Phone and Silverlight to use culture when calling Convert.ChangeType() (thanks trydis)
10 | * Added support for non-standard HTTP methods (thanks jhoerr)
11 | New API methods include:
12 | * `IRestClient.ExecuteAsyncGet()`
13 | * `IRestClient.ExecuteAsyncPost()`
14 | * `IRestClient.ExecuteAsyncGet()`
15 | * `IRestClient.ExecuteAsyncPost()`
16 |
17 | See [groups discussion](https://groups.google.com/forum/?fromgroups=#!topic/restsharp/FCLGE5By7AU) for more info
18 |
19 | * Resolved an xAuth support issue in the OAuth1Authenticator (thanks artema)
20 | * Change AddDefaultParameter methods to be extension methods (thanks haacked)
21 | Added `RestClientExtensions.AddDefaultParameter()` with 4 overloads. See pull request [#311](https://github.com/restsharp/RestSharp/pull/311) for more info
22 |
23 | * Adding support for deserializing enums from integer representations (thanks dontjee)
--------------------------------------------------------------------------------
/TestAppFiles/GenerateHashForDemoSoftware.bat:
--------------------------------------------------------------------------------
1 | echo This file needs its paths fixed. TODO:
2 | @echo off
3 | if exist "../bin/Release/DSAHelper/NetSparkle.DSAHelper.exe" (
4 | if exist "../bin/Release/DSAHelper/SampleDownloadedExecutable/NetSparkleUpdate.exe" (
5 | "../bin/Release/DSAHelper/NetSparkle.DSAHelper.exe" /sign_update "../bin/Release/SampleDownloadedExecutable/NetSparkleUpdate.exe" NetSparkle_DSA.priv > hash-demo-file-release.txt
6 | )
7 | if exist "../bin/Debug/DSAHelper/SampleDownloadedExecutable/NetSparkleUpdate.exe" (
8 | "../bin/Release/DSAHelper/NetSparkle.DSAHelper.exe" /sign_update "../bin/Debug/SampleDownloadedExecutable/NetSparkleUpdate.exe" NetSparkle_DSA.priv > hash-demo-file-debug.txt
9 | )
10 | ) else if exist "../bin/Debug/DSAHelper/NetSparkle.DSAHelper.exe" (
11 | if exist "../bin/Release/DSAHelper/SampleDownloadedExecutable/NetSparkleUpdate.exe" (
12 | "../bin/Debug/DSAHelper/NetSparkle.DSAHelper.exe" /sign_update "../bin/Release/SampleDownloadedExecutable/NetSparkleUpdate.exe" NetSparkle_DSA.priv > hash-demo-file-release.txt
13 | )
14 | if exist "../bin/Debug/SampleDownloadedExecutable/NetSparkleUpdate.exe" (
15 | "../bin/Debug/DSAHelper/NetSparkle.DSAHelper.exe" /sign_update "../bin/Debug/SampleDownloadedExecutable/NetSparkleUpdate.exe" NetSparkle_DSA.priv > hash-demo-file-debug.txt
16 | )
17 | )
--------------------------------------------------------------------------------
/TestAppFiles/GenerateHashForDemoXMLUpdates.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 | if exist "../bin/Debug/NetSparkle.Tools.DSAHelper/netcoreapp3.0/NetSparkle.DSAHelper.exe" (
3 | "../bin/Debug/NetSparkle.Tools.DSAHelper/netcoreapp3.0/NetSparkle.DSAHelper.exe" /sign_update "appcast.xml" NetSparkle_DSA.priv > appcast.xml.dsa
4 | echo appcast.xml.dsa generated
5 | ) else (
6 | if exist "../bin/Debug/NetSparkle.Tools.DSAHelper/netcoreapp3.0/NetSparkle.DSAHelper.exe" (
7 | "../bin/Debug/NetSparkle.Tools.DSAHelper/netcoreapp3.0/NetSparkle.DSAHelper.exe" /sign_update "appcast.xml" NetSparkle_DSA.priv > appcast.xml.dsa
8 | echo appcast.xml.dsa generated
9 | ) else (
10 | echo Error: cannot find NetSparkle.DSAHelper.exe
11 | )
12 | )
--------------------------------------------------------------------------------
/TestAppFiles/GenerateHashForReleaseNotes.bat:
--------------------------------------------------------------------------------
1 | echo This file needs its paths fixed. TODO:
2 | @echo off
3 | if exist "../bin/Release/DSAHelper/NetSparkle.DSAHelper.exe" (
4 | "../bin/Release/DSAHelper/NetSparkle.DSAHelper.exe" /sign_update "2.0-release-notes.md" NetSparkle_DSA.priv > 2.0-release-notes.md.dsa
5 | ) else (
6 | if exist "../bin/Debug/DSAHelper/NetSparkle.DSAHelper.exe" (
7 | "../bin/Debug/DSAHelper/NetSparkle.DSAHelper.exe" /sign_update "2.0-release-notes.md" NetSparkle_DSA.priv > 2.0-release-notes.md.dsa
8 | )
9 | )
--------------------------------------------------------------------------------
/TestAppFiles/NetSparkle_DSA.priv:
--------------------------------------------------------------------------------
1 | 2IX45gCGAGjNXBg3/spd03M2oMsmghmul/H5ePY9AN9URjAOYUcwfi3kQ/KM8i2eD1V/cBKkMJX4xx3kpt39n2Vt+7tyWfXjzMb+3qPapPHMMJL5DDS9cw6FgG3H0tT/LSm7Qn7JLA6w8FOiVIjC+x61u5WqFK0I0vFnc8T1YZs=
xXaw/HrlbsRqg7WD5g1xlkVblys= P2bv3DOTGnyjVnDC5j6Pwd4U6VtRzhPsww9COnwlRWmyNFcf0F/3H5S9YJrO7P+CgIvef30eqUYPHUauLbZ2UK0rItwepz45SfysLvVUb6PU6z/j7gEYiGO/lKd13GfhxmL1mS+XasDSw5brRMxePidiom8H/AB7VVQgELcgutQ= mxJD6rwuJe532PpS9HKjlhvcY1ssBEOFf3HmiYot4d670y0+5nICF3YO8vLxndHA4RqgU/Hux9KtKKg/2hi7c/88j5YyTDWX86n8aPIxHWklKsreP24ul87uuktfhDlhltpfd8AlXxn2SpxQ1Fy/Ktid3E1+uDb64HKf9a35CwE= q/C5yP0VC0Y0ZUPzSD5+O5Rt5X8= sg== tBCt8EG+AffLD2HGCGRhSW82dqE=
--------------------------------------------------------------------------------
/TestAppFiles/NetSparkle_DSA.pub:
--------------------------------------------------------------------------------
1 | 2IX45gCGAGjNXBg3/spd03M2oMsmghmul/H5ePY9AN9URjAOYUcwfi3kQ/KM8i2eD1V/cBKkMJX4xx3kpt39n2Vt+7tyWfXjzMb+3qPapPHMMJL5DDS9cw6FgG3H0tT/LSm7Qn7JLA6w8FOiVIjC+x61u5WqFK0I0vFnc8T1YZs=
xXaw/HrlbsRqg7WD5g1xlkVblys= P2bv3DOTGnyjVnDC5j6Pwd4U6VtRzhPsww9COnwlRWmyNFcf0F/3H5S9YJrO7P+CgIvef30eqUYPHUauLbZ2UK0rItwepz45SfysLvVUb6PU6z/j7gEYiGO/lKd13GfhxmL1mS+XasDSw5brRMxePidiom8H/AB7VVQgELcgutQ= mxJD6rwuJe532PpS9HKjlhvcY1ssBEOFf3HmiYot4d670y0+5nICF3YO8vLxndHA4RqgU/Hux9KtKKg/2hi7c/88j5YyTDWX86n8aPIxHWklKsreP24ul87uuktfhDlhltpfd8AlXxn2SpxQ1Fy/Ktid3E1+uDb64HKf9a35CwE= q/C5yP0VC0Y0ZUPzSD5+O5Rt5X8= sg==
--------------------------------------------------------------------------------
/TestAppFiles/appcast.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | NetSparkle Test App
5 | https://netsparkleupdater.github.io/NetSparkle/files/sample-app/appcast.xml
6 | Most recent changes with links to updates.
7 | en
8 | -
9 |
Version 2.0 (2 bugs fixed; 3 new features)
10 | https://netsparkleupdater.github.io/NetSparkle/files/sample-app/2.0-release-notes.md
11 |
12 | Thu, 27 Oct 2016 10:30:00 +0000
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/doc/generated/git.folder:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NetSparkleUpdater/NetSparkle/bfce0066ae22cfbe6efb117c41f9fc88e1fb0eaf/doc/generated/git.folder
--------------------------------------------------------------------------------
/nuget.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/nuget/NuGet.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NetSparkleUpdater/NetSparkle/bfce0066ae22cfbe6efb117c41f9fc88e1fb0eaf/nuget/NuGet.exe
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.Avalonia.MacOS/App.axaml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.Avalonia.MacOS/App.axaml.cs:
--------------------------------------------------------------------------------
1 | using Avalonia;
2 | using Avalonia.Controls.ApplicationLifetimes;
3 | using Avalonia.Markup.Xaml;
4 |
5 | namespace NetSparkleUpdater.Samples.Avalonia
6 | {
7 | public class App : Application
8 | {
9 | public override void Initialize()
10 | {
11 | AvaloniaXamlLoader.Load(this);
12 | }
13 |
14 | public override void OnFrameworkInitializationCompleted()
15 | {
16 | if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
17 | {
18 | desktop.MainWindow = new MainWindow();
19 | }
20 |
21 | base.OnFrameworkInitializationCompleted();
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.Avalonia.MacOS/Assets/software-update-available.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NetSparkleUpdater/NetSparkle/bfce0066ae22cfbe6efb117c41f9fc88e1fb0eaf/src/NetSparkle.Samples.Avalonia.MacOS/Assets/software-update-available.png
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.Avalonia.MacOS/MainWindow.axaml:
--------------------------------------------------------------------------------
1 |
11 |
13 |
14 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.Avalonia.MacOS/MainWindow.axaml.cs:
--------------------------------------------------------------------------------
1 | using Avalonia;
2 | using Avalonia.Controls;
3 | using Avalonia.Interactivity;
4 | using Avalonia.Markup.Xaml;
5 | using Avalonia.Media.Imaging;
6 | using NetSparkleUpdater.Downloaders;
7 | using NetSparkleUpdater.Enums;
8 | using NetSparkleUpdater.SignatureVerifiers;
9 | using System.IO;
10 | using System.Threading.Tasks;
11 |
12 | namespace NetSparkleUpdater.Samples.Avalonia
13 | {
14 | public partial class MainWindow : Window
15 | {
16 | private SparkleUpdater _sparkle;
17 |
18 | public MainWindow()
19 | {
20 | InitializeComponent();
21 | // set icon in project properties!
22 | string manifestModuleName = System.Reflection.Assembly.GetEntryAssembly().ManifestModule.FullyQualifiedName;
23 | var url = "https://netsparkleupdater.github.io/NetSparkle/files/sample-app-macos/appcast.xml";
24 | // url = "http://php81.test/sparkle/appcast/appcast.xml";
25 | _sparkle = new CustomSparkleUpdater(url, new Ed25519Checker(Enums.SecurityMode.Unsafe, "8zPswEwycU7XQ7OcGQtI/b22pWo1qM2Ual2OhssaDyI="))
26 | {
27 | UIFactory = new NetSparkleUpdater.UI.Avalonia.UIFactory(Icon),
28 | LogWriter = new LogWriter(LogWriterOutputMode.Console)
29 | //UseNotificationToast = false // Avalonia version doesn't yet support notification toast messages
30 | };
31 | // TLS 1.2 required by GitHub (https://developer.github.com/changes/2018-02-01-weak-crypto-removal-notice/)
32 | var dler = new WebRequestAppCastDataDownloader(_sparkle.LogWriter) { TrustEverySSLConnection = true };
33 | // var fileDler = new WebFileDownloader(_sparkle.LogWriter) { TrustEverySSLConnection = true };
34 | _sparkle.AppCastDataDownloader = dler;
35 | // _sparkle.UpdateDownloader = fileDler;
36 | StartSparkle();
37 | }
38 |
39 | private async void StartSparkle()
40 | {
41 | await _sparkle.StartLoop(true, true);
42 | }
43 |
44 | public async Task ManualUpdateCheck_Click(object sender, RoutedEventArgs e)
45 | {
46 | await _sparkle.CheckForUpdatesAtUserRequest();
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.Avalonia.MacOS/NetSparkle.Samples.Avalonia.MacOS.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | WinExe
4 | net8.0
5 | software-update-available.ico
6 | NetSparkleUpdater.Samples.Avalonia
7 | NetSparkleUpdater.Samples.Avalonia
8 | 1.0.0-beta1
9 | false
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.Avalonia.MacOS/NetSparkle_DSA.pub:
--------------------------------------------------------------------------------
1 | 2IX45gCGAGjNXBg3/spd03M2oMsmghmul/H5ePY9AN9URjAOYUcwfi3kQ/KM8i2eD1V/cBKkMJX4xx3kpt39n2Vt+7tyWfXjzMb+3qPapPHMMJL5DDS9cw6FgG3H0tT/LSm7Qn7JLA6w8FOiVIjC+x61u5WqFK0I0vFnc8T1YZs=
xXaw/HrlbsRqg7WD5g1xlkVblys= P2bv3DOTGnyjVnDC5j6Pwd4U6VtRzhPsww9COnwlRWmyNFcf0F/3H5S9YJrO7P+CgIvef30eqUYPHUauLbZ2UK0rItwepz45SfysLvVUb6PU6z/j7gEYiGO/lKd13GfhxmL1mS+XasDSw5brRMxePidiom8H/AB7VVQgELcgutQ= mxJD6rwuJe532PpS9HKjlhvcY1ssBEOFf3HmiYot4d670y0+5nICF3YO8vLxndHA4RqgU/Hux9KtKKg/2hi7c/88j5YyTDWX86n8aPIxHWklKsreP24ul87uuktfhDlhltpfd8AlXxn2SpxQ1Fy/Ktid3E1+uDb64HKf9a35CwE= q/C5yP0VC0Y0ZUPzSD5+O5Rt5X8= sg==
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.Avalonia.MacOS/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Avalonia;
3 | using Avalonia.Controls.ApplicationLifetimes;
4 |
5 | namespace NetSparkleUpdater.Samples.Avalonia
6 | {
7 | class Program
8 | {
9 | // Initialization code. Don't use any Avalonia, third-party APIs or any
10 | // SynchronizationContext-reliant code before AppMain is called: things aren't initialized
11 | // yet and stuff might break.
12 | public static void Main(string[] args) => BuildAvaloniaApp()
13 | .StartWithClassicDesktopLifetime(args);
14 |
15 | // Avalonia configuration, don't remove; also used by visual designer.
16 | public static AppBuilder BuildAvaloniaApp()
17 | => AppBuilder.Configure()
18 | .UsePlatformDetect()
19 | .LogToTrace();
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.Avalonia.MacOS/nuget.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.Avalonia.MacOS/software-update-available.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NetSparkleUpdater/NetSparkle/bfce0066ae22cfbe6efb117c41f9fc88e1fb0eaf/src/NetSparkle.Samples.Avalonia.MacOS/software-update-available.ico
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.Avalonia.MacOSZip/App.axaml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.Avalonia.MacOSZip/App.axaml.cs:
--------------------------------------------------------------------------------
1 | using Avalonia;
2 | using Avalonia.Controls.ApplicationLifetimes;
3 | using Avalonia.Markup.Xaml;
4 |
5 | namespace NetSparkleUpdater.Samples.Avalonia
6 | {
7 | public class App : Application
8 | {
9 | public override void Initialize()
10 | {
11 | AvaloniaXamlLoader.Load(this);
12 | }
13 |
14 | public override void OnFrameworkInitializationCompleted()
15 | {
16 | if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
17 | {
18 | desktop.MainWindow = new MainWindow();
19 | }
20 |
21 | base.OnFrameworkInitializationCompleted();
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.Avalonia.MacOSZip/Assets/software-update-available.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NetSparkleUpdater/NetSparkle/bfce0066ae22cfbe6efb117c41f9fc88e1fb0eaf/src/NetSparkle.Samples.Avalonia.MacOSZip/Assets/software-update-available.png
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.Avalonia.MacOSZip/CustomSparkleUpdater.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.IO;
4 | using System.Runtime.InteropServices;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using NetSparkleUpdater;
8 | using NetSparkleUpdater.Interfaces;
9 |
10 | namespace NetSparkleUpdater.Samples.Avalonia
11 | {
12 | public class CustomSparkleUpdater : NetSparkleUpdater.SparkleUpdater
13 | {
14 | public CustomSparkleUpdater(string appcastUrl, ISignatureVerifier signatureVerifier)
15 | : base(appcastUrl, signatureVerifier, null)
16 | { }
17 | }
18 | }
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.Avalonia.MacOSZip/MainWindow.axaml:
--------------------------------------------------------------------------------
1 |
11 |
13 |
14 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.Avalonia.MacOSZip/NetSparkle.Samples.Avalonia.MacOSZip.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | WinExe
4 | net8.0
5 | software-update-available.ico
6 | NetSparkleUpdater.Samples.Avalonia
7 | NetSparkleUpdater.Samples.Avalonia
8 | false
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.Avalonia.MacOSZip/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Avalonia;
3 | using Avalonia.Controls.ApplicationLifetimes;
4 |
5 | namespace NetSparkleUpdater.Samples.Avalonia
6 | {
7 | class Program
8 | {
9 | // Initialization code. Don't use any Avalonia, third-party APIs or any
10 | // SynchronizationContext-reliant code before AppMain is called: things aren't initialized
11 | // yet and stuff might break.
12 | public static void Main(string[] args) => BuildAvaloniaApp()
13 | .StartWithClassicDesktopLifetime(args);
14 |
15 | // Avalonia configuration, don't remove; also used by visual designer.
16 | public static AppBuilder BuildAvaloniaApp()
17 | => AppBuilder.Configure()
18 | .UsePlatformDetect()
19 | .LogToTrace();
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.Avalonia.MacOSZip/nuget.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.Avalonia.MacOSZip/software-update-available.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NetSparkleUpdater/NetSparkle/bfce0066ae22cfbe6efb117c41f9fc88e1fb0eaf/src/NetSparkle.Samples.Avalonia.MacOSZip/software-update-available.ico
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.Avalonia.Rollback/App.axaml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.Avalonia.Rollback/App.axaml.cs:
--------------------------------------------------------------------------------
1 | using Avalonia;
2 | using Avalonia.Controls.ApplicationLifetimes;
3 | using Avalonia.Markup.Xaml;
4 |
5 | namespace NetSparkleUpdater.Samples.Avalonia
6 | {
7 | public class App : Application
8 | {
9 | public override void Initialize()
10 | {
11 | AvaloniaXamlLoader.Load(this);
12 | }
13 |
14 | public override void OnFrameworkInitializationCompleted()
15 | {
16 | if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
17 | {
18 | desktop.MainWindow = new MainWindow();
19 | }
20 |
21 | base.OnFrameworkInitializationCompleted();
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.Avalonia.Rollback/Assets/software-update-available.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NetSparkleUpdater/NetSparkle/bfce0066ae22cfbe6efb117c41f9fc88e1fb0eaf/src/NetSparkle.Samples.Avalonia.Rollback/Assets/software-update-available.png
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.Avalonia.Rollback/MainWindow.axaml:
--------------------------------------------------------------------------------
1 |
12 |
14 |
15 |
18 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.Avalonia.Rollback/NetSparkle.Samples.Avalonia.Rollback.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | WinExe
4 | net8.0
5 | software-update-available.ico
6 | NetSparkleUpdater.Samples.Avalonia
7 | NetSparkleUpdater.Samples.Avalonia.Rollback
8 | true
9 | true
10 | false
11 | 3.0.0
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.Avalonia.Rollback/OSAppCastFilter.cs:
--------------------------------------------------------------------------------
1 | #nullable enable
2 |
3 | using NetSparkleUpdater.AppCastHandlers;
4 | using NetSparkleUpdater.Interfaces;
5 | using System;
6 | using System.Collections.Generic;
7 | using System.Linq;
8 |
9 | namespace NetSparkleUpdater.Samples.Avalonia
10 | {
11 | ///
12 | /// Basic implementation for filtering
13 | /// your app cast items based on a channel name (e.g. "beta"). Makes it
14 | /// easy to allow your users to be on a beta software track or similar.
15 | /// Note that a "stable" channel search string will not be interpreted as versions
16 | /// like "1.0.0"; it will look for versions like "1.0.0-stable1" (aka search for
17 | /// the string "stable").
18 | /// Names are compared in a case-insensitive manner.
19 | ///
20 | public class OSAppCastFilter : IAppCastFilter
21 | {
22 | private ILogger? _logWriter;
23 |
24 | public OSAppCastFilter(ILogger? logWriter = null)
25 | {
26 | RemoveOlderItems = true;
27 | _logWriter = logWriter;
28 | OSName = "";
29 | }
30 |
31 | public bool RemoveOlderItems { get; set; }
32 |
33 | public string OSName { get; set; }
34 |
35 | ///
36 | public IEnumerable GetFilteredAppCastItems(SemVerLike installed, IEnumerable items)
37 | {
38 | return items.Where((item) =>
39 | {
40 | var semVer = SemVerLike.Parse(item.Version);
41 | var appCastItemChannel = item.Channel ?? "";
42 | if (RemoveOlderItems && semVer.CompareTo(installed) <= 0)
43 | {
44 | _logWriter?.PrintMessage("Removing older item from filtered app cast results");
45 | return false;
46 | }
47 | if (string.IsNullOrWhiteSpace(OSName))
48 | {
49 | return true;
50 | }
51 | return item.OperatingSystem?.ToLower() == OSName.ToLower();
52 | }).OrderByDescending(x => x.SemVerLikeVersion);
53 | }
54 | }
55 | }
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.Avalonia.Rollback/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Avalonia;
3 | using Avalonia.Controls.ApplicationLifetimes;
4 |
5 | namespace NetSparkleUpdater.Samples.Avalonia
6 | {
7 | class Program
8 | {
9 | // Initialization code. Don't use any Avalonia, third-party APIs or any
10 | // SynchronizationContext-reliant code before AppMain is called: things aren't initialized
11 | // yet and stuff might break.
12 | public static void Main(string[] args) => BuildAvaloniaApp()
13 | .StartWithClassicDesktopLifetime(args);
14 |
15 | // Avalonia configuration, don't remove; also used by visual designer.
16 | public static AppBuilder BuildAvaloniaApp()
17 | => AppBuilder.Configure()
18 | .UsePlatformDetect()
19 | .LogToTrace();
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.Avalonia.Rollback/nuget.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.Avalonia.Rollback/software-update-available.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NetSparkleUpdater/NetSparkle/bfce0066ae22cfbe6efb117c41f9fc88e1fb0eaf/src/NetSparkle.Samples.Avalonia.Rollback/software-update-available.ico
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.Avalonia/App.axaml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.Avalonia/App.axaml.cs:
--------------------------------------------------------------------------------
1 | using Avalonia;
2 | using Avalonia.Controls.ApplicationLifetimes;
3 | using Avalonia.Markup.Xaml;
4 |
5 | namespace NetSparkleUpdater.Samples.Avalonia
6 | {
7 | public class App : Application
8 | {
9 | public override void Initialize()
10 | {
11 | AvaloniaXamlLoader.Load(this);
12 | }
13 |
14 | public override void OnFrameworkInitializationCompleted()
15 | {
16 | if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
17 | {
18 | desktop.MainWindow = new MainWindow();
19 | }
20 |
21 | base.OnFrameworkInitializationCompleted();
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.Avalonia/Assets/software-update-available.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NetSparkleUpdater/NetSparkle/bfce0066ae22cfbe6efb117c41f9fc88e1fb0eaf/src/NetSparkle.Samples.Avalonia/Assets/software-update-available.png
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.Avalonia/MainWindow.axaml:
--------------------------------------------------------------------------------
1 |
12 |
14 |
15 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.Avalonia/MainWindow.axaml.cs:
--------------------------------------------------------------------------------
1 | using Avalonia;
2 | using Avalonia.Controls;
3 | using Avalonia.Interactivity;
4 | using Avalonia.Markup.Xaml;
5 | using Avalonia.Media;
6 | using Avalonia.Media.Imaging;
7 | using NetSparkleUpdater.SignatureVerifiers;
8 | using NetSparkleUpdater.UI.Avalonia;
9 | using System.IO;
10 | using System.Threading.Tasks;
11 |
12 | namespace NetSparkleUpdater.Samples.Avalonia
13 | {
14 | public partial class MainWindow : Window
15 | {
16 | private SparkleUpdater _sparkle;
17 |
18 | public MainWindow()
19 | {
20 | InitializeComponent();
21 | // set icon in project properties!
22 | string manifestModuleName = System.Reflection.Assembly.GetEntryAssembly().ManifestModule.FullyQualifiedName;
23 | _sparkle = new SparkleUpdater("https://netsparkleupdater.github.io/NetSparkle/files/sample-app/appcast.xml", new DSAChecker(Enums.SecurityMode.Strict))
24 | {
25 | UIFactory = new NetSparkleUpdater.UI.Avalonia.UIFactory(Icon)
26 | {
27 | // use the following property to change the main grid background on the update window. nullable.
28 | //UpdateWindowGridBackgroundBrush = new SolidColorBrush(Colors.Purple)
29 | },
30 | //UseNotificationToast = false // Avalonia version doesn't yet support notification toast messages
31 | };
32 | // TLS 1.2 required by GitHub (https://developer.github.com/changes/2018-02-01-weak-crypto-removal-notice/)
33 | StartSparkle();
34 | }
35 |
36 | private async void StartSparkle()
37 | {
38 | await _sparkle.StartLoop(true, true);
39 | }
40 |
41 | public async Task ManualUpdateCheck_Click()
42 | {
43 | await _sparkle.CheckForUpdatesAtUserRequest();
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.Avalonia/NetSparkle.Samples.Avalonia.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | WinExe
4 | net8.0
5 | software-update-available.ico
6 | NetSparkleUpdater.Samples.Avalonia
7 | NetSparkleUpdater.Samples.Avalonia
8 | true
9 | true
10 | false
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.Avalonia/NetSparkle_DSA.pub:
--------------------------------------------------------------------------------
1 | 2IX45gCGAGjNXBg3/spd03M2oMsmghmul/H5ePY9AN9URjAOYUcwfi3kQ/KM8i2eD1V/cBKkMJX4xx3kpt39n2Vt+7tyWfXjzMb+3qPapPHMMJL5DDS9cw6FgG3H0tT/LSm7Qn7JLA6w8FOiVIjC+x61u5WqFK0I0vFnc8T1YZs=
xXaw/HrlbsRqg7WD5g1xlkVblys= P2bv3DOTGnyjVnDC5j6Pwd4U6VtRzhPsww9COnwlRWmyNFcf0F/3H5S9YJrO7P+CgIvef30eqUYPHUauLbZ2UK0rItwepz45SfysLvVUb6PU6z/j7gEYiGO/lKd13GfhxmL1mS+XasDSw5brRMxePidiom8H/AB7VVQgELcgutQ= mxJD6rwuJe532PpS9HKjlhvcY1ssBEOFf3HmiYot4d670y0+5nICF3YO8vLxndHA4RqgU/Hux9KtKKg/2hi7c/88j5YyTDWX86n8aPIxHWklKsreP24ul87uuktfhDlhltpfd8AlXxn2SpxQ1Fy/Ktid3E1+uDb64HKf9a35CwE= q/C5yP0VC0Y0ZUPzSD5+O5Rt5X8= sg==
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.Avalonia/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Avalonia;
3 | using Avalonia.Controls.ApplicationLifetimes;
4 |
5 | namespace NetSparkleUpdater.Samples.Avalonia
6 | {
7 | class Program
8 | {
9 | // Initialization code. Don't use any Avalonia, third-party APIs or any
10 | // SynchronizationContext-reliant code before AppMain is called: things aren't initialized
11 | // yet and stuff might break.
12 | public static void Main(string[] args) => BuildAvaloniaApp()
13 | .StartWithClassicDesktopLifetime(args);
14 |
15 | // Avalonia configuration, don't remove; also used by visual designer.
16 | public static AppBuilder BuildAvaloniaApp()
17 | => AppBuilder.Configure()
18 | .UsePlatformDetect()
19 | .LogToTrace();
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.Avalonia/nuget.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.Avalonia/software-update-available.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NetSparkleUpdater/NetSparkle/bfce0066ae22cfbe6efb117c41f9fc88e1fb0eaf/src/NetSparkle.Samples.Avalonia/software-update-available.ico
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.DownloadedExe/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.DownloadedExe/Form1.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace NetSparkleUpdater.Samples.UpdateExe
12 | {
13 | public partial class Form1 : Form
14 | {
15 | public Form1()
16 | {
17 | InitializeComponent();
18 | }
19 |
20 | private void label1_Click(object sender, EventArgs e)
21 | {
22 |
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.DownloadedExe/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using System.Windows.Forms;
6 |
7 | namespace NetSparkleUpdater.Samples.UpdateExe
8 | {
9 | static class Program
10 | {
11 | ///
12 | /// The main entry point for the application.
13 | ///
14 | [STAThread]
15 | static void Main()
16 | {
17 | Application.EnableVisualStyles();
18 | Application.SetCompatibleTextRenderingDefault(false);
19 | Application.Run(new Form1());
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.DownloadedExe/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("SampleDownloadedExecutable")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("SampleDownloadedExecutable")]
13 | [assembly: AssemblyCopyright("Copyright © 2016")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("3fecc323-e8a1-45f9-8764-32b64871535a")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.DownloadedExe/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace SampleDownloadedExecutable.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18 | {
19 |
20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21 |
22 | public static Settings Default
23 | {
24 | get
25 | {
26 | return defaultInstance;
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.DownloadedExe/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.Forms.Multithread/NetSparkle.Samples.Forms.Multithread.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | WinExe
4 | net8.0-windows
5 | enable
6 | true
7 | enable
8 | software-update-available.ico
9 | false
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 | Form
26 |
27 |
28 | Form1.cs
29 |
30 |
31 |
32 |
33 | Form1.cs
34 |
35 |
36 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.Forms.Multithread/NetSparkle.Samples.Forms.Multithread.csproj.user:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.Forms.Multithread/NetSparkle_DSA.pub:
--------------------------------------------------------------------------------
1 | 2IX45gCGAGjNXBg3/spd03M2oMsmghmul/H5ePY9AN9URjAOYUcwfi3kQ/KM8i2eD1V/cBKkMJX4xx3kpt39n2Vt+7tyWfXjzMb+3qPapPHMMJL5DDS9cw6FgG3H0tT/LSm7Qn7JLA6w8FOiVIjC+x61u5WqFK0I0vFnc8T1YZs=
xXaw/HrlbsRqg7WD5g1xlkVblys= P2bv3DOTGnyjVnDC5j6Pwd4U6VtRzhPsww9COnwlRWmyNFcf0F/3H5S9YJrO7P+CgIvef30eqUYPHUauLbZ2UK0rItwepz45SfysLvVUb6PU6z/j7gEYiGO/lKd13GfhxmL1mS+XasDSw5brRMxePidiom8H/AB7VVQgELcgutQ= mxJD6rwuJe532PpS9HKjlhvcY1ssBEOFf3HmiYot4d670y0+5nICF3YO8vLxndHA4RqgU/Hux9KtKKg/2hi7c/88j5YyTDWX86n8aPIxHWklKsreP24ul87uuktfhDlhltpfd8AlXxn2SpxQ1Fy/Ktid3E1+uDb64HKf9a35CwE= q/C5yP0VC0Y0ZUPzSD5+O5Rt5X8= sg==
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.Forms.Multithread/Program.cs:
--------------------------------------------------------------------------------
1 | namespace NetSparkle.Samples.Forms.Multithread
2 | {
3 | internal static class Program
4 | {
5 | ///
6 | /// The main entry point for the application.
7 | ///
8 | [STAThread]
9 | static void Main()
10 | {
11 | // To customize application configuration such as set high DPI settings or default font,
12 | // see https://aka.ms/applicationconfiguration.
13 | ApplicationConfiguration.Initialize();
14 | Application.Run(new Form1());
15 | }
16 | }
17 | }
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.Forms.Multithread/software-update-available.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NetSparkleUpdater/NetSparkle/bfce0066ae22cfbe6efb117c41f9fc88e1fb0eaf/src/NetSparkle.Samples.Forms.Multithread/software-update-available.ico
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.HandleEventsYourself/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.HandleEventsYourself/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 |
9 | namespace NetSparkleUpdater.Samples.HandleEventsYourself
10 | {
11 | ///
12 | /// Interaction logic for App.xaml
13 | ///
14 | public partial class App : Application
15 | {
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.HandleEventsYourself/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | [assembly: ThemeInfo(
4 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
5 | //(used if a resource is not found in the page,
6 | // or application resource dictionaries)
7 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
8 | //(used if a resource is not found in the page,
9 | // app, or any theme specific resource dictionaries)
10 | )]
11 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.HandleEventsYourself/NetSparkle.Samples.HandleEventsYourself.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | WinExe
5 | net8.0-windows
6 | true
7 | false
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.HandleEventsYourself/NetSparkle.Samples.HandleEventsYourself.csproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Designer
7 |
8 |
9 |
10 |
11 | Designer
12 |
13 |
14 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.HandleEventsYourself/NetSparkle_DSA.pub:
--------------------------------------------------------------------------------
1 | 2IX45gCGAGjNXBg3/spd03M2oMsmghmul/H5ePY9AN9URjAOYUcwfi3kQ/KM8i2eD1V/cBKkMJX4xx3kpt39n2Vt+7tyWfXjzMb+3qPapPHMMJL5DDS9cw6FgG3H0tT/LSm7Qn7JLA6w8FOiVIjC+x61u5WqFK0I0vFnc8T1YZs=
xXaw/HrlbsRqg7WD5g1xlkVblys= P2bv3DOTGnyjVnDC5j6Pwd4U6VtRzhPsww9COnwlRWmyNFcf0F/3H5S9YJrO7P+CgIvef30eqUYPHUauLbZ2UK0rItwepz45SfysLvVUb6PU6z/j7gEYiGO/lKd13GfhxmL1mS+XasDSw5brRMxePidiom8H/AB7VVQgELcgutQ= mxJD6rwuJe532PpS9HKjlhvcY1ssBEOFf3HmiYot4d670y0+5nICF3YO8vLxndHA4RqgU/Hux9KtKKg/2hi7c/88j5YyTDWX86n8aPIxHWklKsreP24ul87uuktfhDlhltpfd8AlXxn2SpxQ1Fy/Ktid3E1+uDb64HKf9a35CwE= q/C5yP0VC0Y0ZUPzSD5+O5Rt5X8= sg==
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.NetCore.WPF/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.NetCore.WPF/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 |
9 | namespace NetSparkleUpdater.Samples.NetCore.WPF
10 | {
11 | ///
12 | /// Interaction logic for App.xaml
13 | ///
14 | public partial class App : Application
15 | {
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.NetCore.WPF/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | [assembly: ThemeInfo(
4 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
5 | //(used if a resource is not found in the page,
6 | // or application resource dictionaries)
7 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
8 | //(used if a resource is not found in the page,
9 | // app, or any theme specific resource dictionaries)
10 | )]
11 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.NetCore.WPF/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
12 |
13 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.NetCore.WPF/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using NetSparkleUpdater.SignatureVerifiers;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Controls;
9 | using System.Windows.Data;
10 | using System.Windows.Documents;
11 | using System.Windows.Input;
12 | using System.Windows.Media;
13 | using System.Windows.Media.Imaging;
14 | using System.Windows.Navigation;
15 | using System.Windows.Shapes;
16 |
17 | namespace NetSparkleUpdater.Samples.NetCore.WPF
18 | {
19 | ///
20 | /// Interaction logic for MainWindow.xaml
21 | ///
22 | public partial class MainWindow : Window
23 | {
24 | private SparkleUpdater _sparkle;
25 |
26 | public MainWindow()
27 | {
28 | InitializeComponent();
29 |
30 | // remove the netsparkle key from registry
31 | try
32 | {
33 | Microsoft.Win32.Registry.CurrentUser.DeleteSubKeyTree("Software\\Microsoft\\NetSparkle.TestAppNetCoreWPF");
34 | }
35 | catch { }
36 |
37 | // set icon in project properties!
38 | string manifestModuleName = System.Reflection.Assembly.GetEntryAssembly().ManifestModule.FullyQualifiedName;
39 | var icon = System.Drawing.Icon.ExtractAssociatedIcon(manifestModuleName);
40 | _sparkle = new SparkleUpdater("https://netsparkleupdater.github.io/NetSparkle/files/sample-app/appcast.xml", new DSAChecker(Enums.SecurityMode.Strict))
41 | {
42 | UIFactory = new NetSparkleUpdater.UI.WPF.UIFactory(NetSparkleUpdater.UI.WPF.IconUtilities.ToImageSource(icon)),
43 | //RelaunchAfterUpdate = true,
44 | //UseNotificationToast = true
45 | };
46 | StartSparkle();
47 | }
48 |
49 | private async void StartSparkle()
50 | {
51 | _sparkle.UpdateDetected += _sparkle_UpdateDetected;
52 | await _sparkle.StartLoop(true, true);
53 | }
54 |
55 | private void _sparkle_UpdateDetected(object sender, Events.UpdateDetectedEventArgs e)
56 | {
57 | //e.NextAction = Enums.NextUpdateAction.PerformUpdateUnattended; // uncomment to see how the app will auto-update due to loop
58 | }
59 |
60 | private async void ManualUpdateCheck_Click(object sender, RoutedEventArgs e)
61 | {
62 | await _sparkle.CheckForUpdatesAtUserRequest();
63 | }
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.NetCore.WPF/NetSparkle.Samples.NetCore.WPF.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | WinExe
5 | net8.0-windows
6 | true
7 | software-update-available.ico
8 | false
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.NetCore.WPF/NetSparkle.Samples.NetCore.WPF.csproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Designer
7 |
8 |
9 |
10 |
11 | Designer
12 |
13 |
14 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.NetCore.WPF/NetSparkle_DSA.pub:
--------------------------------------------------------------------------------
1 | 2IX45gCGAGjNXBg3/spd03M2oMsmghmul/H5ePY9AN9URjAOYUcwfi3kQ/KM8i2eD1V/cBKkMJX4xx3kpt39n2Vt+7tyWfXjzMb+3qPapPHMMJL5DDS9cw6FgG3H0tT/LSm7Qn7JLA6w8FOiVIjC+x61u5WqFK0I0vFnc8T1YZs=
xXaw/HrlbsRqg7WD5g1xlkVblys= P2bv3DOTGnyjVnDC5j6Pwd4U6VtRzhPsww9COnwlRWmyNFcf0F/3H5S9YJrO7P+CgIvef30eqUYPHUauLbZ2UK0rItwepz45SfysLvVUb6PU6z/j7gEYiGO/lKd13GfhxmL1mS+XasDSw5brRMxePidiom8H/AB7VVQgELcgutQ= mxJD6rwuJe532PpS9HKjlhvcY1ssBEOFf3HmiYot4d670y0+5nICF3YO8vLxndHA4RqgU/Hux9KtKKg/2hi7c/88j5YyTDWX86n8aPIxHWklKsreP24ul87uuktfhDlhltpfd8AlXxn2SpxQ1Fy/Ktid3E1+uDb64HKf9a35CwE= q/C5yP0VC0Y0ZUPzSD5+O5Rt5X8= sg==
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.NetCore.WPF/software-update-available.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NetSparkleUpdater/NetSparkle/bfce0066ae22cfbe6efb117c41f9fc88e1fb0eaf/src/NetSparkle.Samples.NetCore.WPF/software-update-available.ico
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.NetCore.WinForms/Form1.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 | using System.IO;
4 | using System.Reflection;
5 | using System.Windows.Forms;
6 | using NetSparkleUpdater;
7 | using NetSparkleUpdater.Enums;
8 | using NetSparkleUpdater.SignatureVerifiers;
9 |
10 | namespace NetSparkleUpdater.Samples.NetCore.WinForms
11 | {
12 | public partial class Form1 : Form
13 | {
14 | private SparkleUpdater _sparkleUpdateDetector;
15 |
16 | public Form1()
17 | {
18 | InitializeComponent();
19 |
20 | var appcastUrl = "https://netsparkleupdater.github.io/NetSparkle/files/sample-app/appcast.xml";
21 | // set icon in project properties!
22 | string manifestModuleName = System.Reflection.Assembly.GetEntryAssembly().ManifestModule.FullyQualifiedName;
23 | var icon = System.Drawing.Icon.ExtractAssociatedIcon(manifestModuleName);
24 | _sparkleUpdateDetector = new SparkleUpdater(appcastUrl, new DSAChecker(Enums.SecurityMode.Strict))
25 | {
26 | UIFactory = new NetSparkleUpdater.UI.WinForms.UIFactory(icon),
27 | //RelaunchAfterUpdate = true,
28 | //ShowsUIOnMainThread = true,
29 | //UseNotificationToast = true
30 | };
31 | //_sparkleUpdateDetector.CloseApplication += _sparkleUpdateDetector_CloseApplication;
32 | StartSparkle();
33 | }
34 |
35 | private async void StartSparkle()
36 | {
37 | await _sparkleUpdateDetector.StartLoop(true, true);
38 | }
39 |
40 | private void _sparkleUpdateDetector_CloseApplication()
41 | {
42 | Application.Exit();
43 | }
44 |
45 | private async void AppBackgroundCheckButton_Click(object sender, EventArgs e)
46 | {
47 | // Manually check for updates, this will not show a ui
48 | var result = await _sparkleUpdateDetector.CheckForUpdatesQuietly();
49 | if (result.Status == UpdateStatus.UpdateAvailable)
50 | {
51 | // if update(s) are found, then we have to trigger the UI to show it gracefully
52 | _sparkleUpdateDetector.ShowUpdateNeededUI();
53 | }
54 | }
55 |
56 | private async void ExplicitUserRequestCheckButton_Click(object sender, EventArgs e)
57 | {
58 | await _sparkleUpdateDetector.CheckForUpdatesAtUserRequest();
59 | }
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.NetCore.WinForms/NetSparkle.Samples.NetCore.WinForms.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | WinExe
5 | net8.0-windows
6 | true
7 | software-update-available.ico
8 | false
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 | Form
32 |
33 |
34 | Form1.cs
35 |
36 |
37 |
38 |
39 |
40 | Form1.cs
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.NetCore.WinForms/NetSparkle.Samples.NetCore.WinForms.csproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Form
7 |
8 |
9 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.NetCore.WinForms/NetSparkle_DSA.pub:
--------------------------------------------------------------------------------
1 | 2IX45gCGAGjNXBg3/spd03M2oMsmghmul/H5ePY9AN9URjAOYUcwfi3kQ/KM8i2eD1V/cBKkMJX4xx3kpt39n2Vt+7tyWfXjzMb+3qPapPHMMJL5DDS9cw6FgG3H0tT/LSm7Qn7JLA6w8FOiVIjC+x61u5WqFK0I0vFnc8T1YZs=
xXaw/HrlbsRqg7WD5g1xlkVblys= P2bv3DOTGnyjVnDC5j6Pwd4U6VtRzhPsww9COnwlRWmyNFcf0F/3H5S9YJrO7P+CgIvef30eqUYPHUauLbZ2UK0rItwepz45SfysLvVUb6PU6z/j7gEYiGO/lKd13GfhxmL1mS+XasDSw5brRMxePidiom8H/AB7VVQgELcgutQ= mxJD6rwuJe532PpS9HKjlhvcY1ssBEOFf3HmiYot4d670y0+5nICF3YO8vLxndHA4RqgU/Hux9KtKKg/2hi7c/88j5YyTDWX86n8aPIxHWklKsreP24ul87uuktfhDlhltpfd8AlXxn2SpxQ1Fy/Ktid3E1+uDb64HKf9a35CwE= q/C5yP0VC0Y0ZUPzSD5+O5Rt5X8= sg==
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.NetCore.WinForms/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using System.Windows.Forms;
6 |
7 | namespace NetSparkleUpdater.Samples.NetCore.WinForms
8 | {
9 | static class Program
10 | {
11 | ///
12 | /// The main entry point for the application.
13 | ///
14 | [STAThread]
15 | static void Main()
16 | {
17 | Application.SetHighDpiMode(HighDpiMode.SystemAware);
18 | Application.EnableVisualStyles();
19 | Application.SetCompatibleTextRenderingDefault(false);
20 | Application.Run(new Form1());
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.NetCore.WinForms/software-update-available.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NetSparkleUpdater/NetSparkle/bfce0066ae22cfbe6efb117c41f9fc88e1fb0eaf/src/NetSparkle.Samples.NetCore.WinForms/software-update-available.ico
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.NetFramework.WPF/App.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.NetFramework.WPF/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Windows;
7 |
8 | namespace NetSparkleUpdater.Samples.NetFramework.WPF
9 | {
10 | ///
11 | /// Interaction logic for App.xaml
12 | ///
13 | public partial class App : Application
14 | {
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.NetFramework.WPF/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.NetFramework.WPF/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using NetSparkleUpdater.SignatureVerifiers;
2 | using System.Drawing;
3 | using System.Windows;
4 | using System.Windows.Controls;
5 | using System.Windows.Media;
6 | using Color = System.Windows.Media.Color;
7 | using ColorConverter = System.Windows.Media.ColorConverter;
8 |
9 |
10 | namespace NetSparkleUpdater.Samples.NetFramework.WPF
11 | {
12 | ///
13 | /// Interaction logic for MainWindow.xaml
14 | ///
15 | public partial class MainWindow : Window
16 | {
17 | private SparkleUpdater _sparkle;
18 |
19 | public MainWindow()
20 | {
21 | InitializeComponent();
22 |
23 | // remove the netsparkle key from registry
24 | try
25 | {
26 | Microsoft.Win32.Registry.CurrentUser.DeleteSubKeyTree("Software\\Microsoft\\NetSparkle.TestAppWPF");
27 | }
28 | catch { }
29 |
30 | // set icon in project properties!
31 | string manifestModuleName = System.Reflection.Assembly.GetEntryAssembly().ManifestModule.FullyQualifiedName;
32 | var icon = System.Drawing.Icon.ExtractAssociatedIcon(manifestModuleName);
33 |
34 | _sparkle = new SparkleUpdater("https://netsparkleupdater.github.io/NetSparkle/files/sample-app/appcast.xml", new DSAChecker(Enums.SecurityMode.Strict))
35 | {
36 | UIFactory = new NetSparkleUpdater.UI.WPF.UIFactory(NetSparkleUpdater.UI.WPF.IconUtilities.ToImageSource(icon))
37 | {
38 | ProcessWindowAfterInit = (window, factory) =>
39 | {
40 | // Example of setting font styles on a window after init:
41 | TextBlock.SetFontStyle(window, FontStyles.Italic);
42 | }
43 | },
44 | //RelaunchAfterUpdate = true,
45 | //UseNotificationToast = true
46 | };
47 | _sparkle.StartLoop(true, true);
48 | }
49 |
50 | private void ManualUpdateCheck_Click(object sender, RoutedEventArgs e)
51 | {
52 | _sparkle.CheckForUpdatesAtUserRequest();
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.NetFramework.WPF/NetSparkleTestAppWPF.csproj.vspscc:
--------------------------------------------------------------------------------
1 | ""
2 | {
3 | "FILE_VERSION" = "9237"
4 | "ENLISTMENT_CHOICE" = "NEVER"
5 | "PROJECT_FILE_RELATIVE_PATH" = ""
6 | "NUMBER_OF_EXCLUDED_FILES" = "0"
7 | "ORIGINAL_PROJECT_FILE_PATH" = ""
8 | "NUMBER_OF_NESTED_PROJECTS" = "0"
9 | "SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
10 | }
11 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.NetFramework.WPF/NetSparkle_DSA.pub:
--------------------------------------------------------------------------------
1 | 2IX45gCGAGjNXBg3/spd03M2oMsmghmul/H5ePY9AN9URjAOYUcwfi3kQ/KM8i2eD1V/cBKkMJX4xx3kpt39n2Vt+7tyWfXjzMb+3qPapPHMMJL5DDS9cw6FgG3H0tT/LSm7Qn7JLA6w8FOiVIjC+x61u5WqFK0I0vFnc8T1YZs=
xXaw/HrlbsRqg7WD5g1xlkVblys= P2bv3DOTGnyjVnDC5j6Pwd4U6VtRzhPsww9COnwlRWmyNFcf0F/3H5S9YJrO7P+CgIvef30eqUYPHUauLbZ2UK0rItwepz45SfysLvVUb6PU6z/j7gEYiGO/lKd13GfhxmL1mS+XasDSw5brRMxePidiom8H/AB7VVQgELcgutQ= mxJD6rwuJe532PpS9HKjlhvcY1ssBEOFf3HmiYot4d670y0+5nICF3YO8vLxndHA4RqgU/Hux9KtKKg/2hi7c/88j5YyTDWX86n8aPIxHWklKsreP24ul87uuktfhDlhltpfd8AlXxn2SpxQ1Fy/Ktid3E1+uDb64HKf9a35CwE= q/C5yP0VC0Y0ZUPzSD5+O5Rt5X8= sg==
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.NetFramework.WPF/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace NetSparkleUpdater.Samples.NetFramework.WPF.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.NetFramework.WPF/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.NetFramework.WPF/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.NetFramework.WPF/software-update-available.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NetSparkleUpdater/NetSparkle/bfce0066ae22cfbe6efb117c41f9fc88e1fb0eaf/src/NetSparkle.Samples.NetFramework.WPF/software-update-available.ico
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.NetFramework.WinForms/Form1.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 | using System.IO;
4 | using System.Reflection;
5 | using System.Windows.Forms;
6 | using NetSparkleUpdater;
7 | using NetSparkleUpdater.Enums;
8 | using NetSparkleUpdater.SignatureVerifiers;
9 |
10 | namespace NetSparkleUpdater.Samples.NetFramework.WinForms
11 | {
12 | public partial class Form1 : Form
13 | {
14 | private SparkleUpdater _sparkleUpdateDetector;
15 |
16 | public Form1()
17 | {
18 | InitializeComponent();
19 |
20 | var appcastUrl = "https://netsparkleupdater.github.io/NetSparkle/files/sample-app/appcast.xml";
21 | // set icon in project properties!
22 | string manifestModuleName = System.Reflection.Assembly.GetEntryAssembly().ManifestModule.FullyQualifiedName;
23 | var icon = System.Drawing.Icon.ExtractAssociatedIcon(manifestModuleName);
24 | _sparkleUpdateDetector = new SparkleUpdater(appcastUrl, new DSAChecker(Enums.SecurityMode.Strict))
25 | {
26 | UIFactory = new NetSparkleUpdater.UI.WinForms.UIFactory(icon),
27 | //RelaunchAfterUpdate = true,
28 | //ShowsUIOnMainThread = true,
29 | //UseNotificationToast = true
30 | };
31 | //_sparkleUpdateDetector.CloseApplication += _sparkleUpdateDetector_CloseApplication;
32 | _sparkleUpdateDetector.StartLoop(true, true);
33 | }
34 |
35 | private void _sparkleUpdateDetector_CloseApplication()
36 | {
37 | Application.Exit();
38 | }
39 |
40 | private async void AppBackgroundCheckButton_Click(object sender, EventArgs e)
41 | {
42 | // Manually check for updates, this will not show a ui
43 | var result = await _sparkleUpdateDetector.CheckForUpdatesQuietly();
44 | if (result.Status == UpdateStatus.UpdateAvailable)
45 | {
46 | // if update(s) are found, then we have to trigger the UI to show it gracefully
47 | _sparkleUpdateDetector.ShowUpdateNeededUI();
48 | }
49 |
50 | }
51 |
52 | private void ExplicitUserRequestCheckButton_Click(object sender, EventArgs e)
53 | {
54 | _sparkleUpdateDetector.CheckForUpdatesAtUserRequest();
55 | }
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.NetFramework.WinForms/NetSparkle.Samples.NetFramework.WinForms.csproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | publish\
5 |
6 |
7 |
8 |
9 |
10 | en-US
11 | false
12 |
13 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.NetFramework.WinForms/NetSparkle_DSA.pub:
--------------------------------------------------------------------------------
1 | 2IX45gCGAGjNXBg3/spd03M2oMsmghmul/H5ePY9AN9URjAOYUcwfi3kQ/KM8i2eD1V/cBKkMJX4xx3kpt39n2Vt+7tyWfXjzMb+3qPapPHMMJL5DDS9cw6FgG3H0tT/LSm7Qn7JLA6w8FOiVIjC+x61u5WqFK0I0vFnc8T1YZs=
xXaw/HrlbsRqg7WD5g1xlkVblys= P2bv3DOTGnyjVnDC5j6Pwd4U6VtRzhPsww9COnwlRWmyNFcf0F/3H5S9YJrO7P+CgIvef30eqUYPHUauLbZ2UK0rItwepz45SfysLvVUb6PU6z/j7gEYiGO/lKd13GfhxmL1mS+XasDSw5brRMxePidiom8H/AB7VVQgELcgutQ= mxJD6rwuJe532PpS9HKjlhvcY1ssBEOFf3HmiYot4d670y0+5nICF3YO8vLxndHA4RqgU/Hux9KtKKg/2hi7c/88j5YyTDWX86n8aPIxHWklKsreP24ul87uuktfhDlhltpfd8AlXxn2SpxQ1Fy/Ktid3E1+uDb64HKf9a35CwE= q/C5yP0VC0Y0ZUPzSD5+O5Rt5X8= sg==
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.NetFramework.WinForms/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Windows.Forms;
5 |
6 | namespace NetSparkleUpdater.Samples.NetFramework.WinForms
7 | {
8 | static class Program
9 | {
10 | ///
11 | /// The main entry point for the application.
12 | ///
13 | [STAThread]
14 | static void Main()
15 | {
16 | Application.EnableVisualStyles();
17 | Application.SetCompatibleTextRenderingDefault(false);
18 | Application.Run(new Form1());
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.NetFramework.WinForms/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("SampleApplication")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("None")]
12 | [assembly: AssemblyProduct("SampleApplication")]
13 | [assembly: AssemblyCopyright("None")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("fd2fa548-8325-41b2-bf93-0857f1cf938d")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.NetFramework.WinForms/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace SampleApplication.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.NetFramework.WinForms/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.NetFramework.WinForms/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.NetFramework.WinForms/software-update-available.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NetSparkleUpdater/NetSparkle/bfce0066ae22cfbe6efb117c41f9fc88e1fb0eaf/src/NetSparkle.Samples.NetFramework.WinForms/software-update-available.ico
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.SimpleConsoleApp/.gitignore:
--------------------------------------------------------------------------------
1 | appcast-output/*
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.SimpleConsoleApp/BuildAppCast.sh:
--------------------------------------------------------------------------------
1 |
2 | outputDir="appcast-output"
3 | rm -rf "${outputDir}" # remove any old files
4 | mkdir -p $outputDir
5 | for config in "osx-arm64" "osx-x64" "win-arm64" "win-x64" "linux-x64"; do
6 | if [[ "$config" == osx* ]]; then
7 | ext=""
8 | if [[ "$config" == "osx-arm64" ]]; then
9 | os="macos-arm64"
10 | version=2.0 # since app cast gen doesn't like items with same version right now
11 | else
12 | os="macos-x64"
13 | version=2.1
14 | fi
15 | aot="true"
16 | singlefile="false"
17 | elif [[ "$config" == win* ]]; then
18 | ext=".exe"
19 | if [[ "$config" == "win-arm64" ]]; then
20 | os="windows-arm64"
21 | version=2.2
22 | else
23 | os="windows-x64"
24 | version=2.3
25 | fi
26 | aot="false"
27 | singlefile="true"
28 | else
29 | ext=""
30 | version=2.4
31 | os="linux-x64"
32 | aot="false"
33 | singlefile="true"
34 | fi
35 | filename="${outputDir}/${config}/SimpleNetSparkleConsoleApp${ext}"
36 | filenameNxt="${outputDir}/${config}/SimpleNetSparkleConsoleApp_${os}${ext}"
37 | dotnet publish -c Release --self-contained -r "${config}" -o "${outputDir}/${config}" "-p:PublishAot=${aot}" "-p:PublishSingleFile=${singlefile}"
38 | mv "${filename}" "${filenameNxt}"
39 | netsparkle-generate-appcast -n "Sparkle Console App" --os "${os}" --appcast-output-directory "${outputDir}" --single-file "${filenameNxt}" --reparse-existing --file-version "${version}" -u "https://netsparkleupdater.github.io/NetSparkle/files/console-sample-app"
40 | mv "${filenameNxt}" "${outputDir}/SimpleNetSparkleConsoleApp_${os}${ext}"
41 | done
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.SimpleConsoleApp/CreateAppCast.sh:
--------------------------------------------------------------------------------
1 |
2 | outputDir="appcast-output"
3 | rm -rf "${outputDir}/appcast.xml" # remove any old files
4 | # "win-arm64" not included for now
5 | for config in "osx-arm64" "osx-x64" "win-x64" "linux-x64"; do
6 | if [[ "$config" == osx* ]]; then
7 | ext=""
8 | if [[ "$config" == "osx-arm64" ]]; then
9 | os="macos-arm64"
10 | version=2.0 # since app cast gen doesn't like items with same version right now
11 | else
12 | os="macos-x64"
13 | version=2.1
14 | fi
15 | aot="true"
16 | singlefile="false"
17 | elif [[ "$config" == win* ]]; then
18 | ext=".exe"
19 | if [[ "$config" == "win-arm64" ]]; then
20 | os="windows-arm64"
21 | version=2.2
22 | else
23 | os="windows-x64"
24 | version=2.3
25 | fi
26 | aot="false"
27 | singlefile="true"
28 | else
29 | ext=""
30 | version=2.4
31 | os="linux-x64"
32 | aot="false"
33 | singlefile="true"
34 | fi
35 | filename="${outputDir}/SimpleNetSparkleConsoleApp_${os}${ext}"
36 | if [ -f $filename ]; then
37 | netsparkle-generate-appcast -n "Sparkle Console App" --os "${os}" --appcast-output-directory "${outputDir}" --single-file "${filename}" --reparse-existing --file-version "${version}" -u "https://netsparkleupdater.github.io/NetSparkle/files/console-sample-app"
38 | else
39 | echo "File does not exist for: ${config}"
40 | fi
41 | done
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.SimpleConsoleApp/NetSparkle.Samples.SimpleConsoleApp.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net8.0
6 | enable
7 | enable
8 | true
9 | true
10 |
11 | full
12 | true
13 | enable
14 |
15 | Size
16 | true
17 | true
18 | true
19 | false
20 |
21 | 1.0
22 | false
23 | My Simple Console App - NetSparkle
24 | SimpleNetSparkleConsoleApp
25 | NetSparkleUpdater
26 | NetSparkleUpdater
27 | NetSparkleUpdater
28 |
29 |
30 | False
31 | None
32 |
33 |
34 |
--------------------------------------------------------------------------------
/src/NetSparkle.Samples.SimpleConsoleApp/Program.cs:
--------------------------------------------------------------------------------
1 | Console.WriteLine("");
2 | Console.WriteLine("");
3 | Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
4 | Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
5 | Console.WriteLine("~~~~~~~~~~~~~~~~~ NetSparkle ~~~~~~~~~~~~~~~~~~~~~~~");
6 | Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
7 | Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
8 | Console.WriteLine("Hello, World! This is the app downloaded by NetSparkle — usually the downloaded file would be your installer or DMG or other app you need for your updates~");
9 | Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
10 | Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
11 | Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
12 | Console.WriteLine("");
13 | Console.WriteLine("");
14 | Console.WriteLine("(Program is done, hit any key to end...)");
15 | Console.ReadLine();
--------------------------------------------------------------------------------
/src/NetSparkle.Shared/NetSparkle.Shared.shproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | d9115e42-6ed7-452f-a623-81f70201578b
5 | 14.0
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/src/NetSparkle.Shared/NetSparkleUtilities.projitems:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | $(MSBuildAllProjects);$(MSBuildThisFileFullPath)
5 | true
6 | d9115e42-6ed7-452f-a623-81f70201578b
7 |
8 |
9 | NetSparkleUtilities
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/src/NetSparkle.Tests.AppCastGenerator/AppCastTestCollection.cs:
--------------------------------------------------------------------------------
1 | using Xunit;
2 |
3 | namespace NetSparkle.Tests.AppCastGenerator
4 | {
5 | [CollectionDefinition(SignatureManagerFixture.CollectionName)]
6 | public class SignatureManagerCollection : ICollectionFixture
7 | {
8 |
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/src/NetSparkle.Tests.AppCastGenerator/EmptyTestDataConfiguration.cs:
--------------------------------------------------------------------------------
1 | using NetSparkleUpdater.Configurations;
2 | using NetSparkleUpdater.Interfaces;
3 |
4 | namespace NetSparkle.Tests.AppCastGenerator
5 | {
6 | public class EmptyTestDataConfiguration : Configuration
7 | {
8 | public EmptyTestDataConfiguration(IAssemblyAccessor accessor) : base(accessor)
9 | {
10 | }
11 |
12 | public override void Reload()
13 | {
14 | }
15 | }
16 | }
--------------------------------------------------------------------------------
/src/NetSparkle.Tests.AppCastGenerator/FakeTestDataAssemblyAccessor.cs:
--------------------------------------------------------------------------------
1 | using NetSparkleUpdater.Interfaces;
2 |
3 | namespace NetSparkle.Tests.AppCastGenerator
4 | {
5 | public class FakeTestDataAssemblyAccessor : IAssemblyAccessor
6 | {
7 | public string AssemblyCompany { get; set; }
8 | public string AssemblyCopyright { get; set; }
9 | public string AssemblyDescription { get; set; }
10 | public string AssemblyTitle { get; set; }
11 | public string AssemblyProduct { get; set; }
12 | public string AssemblyVersion { get; set; }
13 | }
14 | }
--------------------------------------------------------------------------------
/src/NetSparkle.Tests.AppCastGenerator/NetSparkle.Tests.AppCastGenerator.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net9.0;net8.0;net7.0;net6.0
5 |
6 | false
7 | true
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/src/NetSparkle.Tests.AppCastGenerator/SignatureManagerFixture.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using NetSparkleUpdater.AppCastGenerator;
4 |
5 | namespace NetSparkle.Tests.AppCastGenerator
6 | {
7 | public class SignatureManagerFixture : IDisposable
8 | {
9 | public const string CollectionName = "signature-manager";
10 |
11 | private SignatureManager _manager;
12 |
13 | public SignatureManagerFixture()
14 | {
15 | _manager = CreateSignatureManager("netsparkle-tests");
16 | }
17 |
18 | public SignatureManager CreateSignatureManager(string temp_directory_name)
19 | {
20 | var signatureManager = new SignatureManager();
21 | signatureManager.SetStorageDirectory(Path.Combine(Path.GetTempPath(), temp_directory_name));
22 | signatureManager.Generate(true);
23 | return signatureManager;
24 | }
25 |
26 | public SignatureManager GetSignatureManager()
27 | {
28 | return _manager;
29 | }
30 |
31 | public void CleanupSignatureManager(SignatureManager manager)
32 | {
33 | var storageDir = manager.GetStorageDirectory();
34 | // the testing storage dir should never equal the default one,
35 | // but because I am paranoid, we will do the check. We never want
36 | // to erase someone's keys!
37 | if (Directory.Exists(storageDir) && storageDir != SignatureManager.GetDefaultStorageDirectory())
38 | {
39 | Directory.Delete(storageDir, true);
40 | }
41 | }
42 |
43 | public void Dispose()
44 | {
45 | CleanupSignatureManager(_manager);
46 | }
47 | }
48 | }
--------------------------------------------------------------------------------
/src/NetSparkle.Tests.AppCastGenerator/URLEncodeTests.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Web;
7 | using Xunit;
8 |
9 |
10 | namespace NetSparkle.Tests.AppCastGenerator
11 | {
12 | public class URLEncodeTests
13 | {
14 | [Fact]
15 | public void TestURLEncoding()
16 | {
17 | // https://stackoverflow.com/questions/3572173/server-urlencode-vs-uri-escapedatastring
18 | var appName = "My FavoriteNew App";
19 | var encoded = HttpUtility.UrlEncode(appName);
20 | Assert.Equal("My+FavoriteNew+App", encoded);
21 | var encodedUri = Uri.EscapeDataString(appName);
22 | Assert.Equal("My%20FavoriteNew%20App", encodedUri); // <----- this is preferred!
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/NetSparkle.Tests.Trimming/NetSparkle.Tests.Trimming.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net8.0
6 | enable
7 | enable
8 | true
9 | true
10 | true
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/src/NetSparkle.Tests.Trimming/Program.cs:
--------------------------------------------------------------------------------
1 | using NetSparkleUpdater;
2 | using NetSparkleUpdater.Enums;
3 | using NetSparkleUpdater.SignatureVerifiers;
4 |
5 | // See https://aka.ms/new-console-template for more information
6 | Console.WriteLine("Hello, World!");
7 |
8 | var checker = new Ed25519Checker(SecurityMode.Strict, "");
9 | var sparkle = new SparkleUpdater("https://netsparkleupdater.github.io/NetSparkle/files/sample-app/appcast.xml", new DSAChecker(NetSparkleUpdater.Enums.SecurityMode.Strict))
10 | {
11 | ShowsUIOnMainThread = false,
12 | //RelaunchAfterUpdate = true,
13 | //UseNotificationToast = true
14 | };
15 | await sparkle.CheckForUpdatesQuietly();
--------------------------------------------------------------------------------
/src/NetSparkle.Tests/AlwaysSucceedSignatureChecker.cs:
--------------------------------------------------------------------------------
1 | using NetSparkleUpdater.Enums;
2 | using NetSparkleUpdater.Interfaces;
3 |
4 | namespace NetSparkleUnitTests
5 | {
6 | public class AlwaysSucceedSignatureChecker : ISignatureVerifier
7 | {
8 | public SecurityMode SecurityMode { get; set; }
9 |
10 | public bool HasValidKeyInformation()
11 | {
12 | return true;
13 | }
14 |
15 | public ValidationResult VerifySignature(string signature, byte[] dataToVerify)
16 | {
17 | return ValidationResult.Valid;
18 | }
19 |
20 | public ValidationResult VerifySignatureOfFile(string signature, string binaryPath)
21 | {
22 | return ValidationResult.Valid;
23 | }
24 |
25 | public ValidationResult VerifySignatureOfString(string signature, string data)
26 | {
27 | return ValidationResult.Valid;
28 | }
29 | }
30 | }
--------------------------------------------------------------------------------
/src/NetSparkle.Tests/AppCastItemTests.cs:
--------------------------------------------------------------------------------
1 | using NetSparkleUpdater;
2 | using NetSparkleUpdater.AppCastHandlers;
3 | using NetSparkleUpdater.Enums;
4 | using NetSparkleUpdater.SignatureVerifiers;
5 | using System;
6 | using System.Linq;
7 | using System.Collections.Generic;
8 | using System.Diagnostics;
9 | using System.Text;
10 | using Xunit;
11 |
12 | namespace NetSparkleUnitTests
13 | {
14 | public class AppCastItemTests
15 | {
16 | [Theory]
17 | [InlineData(null, true, false, false)]
18 | [InlineData("win", true, false, false)]
19 | [InlineData("windows", true, false, false)]
20 | [InlineData("WINDOWS", true, false, false)]
21 | [InlineData("WIndOWS", true, false, false)]
22 | [InlineData("win-x64", true, false, false)]
23 | [InlineData("win-arm", true, false, false)]
24 | [InlineData("windows-arm", true, false, false)]
25 | [InlineData("windows-x86", true, false, false)]
26 | [InlineData("mac", false, true, false)]
27 | [InlineData("macos", false, true, false)]
28 | [InlineData("osx", false, true, false)]
29 | [InlineData("mac-x86", false, true, false)]
30 | [InlineData("macOS-x86", false, true, false)]
31 | [InlineData("macos-arm", false, true, false)]
32 | [InlineData("macos-x64", false, true, false)]
33 | [InlineData("osx-x86", false, true, false)]
34 | [InlineData("osx-arm", false, true, false)]
35 | [InlineData("osx-x64", false, true, false)]
36 | [InlineData("linux", false, false, true)]
37 | [InlineData("linux-x64", false, false, true)]
38 | [InlineData("linux-arm64", false, false, true)]
39 | [InlineData("linux-arm", false, false, true)]
40 | public void CanCheckOSProperly(string osString, bool isWindowsUpdate, bool isMacUpdate, bool isLinuxUpdate)
41 | {
42 | var item = new AppCastItem() { OperatingSystem = osString };
43 | Assert.Equal(item.IsWindowsUpdate, isWindowsUpdate);
44 | Assert.Equal(item.IsMacOSUpdate, isMacUpdate);
45 | Assert.Equal(item.IsLinuxUpdate, isLinuxUpdate);
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/src/NetSparkle.Tests/ConfigurationTests.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using NetSparkleUpdater.Configurations;
4 | using Xunit;
5 |
6 | namespace NetSparkleUnitTests
7 | {
8 | public class ConfigurationTests
9 | {
10 | [Fact]
11 | public void CanUseCustomJsonConfigPath()
12 | {
13 | // create tmp file
14 | var path = Path.Combine(Path.GetTempPath(), "SparkleUpdaterTesting");
15 | if (!Directory.Exists(path))
16 | {
17 | Directory.CreateDirectory(path);
18 | }
19 | try
20 | {
21 | var jsonConfig = new JSONConfiguration(new FakeTestDataAssemblyAccessor()
22 | {
23 | AssemblyCompany = "UnitTest",
24 | AssemblyProduct = "UnitTest"
25 | }, path);
26 | Assert.Equal(path, jsonConfig.GetSavePath());
27 | }
28 | finally
29 | {
30 | // clean up created signature manager even if test fails
31 | // get rid of temp file
32 | Directory.Delete(path);
33 | }
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/NetSparkle.Tests/EmptyTestDataConfiguration.cs:
--------------------------------------------------------------------------------
1 | using NetSparkleUpdater.Configurations;
2 | using NetSparkleUpdater.Interfaces;
3 |
4 | namespace NetSparkleUnitTests
5 | {
6 | public class EmptyTestDataConfiguration : Configuration
7 | {
8 | public EmptyTestDataConfiguration(IAssemblyAccessor accessor) : base(accessor)
9 | {
10 | }
11 |
12 | public override void Reload()
13 | {
14 | }
15 | }
16 | }
--------------------------------------------------------------------------------
/src/NetSparkle.Tests/FakeTestDataAssemblyAccessor.cs:
--------------------------------------------------------------------------------
1 | using NetSparkleUpdater.Interfaces;
2 |
3 | namespace NetSparkleUnitTests
4 | {
5 | public class FakeTestDataAssemblyAccessor : IAssemblyAccessor
6 | {
7 | public string AssemblyCompany { get; set; }
8 | public string AssemblyCopyright { get; set; }
9 | public string AssemblyDescription { get; set; }
10 | public string AssemblyTitle { get; set; }
11 | public string AssemblyProduct { get; set; }
12 | public string AssemblyVersion { get; set; }
13 | }
14 | }
--------------------------------------------------------------------------------
/src/NetSparkle.Tests/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // Setting ComVisible to false makes the types in this assembly not visible
6 | // to COM components. If you need to access a type in this assembly from
7 | // COM, set the ComVisible attribute to true on that type.
8 | [assembly: ComVisible(false)]
9 |
10 | // The following GUID is for the ID of the typelib if this project is exposed to COM
11 | [assembly: Guid("e50ac3a5-6c63-40d7-a4c4-9b359efd5707")]
12 |
--------------------------------------------------------------------------------
/src/NetSparkle.Tests/SemVerLikeTests.cs:
--------------------------------------------------------------------------------
1 | using NetSparkleUpdater.AppCastHandlers;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using Xunit;
8 |
9 | namespace NetSparkleUnitTests
10 | {
11 | public class SemVerLikeTests
12 | {
13 | [Theory]
14 | [InlineData("1.0", "1.0", "")]
15 | [InlineData("1.0-alpha.1", "1.0", "-alpha.1")]
16 | [InlineData("1.0-alpha.1+123", "1.0", "-alpha.1+123")]
17 | [InlineData("1.0+123", "1.0", "+123")]
18 | public void ParseTests(string input, string version, string allSuffixes)
19 | {
20 | var parsed = SemVerLike.Parse(input);
21 | Assert.Equal(expected: version, parsed.Version);
22 | Assert.Equal(expected: allSuffixes, parsed.AllSuffixes);
23 | }
24 |
25 | [Theory]
26 | [InlineData("0.1", "1.0", -1)]
27 | [InlineData("1.1", "0.0", 1)]
28 | [InlineData("1.0", "1.0", 0)]
29 | [InlineData("1.0", "1.0-alpha.1", 1)]
30 | [InlineData("1.0-alpha.1", "1.0-alpha.1", 0)]
31 | [InlineData("1.0-alpha.1", "1.0", -1)]
32 | [InlineData("100.0", "11.999.999", 1)]
33 | [InlineData("11.999.999", "100.0", -1)]
34 | [InlineData("1.0-alpha.1", "1.0-alpha.2", -1)]
35 | [InlineData("1.0-alpha.2", "1.0-alpha.1", 1)]
36 | [InlineData("1.0-alpha.1", "1.0-beta.2", -1)]
37 | [InlineData("1.0-rc.1", "1.0-beta.2", 1)]
38 | [InlineData("1", "1", 0)]
39 | [InlineData("1", "2", -1)]
40 | [InlineData("2", "1", 1)]
41 | public void CompareTest(string left, string right, int result)
42 | {
43 | Assert.Equal(
44 | expected: result,
45 | actual: SemVerLike.Parse(left).CompareTo(SemVerLike.Parse(right))
46 | );
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/src/NetSparkle.Tests/SparkleUpdaterTestCollection.cs:
--------------------------------------------------------------------------------
1 | using Xunit;
2 |
3 | namespace NetSparkleUnitTests
4 | {
5 | [CollectionDefinition(SparkleUpdaterFixture.CollectionName)]
6 | public class SparkleUpdaterTestCollection : ICollectionFixture
7 | {
8 |
9 | }
10 | }
--------------------------------------------------------------------------------
/src/NetSparkle.Tests/StringCastDataDownloader.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Text;
3 | using System.Threading.Tasks;
4 | using NetSparkleUpdater.Interfaces;
5 |
6 | namespace NetSparkleUnitTests
7 | {
8 | public class StringCastDataDownloader : IAppCastDataDownloader
9 | {
10 | private string _data = null;
11 |
12 | public StringCastDataDownloader(string data)
13 | {
14 | _data = data;
15 | }
16 |
17 | public string DownloadAndGetAppCastData(string url)
18 | {
19 | return _data;
20 | }
21 |
22 | public Task DownloadAndGetAppCastDataAsync(string url)
23 | {
24 | return Task.FromResult(_data);
25 | }
26 |
27 | public Encoding GetAppCastEncoding()
28 | {
29 | return Encoding.UTF8;
30 | }
31 | }
32 | }
--------------------------------------------------------------------------------
/src/NetSparkle.Tests/VersionTrimmersTests.cs:
--------------------------------------------------------------------------------
1 | using NetSparkleUpdater.AppCastHandlers;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using Xunit;
8 |
9 | namespace NetSparkleUnitTests
10 | {
11 | public class VersionTrimmersTests
12 | {
13 | [Theory]
14 | [InlineData("2.1", "2.1")]
15 | [InlineData("1.2.3", "1.2.3")]
16 | [InlineData("1.2.3.4", "1.2.3.4")]
17 | [InlineData("0.1-alpha.1", "0.1")]
18 | [InlineData("0.2+123", "0.2")]
19 | public void DefaultVersionTrimmerTest(string from, string to)
20 | {
21 | Assert.Equal(
22 | expected: to,
23 | actual: VersionTrimmers.DefaultVersionTrimmer(SemVerLike.Parse(from)).ToString()
24 | );
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/NetSparkle.Tests/appcast_simple.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | NetSparkle Test App
5 | https://netsparkleupdater.github.io/NetSparkle/files/sample-app/appcast.xml
6 | Most recent changes with links to updates.
7 | en
8 | -
9 |
Version 2.0
10 |
11 | https://netsparkleupdater.github.io/NetSparkle/files/sample-app/2.0-release-notes.md
12 |
13 | Fri, 28 Oct 2016 10:30:00 +0000
14 |
20 |
21 | -
22 |
Version 1.3
23 |
24 | https://netsparkleupdater.github.io/NetSparkle/files/sample-app/1.3-release-notes.md
25 |
26 | Thu, 27 Oct 2016 10:30:00 +0000
27 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/src/NetSparkle.Tests/appcast_with_beta_items.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | NetSparkle Test App
5 | https://netsparkleupdater.github.io/NetSparkle/files/sample-app/appcast.xml
6 | Most recent changes with links to updates.
7 | en
8 | -
9 |
Version 2.1-prerelease
10 |
11 | https://netsparkleupdater.github.io/NetSparkle/files/sample-app/2.1-release-notes.md
12 |
13 | Wed, 28 Oct 2020 10:30:00 +0000
14 |
20 |
21 | -
22 |
Version 2.0
23 |
24 | https://netsparkleupdater.github.io/NetSparkle/files/sample-app/2.0-release-notes.md
25 |
26 | Fri, 28 Oct 2016 10:30:00 +0000
27 |
33 |
34 | -
35 |
Version 1.3
36 |
37 | https://netsparkleupdater.github.io/NetSparkle/files/sample-app/1.3-release-notes.md
38 |
39 | Thu, 27 Oct 2016 10:30:00 +0000
40 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/src/NetSparkle.Tools.AppCastGenerator/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/NetSparkle.Tools.AppCastGenerator/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // Setting ComVisible to false makes the types in this assembly not visible
6 | // to COM components. If you need to access a type in this assembly from
7 | // COM, set the ComVisible attribute to true on that type.
8 | [assembly: ComVisible(false)]
9 |
10 | // The following GUID is for the ID of the typelib if this project is exposed to COM
11 | [assembly: Guid("19f0d329-2127-4788-8afa-ddeda4b70f88")]
12 |
--------------------------------------------------------------------------------
/src/NetSparkle.Tools.DSAHelper/NetSparkleDSAHelper.csproj.vspscc:
--------------------------------------------------------------------------------
1 | ""
2 | {
3 | "FILE_VERSION" = "9237"
4 | "ENLISTMENT_CHOICE" = "NEVER"
5 | "PROJECT_FILE_RELATIVE_PATH" = ""
6 | "NUMBER_OF_EXCLUDED_FILES" = "0"
7 | "ORIGINAL_PROJECT_FILE_PATH" = ""
8 | "NUMBER_OF_NESTED_PROJECTS" = "0"
9 | "SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
10 | }
11 |
--------------------------------------------------------------------------------
/src/NetSparkle.Tools.DSAHelper/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("NetSparkleDSAHelper")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("Microsoft")]
12 | [assembly: AssemblyProduct("NetSparkleDSAHelper")]
13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("291f546c-72d0-43b7-becb-518ffdf3bab7")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/src/NetSparkle.Tools.DSAHelper/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/src/NetSparkle.UI.Avalonia/CheckingForUpdatesWindow.axaml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
22 |
28 |
34 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/src/NetSparkle.UI.Avalonia/CheckingForUpdatesWindow.axaml.cs:
--------------------------------------------------------------------------------
1 | using Avalonia;
2 | using Avalonia.Controls;
3 | using Avalonia.Media.Imaging;
4 | using NetSparkleUpdater.Interfaces;
5 | using System;
6 |
7 | namespace NetSparkleUpdater.UI.Avalonia
8 | {
9 | ///
10 | /// Interaction logic for CheckingForUpdatesWindow.xaml.
11 | ///
12 | /// Window that shows while NetSparkle is checking for updates.
13 | ///
14 | public partial class CheckingForUpdatesWindow : Window, ICheckingForUpdates
15 | {
16 | ///
17 | public event EventHandler? UpdatesUIClosing;
18 |
19 | ///
20 | /// Create the window that tells the user that SparkleUpdater is checking
21 | /// for updates
22 | ///
23 | public CheckingForUpdatesWindow()
24 | {
25 | this.InitializeComponent();
26 | Closing += CheckingForUpdatesWindow_Closing;
27 | }
28 |
29 | ///
30 | /// Create the window that tells the user that SparkleUpdater is checking
31 | /// for updates with a given bitmap to use as an icon/graphic
32 | ///
33 | /// The bitmap to use for the application logo/graphic
34 | public CheckingForUpdatesWindow(Bitmap? iconBitmap)
35 | {
36 | this.InitializeComponent();
37 | #if DEBUG
38 | this.AttachDevTools();
39 | #endif
40 | Closing += CheckingForUpdatesWindow_Closing;
41 | var imageControl = this.FindControl("AppIcon");
42 | if (imageControl != null)
43 | {
44 | imageControl.Source = iconBitmap;
45 | }
46 | }
47 |
48 | private void CheckingForUpdatesWindow_Closing(object? sender, System.ComponentModel.CancelEventArgs e)
49 | {
50 | Closing -= CheckingForUpdatesWindow_Closing;
51 | UpdatesUIClosing?.Invoke(sender, new EventArgs());
52 | }
53 |
54 | void ICheckingForUpdates.Close()
55 | {
56 | Close();
57 | }
58 |
59 | void ICheckingForUpdates.Show()
60 | {
61 | Show();
62 | }
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/src/NetSparkle.UI.Avalonia/Helpers/ChangeNotifier.cs:
--------------------------------------------------------------------------------
1 | using System.ComponentModel;
2 | using System.Runtime.CompilerServices;
3 |
4 | namespace NetSparkleUpdater.UI.Avalonia.Helpers
5 | {
6 | ///
7 | /// implementation used for the WPF UI and its view models.
8 | ///
9 | /// https://docs.microsoft.com/en-us/dotnet/api/system.componentmodel.inotifypropertychanged?view=netframework-4.7.2
10 | ///
11 | ///
12 | public class ChangeNotifier : INotifyPropertyChanged
13 | {
14 | ///
15 | /// Event to listen to property changes on some object
16 | ///
17 | public event PropertyChangedEventHandler? PropertyChanged;
18 |
19 | ///
20 | /// Notify the listener that a property of the given name has changed
21 | ///
22 | /// string name of the property that was changed
23 | protected void NotifyPropertyChanged([CallerMemberName] string propertyName = "")
24 | {
25 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/NetSparkle.UI.Avalonia/Interfaces/IBackgroundColorChanger.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using Avalonia.Media;
5 |
6 | namespace NetSparkleUpdater.UI.Avalonia.Interfaces
7 | {
8 | ///
9 | /// Interface for objects that have the ability to change background color
10 | ///
11 | public interface IBackgroundColorChanger
12 | {
13 | ///
14 | /// Change background color to a specific color
15 | ///
16 | /// color to change background to
17 | void ChangeBackgroundColor(Brush color);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/NetSparkle.UI.Avalonia/Interfaces/IReleaseNotesDisplayer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace NetSparkleUpdater.UI.Avalonia.Interfaces
6 | {
7 | ///
8 | /// Interface for objects that have the ability to show release notes to the user.
9 | /// Used by the UpdateAvailableWindow and its view model to coordinate when the
10 | /// release notes should be shown.
11 | ///
12 | public interface IReleaseNotesDisplayer
13 | {
14 | ///
15 | /// Show the given release notes to the user
16 | ///
17 | /// string of HTML release notes to show to the end-user
18 | void ShowReleaseNotes(string htmlNotes);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/NetSparkle.UI.Avalonia/Interfaces/IUserRespondedToUpdateCheck.cs:
--------------------------------------------------------------------------------
1 | using NetSparkleUpdater.Enums;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Text;
5 |
6 | namespace NetSparkleUpdater.UI.Avalonia.Interfaces
7 | {
8 | ///
9 | /// Interface that allows one object to tell another that the user has
10 | /// responded to an update check with a given response. Used by the
11 | /// 's view model.
12 | ///
13 | public interface IUserRespondedToUpdateCheck
14 | {
15 | ///
16 | /// The user responded to a given update check with some sort of response
17 | /// (e.g. skip update, install update)
18 | ///
19 | /// The user's response to the update notification
20 | void UserRespondedToUpdateCheck(UpdateAvailableResult response);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/NetSparkle.UI.Avalonia/MessageNotificationWindow.axaml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
24 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/src/NetSparkle.UI.Avalonia/MessageNotificationWindow.axaml.cs:
--------------------------------------------------------------------------------
1 | using Avalonia;
2 | using Avalonia.Controls;
3 | using Avalonia.Markup.Xaml;
4 | using Avalonia.Media.Imaging;
5 | using NetSparkleUpdater.UI.Avalonia.ViewModels;
6 |
7 | namespace NetSparkleUpdater.UI.Avalonia
8 | {
9 | ///
10 | /// Interaction logic for MessageNotificationWindow.xaml.
11 | ///
12 | /// Window that shows a single message to the user (usually an error) regarding
13 | /// a software update.
14 | ///
15 | public partial class MessageNotificationWindow : Window
16 | {
17 | ///
18 | /// Construct the notification window for the message notification with the default
19 | /// .
20 | ///
21 | public MessageNotificationWindow()
22 | {
23 | this.InitializeComponent();
24 | DataContext = new MessageNotificationWindowViewModel();
25 | }
26 |
27 | ///
28 | /// Construct the notification window for the message notification with the provided
29 | ///
30 | ///
31 | /// view model that has info on the message to show to the user
32 | /// Bitmap to use for the app's icon/graphic. Not currently used.
33 | public MessageNotificationWindow(MessageNotificationWindowViewModel viewModel, Bitmap? iconBitmap)
34 | {
35 | this.InitializeComponent();
36 | DataContext = viewModel;
37 | /*var imageControl = this.FindControl("AppIcon");
38 | if (imageControl != null)
39 | {
40 | imageControl.Source = iconBitmap;
41 | }*/
42 | }
43 |
44 | ///
45 | /// Close the message window
46 | ///
47 | public void CloseMessage()
48 | {
49 | Close();
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/NetSparkle.UI.Avalonia/ViewModels/MessageNotificationWindowViewModel.cs:
--------------------------------------------------------------------------------
1 | using NetSparkleUpdater.UI.Avalonia.Helpers;
2 |
3 | namespace NetSparkleUpdater.UI.Avalonia.ViewModels
4 | {
5 | ///
6 | /// A view model for showing a single message to the user
7 | ///
8 | public class MessageNotificationWindowViewModel : ChangeNotifier
9 | {
10 | private string _message;
11 |
12 | ///
13 | /// Initialize the view model with an empty string for its message
14 | ///
15 | public MessageNotificationWindowViewModel()
16 | {
17 | _message = "";
18 | }
19 |
20 | ///
21 | /// Initialize the view model with the given message
22 | ///
23 | /// the message to show the user
24 | public MessageNotificationWindowViewModel(string message)
25 | {
26 | _message = message;
27 | }
28 |
29 | ///
30 | /// The message to show to the user
31 | ///
32 | public string Message
33 | {
34 | get => _message;
35 | set { _message = value; NotifyPropertyChanged(); }
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/NetSparkle.UI.WPF/CheckingForUpdatesWindow.xaml:
--------------------------------------------------------------------------------
1 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
35 |
42 |
48 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/src/NetSparkle.UI.WPF/CheckingForUpdatesWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using NetSparkleUpdater.Interfaces;
2 | using System;
3 | using System.Windows;
4 |
5 | namespace NetSparkleUpdater.UI.WPF
6 | {
7 | ///
8 | /// Interaction logic for CheckingForUpdatesWindow.xaml.
9 | ///
10 | /// Window that shows while NetSparkle is checking for updates.
11 | ///
12 | public partial class CheckingForUpdatesWindow : Window, ICheckingForUpdates
13 | {
14 | ///
15 | public event EventHandler? UpdatesUIClosing;
16 |
17 | ///
18 | /// Create the window that tells the user that SparkleUpdater is checking
19 | /// for updates
20 | ///
21 | public CheckingForUpdatesWindow()
22 | {
23 | InitializeComponent();
24 | Closing += CheckingForUpdatesWindow_Closing;
25 | }
26 |
27 | private void CheckingForUpdatesWindow_Closing(object? sender, System.ComponentModel.CancelEventArgs e)
28 | {
29 | Closing -= CheckingForUpdatesWindow_Closing;
30 | UpdatesUIClosing?.Invoke(sender, new EventArgs());
31 | }
32 |
33 | void ICheckingForUpdates.Close()
34 | {
35 | Close();
36 | }
37 |
38 | void ICheckingForUpdates.Show()
39 | {
40 | Show();
41 | }
42 |
43 | private void CancelButton_Click(object sender, RoutedEventArgs e)
44 | {
45 | Close();
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/src/NetSparkle.UI.WPF/Helpers/ChangeNotifier.cs:
--------------------------------------------------------------------------------
1 | using System.ComponentModel;
2 | using System.Runtime.CompilerServices;
3 |
4 | namespace NetSparkleUpdater.UI.WPF.Helpers
5 | {
6 | ///
7 | /// implementation used for the WPF UI and its view models.
8 | ///
9 | /// https://docs.microsoft.com/en-us/dotnet/api/system.componentmodel.inotifypropertychanged?view=netframework-4.7.2
10 | ///
11 | ///
12 | public class ChangeNotifier : INotifyPropertyChanged
13 | {
14 | ///
15 | /// Event to listen to property changes on some object
16 | ///
17 | public event PropertyChangedEventHandler? PropertyChanged;
18 |
19 | ///
20 | /// Notify the listener that a property of the given name has changed
21 | ///
22 | /// string name of the property that was changed
23 | protected void NotifyPropertyChanged([CallerMemberName] string propertyName = "")
24 | {
25 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/NetSparkle.UI.WPF/IconUtilities.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Drawing;
4 | using System.Text;
5 | using System.Windows;
6 | using System.Windows.Interop;
7 | using System.Windows.Media;
8 | using System.Windows.Media.Imaging;
9 |
10 | namespace NetSparkleUpdater.UI.WPF
11 | {
12 | ///
13 | /// Helper class for processing objects and
14 | /// converting them to objects
15 | ///
16 | public class IconUtilities
17 | {
18 | ///
19 | /// Convert System.Drawing.Icon to System.Windows.Media.ImageSource.
20 | /// From: https://stackoverflow.com/a/6580799/3938401
21 | ///
22 | /// The that should be converted to an
23 | /// An representation of the given icon if is non-null
24 | public static ImageSource? ToImageSource(Icon? icon)
25 | {
26 | if (icon == null)
27 | {
28 | return null;
29 | }
30 |
31 | ImageSource imageSource = Imaging.CreateBitmapSourceFromHIcon(
32 | icon.Handle,
33 | Int32Rect.Empty,
34 | BitmapSizeOptions.FromEmptyOptions());
35 |
36 | return imageSource;
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/NetSparkle.UI.WPF/Interfaces/IReleaseNotesDisplayer.cs:
--------------------------------------------------------------------------------
1 |
2 | namespace NetSparkleUpdater.UI.WPF.Interfaces
3 | {
4 | ///
5 | /// Interface for objects that have the ability to show release notes to the user.
6 | /// Used by the UpdateAvailableWindow and its view model to coordinate when the
7 | /// release notes should be shown.
8 | ///
9 | public interface IReleaseNotesDisplayer
10 | {
11 | ///
12 | /// Show the given release notes to the user
13 | ///
14 | /// string of HTML release notes to show to the end-user
15 | void ShowReleaseNotes(string htmlNotes);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/NetSparkle.UI.WPF/Interfaces/IUserRespondedToUpdateCheck.cs:
--------------------------------------------------------------------------------
1 | using NetSparkleUpdater.Enums;
2 |
3 | namespace NetSparkleUpdater.UI.WPF.Interfaces
4 | {
5 | ///
6 | /// Interface that allows one object to tell another that the user has
7 | /// responded to an update check with a given response. Used by the
8 | /// 's view model.
9 | ///
10 | public interface IUserRespondedToUpdateCheck
11 | {
12 | ///
13 | /// The user responded to a given update check with some sort of response
14 | /// (e.g. skip update, install update)
15 | ///
16 | /// The user's response to the update notification
17 | void UserRespondedToUpdateCheck(UpdateAvailableResult response);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/NetSparkle.UI.WPF/MessageNotificationWindow.xaml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 |
20 |
21 |
30 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/src/NetSparkle.UI.WPF/MessageNotificationWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using NetSparkleUpdater.UI.WPF.ViewModels;
2 | using System.Windows;
3 |
4 | namespace NetSparkleUpdater.UI.WPF
5 | {
6 | ///
7 | /// Interaction logic for MessageNotificationWindow.xaml.
8 | ///
9 | /// Window that shows a single message to the user (usually an error) regarding
10 | /// a software update.
11 | ///
12 | public partial class MessageNotificationWindow : Window
13 | {
14 | ///
15 | /// Construct the notification window for the message notification with the default
16 | /// .
17 | ///
18 | public MessageNotificationWindow()
19 | {
20 | InitializeComponent();
21 | DataContext = new MessageNotificationWindowViewModel();
22 | }
23 |
24 | ///
25 | /// Construct the notification window for the message notification with the provided
26 | ///
27 | ///
28 | /// view model that has info on the message to show to the user
29 | public MessageNotificationWindow(MessageNotificationWindowViewModel viewModel)
30 | {
31 | InitializeComponent();
32 | DataContext = viewModel;
33 | }
34 |
35 | private void Button_Click(object sender, RoutedEventArgs e)
36 | {
37 | Close();
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/NetSparkle.UI.WPF/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // Setting ComVisible to false makes the types in this assembly not visible
6 | // to COM components. If you need to access a type in this assembly from
7 | // COM, set the ComVisible attribute to true on that type.
8 | [assembly: ComVisible(false)]
9 |
10 | // The following GUID is for the ID of the typelib if this project is exposed to COM
11 | [assembly: Guid("6915843c-7947-4268-b569-6f5684651df4")]
12 |
--------------------------------------------------------------------------------
/src/NetSparkle.UI.WPF/ToastNotification.xaml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
32 |
33 |
42 |
51 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/src/NetSparkle.UI.WPF/ViewModels/MessageNotificationWindowViewModel.cs:
--------------------------------------------------------------------------------
1 | using NetSparkleUpdater.UI.WPF.Helpers;
2 |
3 | namespace NetSparkleUpdater.UI.WPF.ViewModels
4 | {
5 | ///
6 | /// A view model for showing a single message to the user
7 | ///
8 | public class MessageNotificationWindowViewModel : ChangeNotifier
9 | {
10 | private string _message;
11 |
12 | ///
13 | /// Initialize the view model with an empty string for its message
14 | ///
15 | public MessageNotificationWindowViewModel()
16 | {
17 | _message = "";
18 | }
19 |
20 | ///
21 | /// Initialize the view model with the given message
22 | ///
23 | /// the message to show the user
24 | public MessageNotificationWindowViewModel(string message)
25 | {
26 | _message = message;
27 | }
28 |
29 | ///
30 | /// The message to show to the user
31 | ///
32 | public string Message
33 | {
34 | get => _message;
35 | set { _message = value; NotifyPropertyChanged(); }
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/NetSparkle.UI.WinForms.NetCore/MessageNotificationWindow.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace NetSparkleUpdater.UI.WinForms
12 | {
13 | ///
14 | /// An alert box
15 | ///
16 | public partial class MessageNotificationWindow : Form
17 | {
18 | ///
19 | /// Constructor
20 | ///
21 | public MessageNotificationWindow()
22 | {
23 | InitializeComponent();
24 | }
25 |
26 | ///
27 | /// Constructor
28 | ///
29 | /// Window title
30 | /// Message
31 | /// Your application Icon
32 | public MessageNotificationWindow(string title, string message, Icon? applicationIcon = null)
33 | {
34 | InitializeComponent();
35 | Text = title;
36 | if (applicationIcon != null)
37 | {
38 | Icon = applicationIcon;
39 | iconImage.Image = new Icon(applicationIcon, new Size(48, 48)).ToBitmap();
40 | }
41 | lblMessage.Text = message;
42 | FormBorderStyle = FormBorderStyle.FixedDialog;
43 | }
44 |
45 | private void OK_Click(object? sender, EventArgs e)
46 | {
47 | Close();
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/src/NetSparkle.UI.WinForms.NetFramework/MessageNotificationWindow.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace NetSparkleUpdater.UI.WinForms
12 | {
13 | ///
14 | /// An alert box
15 | ///
16 | public partial class MessageNotificationWindow : Form
17 | {
18 | ///
19 | /// Constructor
20 | ///
21 | public MessageNotificationWindow()
22 | {
23 | InitializeComponent();
24 | }
25 |
26 | ///
27 | /// Constructor
28 | ///
29 | /// Window title
30 | /// Message
31 | /// Your application Icon
32 | public MessageNotificationWindow(string title, string message, Icon? applicationIcon = null)
33 | {
34 | InitializeComponent();
35 | Text = title;
36 | if (applicationIcon != null)
37 | {
38 | Icon = applicationIcon;
39 | iconImage.Image = new Icon(applicationIcon, new Size(48, 48)).ToBitmap();
40 | }
41 | lblMessage.Text = message;
42 | FormBorderStyle = FormBorderStyle.FixedDialog;
43 | }
44 |
45 | private void OK_Click(object? sender, EventArgs e)
46 | {
47 | Close();
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/src/NetSparkle.UI.WinForms.NetFramework/NetSparkle.UI.WinForms.NetFramework.csproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Form
7 |
8 |
9 | Form
10 |
11 |
12 | Form
13 |
14 |
15 | Form
16 |
17 |
18 | Form
19 |
20 |
21 |
--------------------------------------------------------------------------------
/src/NetSparkle.UI.WinForms.NetFramework/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("NetSparkle.UI.WinForms.NetFramework")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("NetSparkle.UI.WinForms.NetFramework")]
13 | [assembly: AssemblyCopyright("Copyright © 2025")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("45f5aadb-a39b-446f-8025-71647238bb89")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("2.0.0.0")]
36 | [assembly: AssemblyFileVersion("2.0.0.0")]
37 |
--------------------------------------------------------------------------------
/src/NetSparkle/AppCast.cs:
--------------------------------------------------------------------------------
1 | using NetSparkleUpdater;
2 | using NetSparkleUpdater.Configurations;
3 | using NetSparkleUpdater.Interfaces;
4 | using System.Collections.Generic;
5 | using System.Text.Json;
6 | using System.Text.Json.Serialization;
7 |
8 | namespace NetSparkleUpdater
9 | {
10 | ///
11 | /// An XML-based app cast document downloader and handler
12 | ///
13 | public class AppCast
14 | {
15 | ///
16 | /// App cast title (usually the name of the application)
17 | ///
18 | [JsonPropertyName("title")]
19 | public string? Title { get; set; }
20 |
21 | ///
22 | /// App cast language (e.g. "en")
23 | ///
24 | [JsonPropertyName("language")]
25 | public string? Language { get; set; }
26 |
27 | ///
28 | /// App cast description (e.g. "updates for my application").
29 | /// Defaults to "Most recent changes with links to updates"
30 | ///
31 | [JsonPropertyName("description")]
32 | public string? Description { get; set; }
33 |
34 | ///
35 | /// Link to location to download this app cast
36 | ///
37 | [JsonPropertyName("link")]
38 | public string? Link { get; set; }
39 |
40 | ///
41 | /// List of that were parsed in the app cast
42 | ///
43 | [JsonPropertyName("items")]
44 | public List Items { get; set; }
45 |
46 | ///
47 | /// Default constructor for objects.
48 | /// Sets ` to an empty list and sets
49 | /// to "Most recent changes with links to updates".
50 | ///
51 | public AppCast()
52 | {
53 | Items = new List();
54 | Description = "Most recent changes with links to updates";
55 | }
56 | }
57 | }
--------------------------------------------------------------------------------
/src/NetSparkle/AppCastHandlers/AppCastReducerDelegate.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace NetSparkleUpdater.AppCastHandlers
4 | {
5 | ///
6 | /// Filter AppCast with SemVerLike version specification.
7 | ///
8 | ///
9 | /// Implementor has responsibility to both order the versions in the app cast
10 | /// (put the ones you want in order starting at index 0) and filter out items you don't want at all.
11 | ///
12 | /// Consider these use cases:
13 | /// - If there is no interest in older versions, exclude them from collection.
14 | /// - If there is no interest in a version to be installed, return empty collection.
15 | /// - If there is an intention to install a Beta version, return it as first of the collection.
16 | /// - If there is an intention to reject any Beta versions, return non Beta versions as a collection.
17 | ///
18 | /// Installed version of app
19 | /// AppCastItem candidate updates
20 | /// An enumerable of app casts NetSparkle should use
21 | public delegate IEnumerable AppCastReducerDelegate(SemVerLike installed, IEnumerable items);
22 | }
23 |
--------------------------------------------------------------------------------
/src/NetSparkle/AppCastHandlers/VersionTrimmerDelegate.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace NetSparkleUpdater.AppCastHandlers
4 | {
5 | ///
6 | /// Trim SemVerLike so that it can be used as a .NET style Version
7 | ///
8 | /// The original version specified
9 | /// Down graded version specification
10 | public delegate Version VersionTrimmerDelegate(SemVerLike semVerLike);
11 | }
12 |
--------------------------------------------------------------------------------
/src/NetSparkle/AppCastHandlers/VersionTrimmers.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace NetSparkleUpdater.AppCastHandlers
4 | {
5 | ///
6 | /// Implementations of VersionTrimmer
7 | ///
8 | public static class VersionTrimmers
9 | {
10 | ///
11 | /// Remove pre-build and build specification
12 | ///
13 | ///
14 | ///
15 | public static Version DefaultVersionTrimmer(SemVerLike semVerLike)
16 | {
17 | return string.IsNullOrWhiteSpace(semVerLike.Version)
18 | ? new Version(0, 0, 0, 0)
19 | : new Version(semVerLike.Version);
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/NetSparkle/ArtWork/software-update-available-old.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NetSparkleUpdater/NetSparkle/bfce0066ae22cfbe6efb117c41f9fc88e1fb0eaf/src/NetSparkle/ArtWork/software-update-available-old.ico
--------------------------------------------------------------------------------
/src/NetSparkle/ArtWork/software-update-available-old.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NetSparkleUpdater/NetSparkle/bfce0066ae22cfbe6efb117c41f9fc88e1fb0eaf/src/NetSparkle/ArtWork/software-update-available-old.png
--------------------------------------------------------------------------------
/src/NetSparkle/ArtWork/software-update-available.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NetSparkleUpdater/NetSparkle/bfce0066ae22cfbe6efb117c41f9fc88e1fb0eaf/src/NetSparkle/ArtWork/software-update-available.ico
--------------------------------------------------------------------------------
/src/NetSparkle/ArtWork/software-update-available.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NetSparkleUpdater/NetSparkle/bfce0066ae22cfbe6efb117c41f9fc88e1fb0eaf/src/NetSparkle/ArtWork/software-update-available.png
--------------------------------------------------------------------------------
/src/NetSparkle/Configurations/DefaultConfiguration.cs:
--------------------------------------------------------------------------------
1 | using NetSparkleUpdater.Interfaces;
2 |
3 | namespace NetSparkleUpdater.Configurations
4 | {
5 | ///
6 | /// A default configuration that really does nothing.
7 | /// Only used if unable to create another .
8 | ///
9 | public class DefaultConfiguration : Configuration
10 | {
11 | ///
12 | /// Constructor that just sends on the to the parent.
13 | ///
14 | /// IAssemblyAccessor for this
15 | public DefaultConfiguration(IAssemblyAccessor accessor) : base(accessor)
16 | {
17 | }
18 |
19 | ///
20 | public override void Reload()
21 | {
22 | }
23 | }
24 | }
--------------------------------------------------------------------------------
/src/NetSparkle/Configurations/SavedConfigurationData.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace NetSparkleUpdater.Configurations
4 | {
5 | ///
6 | /// Configuration data for this software and NetSparkle instance.
7 | /// Allows you to get information on the versions that the user
8 | /// skipped, when the last update was performed, etc.
9 | /// Used by the class to save/load
10 | /// data easily to/from disk.
11 | ///
12 | public class SavedConfigurationData
13 | {
14 | ///
15 | /// Whether or not to check for an update
16 | ///
17 | public bool CheckForUpdate { get; set; }
18 | ///
19 | /// The last that an update check was performed
20 | ///
21 | public DateTime LastCheckTime { get; set; }
22 | ///
23 | /// The previous version of the software that the user ran
24 | ///
25 | public string? PreviousVersionOfSoftwareRan { get; set; }
26 | ///
27 | /// The last version (as a string) that the user chose
28 | /// to skip.
29 | /// Can be blank.
30 | ///
31 | public string? LastVersionSkipped { get; set; }
32 | ///
33 | /// Whether or not the software has run at least one time.
34 | ///
35 | public bool DidRunOnce { get; set; }
36 | ///
37 | /// Last that the configuration data was updated.
38 | ///
39 | public DateTime LastConfigUpdate { get; set; }
40 |
41 | ///
42 | /// Simple data holder constructor for data that is loaded/saved
43 | /// from various places for info on the app, what version the user has skipped, etc.
44 | ///
45 | public SavedConfigurationData()
46 | {
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/src/NetSparkle/Downloaders/AsyncHelper.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation, Inc. All rights reserved.
2 | // Licensed under the MIT License, Version 2.0. See License.txt in the project root for license information.
3 |
4 | using System;
5 | using System.Globalization;
6 | using System.Threading;
7 | using System.Threading.Tasks;
8 |
9 | namespace NetSparkleUpdater.Downloaders
10 | {
11 | internal static class AsyncHelper
12 | {
13 | private static readonly TaskFactory _myTaskFactory = new TaskFactory(CancellationToken.None,
14 | TaskCreationOptions.None, TaskContinuationOptions.None, TaskScheduler.Default);
15 |
16 | public static TResult RunSync(Func> func)
17 | {
18 | var cultureUi = CultureInfo.CurrentUICulture;
19 | var culture = CultureInfo.CurrentCulture;
20 | return _myTaskFactory.StartNew(() =>
21 | {
22 | Thread.CurrentThread.CurrentCulture = culture;
23 | Thread.CurrentThread.CurrentUICulture = cultureUi;
24 | return func();
25 | }).Unwrap().GetAwaiter().GetResult();
26 | }
27 |
28 | public static void RunSync(Func func)
29 | {
30 | var cultureUi = CultureInfo.CurrentUICulture;
31 | var culture = CultureInfo.CurrentCulture;
32 | _myTaskFactory.StartNew(() =>
33 | {
34 | Thread.CurrentThread.CurrentCulture = culture;
35 | Thread.CurrentThread.CurrentUICulture = cultureUi;
36 | return func();
37 | }).Unwrap().GetAwaiter().GetResult();
38 | }
39 | }
40 | }
--------------------------------------------------------------------------------
/src/NetSparkle/Downloaders/LocalFileAppCastDownloader.cs:
--------------------------------------------------------------------------------
1 | using NetSparkleUpdater.Interfaces;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.IO;
5 | using System.Net;
6 | using System.Net.Http;
7 | using System.Net.Security;
8 | using System.Security.Cryptography.X509Certificates;
9 | using System.Text;
10 | using System.Threading.Tasks;
11 |
12 | namespace NetSparkleUpdater.Downloaders
13 | {
14 | ///
15 | /// Class that takes care of downloading data for an app cast, including the
16 | /// app cast itself as well as the app cast signature (if available). Allows
17 | /// you to send extra JSON with your request for the app cast information.
18 | ///
19 | public class LocalFileAppCastDownloader : IAppCastDataDownloader
20 | {
21 | ///
22 | /// Default constructor for the app cast data downloader. Basically
23 | /// does nothing. :)
24 | ///
25 | public LocalFileAppCastDownloader()
26 | {
27 | }
28 |
29 | ///
30 | /// When handling the string url in DownloadAndGetAppCastData, treat the
31 | /// url as a Uri and use Uri.LocalPath as the path to read text from.
32 | ///
33 | public bool UseLocalUriPath { get; set; } = false;
34 |
35 | ///
36 | public string DownloadAndGetAppCastData(string url)
37 | {
38 | if (UseLocalUriPath)
39 | {
40 | return File.ReadAllText(new Uri(url).LocalPath);
41 | }
42 | return File.ReadAllText(url);
43 | }
44 |
45 | ///
46 | public async Task DownloadAndGetAppCastDataAsync(string url)
47 | {
48 | #if NETFRAMEWORK || NETSTANDARD
49 | return await Utilities.ReadAllTextAsync(UseLocalUriPath ? new Uri(url).LocalPath : url);
50 | #else
51 | return await File.ReadAllTextAsync(UseLocalUriPath ? new Uri(url).LocalPath : url);
52 | #endif
53 | }
54 |
55 | ///
56 | public Encoding GetAppCastEncoding()
57 | {
58 | return Encoding.UTF8;
59 | }
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/src/NetSparkle/Enums/FilterItemResult.cs:
--------------------------------------------------------------------------------
1 | using NetSparkleUpdater.Interfaces;
2 |
3 | namespace NetSparkleUpdater.Enums
4 | {
5 | ///
6 | /// Provides the return values for the GetAvailableUpdates call for the AppCastHelper.
7 | /// When an appcast is downloaded, the AppCastHelper will work out which
8 | /// instances match some criteria for a possible update.
9 | ///
10 | public enum FilterItemResult
11 | {
12 | ///
13 | /// Indicates that the is a validate candidate for installation.
14 | ///
15 | Valid = 0,
16 | ///
17 | /// The is for a different operating system
18 | /// than this one, and must be ignored.
19 | ///
20 | NotThisPlatform = 1,
21 | ///
22 | /// The version indicated by the is less than
23 | /// or equal to the currently installed/running version.
24 | ///
25 | VersionIsOlderThanCurrent = 2,
26 | ///
27 | /// A signature is required to validate the item - but it's missing from the
28 | ///
29 | SignatureIsMissing = 3,
30 | ///
31 | /// Some other issue is going on with this that causes us not to want to use it.
32 | /// Use this FilterItemResult if it doens't fit into one of the other categories.
33 | ///
34 | SomeOtherProblem = 4,
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/NetSparkle/Enums/InstallUpdateFailureReason.cs:
--------------------------------------------------------------------------------
1 | namespace NetSparkleUpdater.Enums
2 | {
3 | ///
4 | /// Failures that could happen as a result of calling SparkleUpdater.InstallUpdate
5 | ///
6 | public enum InstallUpdateFailureReason
7 | {
8 | ///
9 | /// The installer file failed its signature validation check
10 | ///
11 | InvalidSignature = 0,
12 | ///
13 | /// The installer file path points to a file path that does not exist or is null
14 | ///
15 | FileNotFound = 1,
16 | ///
17 | /// Installer command couldn't be built, e.g. due to an invalid installer file type that is
18 | /// not supported
19 | ///
20 | CouldNotBuildInstallerCommand = 2,
21 | ///
22 | /// Install was canceled by user via an event, e.g. InstallerProcessAboutToStart
23 | ///
24 | CanceledByUserViaEvent = 3,
25 | }
26 | }
--------------------------------------------------------------------------------
/src/NetSparkle/Enums/LogWriterOutputMode.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 |
4 | namespace NetSparkleUpdater.Enums
5 | {
6 | ///
7 | /// Output mode for the class
8 | ///
9 | public enum LogWriterOutputMode
10 | {
11 | ///
12 | /// Don't output anything
13 | ///
14 | None = 0,
15 | ///
16 | /// Output to
17 | ///
18 | Console = 1,
19 | ///
20 | /// Output to
21 | ///
22 | Trace = 2,
23 | ///
24 | /// Output to
25 | ///
26 | Debug = 3
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/NetSparkle/Enums/NextUpdateAction.cs:
--------------------------------------------------------------------------------
1 | namespace NetSparkleUpdater.Enums
2 | {
3 | ///
4 | /// Every time when detects an update, the
5 | /// consumer can decide what should happen next with the help
6 | /// of the event
7 | ///
8 | public enum NextUpdateAction
9 | {
10 | ///
11 | /// Show the user interface
12 | ///
13 | ShowStandardUserInterface = 1,
14 | ///
15 | /// Perform an unattended install
16 | ///
17 | PerformUpdateUnattended = 2,
18 | ///
19 | /// Prohibit (don't allow) the update
20 | ///
21 | ProhibitUpdate = 3
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/NetSparkle/Enums/SecurityMode.cs:
--------------------------------------------------------------------------------
1 | namespace NetSparkleUpdater.Enums
2 | {
3 | ///
4 | /// Controls the situations where files have to be signed with the private key.
5 | /// If both a public key and a signature are present, they always have to be valid.
6 | ///
7 | /// We recommend using if at all possible.
8 | ///
9 | /// Note that needs to have
10 | /// set to true in order
11 | /// to verify signatures.
12 | ///
13 | public enum SecurityMode
14 | {
15 | ///
16 | /// All files (with or without signature) will be accepted.
17 | /// This mode is strongly NOT recommended. It can cause critical security issues.
18 | ///
19 | Unsafe = 1,
20 |
21 | ///
22 | /// If there is a public key, the app cast and download file have to be signed.
23 | /// If there isn't a public key, files without a signature will also be accepted.
24 | /// This mode is a mix between Unsafe and Strict and can have some security issues if the
25 | /// public key gets lost in the application.
26 | ///
27 | UseIfPossible = 2,
28 |
29 | ///
30 | /// The app cast and download file have to be signed. This means the public key must exist. This is the default mode.
31 | ///
32 | Strict = 3,
33 |
34 | ///
35 | /// Only verify the signature of software downloads (via an ISignatureVerifier).
36 | /// Do not verify the signature of anything else: app casts, release notes, etc.
37 | ///
38 | OnlyVerifySoftwareDownloads = 4,
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/NetSparkle/Enums/UpdateAvailableResult.cs:
--------------------------------------------------------------------------------
1 | using NetSparkleUpdater.Interfaces;
2 |
3 | namespace NetSparkleUpdater.Enums
4 | {
5 | ///
6 | /// Possible result values for implementation.
7 | ///
8 | public enum UpdateAvailableResult
9 | {
10 | ///
11 | /// No result specified. Default value.
12 | ///
13 | None = 0,
14 |
15 | ///
16 | /// User chose to install the update immediately.
17 | ///
18 | InstallUpdate,
19 |
20 | ///
21 | /// User chose to skip the update.
22 | ///
23 | SkipUpdate,
24 |
25 | ///
26 | /// User chose to remind them later about this update (e.g. close for now, but
27 | /// feel free to tell me about it next time that the software checks for updates).
28 | ///
29 | RemindMeLater
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/NetSparkle/Enums/UpdateStatus.cs:
--------------------------------------------------------------------------------
1 | namespace NetSparkleUpdater.Enums
2 | {
3 | ///
4 | /// Possibilities for the status of an update request
5 | ///
6 | public enum UpdateStatus
7 | {
8 | ///
9 | /// An update is available
10 | ///
11 | UpdateAvailable,
12 | ///
13 | /// No updates are available
14 | ///
15 | UpdateNotAvailable,
16 | ///
17 | /// An update is available, but the user has chosen to skip this version
18 | ///
19 | UserSkipped,
20 | ///
21 | /// There was a problem fetching the appcast
22 | ///
23 | CouldNotDetermine
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/NetSparkle/Enums/UserInteractionMode.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace NetSparkleUpdater.Enums
8 | {
9 | ///
10 | /// Allows for updating the application with or without user interaction.
11 | ///
12 | public enum UserInteractionMode
13 | {
14 | ///
15 | /// Shows the changelog UI automatically (this is the default)
16 | ///
17 | NotSilent,
18 | ///
19 | /// Downloads the latest update file and changelog automatically, but does not
20 | /// show any UI until asked to show UI.
21 | ///
22 | DownloadNoInstall,
23 | ///
24 | /// Downloads the latest update file and automatically runs it as an installer file.
25 | /// WARNING: if you don't tell the user that the application is about to quit
26 | /// to update/run an installer, this setting might be quite the shock to the user!
27 | /// Make sure to implement or
28 | /// so that you can show your users
29 | /// what is about to happen.
30 | ///
31 | DownloadAndInstall,
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/NetSparkle/Enums/ValidationResult.cs:
--------------------------------------------------------------------------------
1 | namespace NetSparkleUpdater.Enums
2 | {
3 | ///
4 | /// Return value of the signature verification check functions.
5 | ///
6 | public enum ValidationResult
7 | {
8 | ///
9 | /// The public key and signature both exist and they are valid (the update file
10 | /// is safe to use).
11 | ///
12 | Valid = 1,
13 |
14 | ///
15 | /// Depending on the used, either the public key or the
16 | /// signature doesn't exist -- or they exist but are not valid.
17 | /// In this case the update file will be rejected.
18 | ///
19 | Invalid = 2,
20 |
21 | ///
22 | /// There wasn't any public key or signature available, and this is OK based on the
23 | /// used.
24 | ///
25 | Unchecked = 3,
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/NetSparkle/Events/DownloadInstallEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace NetSparkleUpdater.Events
4 | {
5 | ///
6 | /// Event called when the download/install window closes
7 | ///
8 | /// Sender of this event
9 | /// DownloadInstallArgs with info on whether to install or not
10 | public delegate void DownloadInstallEventHandler(object sender, DownloadInstallEventArgs args);
11 |
12 | ///
13 | /// Args sent via the DownloadInstallEventHandler when the download/install window closes
14 | ///
15 | public class DownloadInstallEventArgs : EventArgs
16 | {
17 | ///
18 | /// Whether or not the listener should perform the installation process
19 | ///
20 | public bool ShouldInstall { get; set; }
21 |
22 | ///
23 | /// True if the download/install event was already handled; false otherwise
24 | ///
25 | public bool WasHandled { get; set; }
26 |
27 | ///
28 | /// Constructor for DownloadInstallArgs
29 | ///
30 | /// True if the listener should start the download process; false otherwise
31 | public DownloadInstallEventArgs(bool shouldInstall) : base()
32 | {
33 | ShouldInstall = shouldInstall;
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/NetSparkle/Events/UpdateDetectedEventArgs.cs:
--------------------------------------------------------------------------------
1 | using NetSparkleUpdater.Configurations;
2 | using NetSparkleUpdater.Enums;
3 | using System;
4 | using System.Collections.Generic;
5 |
6 | namespace NetSparkleUpdater.Events
7 | {
8 | ///
9 | /// Contains all information for the update detected event
10 | ///
11 | public class UpdateDetectedEventArgs : EventArgs
12 | {
13 | ///
14 | /// The next action to execute after the app user decides how to
15 | /// handle an update
16 | ///
17 | public NextUpdateAction NextAction { get; set; }
18 | ///
19 | /// The application configuration (stores data on last time updates were
20 | /// checked, etc.)
21 | ///
22 | public Configuration ApplicationConfig { get; set; }
23 | ///
24 | /// The latest available version in the app cast
25 | ///
26 | public AppCastItem LatestVersion { get; set; }
27 |
28 | ///
29 | /// All app cast items that were sent in the appcast
30 | ///
31 | public List AppCastItems { get; set; }
32 |
33 | ///
34 | /// Basic constructor for UpdateDetectedEventArgs
35 | ///
36 | /// Next update action for this update (e.g. show UI, perform unattended)
37 | /// for the current application
38 | /// that represents an update for the user
39 | /// All objects available.
40 | public UpdateDetectedEventArgs(NextUpdateAction action, Configuration config, AppCastItem item, List items)
41 | {
42 | NextAction = action;
43 | ApplicationConfig = config;
44 | LatestVersion = item;
45 | AppCastItems = items;
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/src/NetSparkle/Events/UpdateResponseEventArgs.cs:
--------------------------------------------------------------------------------
1 | using NetSparkleUpdater.Enums;
2 | using System;
3 |
4 | namespace NetSparkleUpdater.Events
5 | {
6 | ///
7 | /// Event arguments for when a user responds to an available update UI
8 | ///
9 | public class UpdateResponseEventArgs : EventArgs
10 | {
11 | ///
12 | /// The user's response to the update
13 | ///
14 | public UpdateAvailableResult Result { get; set; }
15 |
16 | ///
17 | /// The that the user is responding to an update notice for
18 | ///
19 | public AppCastItem UpdateItem { get; set; }
20 |
21 | ///
22 | /// Constructor for UpdateResponseArgs that allows for easy setting
23 | /// of the result
24 | ///
25 | /// User's response of type
26 | /// Item that the user is responding to an update message for
27 | public UpdateResponseEventArgs(UpdateAvailableResult result, AppCastItem item) : base()
28 | {
29 | Result = result;
30 | UpdateItem = item;
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/NetSparkle/Interfaces/IAppCastDataDownloader.cs:
--------------------------------------------------------------------------------
1 | using System.Text;
2 | using System.Threading.Tasks;
3 |
4 | namespace NetSparkleUpdater.Interfaces
5 | {
6 | ///
7 | /// Interface used by objects that can download app casts from the internet.
8 | /// Use this interface to provide a custom method of grabbing your app cast
9 | /// from the internet or from a local file.
10 | ///
11 | public interface IAppCastDataDownloader
12 | {
13 | ///
14 | /// Download a string of data at the given URL.
15 | /// Used for both downloading app cast and the app cast's .signature file.
16 | /// Note that you must handle your own exceptions if they occur.
17 | /// Otherwise, will act as though the appcast
18 | /// failed to download.
19 | ///
20 | /// non-null string URL for the place where the app cast can be downloaded
21 | /// The app cast data encoded as a string
22 | string DownloadAndGetAppCastData(string url);
23 |
24 | ///
25 | /// Async download a string of data at the given URL.
26 | /// Used for both downloading app cast and the app cast's .signature file.
27 | /// Note that you must handle your own exceptions if they occur.
28 | /// Otherwise, will act as though the appcast
29 | /// failed to download.
30 | ///
31 | /// non-null string URL for the place where the app cast can be downloaded
32 | /// The app cast data encoded as a string
33 | Task DownloadAndGetAppCastDataAsync(string url);
34 |
35 | ///
36 | /// Get the string encoding (e.g. UTF8 or ASCII) of the
37 | /// app cast file so that it can be converted to bytes.
38 | /// (WebRequestAppCastDataDownloader defaults to UTF8.)
39 | ///
40 | /// The of the app cast
41 | Encoding GetAppCastEncoding();
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/NetSparkle/Interfaces/IAppCastFilter.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using NetSparkleUpdater.AppCastHandlers;
3 |
4 | namespace NetSparkleUpdater.Interfaces
5 | {
6 | ///
7 | /// Provides a way to filter out AppCast item instances that do not apply to the current update process.
8 | /// Can be used to make it possible to revert from a "beta" version to a "stable" one - where the current runtime
9 | /// System.Version value of the Configurations is by definition higher
10 | /// than anything in the "stable" app cast list.
11 | ///
12 | public interface IAppCastFilter
13 | {
14 | ///
15 | /// Filter AppCast with SemVerLike version specification. NOTE: When you use this interface
16 | /// with , you must filter out old versions of
17 | /// yourself if you want that to happen! In other words, skips this step
18 | /// when there is an implementation available.
19 | ///
20 | ///
21 | /// Implementor has responsibility to both order the versions in the app cast if desired
22 | /// (put the ones you want in order starting at index 0) and filter out items you don't want at all.
23 | ///
24 | /// Consider these use cases:
25 | /// - If there is no interest in older versions, exclude them from collection.
26 | /// - If there is no interest in a version to be installed, return empty collection.
27 | /// - If there is an intention to install a Beta version, return it as first of the collection.
28 | /// - If there is an intention to reject any Beta versions, return non Beta versions as a collection.
29 | ///
30 | /// Installed version of app
31 | /// AppCastItem candidate updates
32 | /// An enumerable of app casts NetSparkle should use
33 | IEnumerable GetFilteredAppCastItems(SemVerLike installed, IEnumerable items);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/NetSparkle/Interfaces/IAssemblyAccessor.cs:
--------------------------------------------------------------------------------
1 | namespace NetSparkleUpdater.Interfaces
2 | {
3 | ///
4 | /// An assembly accessor grabs details on the current version
5 | /// and publisher information for a C# application (presumably
6 | /// the one that is currently running). This is intended to be
7 | /// used in conjunction with a Configuration subclass in order
8 | /// to retrieve and store info on the latest version of the app
9 | /// that was used, whether the app has run 1x or not, etc.
10 | /// These fields may or may not be required based on the specific
11 | /// Configuration that you use. At the very least, make sure
12 | /// your IAssemblyAccessor can grab valid info for the title of the
13 | /// application, the product name (which may or may not be the same
14 | /// as the title), and the version of the application (e.g. 3.1.2.0).
15 | ///
16 | public interface IAssemblyAccessor
17 | {
18 | ///
19 | /// The publisher of the application.
20 | /// From < Company > tag in .csproj file
21 | ///
22 | string AssemblyCompany { get; }
23 | ///
24 | /// The copyright for the application (e.g. © 2020)
25 | /// From < Copyright > tag in .csproj file
26 | ///
27 | string AssemblyCopyright { get; }
28 | ///
29 | /// Description of the assembly.
30 | /// From < Description > tag in .csproj file
31 | ///
32 | string AssemblyDescription { get; }
33 | ///
34 | /// Title of the assembly, e.g. "My Best Product"
35 | /// From < AssemblyTitle > tag in .csproj file.
36 | /// NOTE: AssemblyDiagnosticsAccessor returns AssemblyProduct here!
37 | ///
38 | string AssemblyTitle { get; }
39 | ///
40 | /// Product for the assembly. Might be the same as
41 | /// the title, but also could be more specific than the
42 | /// title.
43 | /// From < Product > tag in .csproj file
44 | ///
45 | string AssemblyProduct { get; }
46 | ///
47 | /// Version of the item that's running. E.g. 3.1.2.1 or 3.1.2.1-beta1.
48 | /// From < Version > tag in .csproj file
49 | ///
50 | string AssemblyVersion { get; }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/NetSparkle/Interfaces/ICheckingForUpdates.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace NetSparkleUpdater.Interfaces
4 | {
5 | ///
6 | /// Interface for UIs that tell the user that
7 | /// is checking for updates
8 | ///
9 | public interface ICheckingForUpdates
10 | {
11 | ///
12 | /// Event to fire when the checking for updates UI is closing
13 | ///
14 | event EventHandler? UpdatesUIClosing;
15 |
16 | ///
17 | /// Show the checking for updates UI
18 | ///
19 | void Show();
20 |
21 | ///
22 | /// Close the window/UI that shows the checking for updates UI
23 | ///
24 | void Close();
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/NetSparkle/Interfaces/IDownloadProgress.cs:
--------------------------------------------------------------------------------
1 | using NetSparkleUpdater.Events;
2 |
3 | namespace NetSparkleUpdater.Interfaces
4 | {
5 | ///
6 | /// Interface for UI element that shows the progress bar
7 | /// and a method to install and relaunch the appliction
8 | ///
9 | public interface IDownloadProgress
10 | {
11 | ///
12 | /// Event to fire when the download UI is complete; tells you
13 | /// if the install process should happen or not
14 | ///
15 | event DownloadInstallEventHandler? DownloadProcessCompleted;
16 |
17 | ///
18 | /// Enable or disable the download and install button (such as when your "Can I gracefully close the window?" function is async and you don't
19 | /// want your user to click the button multiple times)
20 | ///
21 | /// True if the button should be enabled; false otherwise
22 | void SetDownloadAndInstallButtonEnabled(bool shouldBeEnabled);
23 |
24 | ///
25 | /// Show the UI for download progress
26 | ///
27 | /// True if download was successful; false otherwise
28 | void Show();
29 |
30 | ///
31 | /// Called when the download progress changes
32 | ///
33 | /// sender of the progress update
34 | /// used to deliver info on download progress (e.g.
35 | /// total bytes downloaded)
36 | void OnDownloadProgressChanged(object sender, ItemDownloadProgressEventArgs args);
37 |
38 | ///
39 | /// Close the download progress UI
40 | ///
41 | void Close();
42 |
43 | ///
44 | /// Update UI to show file is downloaded and signature check result
45 | ///
46 | void FinishedDownloadingFile(bool isDownloadedFileValid);
47 |
48 | ///
49 | /// Show an error message in the download progress window if possible.
50 | ///
51 | /// Error message to display
52 | /// True if message displayed; false otherwise
53 | bool DisplayErrorMessage(string errorMessage);
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/NetSparkle/Interfaces/ILogger.cs:
--------------------------------------------------------------------------------
1 | namespace NetSparkleUpdater.Interfaces
2 | {
3 | ///
4 | /// Interface for objects that can handle log information output
5 | /// (e.g. to a console or a file)
6 | ///
7 | public interface ILogger
8 | {
9 | ///
10 | /// Print a message to the log output.
11 | ///
12 | /// Message to print
13 | /// Arguments to print (e.g. if using {0} format arguments)
14 | void PrintMessage(string message, params object[]? arguments);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/NetSparkle/Interfaces/IUpdateAvailable.cs:
--------------------------------------------------------------------------------
1 | using NetSparkleUpdater.Enums;
2 |
3 | namespace NetSparkleUpdater.Interfaces
4 | {
5 | ///
6 | /// Interface for UI element that shows the release notes,
7 | /// and the skip, install, and later buttons
8 | ///
9 | public interface IUpdateAvailable
10 | {
11 | ///
12 | /// Event fired when the user has responded to the
13 | /// skip, later, install question.
14 | ///
15 | event UserRespondedToUpdate? UserResponded;
16 |
17 | ///
18 | /// Show the UI that displays release notes, etc.
19 | ///
20 | void Show();
21 |
22 | ///
23 | /// Hides the release notes
24 | ///
25 | void HideReleaseNotes();
26 |
27 | ///
28 | /// Hides the remind me later button
29 | ///
30 | void HideRemindMeLaterButton();
31 |
32 | ///
33 | /// Hides the skip update button
34 | ///
35 | void HideSkipButton();
36 |
37 | ///
38 | /// Gets the user choice on how to handle this update (e.g. skip, remind me later)
39 | ///
40 | UpdateAvailableResult Result { get; }
41 |
42 | ///
43 | /// Gets or sets the current item being installed
44 | /// (the item that the user should update to)
45 | ///
46 | AppCastItem CurrentItem { get; }
47 |
48 | ///
49 | /// Brings the update info UI to the front of all windows
50 | ///
51 | void BringToFront();
52 |
53 | ///
54 | /// Close the UI that shows update information
55 | ///
56 | void Close();
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/src/NetSparkle/NetSparkleException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace NetSparkleUpdater
4 | {
5 | ///
6 | /// An exception that occurred during NetSparkleUpdater's operations
7 | ///
8 | [Serializable]
9 | public class NetSparkleException : Exception
10 | {
11 | ///
12 | /// Create an exception with the given message
13 | ///
14 | /// the message to use for this exception
15 | public NetSparkleException(string message) : base(message)
16 | {
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/NetSparkle/SourceGenerationContext.cs:
--------------------------------------------------------------------------------
1 | using NetSparkleUpdater.AppCastHandlers;
2 | using NetSparkleUpdater.Configurations;
3 | using System.Text.Json.Serialization;
4 |
5 | namespace NetSparkleUpdater
6 | {
7 | #if !NETFRAMEWORK && !NETSTANDARD
8 | [JsonSerializable(typeof(AppCast))]
9 | [JsonSerializable(typeof(AppCastItem))]
10 | [JsonSerializable(typeof(SavedConfigurationData))]
11 | [JsonSerializable(typeof(SemVerLike))]
12 | internal partial class SourceGenerationContext : JsonSerializerContext { }
13 | #endif
14 | }
15 |
--------------------------------------------------------------------------------
/src/NetSparkle/UpdateInfo.cs:
--------------------------------------------------------------------------------
1 | using NetSparkleUpdater.Enums;
2 | using System.Collections.Generic;
3 |
4 | namespace NetSparkleUpdater
5 | {
6 | ///
7 | /// A simple class to hold information on potential updates to a software product.
8 | ///
9 | public class UpdateInfo
10 | {
11 | ///
12 | /// Create information about an update with the given status and no available update items
13 | ///
14 | /// Information on whether an update is available
15 | public UpdateInfo(UpdateStatus status) : this(status, null)
16 | {
17 | }
18 |
19 | ///
20 | /// Create information about an update with the given status and update items
21 | ///
22 | /// Information on whether an update is available
23 | /// The list of updates that are available to update to
24 | public UpdateInfo(UpdateStatus status, List? updates)
25 | {
26 | Status = status;
27 | Updates = updates ?? new List();
28 | }
29 |
30 | ///
31 | /// Whether or not an update is available
32 | ///
33 | public UpdateStatus Status { get; set; }
34 |
35 | ///
36 | /// Any available updates for the product that the user could
37 | /// potentially install
38 | ///
39 | public List Updates { get; set; }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------