Skip to content
This repository has been archived by the owner on Dec 6, 2021. It is now read-only.

Commit

Permalink
Added rhino registry key
Browse files Browse the repository at this point in the history
  • Loading branch information
teocomi committed Nov 22, 2018
1 parent 6483c8e commit d1f4b87
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 25 deletions.
Binary file added Assets/installer.bmp
Binary file not shown.
Binary file removed Assets/speckle.bmp
Binary file not shown.
16 changes: 9 additions & 7 deletions SpeckleInstaller.iss
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,17 @@ OutputBaseFilename=Speckle
SetupIconFile=Assets\speckle.ico
Compression=lzma
SolidCompression=yes
;WizardImageFile=Assets\speckle.bmp
WizardImageFile=Assets\installer.bmp
ChangesAssociations=yes
PrivilegesRequired=lowest
VersionInfoVersion={#AppVersion}

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Components]
Name: dynamo; Description: Speckle for Dynamo 2.0 v{#DynamoVersion}; Types: full
Name: gh; Description: Speckle for Rhino+Grasshopper v{#RhinoVersion}; Types: full
Name: dynamo; Description: Speckle for Dynamo 2.0 - v{#DynamoVersion}; Types: full
Name: gh; Description: Speckle for Rhino 6 & Grasshopper - v{#RhinoVersion}; Types: full
;Name: excel; Description: Speckle for Revit; Types: full


Expand All @@ -55,7 +56,11 @@ Source: "SpeckleDynamo\*"; DestDir: "{userappdata}\Dynamo\Dynamo Revit\2.0\packa
Source: "SpeckleDynamo\*"; DestDir: "{userappdata}\Dynamo\Dynamo Core\2.0\packages\Speckle for Dynamo\"; Flags: ignoreversion recursesubdirs; Components: dynamo

;excel
;Source: "{#Repository}\Arup.Compute.Excel\bin\Release\Arup.Compute.Excel-AddIn-packed.xll"; DestDir: "{userappdata}\Microsoft\AddIns\"; Flags: ignoreversion; Components: excel
;Source: "{#Repository}\Arup.Compute.Excel\bin\Release\Arup.Compute.Excel-AddIn-packed.xll"; DestDir: "{userappdata}\Microsoft\AddIns\"; Flags: ignoreversion; Components: excel

[Registry]
Root: HKCU; Subkey: "SOFTWARE\McNeel\Rhinoceros\6.0\Plug-ins\512d9705-6f92-49ca-a606-d6d5c1ac6aa2"; ValueType: string; ValueName: "Name"; ValueData: "Speckle";
Root: HKCU; Subkey: "SOFTWARE\McNeel\Rhinoceros\6.0\Plug-ins\512d9705-6f92-49ca-a606-d6d5c1ac6aa2"; ValueType: string; ValueName: "FileName"; ValueData: "{userappdata}\McNeel\Rhinoceros\6.0\Plug-ins\Speckle Rhino Plugin (512d9705-6f92-49ca-a606-d6d5c1ac6aa2)\{#RhinoVersion}\SpeckleWinR6.rhp";


[Icons]
Expand All @@ -64,9 +69,6 @@ Name: "{userappdata}\Microsoft\Windows\Start Menu\Programs\Startup\Speckle"; Fil
Name: "{group}\{cm:UninstallProgram,{#AppName}}"; Filename: "{uninstallexe}"
;Name: "{commondesktop}\{#AppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon

;[Registry]
;Root: HKCU; Subkey: "SOFTWARE\Microsoft\Office\16.0\Excel\Options"; ValueType: string; ValueName: "OPEN"; ValueData: "/R ""Arup.Compute.Excel-AddIn-packed.xll""";

;checks if minimun requirements are met
[Code]
function IsDotNetDetected(version: string; service: cardinal): boolean;
Expand Down
5 changes: 2 additions & 3 deletions SpeckleUpdater/Api.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,11 @@ internal static async Task<Release> GetLatestRelease()
}
}

internal static async Task<string> DownloadRelease(string url)
internal static async Task<string> DownloadRelease(string url, string folder, string path)
{
try
{
var folder = Path.Combine(Path.GetTempPath(), Globals.AppName);
var path = Path.Combine(folder, Globals.InstallerName);

if (!Directory.Exists(folder))
Directory.CreateDirectory(folder);

Expand Down
2 changes: 1 addition & 1 deletion SpeckleUpdater/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<Image Width="300" Source="logo.png" />
<Label
HorizontalAlignment="Center"
Content="Updating..."
Content="Checking for updates..."
Foreground="White" />
</StackPanel>

Expand Down
40 changes: 26 additions & 14 deletions SpeckleUpdater/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,7 @@
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using static SpeckleUpdater.GitHub;

namespace SpeckleUpdater
Expand Down Expand Up @@ -48,16 +38,27 @@ private async void CheckForUpdates()

this.Show();

var installerPath = await Api.DownloadRelease(release.assets.First(x => x.name == Globals.InstallerName).browser_download_url);
var folder = Path.Combine(Path.GetTempPath(), Globals.AppName);
var path = System.IO.Path.Combine(folder, Globals.InstallerName);

if (!File.Exists(installerPath))
//don't download if already there
if(!File.Exists(path) || !IsSameVersion(release.tag_name))
{
await Api.DownloadRelease(release.assets.First(x => x.name == Globals.InstallerName).browser_download_url, folder, path);
}

if (!File.Exists(path))
{
this.Close();
return;
}

//launch the just downloaded installer
Process.Start(installerPath, "/SP- /VERYSILENT /SUPPRESSMSGBOXES /NOICONS");
MessageBoxResult response = MessageBox.Show("Speckle " + release.tag_name + " is available!\nDo you want to install it now?", "Speckle Updater (~˘▾˘)~", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.Yes);
if(response == MessageBoxResult.Yes)
{
//launch the installer
Process.Start(path);
}
this.Close();
}

Expand All @@ -78,5 +79,16 @@ private bool UpdateAvailable(Release release)

return true;
}

private bool IsSameVersion(string version)
{
var current = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
var v = Version.Parse(version.Replace("v", ""));
if (current.CompareTo(v) == 0)
{
return true;
}
return false;
}
}
}
Binary file modified SpeckleUpdater/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit d1f4b87

Please sign in to comment.