Skip to content

Commit

Permalink
feat: add support for inno setup installers and uninstallers
Browse files Browse the repository at this point in the history
closes #1
  • Loading branch information
rfuzzo committed Jan 18, 2023
1 parent b064fb6 commit b307a38
Show file tree
Hide file tree
Showing 16 changed files with 265 additions and 246 deletions.
2 changes: 1 addition & 1 deletion Wolvenkit.Installer.Package/Package.appxmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<Identity
Name="26499Wolvenkit.WolvenKit.Installer"
Publisher="[email protected], &quot;Open Source Developer, Moritz Baron&quot;, O=Open Source Developer, L=Gmunden, S=Oberösterreich, C=AT"
Version="0.2.1.0" />
Version="0.2.0.0" />

<Properties>
<DisplayName>WolvenKit.Installer</DisplayName>
Expand Down
26 changes: 8 additions & 18 deletions Wolvenkit.Installer.Package/Wolvenkit.Installer.Package.wapproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup Condition="'$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '15.0'">
<VisualStudioVersion>15.0</VisualStudioVersion>
</PropertyGroup>

<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
Expand All @@ -15,20 +13,19 @@
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>

<PropertyGroup>
<WapProjPath Condition="'$(WapProjPath)'==''">$(MSBuildExtensionsPath)\Microsoft\DesktopBridge\</WapProjPath>
<PathToXAMLWinRTImplementations>Wolvenkit.Installer\</PathToXAMLWinRTImplementations>
</PropertyGroup>

<!-- Self-contained -->
<PropertyGroup>
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
</PropertyGroup>
<!-- Auto-update -->
<PropertyGroup>
</PropertyGroup>

<Import Project="$(WapProjPath)\Microsoft.DesktopBridge.props" />

<PropertyGroup>
<ProjectGuid>be6c095c-daae-42a7-a8d9-23022a7ca784</ProjectGuid>
<TargetPlatformVersion>10.0.19041.0</TargetPlatformVersion>
Expand All @@ -37,29 +34,26 @@
<DefaultLanguage>en-US</DefaultLanguage>
<AppxPackageSigningEnabled>True</AppxPackageSigningEnabled>
<EntryPointProjectUniqueName>..\Wolvenkit.Installer\Wolvenkit.Installer.csproj</EntryPointProjectUniqueName>
<GenerateTemporaryStoreCertificate>True</GenerateTemporaryStoreCertificate>
<GenerateAppInstallerFile>False</GenerateAppInstallerFile>
<AppxAutoIncrementPackageRevision>True</AppxAutoIncrementPackageRevision>
<GenerateAppInstallerFile>True</GenerateAppInstallerFile>
<AppxAutoIncrementPackageRevision>False</AppxAutoIncrementPackageRevision>
<GenerateTestArtifacts>True</GenerateTestArtifacts>
<AppxBundlePlatforms>x64</AppxBundlePlatforms>
<HoursBetweenUpdateChecks>0</HoursBetweenUpdateChecks>
<PackageCertificateThumbprint>F3B6F39B7D06A96E2752172122D4B0DD245F5504</PackageCertificateThumbprint>
<AppxPackageSigningTimestampDigestAlgorithm>SHA256</AppxPackageSigningTimestampDigestAlgorithm>
<AppInstallerUri>https://github.com/WolvenKit/WolvenKit.Installer/releases/latest/download</AppInstallerUri>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<AppxBundle>Always</AppxBundle>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<AppxBundle>Always</AppxBundle>
</PropertyGroup>

<ItemGroup>
<AppxManifest Include="Package.appxmanifest">
<SubType>Designer</SubType>
</AppxManifest>
</ItemGroup>

<ItemGroup>
<Content Include="Images\LargeTile.scale-100.png" />
<Content Include="Images\LargeTile.scale-125.png" />
Expand Down Expand Up @@ -113,14 +107,12 @@
<Content Include="Images\Wide310x150Logo.scale-200.png" />
<Content Include="Images\Wide310x150Logo.scale-400.png" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Wolvenkit.Installer\Wolvenkit.Installer.csproj">
<SkipGetTargetFrameworkProperties>True</SkipGetTargetFrameworkProperties>
<PublishProfile>Properties\PublishProfiles\win10-$(Platform).pubxml</PublishProfile>
</ProjectReference>
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.2.221116.1">
<IncludeAssets>build</IncludeAssets>
Expand All @@ -129,7 +121,5 @@
<IncludeAssets>build</IncludeAssets>
</PackageReference>
</ItemGroup>

<Import Project="$(WapProjPath)\Microsoft.DesktopBridge.targets" />

</Project>
11 changes: 11 additions & 0 deletions Wolvenkit.Installer/Helper/SettingsHelper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using Windows.Storage;

