using System; using System.Collections.Generic; using System.Text; namespace MPQ.Updater { public class MPQUpdaterEvent { public const int TYPE_COMPLETE = 1; public const int TYPE_VALIDATING = 2; public const int TYPE_DOWNLOADING = 3; public const int TYPE_UNZIP = 4; public const int TYPE_ERROR = -1; public const int TYPE_NOT_ENOUGH_SPACE = -2; public const int TYPE_NA = 0; public int EventType { get; private set; } public string Message { get; private set; } public Exception Cause { get; private set; } public MPQUpdaterEvent(int type, string message, Exception err=null) { this.EventType = type; this.Message = message; this.Cause = err; } override public string ToString() { string ret = "Code=" + EventType; if (Message != null) return "\n" + Message; if (Cause != null) return "\n" + Cause.Message; return ret; } } public interface MPQUpdaterListener { void onEvent(MPQUpdater updater, MPQUpdaterEvent e); } }