Skip to content

Commit 9f6644e

Browse files
Add UpdateInstallationResult to client
Add SharedAssemblyInfo
1 parent a2a3208 commit 9f6644e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+356
-168
lines changed

Telimena/AutomaticTestsClient/Properties/AssemblyInfo.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@
3434
//// [assembly: AssemblyVersion("1.0.*")]
3535

3636

37-
//[assembly: AssemblyVersion("1.0.1.0")]
38-
//[assembly: AssemblyFileVersion("1.1.1.0")]
37+
////[assembly: AssemblyVersion("1.0.1.0")]
38+
////[assembly: AssemblyFileVersion("1.1.1.0")]
3939

40-
//[assembly: AssemblyVersion("2.0.1.0")]
41-
//[assembly: AssemblyFileVersion("2.1.1.0")]
40+
////[assembly: AssemblyVersion("2.0.1.0")]
41+
////[assembly: AssemblyFileVersion("2.1.1.0")]
4242

43-
[assembly: AssemblyVersion("1.0.1.0")]
44-
[assembly: AssemblyFileVersion("1.1.1.0")]
43+
//[assembly: AssemblyVersion("1.0.1.0")]
44+
//[assembly: AssemblyFileVersion("1.1.1.0")]

Telimena/EmbeddedAssemblyTest/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("1.0.0.0")]
36-
[assembly: AssemblyFileVersion("1.0.0.0")]
35+
//[assembly: AssemblyVersion("1.0.0.0")]
36+
//[assembly: AssemblyFileVersion("1.0.0.0")]

Telimena/InstallersTestApp/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
// [assembly: AssemblyVersion("1.0.*")]
3535

3636

37-
[assembly: AssemblyVersion("1.0.0.2")]
38-
[assembly: AssemblyFileVersion("1.0.0.2")]
37+
//[assembly: AssemblyVersion("1.0.0.2")]
38+
//[assembly: AssemblyFileVersion("1.0.0.2")]
3939

4040

4141
//in order to generate the installer for each version

Telimena/PackageTriggerUpdaterTestApp/PackageTriggerUpdaterTestApp.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
<Reference Include="System.Xml" />
4747
</ItemGroup>
4848
<ItemGroup>
49-
<Compile Include="PackageUpdateTesterArguments.cs" />
5049
<Compile Include="PackageTriggerUpdaterTestProgram.cs" />
5150
<Compile Include="Properties\AssemblyInfo.cs" />
5251
</ItemGroup>
@@ -61,6 +60,7 @@
6160
<Name>Telimena.Client</Name>
6261
</ProjectReference>
6362
</ItemGroup>
63+
<Import Project="..\TestAppsSharedLogic\TestAppsSharedLogic.projitems" Label="Shared" />
6464
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
6565
<PropertyGroup>
6666
<PostBuildEvent>powershell -NoProfile -ExecutionPolicy RemoteSigned -file $(ProjectDir)\addToZip.ps1 -SolutionDir $(SolutionDir) -TargetPath $(TargetPath)</PostBuildEvent>

Telimena/PackageTriggerUpdaterTestApp/PackageTriggerUpdaterTestProgram.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using System.Windows.Forms;
77
using Newtonsoft.Json;
88
using Newtonsoft.Json.Serialization;
9+
using SharedLogic;
910
using TelimenaClient;
1011
using TelimenaClient.Model;
1112
using TelimenaClient.Model.Internal;
@@ -65,13 +66,13 @@ public static void PerformUpdate()
6566
MessageBox.Show($"Killed other processes: {killed}", "Updater finished");
6667
}
6768

68-
public static void Work(PackageUpdateTesterArguments arguments)
69+
public static void Work(Arguments arguments)
6970
{
7071
Console.WriteLine("Starting update handling...");
7172
ITelimena teli = TelimenaFactory.Construct(new TelimenaStartupInfo(arguments.TelemetryKey, new Uri(arguments.ApiUrl)));
7273
teli.Properties.UpdatePromptingMode = UpdatePromptingModes.PromptBeforeDownload;
7374
Console.WriteLine("Telimena created... Handling updates");
74-
UpdateCheckResult result = teli.Update.HandleUpdates(false);
75+
UpdateInstallationResult result = teli.Update.HandleUpdates(false);
7576
Console.WriteLine("Finished update handling");
7677
JsonSerializerSettings settings = new JsonSerializerSettings {ContractResolver = new MyJsonContractResolver()};
7778
Console.WriteLine(JsonConvert.SerializeObject(result, settings));
@@ -95,13 +96,13 @@ private static void Main(string[] args)
9596
return;
9697
}
9798

