Skip to content

Commit

Permalink
Added instructions to change storage method of Remind Later and Skip …
Browse files Browse the repository at this point in the history
…options.
  • Loading branch information
ravibpatel committed Jan 27, 2020
1 parent f3b8c19 commit 2e26d4d
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 10 deletions.
6 changes: 2 additions & 4 deletions AutoUpdaterTest/AutoUpdaterTest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
Expand Down Expand Up @@ -73,9 +73,7 @@
</Compile>
<None Include="app.config" />
<None Include="app.manifest" />
<None Include="packages.config">
<SubType>Designer</SubType>
</None>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
Expand Down
4 changes: 3 additions & 1 deletion AutoUpdaterTest/FormMain.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Globalization;
using System.IO;
using System.Net;
using System.Reflection;
using System.Threading;
Expand Down Expand Up @@ -106,7 +107,8 @@ private void FormMain_Load(object sender, EventArgs e)
//Uncomment following if you want to update using FTP.
//AutoUpdater.Start("ftp:https://rbsoft.org/updates/AutoUpdaterTest.xml", new NetworkCredential("FtpUserName", "FtpPassword"));

//AutoUpdater.PersistenceProvider = new JsonFilePersistenceProvider("F:/test.json");
//string jsonPath = Path.Combine(Environment.CurrentDirectory, "settings.json");
//AutoUpdater.PersistenceProvider = new JsonFilePersistenceProvider(jsonPath);

AutoUpdater.Start("https://rbsoft.org/updates/AutoUpdaterTest.xml");
}
Expand Down
2 changes: 1 addition & 1 deletion AutoUpdaterTest/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="12.0.1" targetFramework="net462" />
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net462" />
</packages>
23 changes: 19 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ AutoUpdater.NET is a class library that allows .NET developers to easily add aut

# The NuGet Package [![NuGet](https://img.shields.io/nuget/v/Autoupdater.NET.Official.svg)](https://www.nuget.org/packages/Autoupdater.NET.Official/) [![NuGet](https://img.shields.io/nuget/dt/Autoupdater.NET.Official.svg)](https://www.nuget.org/packages/Autoupdater.NET.Official/)

PM> Install-Package Autoupdater.NET.Official
````powershell
PM> Install-Package Autoupdater.NET.Official
````

## How it works

Expand Down Expand Up @@ -62,7 +64,7 @@ AutoUpdater.Start("http:https://rbsoft.org/updates/AutoUpdaterTest.xml");

Start method of AutoUpdater class takes URL of the XML file you uploaded to server as a parameter.

AutoUpdater.Start should be called from UI thread.
> AutoUpdater.Start should be called from UI thread.
### Current version detection

Expand Down Expand Up @@ -133,7 +135,7 @@ AutoUpdater.BasicAuthXML = AutoUpdater.BasicAuthDownload = AutoUpdater.BasicAuth
````

### Set User-Agent for http web requests

Set the User-Agent string to be used for HTTP web requests so you can differentiate them in your web server request logs.

````csharp
Expand Down Expand Up @@ -206,6 +208,19 @@ You can specify the size of the update form by using below code.
AutoUpdater.UpdateFormSize = new System.Drawing.Size(800, 600);
````

### Change storage method of Remind Later and Skip options

You can change how AutoUpdater.NET saves the Remind Later and Skip values by assigning the PersistenceProvider. If you don't provide a PersistenceProvider then it will save the values in Windows registy.

If you are using .NET 4.0 or above then you can use JsonFilePersistenceProvider instead of default RegistryPersistenceProvider as shown below.

````csharp
string jsonPath = Path.Combine(Environment.CurrentDirectory, "settings.json");
AutoUpdater.PersistenceProvider = new JsonFilePersistenceProvider(jsonPath);
````

You can create your own PersistenceProvider by implementing [IPersistenceProvider](https://github.com/ravibpatel/AutoUpdater.NET/blob/master/AutoUpdater.NET/IPersistenceProvider.cs) interface.

## Check updates frequently

You can call Start method inside Timer to check for updates frequently.
Expand Down Expand Up @@ -285,7 +300,7 @@ private void AutoUpdaterOnCheckForUpdateEvent(UpdateInfoEventArgs args)
}

// Uncomment the following line if you want to show standard update dialog instead.
// AutoUpdater.ShowUpdateForm();
// AutoUpdater.ShowUpdateForm(args);
if (dialogResult.Equals(DialogResult.Yes) || dialogResult.Equals(DialogResult.OK))
{
Expand Down

0 comments on commit 2e26d4d

Please sign in to comment.