Skip to content

Commit 1b6e0e3

Browse files
committed
Fixed a bug where it didn't recognize previous version of Updater as legit.
1 parent 163a5e2 commit 1b6e0e3

6 files changed

Lines changed: 21 additions & 12 deletions

File tree

8.21 KB
Loading

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ In order to use the `BlueUpdate` toolkit, you must have your own web directory i
3333

3434
Before using the `Update` class, you must set the `UpdatableApp.Current`, which represents the currently running application. This must be done in order to check if the currently running application was installed correctly, to set the root directory, etc.. Every application must be inside the directory with the same name as the application itself. The recommended install path format is: *`/MyCompany/My App/My App.exe`*. The root directory of this example is *`/MyCompany`*. This way, you can have multiple applications inside your companies root directory.
3535

36-
When you use the `Update` class for the first time, its static initializer will check if the updater is installed inside the root directory. If I follow the previous path example, the updater would be installed in *`/MyCompany/Updater`*. If the updater is not yet installed, it will install it. The updater is very small (~1 MB).
36+
When you use the `Update` class for the first time, its static initializer will check if the updater is installed inside the root directory. If I follow the previous path example, the updater would be installed in *`/MyCompany/Updater`*. If the updater is not yet installed, it will install it. The updater is very small (~398 KB).
3737

3838
The `Update.Check()` simply checks if the latest version of the application is greater than the current. If it is, then it needs to be updated.
3939
The `Update.Run()` starts the updater application, which will update the currently running application. That is why the currently running application must close immediately after that, otherwise the updater will not be able to update/modify the files of the application.

src/BlueUpdate/BlueUpdate Updater/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,5 +79,5 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
7979
// You can specify all the values or you can default the Build and Revision Numbers
8080
// by using the '*' as shown below:
8181
// [assembly: AssemblyVersion("1.0.*")]
82-
[assembly: AssemblyVersion("1.0.4.0")]
83-
[assembly: AssemblyFileVersion("1.0.4.0")]
82+
[assembly: AssemblyVersion("1.0.4.1")]
83+
[assembly: AssemblyFileVersion("1.0.4.1")]

src/BlueUpdate/BlueUpdate/BlueUpdate.nuspec

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,23 @@
99
<license type="file">LICENSE.md</license>
1010
<projectUrl>https://github.com/GregaMohorko/BlueUpdate</projectUrl>
1111
<repository type="git" url="https://github.com/GregaMohorko/BlueUpdate.git" branch="master" />
12-
<icon>BlueUpdate Icon.png</icon>
12+
<icon>BlueUpdate Icon 128x128.png</icon>
1313
<requireLicenseAcceptance>false</requireLicenseAcceptance>
1414
<description>$description$</description>
1515
<copyright>$copyright$</copyright>
1616
<tags>Update Updater Version Check Checksum Deployment Install</tags>
17-
<releaseNotes>Enabled SourceLink.</releaseNotes>
17+
<releaseNotes>Fixed a bug where it didn't recognize previous version of Updater as legit.</releaseNotes>
1818
<dependencies>
19-
<dependency id="GM.Utility" version="1.3.0" />
19+
<group targetFramework=".NETFramework4.7.1">
20+
</group>
21+
<group>
22+
<dependency id="GM.Utility" version="1.3.0" />
23+
</group>
2024
</dependencies>
2125
</metadata>
2226
<files>
2327
<file src="readme.txt" />
24-
<file src="..\..\..\Documentation\Icon\BlueUpdate Icon.png" target="" />
28+
<file src="..\..\..\Documentation\Icon\BlueUpdate Icon 128x128.png" target="" />
2529
<file src="..\..\..\LICENSE.md" target="" />
2630
</files>
2731
</package>

src/BlueUpdate/BlueUpdate/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,5 +60,5 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
6060
// You can specify all the values or you can default the Build and Revision Numbers
6161
// by using the '*' as shown below:
6262
// [assembly: AssemblyVersion("1.0.*")]
63-
[assembly: AssemblyVersion("1.0.4.0")]
64-
[assembly: AssemblyFileVersion("1.0.4.0")]
63+
[assembly: AssemblyVersion("1.0.4.1")]
64+
[assembly: AssemblyFileVersion("1.0.4.1")]

src/BlueUpdate/BlueUpdate/Update.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ namespace BlueUpdate
4343
{
4444
public static class Update
4545
{
46+
/// <summary>
47+
/// For backward compatibility, include all previous company names.
48+
/// </summary>
49+
private static string[] GetAllPastCompanyNames() => new string[] { "Grega Mohorko" };
50+
4651
/// <summary>
4752
/// Root directory of all applications.
4853
/// </summary>
@@ -78,7 +83,7 @@ static Update()
7883
if(updaterFileInfo != null) {
7984
ReflectionUtility.AssemblyInformation assembly = ReflectionUtility.GetAssemblyInformation(ReflectionUtility.GetAssembly(ReflectionUtility.AssemblyType.CURRENT));
8085

81-
if(updaterFileInfo.CompanyName != assembly.Company || updaterFileInfo.ProductName != BlueUpdateConstants.UPDATER_NAME) {
86+
if((updaterFileInfo.CompanyName != assembly.Company && !GetAllPastCompanyNames().Contains(updaterFileInfo.CompanyName)) || updaterFileInfo.ProductName != BlueUpdateConstants.UPDATER_NAME) {
8287
throw new Exception("Updater executable is not legit.");
8388
}
8489
Version currentVersion = Version.Parse(updaterFileInfo.FileVersion);
@@ -98,8 +103,8 @@ static Update()
98103
UpdateUtility.Update(Updater);
99104
}
100105
}catch(Exception e) {
101-
MessageBox.Show($"Error while initializing BlueUpdate:{Environment.NewLine}{Environment.NewLine}{e.Message}");
102-
throw e;
106+
_ = MessageBox.Show($"Error while initializing BlueUpdate:{Environment.NewLine}{Environment.NewLine}{e.Message}");
107+
throw;
103108
}
104109
}
105110

0 commit comments

Comments
 (0)