NetSparkleUpdater / NetSparkle

NetSparkle is a C#, cross-platform, highly-configurable software update framework with pre-built UI for .NET developers compatible with .NET 4.6.2/.NET 6+, WinForms, WPF, and Avalonia; uses Ed25519 signatures. View basic usage here in the README and try the samples for yourself.
https://netsparkleupdater.github.io/NetSparkle/
MIT License
606 stars 84 forks source link

Provide events for installer #93

Closed hypervtechnics closed 2 months ago

hypervtechnics commented 4 years ago

It would be nice to receive events like with Squirrel to react to certain - who would have guessed - events.

Events:

Also cool to create a small framework to handle migrations to be run when certain versions are passed during an upgrade.

Deadpikle commented 4 years ago

Rather than using events, I chose to use properties on the Configuration object since Configuration was already in place and let me keep all the logic there rather than adding more logic to SparkleUpdater.

In the latest preview of NetSparkle, you can now use Configuration.IsFirstRun to see whether this is the first time the application has run. If you reload the configuration data by calling Configuration.Reload(), this flag will be false, even in the same run of the software, so...be forewarned if you reload data manually.

You can also now use Configuration.PreviousVersionOfSoftwareRan to see what the user ran last. The same warnings about reloading configuration data apply. This property is "" on the first run of the software.

Something like this should be helpful:

if (SparkleUpdater.Configuration.IsFirstRun)
  // handle first run
else if (!string.IsNullOrWhiteSpace(SparkleUpdater.Configuration.PreviousVersionOfSoftwareRan) 
          && SparkleUpdater.Configuration.PreviousVersionOfSoftwareRan != SparkleUpdater.Configuration.InstalledVersion)
   // handle update by figuring out what needs to be updated or shown to the user or whatnot

I don't think we can properly handle Install or Uninstall events at this point since we don't control those events of the software at all.

hypervtechnics commented 4 years ago

What do you think about storing the previous version as Version? (Nullable), so you don't have to parse it?

For the install (which is kind of first run) and uninstall I agree.

Deadpikle commented 4 years ago

I'm sorry for forgetting to reply.

I would rather let the user parse the string themselves if they need to -- they might be storing the version in formats such as 2.0.0-beta2342 or some other incompatible-with-Version format.

Deadpikle commented 3 years ago

Calling this "done" for 2.0, but am open to further suggestions for 2.1+.

hypervtechnics commented 3 years ago

Hi, sorry had no time yet. I am trying to build a full stack prototype for the whole software update path using Avalonia for multiple platforms (Linux and Windows for now), Will look into it.

Deadpikle commented 3 years ago

Oh, that's fine. I'm just wanting to wrap things up for a 2.0 release right now. There's no rush or pressure on you to do anything more (although contributions are always welcome). :)

Deadpikle commented 2 months ago

Closing this as it's been several years and we even now support versions like 1.2.3-beta1 and such. Please re-open or open a new issue if there are more events that are desired.