From a88b32e2375d90dfa92b952d70623486547f7c35 Mon Sep 17 00:00:00 2001
From: sr55 <sr55.hb@outlook.com>
Date: Sun, 18 Dec 2016 22:15:56 +0000
Subject: [PATCH] WinGui: Update the VersionUtility class to work for official
 releases that are not from subversion.

---
 .../Properties/AssemblyInfo.cs                |  2 +-
 .../Utilities/VersionHelper.cs                | 12 ++--
 win/CS/HandBrakeWPF/HandBrakeWPF.csproj       |  2 -
 .../HandBrakeWPF/Properties/AssemblyInfo.cs   |  2 +-
 .../Properties/AssemblyInfo.cs.Nightly.tmpl   | 65 -------------------
 .../Properties/AssemblyInfo.cs.tmpl           | 65 -------------------
 win/CS/build.xml                              | 19 +-----
 7 files changed, 9 insertions(+), 158 deletions(-)
 delete mode 100644 win/CS/HandBrakeWPF/Properties/AssemblyInfo.cs.Nightly.tmpl
 delete mode 100644 win/CS/HandBrakeWPF/Properties/AssemblyInfo.cs.tmpl

diff --git a/win/CS/HandBrake.ApplicationServices/Properties/AssemblyInfo.cs b/win/CS/HandBrake.ApplicationServices/Properties/AssemblyInfo.cs
index 98317d1f1..3d0461627 100644
--- a/win/CS/HandBrake.ApplicationServices/Properties/AssemblyInfo.cs
+++ b/win/CS/HandBrake.ApplicationServices/Properties/AssemblyInfo.cs
@@ -43,5 +43,5 @@ using System.Runtime.InteropServices;
 // 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("0.0.0.0")]
+[assembly: AssemblyVersion("1.0.0.0")]
 [assembly: NeutralResourcesLanguage("")]
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/VersionHelper.cs b/win/CS/HandBrake.ApplicationServices/Utilities/VersionHelper.cs
index 47673c112..209e3ddc8 100644
--- a/win/CS/HandBrake.ApplicationServices/Utilities/VersionHelper.cs
+++ b/win/CS/HandBrake.ApplicationServices/Utilities/VersionHelper.cs
@@ -28,11 +28,9 @@ namespace HandBrake.ApplicationServices.Utilities
         /// </returns>
         public static string GetVersion()
         {
-            Version version = Assembly.GetEntryAssembly().GetName().Version;
-
             IHandBrakeInstance instance = HandBrakeInstanceManager.GetScanInstance(1);
        
-            return IsNightly() ? string.Format("Nightly {0} ({1})", instance.Version, instance.Build) : string.Format("{0}.{1}.{2}.{3}", version.Major, version.Minor, version.Build, version.Revision);
+            return IsNightly() ? string.Format("Nightly {0} ({1})", instance.Version, instance.Build) : string.Format("{0} ({1})", instance.Version, instance.Build);
         }
 
         /// <summary>
@@ -43,10 +41,10 @@ namespace HandBrake.ApplicationServices.Utilities
         /// </returns>
         public static bool IsNightly()
         {
-            Version version = Assembly.GetEntryAssembly().GetName().Version;
+            IHandBrakeInstance instance = HandBrakeInstanceManager.GetScanInstance(1);
 
-            // The MSBuild.xml script sets 0.0.0 for nightly builds.
-            return version.Major == 0 && version.Minor == 0 && version.Build == 0;
+            // 01 = Unofficial Builds.  00 = Official Tagged Releases.
+            return instance.Build.ToString().EndsWith("01");
         }
 
         /// <summary>
@@ -57,7 +55,7 @@ namespace HandBrake.ApplicationServices.Utilities
         /// </returns>
         public static string GetPlatformBitnessVersion()
         {
-            return System.Environment.Is64BitProcess ? "64bit Version" : "32bit Version";
+            return System.Environment.Is64BitProcess ? "64bit" : "32bit";
         }
 
         /// <summary>
diff --git a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj
index 71584b1b0..5537b4045 100644
--- a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj
+++ b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj
@@ -475,8 +475,6 @@
     <None Include="Installer\Installer64.nsi" />
     <None Include="Installer\MakeNightly.nsi" />
     <None Include="Installer\MakeNightly64.nsi" />