namespace Wolvenkit.Installer.Helper;
internal static class SettingsHelper
{
private const string s_useZipInstallers = "useZipInstallers";

// Booleans
public static bool GetUseZipInstallers() => ApplicationData.Current.LocalSettings.Values.TryGetValue(s_useZipInstallers, out var value) && value is bool b && b;
public static void SetUseZipInstallers(bool value) => ApplicationData.Current.LocalSettings.Values[s_useZipInstallers] = value;
}
6 changes: 3 additions & 3 deletions Wolvenkit.Installer/Models/PackageModel.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
namespace Wolvenkit.Installer.Models;
public class PackageModel
{
public PackageModel(string name, string version, string[] files, string path)
public PackageModel(string name, string version, /*string[] files,*/ string path)
{
Version = version;
Name = name;
Files = files;
//Files = files;
Path = path;
}

public string Name { get; set; }
public string Path { get; set; }
public string Version { get; set; }
public string[] Files { get; set; }
//public string[] Files { get; set; }
}
4 changes: 2 additions & 2 deletions Wolvenkit.Installer/Resources/AvailableApps.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
"Url": "https://github.com/WolvenKit/WolvenKit",
"Name": "WolvenKit",
"AssetPattern": "WolvenKit-.*.zip",
"AssetPattern": "WolvenKitSetup-.*.exe",
"Executable": "WolvenKit.exe",
"Description": "Cyberpunk 2077 mod editor and creator",
"Category": "Application",
Expand All @@ -11,7 +11,7 @@
{
"Url": "https://github.com/WolvenKit/WolvenKit-nightly-releases",
"Name": "WolvenKit Nightly",
"AssetPattern": "WolvenKit-.*.zip",
"AssetPattern": " WolvenKit.NightlySetup-.*.exe",
"Executable": "WolvenKit.exe",
"Description": "Wolvenkit Beta",
"Category": "Application",
Expand Down
20 changes: 20 additions & 0 deletions Wolvenkit.Installer/Services/BannerNotification.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using CommunityToolkit.Mvvm.ComponentModel;
using Microsoft.UI.Xaml.Controls;

namespace Wolvenkit.Installer.Services;

[ObservableObject]
public partial class BannerNotification
{
[ObservableProperty]
private string title;

[ObservableProperty]
private bool isOpen;

[ObservableProperty]
private string message;

[ObservableProperty]
private InfoBarSeverity severity;
}
21 changes: 21 additions & 0 deletions Wolvenkit.Installer/Services/DialogService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System;
using System.Threading.Tasks;
using Microsoft.UI.Xaml.Controls;

namespace Wolvenkit.Installer.Services;

public class DialogService : IDialogService
{
public async Task DisplayAlert(string title, string message, string cancel)
{
ContentDialog dlg = new()
{
Title = title,
Content = message,
CloseButtonText = cancel,
XamlRoot = App.MainRoot.XamlRoot,
};

await dlg.ShowAsync();
}
}
20 changes: 1 addition & 19 deletions Wolvenkit.Installer/Services/IDialogService.cs
Original file line number Diff line number Diff line change
@@ -1,28 +1,10 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.UI.Xaml.Controls;

namespace Wolvenkit.Installer.Services;
public interface IDialogService
{
Task DisplayAlert(string title, string message, string cancel);
}

public class DialogService : IDialogService
{
public async Task DisplayAlert(string title, string message, string cancel)
{
ContentDialog dlg = new()
{
Title = title,
Content = message,
CloseButtonText = cancel,
XamlRoot = App.MainRoot.XamlRoot,
};

await dlg.ShowAsync();
}
}
22 changes: 22 additions & 0 deletions Wolvenkit.Installer/Services/ILibraryService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System.Collections.ObjectModel;
using System.Threading.Tasks;
using Wolvenkit.Installer.Models;
using Wolvenkit.Installer.ViewModel;

namespace Wolvenkit.Installer.Services;

public interface ILibraryService
{
ObservableCollection<PackageViewModel> InstalledPackages { get; }

ObservableCollection<RemotePackageViewModel> RemotePackages { get; set; }

Task<string> GetLatestVersionAsync(RemotePackageModel model, bool prerelease);
Task<bool> InstallAsync(RemotePackageModel id, string installPath);
Task<bool> InstallAsync(PackageModel id, string installPath);
Task InitAsync();
Task SaveAsync();
Task<bool> RemoveAsync(PackageModel model);
bool TryGetRemote(PackageModel model, out RemotePackageViewModel remote);
}

77 changes: 1 addition & 76 deletions Wolvenkit.Installer/Services/INotificationService.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using CommunityToolkit.Mvvm.ComponentModel;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Controls;

namespace Wolvenkit.Installer.Services;
public interface INotificationService
Expand All @@ -24,77 +23,3 @@ public interface INotificationService
/// </summary>
void Completed();
}

[ObservableObject]
public partial class NotificationService : INotificationService
{
public NotificationService()
{
BannerNotification = new();
Progress = new();
}

[ObservableProperty]
private BannerNotification bannerNotification;

[ObservableProperty]
private Progress progress;


// Banners
public void DisplayBanner(string title, string message, InfoBarSeverity severity)
{
BannerNotification.IsOpen = true;

BannerNotification.Message = message;
BannerNotification.Severity = severity;
BannerNotification.Title = title;
}

public void DisplayError(string message)
{
BannerNotification.IsOpen = true;

BannerNotification.Message = message;
BannerNotification.Severity = InfoBarSeverity.Error;
BannerNotification.Title = "Error";
}

public void CloseBanner() => BannerNotification.IsOpen = false;

public void StartIndeterminate() => Progress.IsIndeterminate = true;
public void StopIndeterminate() => Progress.IsIndeterminate = false;
public void Report(double v) => Progress.Value = (int)(v * 100);
public void Completed()
{
Progress.Value = 100;
Progress.IsIndeterminate = false;
}
}

[ObservableObject]
public partial class BannerNotification
{
[ObservableProperty]
private string title;

[ObservableProperty]
private bool isOpen;

[ObservableProperty]
private string message;

[ObservableProperty]
private InfoBarSeverity severity;
}

[ObservableObject]
public partial class Progress
{
[ObservableProperty]
private int value;

[ObservableProperty]
private bool isIndeterminate;

}
Loading

0 comments on commit b307a38

Please sign in to comment.