forked from synhershko/NAppUpdate
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hack a way around some serialization related issues
The abstract class only wraps some common functionality on top of the IUpdateTask interface, a consumer can either derive from it or implement the interface himself. Binary serialization saves us a lot of work, but makes implementing a task more of an hassle than it should be, so we might move to a more transient way in the future
- Loading branch information
1 parent
ed2b72c
commit 9c499e8
Showing
8 changed files
with
66 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using System; | ||
using NAppUpdate.Framework.Common; | ||
using NAppUpdate.Framework.Conditions; | ||
using NAppUpdate.Framework.Sources; | ||
|
||
namespace NAppUpdate.Framework.Tasks | ||
{ | ||
[Serializable] | ||
public abstract class UpdateTaskBase : IUpdateTask | ||
{ | ||
public string Description { get; set; } | ||
public TaskExecutionStatus ExecutionStatus { get; set; } | ||
|
||
[NonSerialized] | ||
private BooleanCondition _updateConditions; | ||
public BooleanCondition UpdateConditions | ||
{ | ||
get { return _updateConditions ?? (_updateConditions = new BooleanCondition()); } | ||
set { _updateConditions = value; } | ||
} | ||
|
||
[field: NonSerialized] | ||
public event ReportProgressDelegate ProgressDelegate; | ||
|
||
public virtual void OnProgress(UpdateProgressInfo pi) | ||
{ | ||
if (ProgressDelegate != null) | ||
ProgressDelegate(pi); | ||
} | ||
|
||
public abstract bool Prepare(IUpdateSource source); | ||
public abstract TaskExecutionStatus Execute(bool coldRun); | ||
public abstract bool Rollback(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using NAppUpdate.Framework.Tasks; | ||
|
||
namespace NAppUpdate.Tests.Tasks | ||
{ | ||
[TestClass] | ||
public class BasicTaskTests | ||
{ | ||
[TestMethod] | ||
public void TestTaskDefaultCharacteristics() | ||
{ | ||
var task = new FileUpdateTask(); // just a random task object | ||
Assert.IsTrue(task.ExecutionStatus == TaskExecutionStatus.Pending); | ||
} | ||
} | ||
} |