mirror of
https://github.com/cyanfish/naps2.git
synced 2024-10-05 11:57:32 +03:00
Added new fields to UserConfig and AppConfig, and added some types relating to automatic updates.
This commit is contained in:
parent
464c34f030
commit
50a9788244
@ -26,12 +26,13 @@ using System.Xml;
|
||||
using System.Xml.Schema;
|
||||
using System.Xml.Serialization;
|
||||
using NAPS2.Scan;
|
||||
using NAPS2.Update;
|
||||
|
||||
namespace NAPS2.Config
|
||||
{
|
||||
public class AppConfig
|
||||
{
|
||||
public const int CURRENT_VERSION = 1;
|
||||
public const int CURRENT_VERSION = 2;
|
||||
|
||||
public int Version { get; set; }
|
||||
|
||||
@ -44,5 +45,7 @@ namespace NAPS2.Config
|
||||
public MessageBoxIcon StartupMessageIcon { get; set; }
|
||||
|
||||
public ExtendedScanSettings DefaultProfileSettings { get; set; }
|
||||
|
||||
public AutoUpdateStatus AutoUpdate { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NAPS2.Update;
|
||||
|
||||
namespace NAPS2.Config
|
||||
{
|
||||
@ -31,12 +32,16 @@ namespace NAPS2.Config
|
||||
FormStates = new List<FormState>();
|
||||
}
|
||||
|
||||
public const int CURRENT_VERSION = 1;
|
||||
public const int CURRENT_VERSION = 2;
|
||||
|
||||
public int Version { get; set; }
|
||||
|
||||
public string Culture { get; set; }
|
||||
|
||||
public List<FormState> FormStates { get; set; }
|
||||
|
||||
public AutoUpdateStatus AutoUpdate { get; set; }
|
||||
|
||||
public DateTime? LastUpdateCheckDate { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -172,6 +172,12 @@
|
||||
<Compile Include="StringWrapper.cs" />
|
||||
<Compile Include="UnmanagedArray.cs" />
|
||||
<Compile Include="UnmanagedBase.cs" />
|
||||
<Compile Include="Update\AutoUpdater.cs" />
|
||||
<Compile Include="Update\AutoUpdateStatus.cs" />
|
||||
<Compile Include="Update\ICurrentVersionSource.cs" />
|
||||
<Compile Include="Update\IUrlStreamReader.cs" />
|
||||
<Compile Include="Update\IUrlTextReader.cs" />
|
||||
<Compile Include="Update\ILatestVersionSource.cs" />
|
||||
<Compile Include="WinForms\FormBase.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
|
14
NAPS2/Update/AutoUpdateStatus.cs
Normal file
14
NAPS2/Update/AutoUpdateStatus.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace NAPS2.Update
|
||||
{
|
||||
public enum AutoUpdateStatus
|
||||
{
|
||||
Unspecified,
|
||||
Enabled,
|
||||
Disabled
|
||||
}
|
||||
}
|
37
NAPS2/Update/AutoUpdater.cs
Normal file
37
NAPS2/Update/AutoUpdater.cs
Normal file
@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Deployment.Application;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using NAPS2.Config;
|
||||
|
||||
namespace NAPS2.Update
|
||||
{
|
||||
public class AutoUpdater
|
||||
{
|
||||
private readonly UserConfigManager _userConfigManager;
|
||||
private readonly AppConfigManager _appConfigManager;
|
||||
|
||||
public AutoUpdater(UserConfigManager userConfigManager, AppConfigManager appConfigManager)
|
||||
{
|
||||
_userConfigManager = userConfigManager;
|
||||
_appConfigManager = appConfigManager;
|
||||
}
|
||||
|
||||
public void OnApplicationStart()
|
||||
{
|
||||
PromptToEnableAutomaticUpdates();
|
||||
CheckForUpdate();
|
||||
}
|
||||
|
||||
private void PromptToEnableAutomaticUpdates()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private void CheckForUpdate()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
12
NAPS2/Update/ICurrentVersionSource.cs
Normal file
12
NAPS2/Update/ICurrentVersionSource.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace NAPS2.Update
|
||||
{
|
||||
public interface ICurrentVersionSource
|
||||
{
|
||||
string GetCurrentVersion();
|
||||
}
|
||||
}
|
13
NAPS2/Update/ILatestVersionSource.cs
Normal file
13
NAPS2/Update/ILatestVersionSource.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace NAPS2.Update
|
||||
{
|
||||
public interface ILatestVersionSource
|
||||
{
|
||||
Task<string> GetLatestVersion();
|
||||
}
|
||||
}
|
13
NAPS2/Update/IUrlStreamReader.cs
Normal file
13
NAPS2/Update/IUrlStreamReader.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace NAPS2.Update
|
||||
{
|
||||
public interface IUrlStreamReader
|
||||
{
|
||||
Stream OpenStream(string url);
|
||||
}
|
||||
}
|
12
NAPS2/Update/IUrlTextReader.cs
Normal file
12
NAPS2/Update/IUrlTextReader.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace NAPS2.Update
|
||||
{
|
||||
public interface IUrlTextReader
|
||||
{
|
||||
string DownloadText(string url);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user