-    <None Include="Properties\AssemblyInfo.cs.Nightly.tmpl" />
-    <None Include="Properties\AssemblyInfo.cs.tmpl" />
     <AppDesigner Include="Properties\" />
     <EmbeddedResource Include="public.key" />
   </ItemGroup>
diff --git a/win/CS/HandBrakeWPF/Properties/AssemblyInfo.cs b/win/CS/HandBrakeWPF/Properties/AssemblyInfo.cs
index f3a0d749e..66b7716db 100644
--- a/win/CS/HandBrakeWPF/Properties/AssemblyInfo.cs
+++ b/win/CS/HandBrakeWPF/Properties/AssemblyInfo.cs
@@ -61,5 +61,5 @@ using System.Windows;
 // 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("0.0.0.0")]
+[assembly: AssemblyVersion("1.0.0.0")]
 [assembly: NeutralResourcesLanguage("")]
\ No newline at end of file
diff --git a/win/CS/HandBrakeWPF/Properties/AssemblyInfo.cs.Nightly.tmpl b/win/CS/HandBrakeWPF/Properties/AssemblyInfo.cs.Nightly.tmpl
deleted file mode 100644
index 389c15de3..000000000
--- a/win/CS/HandBrakeWPF/Properties/AssemblyInfo.cs.Nightly.tmpl
+++ /dev/null
@@ -1,65 +0,0 @@
-// --------------------------------------------------------------------------------------------------------------------
-// <copyright file="ListBoxHelper.cs" company="HandBrake Project (http://handbrake.fr)">
-//   This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
-// </copyright>
-// <summary>
-//   Assembly Info
-// </summary>
-// <auto-generated/>
-// --------------------------------------------------------------------------------------------------------------------
-
-using System.Reflection;
-using System.Resources;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Windows;
-
-// 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("HandBrake")]
-[assembly: AssemblyDescription("HandBrake is an open-source, GPL-licensed, multiplatform, multithreaded video transcoder.")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("HandBrake")]
-[assembly: AssemblyProduct("HandBrake")]
-[assembly: AssemblyCopyright("Copyright © 2003-2016 HandBrake Team")]
-[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)]
-
-//In order to begin building localizable applications, set 
-//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
-//inside a <PropertyGroup>.  For example, if you are using US english
-//in your source files, set the <UICulture> to en-US.  Then uncomment
-//the NeutralResourceLanguage attribute below.  Update the "en-US" in
-//the line below to match the UICulture setting in the project file.
-
-//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
-
-
-[assembly: ThemeInfo(
-    ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
-    //(used if a resource is not found in the page, 
-    // or application resource dictionaries)
-    ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
-    //(used if a resource is not found in the page, 
-    // app, or any theme specific resource dictionaries)
-)]
-
-
-// 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.*")]  $WCREV$
-[assembly: AssemblyVersion("0.0.0.0")]
-[assembly: NeutralResourcesLanguage("")]
\ No newline at end of file
diff --git a/win/CS/HandBrakeWPF/Properties/AssemblyInfo.cs.tmpl b/win/CS/HandBrakeWPF/Properties/AssemblyInfo.cs.tmpl
deleted file mode 100644
index 2b1808d40..000000000
--- a/win/CS/HandBrakeWPF/Properties/AssemblyInfo.cs.tmpl
+++ /dev/null
@@ -1,65 +0,0 @@
-// --------------------------------------------------------------------------------------------------------------------
-// <copyright file="ListBoxHelper.cs" company="HandBrake Project (http://handbrake.fr)">
-//   This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
-// </copyright>
-// <summary>
-//   Assembly Info
-// </summary>
-// <auto-generated/>
-// --------------------------------------------------------------------------------------------------------------------
-
-using System.Reflection;
-using System.Resources;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Windows;
-
-// 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("HandBrake")]
-[assembly: AssemblyDescription("HandBrake is an open-source, GPL-licensed, multiplatform, multithreaded video transcoder.")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("HandBrake")]
-[assembly: AssemblyProduct("HandBrake")]
-[assembly: AssemblyCopyright("Copyright © 2003-2016 HandBrake Team")]
-[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)]
-
-//In order to begin building localizable applications, set 
-//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
-//inside a <PropertyGroup>.  For example, if you are using US english
-//in your source files, set the <UICulture> to en-US.  Then uncomment
-//the NeutralResourceLanguage attribute below.  Update the "en-US" in
-//the line below to match the UICulture setting in the project file.
-
-//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
-
-
-[assembly: ThemeInfo(
-    ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
-    //(used if a resource is not found in the page, 
-    // or application resource dictionaries)
-    ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
-    //(used if a resource is not found in the page, 
-    // app, or any theme specific resource dictionaries)
-)]
-
-
-// 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.*")] $WCREV$
-[assembly: AssemblyVersion("0.1.0.0")]
-[assembly: NeutralResourcesLanguage("")]
\ No newline at end of file
diff --git a/win/CS/build.xml b/win/CS/build.xml
index 60205971c..6333f6b2a 100644
--- a/win/CS/build.xml
+++ b/win/CS/build.xml
@@ -26,11 +26,11 @@
 
   <!-- Dependencies -->
   <PropertyGroup>
