Skip to content

Commit

Permalink
Revert "Merge pull request #108 from paolosalvatori/assembly-version-…
Browse files Browse the repository at this point in the history
…locally-and-on-buildserver"

This reverts commit 666eb7b, reversing
changes made to 957e3b9.
  • Loading branch information
SeanFeldman committed May 4, 2017
1 parent 666eb7b commit 6d77b1f
Show file tree
Hide file tree
Showing 9 changed files with 152 additions and 56 deletions.
78 changes: 33 additions & 45 deletions Forms/AboutForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 1 addition & 5 deletions Forms/AboutForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

namespace Microsoft.Azure.ServiceBusExplorer.Forms
{
public sealed partial class AboutForm : Form
public partial class AboutForm : Form
{
#region Private Fields
private readonly Bitmap whiteLogoBitmap = new Bitmap(Resources.WhiteLogo);
Expand Down Expand Up @@ -115,10 +115,6 @@ public AboutForm()
timer.Interval = 40;
timer.Tick += timer_Tick;
timer.Enabled = true;

var version = VersionProvider.GetVersion();
Text += version;
lblVersion.Text += VersionProvider.GetVersionWithSha();
}
#endregion

Expand Down
11 changes: 9 additions & 2 deletions Forms/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6911,8 +6911,15 @@ private async void purgeDeadletterQueueMessages_Click(object sender, EventArgs e

private void MainForm_Load(object sender, EventArgs e)
{
var version = VersionProvider.GetVersion();
Text = $@"Service Bus Explore {version}";
if (!Text.EndsWith("1.0.0"))
{
return;
}
var version = VersionHelper.RetrieveLatestReleaseFromGitHubAsync().Result;
if (!string.IsNullOrWhiteSpace(version))
{
Text = $@"Service Bus Explore {version}";
}
}
#endregion
}
Expand Down
68 changes: 68 additions & 0 deletions Helpers/VersionHelper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#region Copyright
//=======================================================================================
// Microsoft Azure Customer Advisory Team
//
// This sample is supplemental to the technical guidance published on my personal
// blog at http://blogs.msdn.com/b/paolos/.
//
// Author: Paolo Salvatori
//=======================================================================================
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// LICENSED UNDER THE APACHE LICENSE, VERSION 2.0 (THE "LICENSE"); YOU MAY NOT USE THESE
// FILES EXCEPT IN COMPLIANCE WITH THE LICENSE. YOU MAY OBTAIN A COPY OF THE LICENSE AT
// http://www.apache.org/licenses/LICENSE-2.0
// UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING, SOFTWARE DISTRIBUTED UNDER THE
// LICENSE IS DISTRIBUTED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, EITHER EXPRESS OR IMPLIED. SEE THE LICENSE FOR THE SPECIFIC LANGUAGE GOVERNING
// PERMISSIONS AND LIMITATIONS UNDER THE LICENSE.
//=======================================================================================
#endregion

#region Using Directives

using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Microsoft.Azure.ServiceBusExplorer.Forms;
using Newtonsoft.Json.Linq;

#endregion


namespace Microsoft.Azure.ServiceBusExplorer.Helpers
{
public static class VersionHelper
{
#region Public Static Methods

public static async Task<string> RetrieveLatestReleaseFromGitHubAsync()
{
try
{
var httpClient = new HttpClient
{
BaseAddress = new Uri("https://api.github.com")
};
httpClient.DefaultRequestHeaders.Accept.Clear();
httpClient.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue(new ProductHeaderValue("ServiceBusExplorer")));
httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

var httpResponseMessage = await httpClient.GetAsync("/repos/paolosalvatori/servicebusexplorer/releases/latest").ConfigureAwait(false);
if (httpResponseMessage.IsSuccessStatusCode)
{
var json = await httpResponseMessage.Content.ReadAsStringAsync();
var jObject = JObject.Parse(json);
return (string)jObject.SelectToken("name");
}
}
catch (Exception ex)
{
MainForm.SingletonMainForm.HandleException(ex);
}
return null;
}
#endregion
}
}
2 changes: 2 additions & 0 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
[assembly: AssemblyCopyright("Copyright © Microsoft 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
Expand Down
36 changes: 36 additions & 0 deletions ServiceBusExplorer.Tests/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ServiceBusExplorer.Tests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("ServiceBusExplorer.Tests")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("ab80c6e1-376c-4e98-8512-5ac9161e932b")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// 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.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
4 changes: 1 addition & 3 deletions ServiceBusExplorer.Tests/ServiceBusExplorer.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Helpers\ConversionHelperTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
Expand All @@ -50,9 +51,6 @@
<ItemGroup>
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand Down
1 change: 1 addition & 0 deletions ServiceBusExplorer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,7 @@
<Compile Include="Helpers\OnOffDeviceEventDataGenerator.cs" />
<Compile Include="Helpers\ThresholdDeviceBrokeredMessageGenerator.cs" />
<Compile Include="Helpers\ThresholdDeviceEventDataGenerator.cs" />
<Compile Include="Helpers\VersionHelper.cs" />
<Compile Include="Helpers\VersionProvider.cs" />
<Compile Include="Helpers\WindowsPhoneNotificationXmlBuilder.cs" />
<Compile Include="Helpers\MonitorRuleList.cs" />
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ assembly_info:
before_build:
- nuget restore
- cmd: echo %appveyor_build_version%
- ps: gitversion /l console /output buildserver /updateAssemblyInfo GitVersionTaskAssemblyInfo.g.cs
- ps: gitversion /l console /output buildserver /updateAssemblyInfo
- cmd: echo %appveyor_build_version%
- cmd: ECHO %GitVersion_MajorMinorPatch%

Expand Down

0 comments on commit 6d77b1f

Please sign in to comment.