98-
PackageUpdateTesterArguments arguments;
99+
Arguments arguments;
99100
Console.WriteLine("Loading Arguments...");
100101
string decoded = "";
101102
try
102103
{
103104
decoded = Base64Decode(args[0]);
104-
arguments = JsonConvert.DeserializeObject<PackageUpdateTesterArguments>(decoded);
105+
arguments = JsonConvert.DeserializeObject<Arguments>(decoded);
105106
}
106107
catch (Exception ex)
107108
{

Telimena/PackageTriggerUpdaterTestApp/PackageUpdateTesterArguments.cs

Lines changed: 0 additions & 12 deletions
This file was deleted.

Telimena/PackageTriggerUpdaterTestApp/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("1.0.1.2")]
36-
[assembly: AssemblyFileVersion("1.1.1.2")]
35+
//[assembly: AssemblyVersion("1.0.1.2")]
36+
//[assembly: AssemblyFileVersion("1.1.1.2")]

Telimena/Telimena.Client.Tests/TestConstructor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,10 @@ private void ValidateFaultyTeli(ITelimena teli)
126126
teli.Track.Log(LogLevel.Warn, "There should be no error here even though it is not working");
127127
teli.Track.SendAllDataNow();
128128

129-
var result = teli.Update.CheckForUpdates();
129+
UpdateCheckResult result = teli.Update.CheckForUpdates();
130130

131131
Assert.AreEqual("Update check handled by NullObjectTelemetryModule", result.Exception.Message);
132-
result = teli.Update.HandleUpdatesAsync(true).Result;
132+
UpdateInstallationResult result2 = teli.Update.HandleUpdatesAsync(true).Result;
133133

134134
Assert.IsNotNull(teli.Properties);
135135
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
namespace TelimenaClient.Model.Internal
2+
{
3+
/// <summary>
4+
/// Returned after handling update installation
5+
/// </summary>
6+
public class UpdateInstallationResult
7+
{
8+
/// <summary>
9+
/// The result of update check procedure
10+
/// </summary>
11+
public UpdateCheckResult CheckResult { get; set; }
12+
13+
/// <summary>
14+
/// Gets or sets the exception which occurred during installation
15+
/// </summary>
16+
/// <value>The exception.</value>
17+
public TelimenaException Exception { get; set; }
18+
19+
}
20+
}

Telimena/Telimena.Client/NullObjects/NullObjectUpdatesModule.cs

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,48 +6,55 @@ namespace TelimenaClient
66
{
77
internal class NullObjectUpdatesModule : IUpdatesModule
88
{
9-
private UpdateCheckResult Result =>
9+
private UpdateCheckResult CheckResult =>
1010
new UpdateCheckResult()
1111
{
1212
Exception = new TelimenaException($"Update check handled by {nameof(NullObjectTelemetryModule)}")
1313
};
1414

15+
private UpdateInstallationResult InstallationResult =>
16+
new UpdateInstallationResult()
17+
{
18+
Exception = new TelimenaException($"Update installation handled by {nameof(NullObjectTelemetryModule)}")
19+
};
20+
1521
public Task<UpdateCheckResult> CheckForUpdatesAsync(bool acceptBeta = true)
1622
{
1723
// This is for when initialization of proper telemetry module would fail - we should never throw errors in client code!
18-
return Task.FromResult(this.Result);
24+
return Task.FromResult(this.CheckResult);
1925
}
2026

21-
public Task<UpdateCheckResult> HandleUpdatesAsync(bool acceptBeta)
27+
public Task<UpdateInstallationResult> HandleUpdatesAsync(bool acceptBeta)
2228
{
2329
// This is for when initialization of proper telemetry module would fail - we should never throw errors in client code!
24-
return Task.FromResult(this.Result);
30+
return Task.FromResult(this.InstallationResult);
2531

2632
}
2733

2834
public UpdateCheckResult CheckForUpdates()
2935
{
3036
// This is for when initialization of proper telemetry module would fail - we should never throw errors in client code!
31-
return this.Result;
37+
return this.CheckResult;
3238
}
3339

34-
public void InstallUpdates(UpdateCheckResult checkResult, bool acceptBeta)
40+
public UpdateInstallationResult InstallUpdates(UpdateCheckResult checkResult, bool acceptBeta)
3541
{
3642
// This is for when initialization of proper telemetry module would fail - we should never throw errors in client code!
43+
return this.InstallationResult;
3744
}
3845

39-
public Task InstallUpdatesAsync(UpdateCheckResult checkResult, bool acceptBeta)
46+
public Task<UpdateInstallationResult> InstallUpdatesAsync(UpdateCheckResult checkResult, bool acceptBeta)
4047
{
4148

4249
// This is for when initialization of proper telemetry module would fail - we should never throw errors in client code!
43-
return Task.FromResult(this.Result);
50+
return Task.FromResult(this.InstallationResult);
4451

4552
}
4653

47-
public UpdateCheckResult HandleUpdates(bool acceptBeta)
54+
public UpdateInstallationResult HandleUpdates(bool acceptBeta)
4855
{
4956
// This is for when initialization of proper telemetry module would fail - we should never throw errors in client code!
50-
return this.Result;
57+
return this.InstallationResult;
5158
}
5259
}
5360
}