-    <NightlyDependsOn>NightlyPreBuild;BuildRelease;NightlyPostBuild</NightlyDependsOn>
+    <NightlyDependsOn>BuildRelease;NightlyPostBuild</NightlyDependsOn>
   </PropertyGroup>
 
   <PropertyGroup>
-    <InstallDependsOn>PreBuild;BuildRelease;ReleasePostBuild</InstallDependsOn>
+    <InstallDependsOn>BuildRelease;ReleasePostBuild</InstallDependsOn>
   </PropertyGroup>
 
   <!-- Builds /t: -->
@@ -46,21 +46,6 @@
     </MSBuild>
   </Target>
 
-  <!-- Pre Build Events. You must do a full checkout as it takes the svn from the main directory.  $(MSBuildProjectDirectory)\. is not used. -->
-    <Target Name="NightlyPreBuild">
-    <!--<Exec Command="subwcrev.exe ../../ $(MSBuildProjectDirectory)\HandBrakeWPF\Properties\AssemblyInfo.cs.Nightly.tmpl $(MSBuildProjectDirectory)\HandBrakeWPF\Properties\AssemblyInfo.cs" />
-    <Exec Command="subwcrev.exe ../../ $(MSBuildProjectDirectory)\HandBrakeWPF\Installer\MakeNightly.nsi.tmpl $(MSBuildProjectDirectory)\HandBrakeWPF\Installer\MakeNightly.nsi" Condition="$(Platform) == 'x86'" />
-    <Exec Command="subwcrev.exe ../../ $(MSBuildProjectDirectory)\HandBrakeWPF\Installer\MakeNightly64.nsi.tmpl $(MSBuildProjectDirectory)\HandBrakeWPF\Installer\MakeNightly64.nsi" Condition="$(Platform) == 'x64'" />
-    <Exec Command="subwcrev.exe ../../ $(MSBuildProjectDirectory)\HandBrake.ApplicationServices\Properties\AssemblyInfo.cs.Nightly.tmpl $(MSBuildProjectDirectory)\HandBrake.ApplicationServices\Properties\AssemblyInfo.cs" />-->
-    </Target>
-
-    <Target Name="PreBuild">
-      <!-- <Exec Command="subwcrev.exe ../../ $(MSBuildProjectDirectory)\HandBrakeWPF\Properties\AssemblyInfo.cs.tmpl $(MSBuildProjectDirectory)\HandBrakeWPF\Properties\AssemblyInfo.cs" />
-      <Exec Command="subwcrev.exe ../../ $(MSBuildProjectDirectory)\HandBrakeWPF\Installer\MakeNightly.nsi.tmpl $(MSBuildProjectDirectory)\HandBrakeWPF\Installer\MakeNightly.nsi" Condition="$(Platform) == 'x86'" />
-      <Exec Command="subwcrev.exe ../../ $(MSBuildProjectDirectory)\HandBrakeWPF\Installer\MakeNightly64.nsi.tmpl $(MSBuildProjectDirectory)\HandBrakeWPF\Installer\MakeNightly64.nsi" Condition="$(Platform) == 'x64'" />
-      <Exec Command="subwcrev.exe ../../ $(MSBuildProjectDirectory)\HandBrake.ApplicationServices\Properties\AssemblyInfo.cs.tmpl $(MSBuildProjectDirectory)\HandBrake.ApplicationServices\Properties\AssemblyInfo.cs" />-->
-    </Target>
-
   <!-- Post Build Events -->
   <Target Name="NightlyPostBuild">
     <Exec Command="copy $(MSBuildProjectDirectory)\HandBrakeWPF\Installer\MakeNightly.nsi $(MSBuildProjectDirectory)\HandBrakeWPF\bin\x86\Release /Y" Condition="$(Platform) == 'x86'" />
-- 
2.40.0