NetSparkle
An XML-based appcast document downloader and handler
Sparkle XML namespace
App cast title (usually the name of the application)
App cast language (e.g. "en")
Extension (WITHOUT the "." at the start) for the signature
file. Defaults to "signature".
List of that were parsed in the app cast
Create a new object with an empty list of items
Setup the app cast handler info for downloading and parsing app cast information
downloader that will manage the app cast download
(provided by via the
property.
full URL to the app cast file
configuration for handling update intervals/checks
(user skipped versions, etc.)
Object to check signatures of app cast information
object that you can utilize to do any necessary logging
Download castUrl resource and parse it
Parse the app cast XML string into a list of objects.
When complete, the Items list should contain the parsed information
as objects.
the non-null string XML app cast
Returns sorted list of updates between current installed version and latest version in .
Currently installed version is NOT included in the output.
A list of updates that could be installed
Create app cast XML document as an object
The list to include in the output file
Application title/title for the app cast
Link to the where the app cast is going to be downloaded
Text that describes the app cast (e.g. what it provides)
Language of the app cast file
An xml document that describes the list of passed in update items
Item from a Sparkle AppCast file
The application name
The installed version
The item title
The available version
Shortened version
The release notes link
The signature of the Release Notes file
The embedded description
The download link
The signature of the download file
Date item was published
Whether the update was marked critical or not via sparkle:critical
Length of update set via sparkle:length (usually the # of bytes of the update)
Operating system that this update applies to
True if this update is a windows update; false otherwise.
Acceptable OS strings are: "win" or "windows" (this is
checked with a case-insensitive check). If not specified,
assumed to be a Windows update.
True if this update is a macOS update; false otherwise.
Acceptable OS strings are: "mac", "osx", or "macos" (this is
checked with a case-insensitive check). If not specified,
assumed to be a Windows update.
True if this update is a macOS update; false otherwise.
Acceptable OS strings are: "linux" (this is
checked with a case-insensitive check). If not specified,
assumed to be a Linux update.
MIME type for file as specified in the closure tag. Defaults to "application/octet-stream".
Parse item Xml Node to AppCastItem
Currently installed version
Application name
The url of the appcast
The item XML node
logwriter instance
AppCastItem from Xml Node
Create Xml node from this instance of AppCastItem
An XML node
Compares this version to the version of another
the other instance
-1, 0, 1 if this instance is less than, equal to, or greater than the
See if this this version equals the version of another .
Also checks to make sure the application names match.
the instance to compare to
Derive hashcode from immutable variables
the integer haschode of this app cast item
Check the equality of two instances
first to compare
second to compare
True if items are the same; false otherwise
Check if two instances are different
first to compare
second to compare
True if items are different; false if they are the same
Less than comparison of version between two instances
first to compare
second to compare
True if left version is less than right version; false otherwise
Less than or equal to comparison of version between two AppCastItem instances
AppCastItem to compare
AppCastItem to compare
True if left version is less than or equal to right version
Greater than comparison of version between two instances
first to compare
second to compare
True if left version is greater than right version; false otherwise
Greater than or equal to comparison of version between two instances
first to compare
second to compare
True if left version is greater than or equal to right version; false otherwise
An assembly accessor that uses
to get information on the assembly with a given name
Create a new diagnostics accessor and parse the assembly's information
using .
is used to get the full file
path of the given assembly.
the assembly name
Thrown when the path to the assembly with the given name doesn't exist
Gets the description
An assembly accessor that uses reflection to learn information
on an assembly with a given name.
Create the assembly accessor with a given assembly name. All pertinent attributes
that are needed are read during object construction.
the assembly name.
If null is passed, is used to get info on the asembly.
Thrown when the path to the assembly with the given name doesn't exist
Thrown when the assembly can't be loaded
Thrown when the assembly doesn't have any readable attributes
This methods creates an attribute instance from the attribute data
information
Abstract class to handle update intervals and know which is the currently installed version
of the software.
The application name
The previous version of the software that the user ran, e.g. "1.5.2"
The currently-installed version, e.g. "1.4.3"
Flag to indicate if we should check for updates
True if this is the first time the application has been run based on save config data; false otherwise
of the last update check
The version number of the update that was skipped last.
If the user skipped an update, then the version to ignore is stored here (e.g. "1.4.3")
Whether or not the application has run at least one time
Last profile update
Object that accesses version, title, etc. info for the currently running application
(or some other application)
Constructor for Configuration -- should load all pertinent values by the end of the constructor!
If any exception is thrown during construction of this object (e.g. from the assembly accessors),
then is set to false.
Object that accesses version, title, etc. info for the application
you would like to check for updates for
Set the last configuration update time to .
Set the last time we checked for updates to .
Should be used after an update check has been made.
Set the given version as the version that should be skipped (ignored)
when looking at available updates
the version to skip. e.g. "1.2.3"
Reloads the configuration object from disk/memory/etc.
Set the configuration values to their default values (should check for update,
last check time was in the past, no version skipped, and have never run the
software).
A configuration subclsas that can save and load its data from a JSON
file that lives on disk. This type of can
be used on any operating system where you can read/write files.
Constructor for a configuration that saves and loads its configuration data to and
from a JSON file that resides on disk. This Configuration can be used on any
operating system.
Object that accesses version, title, etc. info for the application
you would like to check for updates for
Constructor for a configuration that saves and loads its configuration data to and
from a JSON file that resides on disk. This Configuration can be used on any
operating system.
Object that accesses version, title, etc. info for the application
you would like to check for updates for
location to save the JSON configuration data to; can be null or empty string.
If not null or empty string, must represent a valid path on disk (directories must already be created).
This class will take care of creating/overwriting the file at that path if necessary.
Thrown when the configuration data cannot be read or saved
Get the full file path to the location and file name on disk
where the JSON configuration data should be saved.
By default, stored in in
the "NetSparkleUpdater" folder in the "data.json" file.
Thrown when the assembly accessor does not have the company or product name
information available
Load configuration values from the json file at the given path.
the configuration file location
true if the items were loaded, false if the file didn't exist or was unable to be loaded
Store the configuration information to disk as json
the save path to the json file
true if the values were saved to dis, false otherwise
This class handles all registry values which are used from sparkle to handle
update intervalls. All values are stored in HKCU\Software\Vendor\AppName which
will be read ot from the assembly information. All values are of the REG_SZ
type, no matter what their "logical" type is.
This should only be used on Windows!
Constructor for a configuration that saves and loads information from the Windows registry.
This should only be used on Windows!
Object that accesses version, title, etc. info for the application
you would like to check for updates for
Constructor for a configuration that saves and loads information from the Windows registry.
This should only be used on Windows!
Object that accesses version, title, etc. info for the application
you would like to check for updates for
Location in the registry where configuration data should be stored and
loaded from
Generate the path in the registry where data will be saved to/loaded from.
Thrown when the assembly accessor does not have the company or product name
information available
Load values from the provided registry path
the registry path
true if the items were loaded successfully; false otherwise
Stores the configuration data into the registry at the given path
the registry path
true if the values were saved to the registry; false otherwise
Configuration data for this software and NetSparkle instance.
Allows you to get information on the versions that the user
skipped, when the last update was performed, etc.
Used by the class to save/load
data easily to/from disk.
Whether or not to check for an update
The last that an update check was performed
The previous version of the software that the user ran
The last version (as a string) that the user chose
to skip.
Can be blank.
Whether or not the software has run at least one time.
Last that the configuration data was updated.
Class that downloads files from the internet and reports
progress on those files being downloaded. Uses a
object as its main method for downloading.
Default constructor for the web client file downloader.
Uses default credentials and default proxy.
Default constructor for the web client file downloader.
Uses default credentials and default proxy.
ILogger to write logs to
ILogger to log data from WebClientFileDownloader
Do preparation work necessary to download a file,
aka set up the WebClient for use.
Class that takes care of downloading data for an app cast, including the
app cast itself as well as the app cast signature (if available). Allows
you to send extra JSON with your request for the app cast information.
Default constructor for the app cast data downloader. Basically
does nothing. :)
If true, don't check the validity of SSL certificates. Defaults to false.
If not "", sends extra JSON via POST to server with the web request for update information and for the app cast signature.
Download the app cast from the given URL.
Performs a GET request by default. If is set,
uses a POST request and sends the JSON data along with the
request.
the URL to download the app cast from
the response from the web server if creating the request
succeeded; null otherwise. The response is not guaranteed to have
succeeded!
Determine if the remote X509 certificate is valid
the web request that is being made
the certificate
the chain
any SSL policy errors that have occurred
true if the cert is valid; false otherwise
Every time when detects an update, the
consumer can decide what should happen next with the help
of the event
Show the user interface
Perform an unattended install
Prohibit (don't allow) the update
Controls the situations where files have to be signed with the private key.
If both a public key and a signature are present, they always have to be valid.
We recommend using if at all possible.
Note that needs to have
set to true in order
to verify signatures.
All files (with or without signature) will be accepted.
This mode is strongly NOT recommended. It can cause critical security issues.
If there is a public key, the app cast and download file have to be signed.
If there isn't a public key, files without a signature will also be accepted.
This mode is a mix between Unsafe and Strict and can have some security issues if the
public key gets lost in the application.
The app cast and download file have to be signed. This means the public key must exist. This is the default mode.
Only verify the signature of software downloads (via an ISignatureVerifier).
Do not verify the signature of anything else: app casts, release notes, etc.
Possible result values for implementation.
No result specified. Default value.
User chose to install the update immediately.
User chose to skip the update.
User chose to remind them later about this update (e.g. close for now, but
feel free to tell me about it next time that the software checks for updates).
Possibilities for the status of an update request
An update is available
No updates are available
An update is available, but the user has chosen to skip this version
There was a problem fetching the appcast
Allows for updating the application with or without user interaction.
Shows the changelog UI automatically (this is the default)
Downloads the latest update file and changelog automatically, but does not
show any UI until asked to show UI.
Downloads the latest update file and automatically runs it as an installer file.
WARNING: if you don't tell the user that the application is about to quit
to update/run an installer, this setting might be quite the shock to the user!
Make sure to implement or
so that you can show your users
what is about to happen.
Return value of the signature verification check functions.
The public key and signature both exist and they are valid (the update file
is safe to use).
Depending on the used, either the public key or the
signature doesn't exist -- or they exist but are not valid.
In this case the update file will be rejected.
There wasn't any public key or signature available, and this is OK based on the
used.
Event called when the download/install window closes
Sender of this event
DownloadInstallArgs with info on whether to install or not
Args sent via the DownloadInstallEventHandler when the download/install window closes
Whether or not the listener should perform the installation process
True if the download/install event was already handled; false otherwise
Constructor for DownloadInstallArgs
True if the listener should start the download process; false otherwise
Provides data for a progress event for downloading an AppCastItem from a
web server.
Create an object based on
the total percentage (0-100, inclusive) and the custom user state.
the total download progress as an int (between 0-100)
the custom user state sent along with the download progress
Create an object based on
the total percentage (0-100, inclusive), the custom user state, the
number of bytes received, and the number of total bytes that need to
be downloaded.
the total download progress as an int (between 0-100)
the custom user state sent along with the download progress
the number of bytes received by the downloader
the total number of bytes that need to be downloadeds
The number of bytes received by the downloader
The total number of bytes that need to be downloaded
Contains all information for the update detected event
The next action to execute after the app user decides how to
handle an update
The application configuration (stores data on last time updates were
checked, etc.)
The latest available version in the app cast
All app cast items that were sent in the appcast
Event arguments for when a user responds to an available update UI
The user's response to the update
The AppCastItem that the user is responding to an update notice for
Constructor for UpdateResponseArgs that allows for easy setting
of the result
User's response of type
Item that the user is responding to an update message for
Interface used by objects that can download app casts from the internet.
Use this interface to provide a custom method of grabbing your app cast
from the internet or from a local file.
Used for both downloading app cast and the app cast's .dsa file.
Note that you must handle your own exceptions if they occur.
Otherwise, will act as though the appcast
failed to download.
string URL for the place where the app cast can be downloaded
The app cast data encoded as a string
Get the string encoding (e.g. UTF8 or ASCII) of the
app cast file so that it can be converted to bytes.
(WebRequestAppCastDataDownloader defaults to UTF8.)
The of the app cast
Interface used by objects that initiate a download process
for an app cast, perform any needed signature verification on
the app cast, and parse the app cast's items into a list of
.
Implement this interface if you would like to use a custom parsing
method for your app cast that isn't yet built into NetSparkle.
Setup the app cast handler info for downloading and parsing app cast information
downloader that will manage the app cast download
(provided by via the
property.
full URL to the app cast file
configuration for handling update intervals/checks
(user skipped versions, etc.)
Object to check signatures of app cast information
object that you can utilize to do any necessary logging
Download the app cast file via the
object and parse the downloaded information.
If this function is successful, will call
to get the information.
Note that you must handle your own exceptions if they occur. Otherwise,
will act as though the appc ast failed to download.
true if downloading and parsing succeeded; false otherwise
Retrieve the available updates from the app cast.
This should be called after has
successfully completed.
a list of updates. Can be empty if no updates are available.
An assembly accessor grabs details on the current version
and publisher information for a C# application (presumably
the one that is currently running). This is intended to be
used in conjunction with a Configuration subclass in order
to retrieve and store info on the latest version of the app
that was used, whether the app has run 1x or not, etc.
These fields may or may not be required based on the specific
Configuration that you use. At the very least, make sure
your IAssemblyAccessor can grab valid info for the title of the
application, the product name (which may or may not be the same
as the title), and the version of the application (e.g. 3.1.2.0).
The publisher of the application. Might be "".
The copyright for the application (e.g. ?2020)
Description of the assembly.
Title of the assembly, e.g. "My Best Product"
Product for the assembly. Might be the same as
the title, but also could be more specific than the
title.
Version of the item that's running. E.g. 3.1.2.1.
Interface for UIs that tell the user that
is checking for updates
Event to fire when the checking for updates UI is closing
Show the checking for updates UI
Close the window/UI that shows the checking for updates UI
Interface for UI element that shows the progress bar
and a method to install and relaunch the appliction
Event to fire when the download UI is complete; tells you
if the install process should happen or not
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
want your user to click the button multiple times)
True if the button should be enabled; false otherwise
Show the UI for download progress
True if download was successful; false otherwise
Called when the download progress changes
sender of the progress update
used to deliver info on download progress (e.g.
total bytes downloaded)
Close the download progress UI
Update UI to show file is downloaded and signature check result
Show an error message in the download progress window if possible.
Error message to display
True if message displayed; false otherwise
Interface for objects that can handle log information output
(e.g. to a console or a file)
Print a message to the log output.
Message to print
Arguments to print (e.g. if using {0} format arguments)
Interface for objects that can verify a signature for an app cast, a
downloaded file, or some other item. This is used to verify that the
correct data was downloaded from the internet and there wasn't any
nefarious play or manipulation of items when something was delivered
to the end user.
The for the signature verifier. This determines
the level of security for the application and the items that it downloads
from the internet.
Check to see if we have valid public (or other) key information so
that we can verify signatures properly.
true if this object has valid public/other key information
and can safely verify the signature of a given item; false otherwise
Verify that the given data has the same signature as the passed-in signature
the base 64 signature to validate against dataToVerify's signature
the data that should be used to obtain a signature and
checked against the passed-in signature
the result of the verification process
Verify that the file at the given path has the same signature as the passed-in
signature
the base 64 signature to validate against the signature of
the file at binaryPath
the file path to the file whose signature you want to verify
the result of the verification process
Verify that the file at the given path has the same signature as the passed-in
string
the base 64 signature to validate against the signature
of the passed-in string
the string whose signature you want to verify
the result of the verification process
Universal interface for creating UI utilized by SparkleUpdater
Create sparkle form implementation. This is the form that tells the user that an update is available, shows changelogs if necessary, etc.
The instance controlling this UI
Sorted array of updates from latest to previous
If true, make sure UI text shows that the user is about to install the file instead of download it.
APP is Purchased>
Create the download progress window
The instance controlling this UI
Appcast item to download
Inform user in some way that NetSparkle is checking for updates
The instance controlling this UI
Initialize UI. Called when Sparkle is constructed and/or when the UIFactory is set.
The instance controlling this UI
Show user a message saying downloaded update format is unknown
The instance controlling this UI
file name for the download
Show user that current installed version is up-to-date
The instance controlling this UI
Show message that latest update was skipped by user
The instance controlling this UI
Show message that appcast is not available
The instance controlling this UI
The URL to the app cast file
See if this UIFactory can show toast messages
The instance controlling this UI
true if the UIFactory can show for toast messages; false otherwise
Show 'toast' window to notify new version is available
The instance controlling this UI
Appcast updates
handler for click
Show message on download error
The instance controlling this UI
Error message from exception
the URL for the appcast file
Shut down the UI so we can run an update.
If in WPF, System.Windows.Application.Current.Shutdown().
If in WinForms, Application.Exit().
If in Avalonia, shuts down the current application lifetime if it
implements IClassicDesktopStyleApplicationLifetime.
The instance controlling this UI
Hides the release notes view when an update is found.
Hides the skip this update button when an update is found.
Hides the remind me later button when an update is found.
The HTML template to use for each changelog, version, etc. for every app cast
item update. If you set this to "" or null, the default ReleaseNotesGrabber will use
the default template.
To work properly, you MUST have 3 placeholders in the template ({0}, {1}, {2}, {3}),
as this will be used in a string.Format() call.
The only exception to this would be if you implement your own
subclass that overrides
.
{0} = app cast item version;
{1} = app cast publication date;
{2} = the actual release notes;
{3} = the background color for the release notes header.
Any additional header information to stick in the HTML head element
that will show up in the release notes (e.g. styles, etc.).
Must be HTML formatted to work properly.
Can be null or "".
Interface for UI element that shows the release notes,
and the skip, install, and later buttons
Event fired when the user has responded to the
skip, later, install question.
Show the UI that displays release notes, etc.
Hides the release notes
Hides the remind me later button
Hides the skip update button
Gets the user choice on how to handle this update (e.g. skip, remind me later)
Gets or sets the current item being installed
(the item that the user should update to)
Brings the update info UI to the front of all windows
Close the UI that shows update information
Interface for objects that can download (or otherwise obtain) update files
for a given . These objects should send back
progress updates and handle other exceptions or other event changes as necessary.
Return true if the update downloader is currently downloading the update
Event to call when some progress has been made on the download
Event to call when the download of the update file has been completed
Start the download of the file. The file download should be asynchronous!
URL for the download
Where to download the file
Cancel the download.
Clean up and dispose of anything that has to be disposed of
(cancel the download if needed, etc.)
Retrieve the download file name of the app cast item from the server.
This is useful if the server has any sort of redirects that take place
when starting the download process. The client will use this file name
when saving the file on disk.
NetSparkle.CheckServerFileName = false can be set to avoid this call.
The AppCastItem that will be downloaded
The file name of the file to download from the server
(including file extension). Null if not found/had error/not applicable.
A simple class to handle log information for NetSparkleUpdater.
Make sure to do any setup for this class that you want
to do before calling StartLoop on your object.
Tag to show before any log statements
Empty constructor -> sets PrintDiagnosticToConsole to false
LogWriter constructor that takes a bool to determine
the value for printDiagnosticToConsole
False to print to ;
true to print to
True if this class should print to ;
false if this object should print to .
Defaults to false.
The loop that checks for updates every now and again has started
the object that initiated the call
The loop that checks for updates has finished checking for updates
the object that initiated the call
true if an update is required; false otherwise
An update was detected for the user's currently running software
the object that initiated the call
Information about the update that was detected
has started checking for updates
The instance that is checking for an update.
has finished checking for updates
that finished checking for an update.
Update status (e.g. whether an update is available)
An asynchronous cancel event handler.
The source of the event.
A System.ComponentModel.CancelEventArgs that contains the event data.
Delegate for custom application shutdown logic
Async version of CloseApplication().
Delegate for custom application shutdown logic
A delegate for download events (start, canceled).
Delegate that provides information about some download progress that has been made
The object that initiated the event
The information on how much data has been downloaded and how much
needs to be downloaded
Delegate that provides information about some download progress that has been made
when downloading a specific .
The object that initiated the event
The item that is being downloaded
The information on how much data has been downloaded and how much
needs to be downloaded
A handler called when the user responsed to an available update
The object that initiated the event
An UpdateResponse object that contains the information on how the user
responded to the available update (e.g. skip, remind me later). Be warned that
might be null.
A delegate for a download error that occurred for some reason
The item that is being downloaded
The path to the place where the file was being downloaded
The that occurred to cause the error
An exception that occurred during NetSparkleUpdater's operations
Create an exception with the given message
the message to use for this exception
Create an exception with the given serialization information and streaming context
The serialized exception information
the context of the serialization operation for this exception
A strongly-typed resource class, for looking up localized strings, etc.
Returns the cached ResourceManager instance used by this class.
Overrides the current thread's CurrentUICulture property for all
resource lookups using this strongly typed resource class.
Looks up a localized string similar to Error!.
Looks up a localized string similar to Info.
Looks up a localized string similar to Sorry, either you aren't connected to the internet, or our server is having a problem..
Looks up a localized string similar to Sorry, there was a problem attempting to download the update
{0}.
Looks up a localized string similar to Updater not supported, please execute {0} manually.
Looks up a localized string similar to You have elected to skip this version..
Looks up a localized string similar to Your current version is up to date..
Looks up a localized string similar to More information.
Looks up a localized string similar to New Version Available.
Grabs release notes formatted as Markdown (https://en.wikipedia.org/wiki/Markdown)
from the server and allows you to view them as HTML.
The for this ReleaseNotesGrabber. Mostly
used for logging via , but also can be used
to grab other information about updates, etc.
List of supported extensions for markdown files (.md, .mkdn, .mkd, .markdown)
Whether or not to check the signature of the release notes
after they've been downloaded. Defaults to false.
HTML to show while release notes are loading. Does NOT include
ending body and html tags.
The HTML template to use for each changelog, version, etc. for every app cast
item update
The HTML template to use for each changelog, version, etc. for every app cast
item update
The initial HTML to use for the changelog. This is everything before the
body tag and includes the html and head elements/tags. This ends with an
open body tag.
Base constructor for ReleaseNotesGrabber
Template to use for separating each item in the HTML
Any additional header information to stick in the HTML that will show up in the release notes
Sparkle updater being used
Generates the text to display while release notes are loading.
By default, this is InitialHTML + LoadingHTML + the ending body and html tags.
HTML to show to the user while release notes are loading
Asynchronously download all of the release notes provided to this function and convert them to HTML
List of items that you want to display in the release notes
The latest version (most current version) of your releases
Token to cancel the async download requests
The release notes formatted as HTML and ready to display to the user
Grab the release notes for the given item and return their release notes
in HTML format so that they can be displayed to the user.
item to download the release notes for
that can be used for logging information
about the release notes grabbing process (or its failures)
token that can be used to cancel a release notes
grabbing operation
The release notes, formatted as HTML, for a given release of the software
Download the release notes at the given link. Does not do anything else
for the release notes (verification, display, etc.) -- just downloads the
release notes and passes them back as a string.
string URL to the release notes to download
token that can be used to cancel a download operation
that can be used for logging information
about the download process (or its failures)
The release notes data (file data) at the given link as a string. Typically this data
is formatted as markdown.
Class that allows you to verify a DSA signature of
some text, a file, or some other item based on a
DSA public key
Create a DSAChecker object from the given parameters
The of the validator. Controls what needs to be set in order to validate
an app cast and its items.
the DSA public key as a string (will be used instead of the file if available, non-null, and not blank)
the public key file name (including extension)
Gets a file resource based on a public key at a given path
the file name of the public key
the data stream of the file resource if the file exists; null otherwise
Get a resource stream based on the public key
the public key resource name
a stream that contains the public key if found; null otherwise
Class to verify a Ed25519 signature
Determines if a public key exists
bool
Create a Ed25519Checker object from the given parameters
The security mode of the validator. Controls what needs to be set in order to validate
an app cast and its items.
the base 64 public key as a string
the public key file
Gets a file resource based on a public key at a given path
the file name of the public key
the data stream of the file resource if the file exists; null otherwise
Get a resource stream based on the public key
the public key resource name
a stream that contains the public key if found; null otherwise
Class to communicate with a sparkle-based appcast to download
and install updates to an application
The responsible for launching the downloaded update.
Only valid once the application is about to quit and the update is going to
be launched.
Constructor which requires the app cast url and the object that will verify app cast signatures
the URL of the app cast file
the object that will verify your app cast signatures.
ctor which needs the app cast url, an object to verify app cast signatures, and a reference assembly
the URL of the app cast file
the object that will verify your app cast signatures.
the name of the assembly to use for comparison when checking update versions
Constructor that performs all necessary initialization for software update checking
the URL of the app cast file
the object that will verify your app cast signatures.
the name of the assembly to use for comparison when checking update versions
a UI factory to use in place of the default UI
The security protocol used by NetSparkle. Setting this property will also set this
for the current AppDomain of the caller. Needs to be set to
SecurityProtocolType.Tls12 for some cases (such as when downloading from GitHub).
Set the user interaction mode for Sparkle to use when there is a valid update for the software
If set, downloads files to this path. If the folder doesn't already exist, creates
the folder at download time (and not before).
Note that this variable is a path, not a full file name.
Defines if the application needs to be relaunched after executing the downloaded installer
Run the downloaded installer with these arguments
Function that is called asynchronously to clean up old installers that have been
downloaded with SilentModeTypes.DownloadNoInstall or SilentModeTypes.DownloadAndInstall.
Whether or not the update loop is running
Factory for creating UI elements like progress window, etc.
The user interface that shows the release notes and
asks the user to skip, remind me later, or update
The user interface that shows a download progress bar,
and then asks to install and relaunch the application
The user interface that shows the 'Checking for Updates...'
UIrm.
The configuration object for a given assembly that has information on when
updates were checked last, any updates that have been skipped, etc.
Path to the working directory for the current application.
This is the directory that the current executable sits in --
e.g. C:/Users/...Foo/. It will be used when restarting the
application on Windows or will be used on macOS/Linux for
overwriting files on an update.
Executable name to use when restarting the software.
This is the name that will be used/started when the update has been installed.
This defaults to .
Used in conjunction with RestartExecutablePath to restart the application --
cd "{RestartExecutablePath}"
"{RestartExecutableName}" is what is called to restart the app.
The object that verifies signatures (DSA, Ed25519, or otherwise) of downloaded items
Gets or sets the app cast URL
Specifies if you want to use the notification toast message (not implemented in all UIs).
This setting is only valid on WinForms and WPF.
If true, tries to run UI code on the main thread using .
Must be set to true if using NetSparkleUpdater from Avalonia.
Object that handles any diagnostic messages for NetSparkle.
If you want to use your own class for this, you should just
need to override in your own class.
Make sure to set this object before calling to guarantee
that all messages will get sent to the right place!
Whether or not to check with the online server to verify download
file names.
Returns the latest appcast items to the caller. Might be null.
Loops through all of the most recently grabbed app cast items
and checks if any of them are marked as critical
The object responsable for downloading update files for your application
The object responsible for downloading app cast and app cast signature
information for your application
The object responsible for parsing app cast information and checking to
see if any updates are available in a given app cast
Starts a SparkleUpdater background loop to check for updates every 24 hours.
You should only call this function when your app is initialized and shows its main UI.
whether the first check should happen before or after the first interval
Starts a SparkleUpdater background loop to check for updates on a given interval.
You should only call this function when your app is initialized and shows its main UI.
whether the first check should happen before or after the first interval
the interval to wait between update checks
Starts a SparkleUpdater background loop to check for updates every 24 hours.
You should only call this function when your app is initialized and shows its main UI.
whether the first check should happen before or after the first interval
if is true, whether the first check
should happen even if the last check was less than 24 hours ago
Starts a SparkleUpdater background loop to check for updates on a given interval.
You should only call this function when your app is initialized and shows its main UIw.
whether the first check should happen before or after the first interval
if is true, whether the first check
should happen even if the last check was within the last interval
the interval to wait between update checks
Stops the SparkleUpdater background loop. Called automatically by .
Finalizer
Inherited from IDisposable. Stops all background activities.
Dispose of managed and unmanaged resources
true if the object is currently being disposed; false otherwise
Unregisters events so that we don't call events more often than we should
This method checks if an update is required. During this process the appcast
will be downloaded and checked against the reference assembly. Ensure that
the calling process has read access to the reference assembly.
This method is also called from the background loops.
the SparkleUpdater configuration for the reference assembly
true to ignore skipped versions, false otherwise
with information on whether there is an update available or not.
Shows the update needed UI with the given set of updates.
updates to show UI for
If true, make sure UI text shows that the user is about to install the file instead of download it.
Shows the update UI with the latest downloaded update information.
If true, make sure UI text shows that the user is about to install the file instead of download it.
Get the download path for a given app cast item.
If any directories need to be created, this function
will create those directories.
The item that you want to generate a download path for
The download path for an app cast item if item is not null and has valid download link
Otherwise returns null.
Starts the download process by grabbing the download path for
the app cast item (asynchronous so that it can get the server's
download name in case there is a redirect; cancel this by setting
CheckServerFileName to false), then beginning the download
process if the download file doesn't already exist
the appcast item to download
Called when the installer is downloaded
the object that initiated this event call
information on if the download was successful.
Run the provided app cast item update regardless of what else is going on.
Note that a more up to date download may be taking place, so if you don't
want to run a potentially out-of-date installer, don't use this. This should
only be used if your user wants to update before another update has been
installed AND the file is already downloaded.
This function will verify that the file exists and that the
signature is valid before running. It will also utilize the
PreparingToExit event to ensure that the application can close.
AppCastItem to install
Install path to the executable. If not provided, will ask the server for the download path.
Checks to see
True if the user has silent updates enabled; false otherwise.
Checks to see if two extensions match (this is basically just a
convenient string comparison). Both extensions should include the
initial . (full-stop/period) in the extension.
first extension to check
other extension to check
true if the extensions match; false otherwise
Get the install command for the file at the given path. Figures out which
command to use based on the download file path's file extension.
Currently supports .exe, .msi, and .msp.
Path to the downloaded update file
the installer command if the file has one of the given
extensions; the initial downloadFilePath if not.
Get the install command for the file at the given path. Figures out which
command to use based on the download file path's file extension.
Windows: currently supports .exe, .msi, and .msp.
macOS: currently supports .pkg, .dmg, and .zip.
Linux: currently supports .tar.gz, .deb, and .rpm.
Path to the downloaded update file
the installer command if the file has one of the given
extensions; the initial downloadFilePath if not.
Checks to see if the file at the path is a zip download.
If user is on macOS and extension is a .zip, returns true.
If user is on Linux and extension is a .tar.gz, returns true.
Otherwise returns false. Always returns false on .NET Framework.
Path to the downloaded update file
True if on macOS and path is a .zip, true of on Linux and path is a
.tar.gz. False otherwise.
Updates the application via the file at the given path. Figures out which command needs
to be run, sets up the application so that it will start the downloaded file once the
main application stops, and then waits to start the downloaded update.
path to the downloaded installer/updater
the awaitable for the application quitting
Execute a shell script.
https://stackoverflow.com/a/47918132/3938401
Path to script to run via a shell
True for the calling process to wait for the command to finish before exiting; false otherwise
Quits the application (host application) that is using/started SparkleUpdater
Asynchronous task that can be awaited to call code after the application
is quit (which may or may not be worth it based on your program setup)
Ask the application to close their current work items.
Apps may need, for example, to let the user save their work
true if it's OK to run the installer and close the software; false otherwise
Check for updates, using UI interaction appropriate for if the user initiated the update request
true to ignore skipped versions, false otherwise
Check for updates, using interaction appropriate for where the user doesn't know you're doing it, so be polite.
Basically, this checks for updates without showing a UI. NO UI WILL BE SHOWN. You must handle any showing
of the UI yourself -- see the "HandleEventsYourself" sample!
true to ignore skipped versions, false otherwise
Perform a one-time check for updates
true if user triggered the update check (so show UI), false otherwise (no UI)
true to ignore skipped versions, false otherwise
Cancels an in-progress download of an app cast file and deletes the temporary file.
Events should always be fired on the thread that started the Sparkle object.
Used for events that are fired after coming from an update available window
or the download progress window.
Basically, if is true, just invokes the action. Otherwise,
uses the to call the action. Ensures that the action
is always on the main thread.
Events should always be fired on the thread that started the Sparkle object.
Used for events that are fired after coming from an update available window
or the download progress window.
Basically, if is true, just invokes the action. Otherwise,
uses the to call the action. Ensures that the action
is always on the main thread.
Loop that occasionally checks for updates for the running application
This method will be notified by the SparkleUpdater loop when
some update info has been downloaded. If the info has been
downloaded fully (e.ProgressPercentage == 1), the UI
for downloading updates will be shown (if not downloading silently)
or the download will be performed (if downloading silently).
Updates from appcast have been downloaded from the server.
If the user is downloading silently, the download will begin.
If the user is not downloading silently, the update UI will be shown.
updates to be installed. If null, nothing will happen.
This event will be raised when an update check is about to be started
This event will be raised when an update check has finished
Called when update check has just begun
This event can be used to override the standard user interface
process when an update is detected
Called when update check is all done. may have been
called between the start and end of the update check.
The user responded to the update UI with a given response.
This is called _after_ NetSparkle handles the response in all cases EXCEPT
when the result is UpdateAvailableResult.InstallUpdate -- in that case, this
event is called BEFORE downloading the update begins.
Called when the download of an app cast file has just started
Called when the download of an app cast file has been canceled
Called when the download of an app cast file has downloaded but has an error other than corruption
Called when the download of an app cast file has made some progress.
This data is also sent to the progress window if one is available.
Called when the downloaded file is fully downloaded and verified regardless of the value for
SilentMode. Note that if you are installing fully silently, this will be called before the
install file is executed, so don't manually initiate the file or anything. Useful when using
SilentModeTypes.DownloadNoInstall so you can let your user know when the downloaded
update is ready.
Called when the downloaded file is already downloaded (or at least partially on disk) and the DSA
signature doesn't match. When this is called, Sparkle is not taking any further action to
try to download the install file during this instance of the software. In order to make Sparkle
try again, you must delete the file off disk yourself. Sparkle will try again after the software
is restarted. This event could allow you to tell the user what happened if updates are silent.
Called when the downloaded file is fully downloaded and has its signature checked, but something
went wrong during the signature check.
If you're sure the file is there, you can try verifying the file again AND triggering an install
with SparkleUpdater.InstallUpdate, but make sure to warn your users first!
Subscribe to this event to get a chance to shut down gracefully before the application is closed.
If is set, this has no effect.
Subscribe to this event to get a chance to asynchronously shut down gracefully before the
application is closed.
This overrides .
Event for custom shutdown logic. If this is set, it is called instead of
Application.Current.Shutdown or Application.Exit.
If is set, this has no effect.
Warning: The script that launches your executable only waits for 90 seconds before
giving up! Make sure that your software closes within 90 seconds if you implement this event!
If you need an event that can be canceled, use .
Event for asynchronous custom shutdown logic. If this is set, it is called instead of
Application.Current.Shutdown or Application.Exit.
This overrides .
Warning: The script that launches your executable only waits for 90 seconds before
giving up! Make sure that your software closes within 90 seconds if you implement this event!
If you need an event that can be canceled, use .
A simple class to hold information on potential updates to a software product.
Create information about an update with the given status and no available update items
Information on whether an update is available
Create information about an update with the given status and update items
Information on whether an update is available
The list of updates that are available to update to
Whether or not an update is available
Any available updates for the product that the user could
potentially install
Provides commonly used utility functions to users of NetSparkleUpdater
Removes trailing 0 components from the given version.
"1.2.3.0" -> "1.2.3";
"1.2.0.0" -> "1.2";
"1.0.0.0" -> "1.0"
Version object
Version string
Gets the signature of a file with the given DSA private key.
Path to the file you want to sign
Path to the private key file
DSA signature as base64 string
Creates a from a URL string. If the URL is relative, converts it to an absolute URL based on the appcast URL.
relative or absolute URL
URL to appcast
Convert a number of bytes to a user-readable string
Number of bytes to convert
A string that represents the number of bytes in KB, MB, or GB if numBytes > 1024.
If numBytes is less than 1024, returns numBytes.
Get the full base (running) directory for this application including a trailing slash.
From WalletWasabi:
https://github.com/zkSNACKs/WalletWasabi/blob/8d42bce976605cca3326ea6c998b2294494900e6/WalletWasabi/Helpers/EnvironmentHelpers.cs
the full running directory path including trailing slash for this application
Convert a given to a byte array
the to convert
a byte[] array of the data in the given stream
Checks to see whether a signature is ncessary given the provided
info on the and whether or not valid
key information exists at the moment.
the for the signature check
true if the application has appropriate key
information in order to run signature checks; false otherwise
True if the caller is checking on the signature of a software
download; false if the caller is checking on the signature of something else (e.g. release notes,
app cast)
true if an item's signature needs to be checked; false otherwise
Options for configuring MarkdownSharp.
when true, (most) bare plain URLs are auto-hyperlinked
WARNING: this is a significant deviation from the markdown spec
when true, RETURN becomes a literal newline
WARNING: this is a significant deviation from the markdown spec
use ">" for HTML output, or " />" for XHTML output
when false, email addresses will never be auto-linked
WARNING: this is a significant deviation from the markdown spec
when true, bold and italic require non-word characters on either side
WARNING: this is a significant deviation from the markdown spec
when true, asterisks may be used for intraword emphasis
this does nothing if StrictBoldItalic is false
Markdown is a text-to-HTML conversion tool for web writers.
Markdown allows you to write using an easy-to-read, easy-to-write plain text format,
then convert it to structurally valid XHTML (or HTML).
Create a new Markdown instance using default options
Create a new Markdown instance and optionally load options from a configuration
file. There they should be stored in the appSettings section, available options are:
Markdown.StrictBoldItalic (true/false)
Markdown.EmptyElementSuffix (">" or " />" without the quotes)
Markdown.LinkEmails (true/false)
Markdown.AutoNewLines (true/false)
Markdown.AutoHyperlink (true/false)
Markdown.AsteriskIntraWordEmphasis (true/false)
Create a new Markdown instance and set the options from the MarkdownOptions object.
use ">" for HTML output, or " />" for XHTML output
when false, email addresses will never be auto-linked
WARNING: this is a significant deviation from the markdown spec
when true, bold and italic require non-word characters on either side
WARNING: this is a significant deviation from the markdown spec
when true, asterisks may be used for intraword emphasis
this does nothing if StrictBoldItalic is false
when true, RETURN becomes a literal newline
WARNING: this is a significant deviation from the markdown spec
when true, (most) bare plain URLs are auto-hyperlinked
WARNING: this is a significant deviation from the markdown spec
maximum nested depth of [] and () supported by the transform; implementation detail
Tabs are automatically converted to spaces as part of the transform
this constant determines how "wide" those tabs become in spaces
In the static constuctor we'll initialize what stays the same across all transforms.
current version of MarkdownSharp;
see http://code.google.com/p/markdownsharp/ for the latest code or to contribute
Transforms the provided Markdown-formatted text to HTML;
see http://en.wikipedia.org/wiki/Markdown
The order in which other subs are called here is
essential. Link and image substitutions need to happen before
EscapeSpecialChars(), so that any *'s or _'s in the a
and img tags get encoded.
Perform transformations that form block-level tags like paragraphs, headers, and list items.
Perform transformations that occur *within* block-level tags like paragraphs, headers, and list items.
splits on two or more newlines, to form "paragraphs";
each paragraph is then unhashed (if it is a hash and unhashing isn't turned off) or wrapped in HTML p tag
Reusable pattern to match balanced [brackets]. See Friedl's
"Mastering Regular Expressions", 2nd Ed., pp. 328-331.
Reusable pattern to match balanced (parens). See Friedl's
"Mastering Regular Expressions", 2nd Ed., pp. 328-331.
Strips link definitions from text, stores the URLs and titles in hash references.
^[id]: url "optional title"
derived pretty much verbatim from PHP Markdown
replaces any block-level HTML blocks with hash entries
returns an array of HTML tokens comprising the input string. Each token is
either a tag (possibly with nested, tags contained therein, such
as <a href="<MTFoo>">, or a run of text between tags. Each element of the
array is a two-element array; the first is either 'tag' or 'text'; the second is
the actual value.
Turn Markdown link shortcuts into HTML anchor tags
[link text](url "title")
[link text][id]
[id]
Turn Markdown image shortcuts into HTML img tags.
![alt text][id]
![alt text](url "optional title")
Turn Markdown headers into HTML header tags
Header 1
========
Header 2
--------
# Header 1
## Header 2
## Header 2 with closing hashes ##
...
###### Header 6
Turn Markdown horizontal rules into HTML hr tags
***
* * *
---
- - -
Turn Markdown lists into HTML ul and ol and li tags
Process the contents of a single ordered or unordered list, splitting it
into individual list items.
/// Turn Markdown 4-space indented code into HTML pre code blocks
Turn Markdown `code spans` into HTML code tags
Turn Markdown *italics* and **bold** into HTML strong and em tags
Turn markdown line breaks (two space at end of line) into HTML break tags
Turn Markdown > quoted blocks into HTML blockquote blocks
Turn angle-delimited URLs into HTML anchor tags
<http://www.example.com>
Remove one level of line-leading spaces
encodes email address randomly
roughly 10% raw, 45% hex, 45% dec
note that @ is always encoded and : never is
Encode/escape certain Markdown characters inside code blocks and spans where they are literals
Encode any ampersands (that aren't part of an HTML entity) and left or right angle brackets
Encodes any escaped characters such as \`, \*, \[ etc
swap back in all the special characters we've hidden
escapes Bold [ * ] and Italic [ _ ] characters
Within tags -- meaning between < and > -- encode [\ ` * _] so they
don't conflict with their use in Markdown for code, italics and strong.
We're replacing each such character with its corresponding hash
value; this is likely overkill, but it should prevent us from colliding
with the escape values by accident.
convert all tabs to _tabWidth spaces;
standardizes line endings from DOS (CR LF) or Mac (CR) to UNIX (LF);
makes sure text ends with a couple of newlines;
removes any blank lines (only spaces) in the text
this is to emulate what's evailable in PHP