Telimena/Telimena.Client/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
3535
[assembly: AssemblyVersion("2.6.0.0")]
36-
[assembly: AssemblyFileVersion("2.7.3.0")]
36+
[assembly: AssemblyFileVersion("2.8.0.0")]
3737
[assembly: InternalsVisibleTo("Telimena.Client, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c971ad3e98a859ebdad5167d153292910c2fd4bbf59e41005addb7bf3f5fcf42552125709c9768719dfdfbc6af2cbac13aa0369b19cfc67f260b5b0f78cc8a3dee96bf2ad1b6795b9a9643d71dc2cc8b90c03a591ef1578f4cd000fce54eb7f7c8c660fd7a12089860ea2e0326b2a1e7635f17ae9c8ef0c62a54176432545ac3")]
3838
[assembly: InternalsVisibleTo("Telimena.Client.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c971ad3e98a859ebdad5167d153292910c2fd4bbf59e41005addb7bf3f5fcf42552125709c9768719dfdfbc6af2cbac13aa0369b19cfc67f260b5b0f78cc8a3dee96bf2ad1b6795b9a9643d71dc2cc8b90c03a591ef1578f4cd000fce54eb7f7c8c660fd7a12089860ea2e0326b2a1e7635f17ae9c8ef0c62a54176432545ac3")]
3939
[assembly: InternalsVisibleTo("Telimena.Updater.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c971ad3e98a859ebdad5167d153292910c2fd4bbf59e41005addb7bf3f5fcf42552125709c9768719dfdfbc6af2cbac13aa0369b19cfc67f260b5b0f78cc8a3dee96bf2ad1b6795b9a9643d71dc2cc8b90c03a591ef1578f4cd000fce54eb7f7c8c660fd7a12089860ea2e0326b2a1e7635f17ae9c8ef0c62a54176432545ac3")]

Telimena/Telimena.Client/Telimena.Client.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@
8989
<ItemGroup>
9090
<Compile Include="Messenger\ApiRoutes.cs" />
9191
<Compile Include="Model\DefaultToolkitNames.cs" />
92+
<Compile Include="Model\Internal\UpdateInstallationResult.cs" />
9293
<Compile Include="Model\LogLevel.cs" />
9394
<Compile Include="NullObjects\NullObjectTelemetryModule.cs" />
9495
<Compile Include="NullObjects\NullObjectTelimena.cs" />

Telimena/Telimena.Client/Updates/IUpdatesModule.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public interface IUpdatesModule : IFluentInterface
2424
/// </summary>
2525
/// <param name="acceptBeta">Determines whether update packages marked as 'beta' version should be used</param>
2626
/// <returns></returns>
27-
Task<UpdateCheckResult> HandleUpdatesAsync(bool acceptBeta);
27+
Task<UpdateInstallationResult> HandleUpdatesAsync(bool acceptBeta);
2828

2929

3030
/// <summary>
@@ -48,16 +48,15 @@ public interface IUpdatesModule : IFluentInterface
4848
/// <param name="checkResult">The result contains info about packages to be installed. You can modify it (e.g. exclude certain ones)</param>
4949
/// <param name="acceptBeta">Determines whether update packages marked as 'beta' version should be used</param>
5050
/// <returns></returns>
51-
void InstallUpdates(UpdateCheckResult checkResult, bool acceptBeta);
51+
UpdateInstallationResult InstallUpdates(UpdateCheckResult checkResult, bool acceptBeta);
5252

5353
/// <summary>
5454
/// Installs the updates specified in the input parameter. It will not ask any questions.
5555
/// </summary>
5656
/// <param name="checkResult">The result contains info about packages to be installed. You can modify it (e.g. exclude certain ones)</param>
5757
/// <param name="acceptBeta">Determines whether update packages marked as 'beta' version should be used</param>
5858
/// <returns></returns>
59-
Task InstallUpdatesAsync(UpdateCheckResult checkResult, bool acceptBeta);
60-
59+
Task<UpdateInstallationResult> InstallUpdatesAsync(UpdateCheckResult checkResult, bool acceptBeta);
6160

