diff --git a/Promises/Promises.Tests/V1/Tests/PromiseTests.cs b/Promises/Promises.Tests/V1/Tests/PromiseTests.cs index ace5b05..e763d32 100644 --- a/Promises/Promises.Tests/V1/Tests/PromiseTests.cs +++ b/Promises/Promises.Tests/V1/Tests/PromiseTests.cs @@ -310,7 +310,7 @@ public void Promise_CastToIPromiseBase_Catch_InvokesCallback_WhenPromiseIsFailed IPromise promise = new Promise(); promise.Fail(new Exception()); - var testPromise = (IPromiseBase)promise; + var testPromise = (IFuture)promise; testPromise.Catch(delegate { @@ -2305,7 +2305,7 @@ public void Promise_Then_InvokesCallback_WhenPromiseIsResolved_WhenCastToIPromis { bool didResolve = false; - IPromiseBase promise = (IPromiseBase)GetResolvedPromise(); + var promise = (IFuture)GetResolvedPromise(); promise.Then(delegate { @@ -3625,7 +3625,7 @@ public void GenericPromise_Then_InvokesCallback_WhenPromiseIsResolved() public void GenericPromise_Then_InvokesCallback_WhenPromiseIsResolved_WhenCastIPromiseBase() { bool didResolve = false; - var promise = (IPromiseBase)GetBoolResolvedPromise(true); + var promise = (IFuture)GetBoolResolvedPromise(true); promise.Then(delegate (bool value) { Assert.AreEqual(value, true); diff --git a/Promises/Promises/Promises.csproj b/Promises/Promises/Promises.csproj index 87239c8..0eadf07 100644 --- a/Promises/Promises/Promises.csproj +++ b/Promises/Promises/Promises.csproj @@ -65,7 +65,7 @@ - + diff --git a/Promises/Promises/Promises.nuspec b/Promises/Promises/Promises.nuspec index bc9f9f9..6a63160 100644 --- a/Promises/Promises/Promises.nuspec +++ b/Promises/Promises/Promises.nuspec @@ -14,7 +14,7 @@ $description$ - Adding lib/unity to NuGet package for supporting NuGetForUnity. + Semantic change from IPromiseBase to IFuture. IPromiseBase made obsolete, will remove in future version. $copyright$ diff --git a/Promises/Promises/Properties/AssemblyInfo.cs b/Promises/Promises/Properties/AssemblyInfo.cs index f8da51d..211b48f 100644 --- a/Promises/Promises/Properties/AssemblyInfo.cs +++ b/Promises/Promises/Properties/AssemblyInfo.cs @@ -31,5 +31,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.6.3")] -[assembly: AssemblyFileVersion("1.6.3")] +[assembly: AssemblyVersion("1.7.0")] +[assembly: AssemblyFileVersion("1.7.0")] diff --git a/Promises/Promises/V1/Core/Promise.cs b/Promises/Promises/V1/Core/Promise.cs index f731162..9b75f03 100644 --- a/Promises/Promises/V1/Core/Promise.cs +++ b/Promises/Promises/V1/Core/Promise.cs @@ -768,110 +768,110 @@ protected virtual void ClearPromiseHandlers() #region IPromiseBase Implementation #region Catch - IPromiseBase IPromiseBase.Catch(Action callback) + IFuture IFuture.Catch(Action callback) { return Catch(callback); } - IPromiseBase IPromiseBase.Catch(Action callback) + IFuture IFuture.Catch(Action callback) { return Catch(callback); } #endregion #region Then - IPromiseBase IPromiseBase.Then(Action callback) + IFuture IFuture.Then(Action callback) { return Then(callback); } - IPromiseBase IPromiseBase.Then(Action callback, P1 property1) + IFuture IFuture.Then(Action callback, P1 property1) { return Then(callback, property1); } - IPromiseBase IPromiseBase.Then(Action callback, P1 property1, P2 property2) + IFuture IFuture.Then(Action callback, P1 property1, P2 property2) { return Then(callback, property1, property2); } - IPromiseBase IPromiseBase.Then(Action callback, P1 property1, P2 property2, P3 property3) + IFuture IFuture.Then(Action callback, P1 property1, P2 property2, P3 property3) { return Then(callback, property1, property2, property3); } - IPromiseBase IPromiseBase.Then(Func callback) + IFuture IFuture.Then(Func callback) { return Then(callback); } - IPromiseBase IPromiseBase.Then(Func callback, P1 property1) + IFuture IFuture.Then(Func callback, P1 property1) { return Then(callback, property1); } - IPromiseBase IPromiseBase.Then(Func callback, P1 property1, P2 property2) + IFuture IFuture.Then(Func callback, P1 property1, P2 property2) { return Then(callback, property1, property2); } - IPromiseBase IPromiseBase.Then(Func callback, P1 property1, P2 property2, P3 property3) + IFuture IFuture.Then(Func callback, P1 property1, P2 property2, P3 property3) { return Then(callback, property1, property2, property3); } #endregion #region Chain - public IPromiseBase Chain(Func callback) + public IFuture Chain(Func callback) { return Chain(callback); } - public IPromiseBase Chain(Func callback, P1 property1) + public IFuture Chain(Func callback, P1 property1) { return Chain(callback, property1); } - public IPromiseBase Chain(Func callback, P1 property1, P2 property2) + public IFuture Chain(Func callback, P1 property1, P2 property2) { return Chain(callback, property1, property2); } - public IPromiseBase Chain(Func callback, P1 property1, P2 property2, P3 property3) + public IFuture Chain(Func callback, P1 property1, P2 property2, P3 property3) { return Chain(callback, property1, property2, property3); } - public IPromiseBase Chain(Func> callback) + public IFuture Chain(Func> callback) { return Chain(callback); } - public IPromiseBase Chain(Func> callback, P1 property1) + public IFuture Chain(Func> callback, P1 property1) { return Chain(callback, property1); } - public IPromiseBase Chain(Func> callback, P1 property1, P2 property2) + public IFuture Chain(Func> callback, P1 property1, P2 property2) { return Chain(callback, property1, property2); } - public IPromiseBase Chain(Func> callback, P1 property1, P2 property2, P3 property3) + public IFuture Chain(Func> callback, P1 property1, P2 property2, P3 property3) { return Chain(callback, property1, property2, property3); } #endregion #region Progress - IPromiseBase IPromiseBase.Progress(Action progressHandler) + IFuture IFuture.Progress(Action progressHandler) { return Progress(progressHandler); } #endregion #region Finally - IPromiseBase IPromiseBase.Finally(Action callback) + IFuture IFuture.Finally(Action callback) { return Finally(callback); } @@ -1460,110 +1460,110 @@ protected override void ClearPromiseHandlers() #region IPromiseBase Implementation #region Then - IPromiseBase IPromiseBase.Then(Action callback) + IFuture IFuture.Then(Action callback) { return Then(callback); } - IPromiseBase IPromiseBase.Then(Action callback, P1 property1) + IFuture IFuture.Then(Action callback, P1 property1) { return Then(callback, property1); } - IPromiseBase IPromiseBase.Then(Action callback, P1 property1, P2 property2) + IFuture IFuture.Then(Action callback, P1 property1, P2 property2) { return Then(callback, property1, property2); } - IPromiseBase IPromiseBase.Then(Action callback, P1 property1, P2 property2, P3 property3) + IFuture IFuture.Then(Action callback, P1 property1, P2 property2, P3 property3) { return Then(callback, property1, property2, property3); } - IPromiseBase IPromiseBase.Then(Func callback) + IFuture IFuture.Then(Func callback) { return Then(callback); } - IPromiseBase IPromiseBase.Then(Func callback, P1 property1) + IFuture IFuture.Then(Func callback, P1 property1) { return Then(callback, property1); } - IPromiseBase IPromiseBase.Then(Func callback, P1 property1, P2 property2) + IFuture IFuture.Then(Func callback, P1 property1, P2 property2) { return Then(callback, property1, property2); } - IPromiseBase IPromiseBase.Then(Func callback, P1 property1, P2 property2, P3 property3) + IFuture IFuture.Then(Func callback, P1 property1, P2 property2, P3 property3) { return Then(callback, property1, property2, property3); } #endregion #region Chain - public IPromiseBase Chain(Func callback) + public IFuture Chain(Func callback) { return Chain(callback); } - public IPromiseBase Chain(Func callback, P1 property1) + public IFuture Chain(Func callback, P1 property1) { return Chain(callback, property1); } - public IPromiseBase Chain(Func callback, P1 property1, P2 property2) + public IFuture Chain(Func callback, P1 property1, P2 property2) { return Chain(callback, property1, property2); } - public IPromiseBase Chain(Func callback, P1 property1, P2 property2, P3 property3) + public IFuture Chain(Func callback, P1 property1, P2 property2, P3 property3) { return Chain(callback, property1, property2, property3); } - public IPromiseBase Chain(Func> callback) + public IFuture Chain(Func> callback) { return Chain(callback); } - public IPromiseBase Chain(Func> callback, P1 property1) + public IFuture Chain(Func> callback, P1 property1) { return Chain(callback, property1); } - public IPromiseBase Chain(Func> callback, P1 property1, P2 property2) + public IFuture Chain(Func> callback, P1 property1, P2 property2) { return Chain(callback, property1, property2); } - public IPromiseBase Chain(Func> callback, P1 property1, P2 property2, P3 property3) + public IFuture Chain(Func> callback, P1 property1, P2 property2, P3 property3) { return Chain(callback, property1, property2, property3); } #endregion #region Catch - IPromiseBase IPromiseBase.Catch(Action callback) + IFuture IFuture.Catch(Action callback) { return Catch(callback); } - IPromiseBase IPromiseBase.Catch(Action callback) + IFuture IFuture.Catch(Action callback) { return Catch(callback); } #endregion #region Progress - IPromiseBase IPromiseBase.Progress(Action progressHandler) + IFuture IFuture.Progress(Action progressHandler) { return Progress(progressHandler); } #endregion #region Finally - IPromiseBase IPromiseBase.Finally(Action callback) + IFuture IFuture.Finally(Action callback) { return Finally(callback); } diff --git a/Promises/Promises/V1/Interfaces/IFuture.cs b/Promises/Promises/V1/Interfaces/IFuture.cs new file mode 100644 index 0000000..aff92b1 --- /dev/null +++ b/Promises/Promises/V1/Interfaces/IFuture.cs @@ -0,0 +1,104 @@ +using AOFL.Promises.V1.Core; +using System; + +namespace AOFL.Promises.V1.Interfaces +{ + [Obsolete("Convert to use IFuture semantic.")] + public interface IPromiseBase : IFuture { } + [Obsolete("Convert to use IFuture semantic.")] + public interface IPromiseBase : IFuture { } + + public interface IFuture + { + PromiseState State { get; } + string Name { get; set; } + Exception Error { get; } + + #region Catch + IFuture Catch(Action callback); + IFuture Catch(Action callback) where TException : Exception; + #endregion + + #region Then + IFuture Then(Action callback); + IFuture Then(Action callback, P1 property1); + IFuture Then(Action callback, P1 property1, P2 property2); + IFuture Then(Action callback, P1 property1, P2 property2, P3 property3); + + IFuture Then(Func callback); + IFuture Then(Func callback, P1 property1); + IFuture Then(Func callback, P1 property1, P2 property2); + IFuture Then(Func callback, P1 property1, P2 property2, P3 property3); + #endregion + + #region Chain + IFuture Chain(Func callback); + IFuture Chain(Func callback, P1 property1); + IFuture Chain(Func callback, P1 property1, P2 property2); + IFuture Chain(Func callback, P1 property1, P2 property2, P3 property3); + + IFuture Chain(Func> callback); + IFuture Chain(Func> callback, P1 property1); + IFuture Chain(Func> callback, P1 property1, P2 property2); + IFuture Chain(Func> callback, P1 property1, P2 property2, P3 property3); + #endregion + + #region Done + void Done(); + void Done(Action callback); + #endregion + + #region Progress + IFuture Progress(Action progressHandler); + float GetProgress(); + #endregion + + #region Finally + IFuture Finally(Action callback); + #endregion + + void RequestCancel(); + } + + public interface IFuture : IFuture + { + T1 Value { get; } + + #region Then + IFuture Then(Action callback); + IFuture Then(Action callback, P1 property1); + IFuture Then(Action callback, P1 property1, P2 property2); + IFuture Then(Action callback, P1 property1, P2 property2, P3 property3); + + IFuture Then(Func callback); + IFuture Then(Func callback, P1 property1); + IFuture Then(Func callback, P1 property1, P2 property2); + IFuture Then(Func callback, P1 property1, P2 property2, P3 property3); + #endregion + + #region Chain + IFuture Chain(Func callback); + IFuture Chain(Func callback, P1 property1); + IFuture Chain(Func callback, P1 property1, P2 property2); + IFuture Chain(Func callback, P1 property1, P2 property2, P3 property3); + + IFuture Chain(Func> callback); + IFuture Chain(Func> callback, P1 property1); + IFuture Chain(Func> callback, P1 property1, P2 property2); + IFuture Chain(Func> callback, P1 property1, P2 property2, P3 property3); + #endregion + + #region Catch + new IFuture Catch(Action callback); + new IFuture Catch(Action callback) where TException : Exception; + #endregion + + #region Progress + new IFuture Progress(Action progressHandler); + #endregion + + #region Finally + new IFuture Finally(Action callback); + #endregion + } +} diff --git a/Promises/Promises/V1/Interfaces/IPromise.cs b/Promises/Promises/V1/Interfaces/IPromise.cs index 26f7633..04cba0d 100644 --- a/Promises/Promises/V1/Interfaces/IPromise.cs +++ b/Promises/Promises/V1/Interfaces/IPromise.cs @@ -7,7 +7,7 @@ namespace AOFL.Promises.V1.Interfaces { - public interface IPromise : IPromiseBase + public interface IPromise : IFuture { event PromiseCancelRequestedHandler CancelRequested; @@ -72,7 +72,7 @@ public interface IPromise : IPromiseBase new void RequestCancel(); } - public interface IPromise : IPromiseBase, IPromise + public interface IPromise : IFuture, IPromise { new T1 Value { get; } diff --git a/Promises/Promises/V1/Interfaces/IPromiseBase.cs b/Promises/Promises/V1/Interfaces/IPromiseBase.cs deleted file mode 100644 index 47a4279..0000000 --- a/Promises/Promises/V1/Interfaces/IPromiseBase.cs +++ /dev/null @@ -1,102 +0,0 @@ -using AOFL.Promises.V1.Core; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace AOFL.Promises.V1.Interfaces -{ - public interface IPromiseBase - { - PromiseState State { get; } - string Name { get; set; } - Exception Error { get; } - - #region Catch - IPromiseBase Catch(Action callback); - IPromiseBase Catch(Action callback) where TException : Exception; - #endregion - - #region Then - IPromiseBase Then(Action callback); - IPromiseBase Then(Action callback, P1 property1); - IPromiseBase Then(Action callback, P1 property1, P2 property2); - IPromiseBase Then(Action callback, P1 property1, P2 property2, P3 property3); - - IPromiseBase Then(Func callback); - IPromiseBase Then(Func callback, P1 property1); - IPromiseBase Then(Func callback, P1 property1, P2 property2); - IPromiseBase Then(Func callback, P1 property1, P2 property2, P3 property3); - #endregion - - #region Chain - IPromiseBase Chain(Func callback); - IPromiseBase Chain(Func callback, P1 property1); - IPromiseBase Chain(Func callback, P1 property1, P2 property2); - IPromiseBase Chain(Func callback, P1 property1, P2 property2, P3 property3); - - IPromiseBase Chain(Func> callback); - IPromiseBase Chain(Func> callback, P1 property1); - IPromiseBase Chain(Func> callback, P1 property1, P2 property2); - IPromiseBase Chain(Func> callback, P1 property1, P2 property2, P3 property3); - #endregion - - #region Done - void Done(); - void Done(Action callback); - #endregion - - #region Progress - IPromiseBase Progress(Action progressHandler); - float GetProgress(); - #endregion - - #region Finally - IPromiseBase Finally(Action callback); - #endregion - - void RequestCancel(); - } - - public interface IPromiseBase : IPromiseBase - { - T1 Value { get; } - - #region Then - IPromiseBase Then(Action callback); - IPromiseBase Then(Action callback, P1 property1); - IPromiseBase Then(Action callback, P1 property1, P2 property2); - IPromiseBase Then(Action callback, P1 property1, P2 property2, P3 property3); - - IPromiseBase Then(Func callback); - IPromiseBase Then(Func callback, P1 property1); - IPromiseBase Then(Func callback, P1 property1, P2 property2); - IPromiseBase Then(Func callback, P1 property1, P2 property2, P3 property3); - #endregion - - #region Chain - IPromiseBase Chain(Func callback); - IPromiseBase Chain(Func callback, P1 property1); - IPromiseBase Chain(Func callback, P1 property1, P2 property2); - IPromiseBase Chain(Func callback, P1 property1, P2 property2, P3 property3); - - IPromiseBase Chain(Func> callback); - IPromiseBase Chain(Func> callback, P1 property1); - IPromiseBase Chain(Func> callback, P1 property1, P2 property2); - IPromiseBase Chain(Func> callback, P1 property1, P2 property2, P3 property3); - #endregion - - #region Catch - new IPromiseBase Catch(Action callback); - new IPromiseBase Catch(Action callback) where TException : Exception; - #endregion - - #region Progress - new IPromiseBase Progress(Action progressHandler); - #endregion - - #region Finally - new IPromiseBase Finally(Action callback); - #endregion - } -}