diff --git a/Utils/OwnObject.cs b/Utils/OwnObject.cs index be98b00..6b6c586 100644 --- a/Utils/OwnObject.cs +++ b/Utils/OwnObject.cs @@ -7,7 +7,7 @@ namespace BlubbFish.Utils { abstract public class OwnObject { - public class LogObject { + public struct LogObject { public LogObject(DateTime date, String location, String message, LogLevel level) { this.Date = date; this.Location = location; diff --git a/Utils/Updater.cs b/Utils/Updater.cs new file mode 100644 index 0000000..95001ab --- /dev/null +++ b/Utils/Updater.cs @@ -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() { } + + /// + /// Get Instance of Updater + /// + public static Updater Instance { + get { + if(instances == null) { + instances = new Updater(); + } + return instances; + } + } + + /// + /// Waits for the Result of the Updater thread. + /// + public void WaitForExit() { + throw new NotImplementedException(); + } + + /// + /// Set Path to check for Updates + /// + /// HTTP URI + public void SetPath(String url) { + this.url = url; + } + + /// + /// Check for Updates + /// + /// + 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."); + } + } + + /// + /// Update the file + /// + /// The filename of the targetfile + /// The url of the sourcefile + /// Updates the Programm after it has been closed + /// + public Boolean Update(String filename, String url, Boolean afterExit = true) { + return true; + } + } +}