6261
/// <summary>
6362
/// Handles the updating process from start to end
@@ -68,6 +67,6 @@ public interface IUpdatesModule : IFluentInterface
6867
/// </summary>
6968
/// <param name="acceptBeta">Determines whether update packages marked as 'beta' version should be used</param>
7069
/// <returns></returns>
71-
UpdateCheckResult HandleUpdates(bool acceptBeta);
70+
UpdateInstallationResult HandleUpdates(bool acceptBeta);
7271
}
7372
}

Telimena/Telimena.Client/Updates/UpdatesModule.cs

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,12 @@ public async Task<UpdateCheckResult> CheckForUpdatesAsync(bool acceptBeta = true
7373
}
7474

7575
/// <inheritdoc />
76-
public async Task<UpdateCheckResult> HandleUpdatesAsync(bool acceptBeta)
76+
public async Task<UpdateInstallationResult> HandleUpdatesAsync(bool acceptBeta)
7777
{
78+
UpdateCheckResult checkResult = null;
7879
try
7980
{
80-
UpdateCheckResult checkResult = await this.CheckForUpdatesAsync(acceptBeta).ConfigureAwait(false);
81+
checkResult = await this.CheckForUpdatesAsync(acceptBeta).ConfigureAwait(false);
8182
if (checkResult.Exception == null)
8283
{
8384
UpdateHandler handler = new UpdateHandler(this.telimena.Messenger, this.telimena.Properties.LiveProgramInfo, new DefaultWpfInputReceiver()
@@ -89,7 +90,10 @@ public async Task<UpdateCheckResult> HandleUpdatesAsync(bool acceptBeta)
8990
throw checkResult.Exception;
9091
}
9192

92-
return checkResult;
93+
return new UpdateInstallationResult()
94+
{
95+
CheckResult = checkResult
96+
};
9397
}
9498
catch (Exception ex)
9599
{
@@ -99,7 +103,11 @@ public async Task<UpdateCheckResult> HandleUpdatesAsync(bool acceptBeta)
99103
throw exception;
100104
}
101105

102-
return new UpdateCheckResult { Exception = exception };
106+
return new UpdateInstallationResult()
107+
{
108+
CheckResult = checkResult
109+
,Exception = exception
110+
};
103111
}
104112
}
105113

@@ -131,13 +139,13 @@ public UpdateCheckResult CheckForUpdates()
131139
}
132140

133141
/// <inheritdoc />
134-
public void InstallUpdates(UpdateCheckResult checkResult, bool acceptBeta)
142+
public UpdateInstallationResult InstallUpdates(UpdateCheckResult checkResult, bool acceptBeta)
135143
{
136-
Task.Run(() => this.InstallUpdatesAsync(checkResult, acceptBeta)).GetAwaiter().GetResult();
144+
return Task.Run(() => this.InstallUpdatesAsync(checkResult, acceptBeta)).GetAwaiter().GetResult();
137145
}
138146

139147
/// <inheritdoc />
140-
public Task InstallUpdatesAsync(UpdateCheckResult checkResult, bool takeBeta)
148+
public async Task<UpdateInstallationResult> InstallUpdatesAsync(UpdateCheckResult checkResult, bool takeBeta)
141149
{
142150
try
143151
{
@@ -147,7 +155,12 @@ public Task InstallUpdatesAsync(UpdateCheckResult checkResult, bool takeBeta)
147155
}
148156
UpdateHandler handler = new UpdateHandler(this.telimena.Messenger, this.telimena.Properties.LiveProgramInfo, new DefaultWpfInputReceiver()
149157
, new UpdateInstaller(), this.telimena.Locator);
150-
return handler.HandleUpdates(UpdatePromptingModes.DontPrompt, checkResult.ProgramUpdatesToInstall, checkResult.UpdaterUpdate);
158+
await handler.HandleUpdates(UpdatePromptingModes.DontPrompt, checkResult.ProgramUpdatesToInstall, checkResult.UpdaterUpdate).ConfigureAwait(false);
159+
160+
return new UpdateInstallationResult()
161+
{
162+
CheckResult = checkResult
163+
};
151164
}
152165
catch (Exception ex)
153166
{
@@ -156,14 +169,17 @@ public Task InstallUpdatesAsync(UpdateCheckResult checkResult, bool takeBeta)
156169
{
157170
throw exception;
158171
}
159-
160-
return Task.FromResult(false);
172+
return new UpdateInstallationResult()
173+
{
174+
CheckResult = checkResult
175+
,Exception = exception
176+
};
161177
}
162178

163179
}
164180

165181
/// <inheritdoc />
166-
public UpdateCheckResult HandleUpdates(bool acceptBeta)
182+
public UpdateInstallationResult HandleUpdates(bool acceptBeta)
167183
{
168184
return Task.Run(() => this.HandleUpdatesAsync(acceptBeta)).GetAwaiter().GetResult();
169185
}

0 commit comments

Comments
 (0)