[NF] First try to create an Autoupdater
This commit is contained in:
parent
80a3d4ae8f
commit
75dd6e8e5e
@ -7,7 +7,7 @@ namespace BlubbFish.Utils
|
|||||||
{
|
{
|
||||||
abstract public class OwnObject
|
abstract public class OwnObject
|
||||||
{
|
{
|
||||||
public class LogObject {
|
public struct LogObject {
|
||||||
public LogObject(DateTime date, String location, String message, LogLevel level) {
|
public LogObject(DateTime date, String location, String message, LogLevel level) {
|
||||||
this.Date = date;
|
this.Date = date;
|
||||||
this.Location = location;
|
this.Location = location;
|
||||||
|
66
Updater.cs
Normal file
66
Updater.cs
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace BlubbFish.Utils {
|
||||||
|
public class Updater {
|
||||||
|
private static Updater instances;
|
||||||
|
private String url;
|
||||||
|
|
||||||
|
public delegate void UpdateStatus(Boolean hasUpdates, String message);
|
||||||
|
|
||||||
|
public event UpdateStatus UpdateResult;
|
||||||
|
|
||||||
|
private Updater() { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get Instance of Updater
|
||||||
|
/// </summary>
|
||||||
|
public static Updater Instance {
|
||||||
|
get {
|
||||||
|
if(instances == null) {
|
||||||
|
instances = new Updater();
|
||||||
|
}
|
||||||
|
return instances;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Waits for the Result of the Updater thread.
|
||||||
|
/// </summary>
|
||||||
|
public void WaitForExit() {
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Set Path to check for Updates
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="url">HTTP URI</param>
|
||||||
|
public void SetPath(String url) {
|
||||||
|
this.url = url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Check for Updates
|
||||||
|
/// </summary>
|
||||||
|
/// <exception cref="ArgumentException"></exception>
|
||||||
|
public void Check() {
|
||||||
|
if(this.url == "") {
|
||||||
|
throw new ArgumentException("You must set url first.");
|
||||||
|
}
|
||||||
|
if(this.UpdateResult == null) {
|
||||||
|
throw new ArgumentNullException("You must attach an event first.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Update the file
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="filename">The filename of the targetfile</param>
|
||||||
|
/// <param name="url">The url of the sourcefile</param>
|
||||||
|
/// <param name="afterExit">Updates the Programm after it has been closed</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public Boolean Update(String filename, String url, Boolean afterExit = true) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user