Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avalonia #2497

Draft
wants to merge 75 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
f618862
update to net8.0
taooceros Nov 26, 2023
48bfef2
update global.json
taooceros Dec 7, 2023
6374f41
update dependency
taooceros Dec 10, 2023
05a0455
update font name
taooceros Dec 10, 2023
d788de8
first port to avalonia
taooceros Jan 18, 2024
dc4e1c4
port image
taooceros Jan 18, 2024
0f3cb5d
bind to task instead of the complex loading scheme
taooceros Jan 18, 2024
2d8490b
small fix
taooceros Jan 19, 2024
4c7b592
Welcome Page Port Part 1
taooceros Jan 19, 2024
9555007
finish porting welcome pages
taooceros Jan 19, 2024
c4c1860
main keybinding & svg support
taooceros Jan 19, 2024
329b3bb
Use Resource for Glyph Font Family
taooceros Jan 19, 2024
ce6321c
Merge branch 'dev' into avalonia
taooceros Jan 21, 2024
3fe58d7
Use DynamicData as resultcollection
taooceros Jan 21, 2024
5303e13
minor fix
taooceros Jan 21, 2024
84fe131
fix lazy load image
taooceros Jan 22, 2024
1cc8b9d
first commit
taooceros Mar 23, 2024
3d6782c
migrate to velopack
taooceros Mar 24, 2024
f5762f6
modify argument for post_build.ps1
taooceros Mar 24, 2024
3a885ea
install required tool
taooceros Mar 24, 2024
2f7bd56
fix upload
taooceros Mar 24, 2024
eecd5fe
fix upload path
taooceros Mar 24, 2024
559666b
clean up post_build and roll back delete unused
taooceros Mar 26, 2024
bd5bed2
fix up artifact name
taooceros Mar 26, 2024
765c30f
remove cache to test and skip pr build
taooceros Mar 26, 2024
d562441
delete no-build
taooceros Mar 26, 2024
be86129
delete unused arg
taooceros Mar 26, 2024
0644f32
remove squirrel
taooceros Mar 26, 2024
f7f3759
test cache again
taooceros Mar 26, 2024
653ee90
empty
taooceros Mar 26, 2024
9785ec8
test github action and remove cache as it is so slow
taooceros Mar 26, 2024
0d316a5
test github action
taooceros Mar 26, 2024
b886408
trigger push only on dev/master
taooceros Mar 26, 2024
f5b1880
install vpk
taooceros Mar 26, 2024
5532efb
do not compress for artifacts as either binary or too small
taooceros Mar 26, 2024
c4e38b1
use v4 for upload artifact
taooceros Mar 26, 2024
a7c2227
fix cache key
taooceros Mar 26, 2024
05a5a50
try new nunit
taooceros Mar 26, 2024
cffb5bc
cache after checkout
taooceros Mar 26, 2024
b24b035
revise cache
taooceros Mar 26, 2024
943a9fd
try to cache vpk
taooceros Mar 26, 2024
bdad186
empty
taooceros Mar 26, 2024
8c19ed7
revising remove duplicate
taooceros Mar 26, 2024
2eb6474
try not install vpk
taooceros Mar 26, 2024
4337c60
install only if cache not exists
taooceros Mar 26, 2024
067f69b
set assemblyinfo after checkout
taooceros Mar 26, 2024
286f49c
fix assembly version
taooceros Mar 26, 2024
7df7ac0
revise version
taooceros Mar 26, 2024
c6ca273
add version info to the main project
taooceros Mar 26, 2024
41ad35a
revise assembly version
taooceros Mar 26, 2024
d3e91e0
fix log
taooceros Mar 26, 2024
d1f61bd
try github run id
taooceros Mar 27, 2024
cb7fc2b
use a different build number
taooceros Mar 27, 2024
42c21a2
use Sem2 versioning
taooceros Mar 27, 2024
0c773b0
revise versioning
taooceros Mar 27, 2024
e31cde4
fix environmental variable usage
taooceros Mar 27, 2024
5cb72bf
fix env variable (again)
taooceros Mar 27, 2024
9f5f04c
fix again
taooceros Mar 27, 2024
d013135
remove $ before env
taooceros Mar 27, 2024
742604c
fix build script and no need to upload nupkg and release as artifact
taooceros Mar 27, 2024
c563035
change the version being used and portable datafolder creation for no…
taooceros Mar 27, 2024
fc96eed
set NUGET_CERT_REVOCATION_MODE to offline to prevent slower restore
taooceros Mar 27, 2024
8f718fd
try again
taooceros Mar 27, 2024
94d912d
do not use tag number to create build which causes appveyor to publis…
taooceros Mar 27, 2024
1ca7ff0
try sourcelink
taooceros Mar 27, 2024
92839b0
don't check whether the location exists and use the productversion si…
taooceros Mar 28, 2024
5d122df
Merge branch 'dev' into velopack
taooceros Mar 29, 2024
db4553f
fix a little spell check
taooceros Mar 29, 2024
88957a1
Merge remote-tracking branch 'origin/velopack' into velopack
taooceros Mar 29, 2024
0d0bd5e
do not include some test file
taooceros Mar 29, 2024
d9c65e2
remove all test from spellcheck (should do them manually)
taooceros Mar 29, 2024
01bbe8f
change a little bit pattern
taooceros Mar 29, 2024
8ba180b
fix more spellcheck
taooceros Mar 29, 2024
6c3bcdc
fix remaining spell
taooceros Mar 29, 2024
90ec4c0
Merge branch 'velopack' into avalonia
taooceros Apr 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/actions/spelling/allow.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,21 @@ https
ssh
ubuntu
runcount
nunit
velopack
vpk
vsc
appveyor
appwrite
IME
hotkey
prioritise
runas
softpedia
sourcelink
TRAYMOUSEMESSAGE
uninstaller
vkcode
winget
workaround
nupkg
1 change: 1 addition & 0 deletions .github/actions/spelling/excludes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,4 @@ ignore$
\.csproj$
\.DotSettings$
\.targets$
.*Test.cs$
8 changes: 8 additions & 0 deletions .github/actions/spelling/expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,11 @@ JsonRPC
JsonRPCV2
Softpedia
img
ime
LPWStr
flowlauncher
hotkeys
LPW
productversion
requery
Wnd
9 changes: 8 additions & 1 deletion .github/actions/spelling/patterns.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,14 @@
# Automatically suggested patterns
# hit-count: 360 file-count: 108
# IServiceProvider
\bI(?=(?:[A-Z][a-z]{2,})+\b)
# IPublicAPI
\bI(?=(?:[A-Z][a-z]{2,}[A-Z]*)+\b)

# KListener
\bK(?=(?:[A-Z][a-z]{2,})+\b)

# TApplication
\bT(?=(?:[A-Z][a-z]{2,})+\b)

# hit-count: 297 file-count: 18
# uuid:
Expand Down
107 changes: 107 additions & 0 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net

name: .NET

on:
workflow_dispatch:
push:
branches:
- dev
- master
pull_request:
branches:
- dev
- master

jobs:
build:

runs-on: windows-latest
env:
FlowVersion: 1.17.2
NUGET_CERT_REVOCATION_MODE: offline
BUILD_NUMBER: ${{ github.run_number }}
steps:
- uses: actions/checkout@v4
- name: Set Flow.Launcher.csproj version
id: update
uses: vers-one/dotnet-project-version-updater@v1.5
with:
file: |
"**/SolutionAssemblyInfo.cs"
version: ${{ env.FlowVersion }}.${{ env.BUILD_NUMBER }}
- uses: actions/cache@v4
name: Restore Nuget Cache
with:
path: |
~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
restore-keys: |
${{ runner.os }}-nuget
- uses: actions/cache@v4
name: Restore dotnet tool Cache
with:
path: |
~/.dotnet/tools
key: ${{ runner.os }}-dotnet-tools-${{ hashFiles('~/.dotnet/tools/**') }}
restore-keys: |
${{ runner.os }}-dotnet-tools
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 7.0.x
# - name: Install vpk
# Install vpk tool (dotnet tool install will not reinstall if already installed)
# We will update the cli by removing cache
# run: dotnet tool install -g vpk
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore -c Release
- name: Initialize Service
run: |
sc config WSearch start= auto # Starts Windows Search service- Needed for running ExplorerTest
net start WSearch
- name: Test
run: dotnet test --no-build --verbosity normal -c Release
- name: Perform post_build tasks
shell: pwsh
run: .\Scripts\post_build.ps1 -flowversion "${env:FlowVersion}-build.${env:BUILD_NUMBER}"
- name: Upload Plugin Nupkg
uses: actions/upload-artifact@v4
with:
name: Plugin nupkg
path: |
Output\Release\Flow.Launcher.Plugin.*.nupkg
compression-level: 0
- name: Upload Setup
uses: actions/upload-artifact@v4
with:
name: Flow Installer
path: |
Releases\FlowLauncher-*.exe
compression-level: 0
- name: Upload Portable Version
uses: actions/upload-artifact@v4
with:
name: Portable Version
path: |
Releases\FlowLauncher-*-Portable.zip
compression-level: 0
# - name: Upload Full Nupkg
# uses: actions/upload-artifact@v4
# with:
# name: Full nupkg
# path: |
# Releases\FlowLauncher-*-full.nupkg
#
# compression-level: 0
# - name: Upload Release Information
# uses: actions/upload-artifact@v4
# with:
# name: RELEASES
# path: |
# Releases\RELEASES*
# compression-level: 0
#
8 changes: 1 addition & 7 deletions Flow.Launcher.Core/Configuration/IPortable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@ public interface IPortable
{
void EnablePortableMode();
void DisablePortableMode();
void RemoveShortcuts();
void RemoveUninstallerEntry();
void CreateShortcuts();
void CreateUninstallerEntry();
void MoveUserDataFolder(string fromLocation, string toLocation);
void VerifyUserDataAfterMove(string fromLocation, string toLocation);
bool CanUpdatePortability();
}
}
}
111 changes: 29 additions & 82 deletions Flow.Launcher.Core/Configuration/Portable.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Microsoft.Win32;
using Squirrel;
using System;
using System.IO;
using System.Reflection;
Expand All @@ -9,41 +8,26 @@
using Flow.Launcher.Infrastructure.UserSettings;
using Flow.Launcher.Plugin.SharedCommands;
using System.Linq;
using Flow.Launcher.Core.Plugin;
using Velopack;
using Velopack.Locators;
using Velopack.Windows;

namespace Flow.Launcher.Core.Configuration
{
public class Portable : IPortable
{
/// <summary>
/// As at Squirrel.Windows version 1.5.2, UpdateManager needs to be disposed after finish
/// </summary>
/// <returns></returns>
private UpdateManager NewUpdateManager()
{
var applicationFolderName = Constant.ApplicationDirectory
.Split(new[] { Path.DirectorySeparatorChar }, StringSplitOptions.None)
.Last();

return new UpdateManager(string.Empty, applicationFolderName, Constant.RootDirectory);
}

public void DisablePortableMode()
{
try
{
MoveUserDataFolder(DataLocation.PortableDataPath, DataLocation.RoamingDataPath);
#if !DEBUG
// Create shortcuts and uninstaller are not required in debug mode,
// otherwise will repoint the path of the actual installed production version to the debug version
CreateShortcuts();
CreateUninstallerEntry();
#endif
IndicateDeletion(DataLocation.PortableDataPath);

MessageBox.Show("Flow Launcher needs to restart to finish disabling portable mode, " +
"after the restart your portable data profile will be deleted and roaming data profile kept");
"after the restart your portable data profile will be deleted and roaming data profile kept");

UpdateManager.RestartApp(Constant.ApplicationFileName);
PluginManager.API.RestartApp();
}
catch (Exception e)
{
Expand All @@ -56,42 +40,19 @@ public void EnablePortableMode()
try
{
MoveUserDataFolder(DataLocation.RoamingDataPath, DataLocation.PortableDataPath);
#if !DEBUG
// Remove shortcuts and uninstaller are not required in debug mode,
// otherwise will delete the actual installed production version
RemoveShortcuts();
RemoveUninstallerEntry();
#endif
IndicateDeletion(DataLocation.RoamingDataPath);

MessageBox.Show("Flow Launcher needs to restart to finish enabling portable mode, " +
"after the restart your roaming data profile will be deleted and portable data profile kept");
"after the restart your roaming data profile will be deleted and portable data profile kept");

UpdateManager.RestartApp(Constant.ApplicationFileName);
PluginManager.API.RestartApp();
}
catch (Exception e)
{
Log.Exception("|Portable.EnablePortableMode|Error occurred while enabling portable mode", e);
}
}

public void RemoveShortcuts()
{
using (var portabilityUpdater = NewUpdateManager())
{
portabilityUpdater.RemoveShortcutsForExecutable(Constant.ApplicationFileName, ShortcutLocation.StartMenu);
portabilityUpdater.RemoveShortcutsForExecutable(Constant.ApplicationFileName, ShortcutLocation.Desktop);
portabilityUpdater.RemoveShortcutsForExecutable(Constant.ApplicationFileName, ShortcutLocation.Startup);
}
}

public void RemoveUninstallerEntry()
{
using (var portabilityUpdater = NewUpdateManager())
{
portabilityUpdater.RemoveUninstallerRegistryEntry();
}
}

public void MoveUserDataFolder(string fromLocation, string toLocation)
{
Expand All @@ -104,36 +65,10 @@ public void VerifyUserDataAfterMove(string fromLocation, string toLocation)
FilesFolders.VerifyBothFolderFilesEqual(fromLocation, toLocation);
}

public void CreateShortcuts()
{
using (var portabilityUpdater = NewUpdateManager())
{
portabilityUpdater.CreateShortcutsForExecutable(Constant.ApplicationFileName, ShortcutLocation.StartMenu, false);
portabilityUpdater.CreateShortcutsForExecutable(Constant.ApplicationFileName, ShortcutLocation.Desktop, false);
portabilityUpdater.CreateShortcutsForExecutable(Constant.ApplicationFileName, ShortcutLocation.Startup, false);
}
}

public void CreateUninstallerEntry()
{
var uninstallRegSubKey = @"Software\Microsoft\Windows\CurrentVersion\Uninstall";

using (var baseKey = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Default))
using (var subKey1 = baseKey.CreateSubKey(uninstallRegSubKey, RegistryKeyPermissionCheck.ReadWriteSubTree))
using (var subKey2 = subKey1.CreateSubKey(Constant.FlowLauncher, RegistryKeyPermissionCheck.ReadWriteSubTree))
{
subKey2.SetValue("DisplayIcon", Path.Combine(Constant.ApplicationDirectory, "app.ico"), RegistryValueKind.String);
}

using (var portabilityUpdater = NewUpdateManager())
{
_ = portabilityUpdater.CreateUninstallerRegistryEntry();
}
}

internal void IndicateDeletion(string filePathTodelete)
internal void IndicateDeletion(string filePathToDelete)
{
var deleteFilePath = Path.Combine(filePathTodelete, DataLocation.DeletionIndicatorFile);
var deleteFilePath = Path.Combine(filePathToDelete, DataLocation.DeletionIndicatorFile);
using (var _ = File.CreateText(deleteFilePath))
{
}
Expand All @@ -145,23 +80,35 @@ internal void IndicateDeletion(string filePathTodelete)
///</summary>
public void PreStartCleanUpAfterPortabilityUpdate()
{
// check whether the package locate in %LocalAppData%
// if not create the portable data folder
// Don't create the folder if the version is 1.0.0 (Dev) to allow potential debugging with data in the project folder
// It is still possible to create the UserData folder for dev version manually but we want to keep the current behavior
if (!Constant.ProgramDirectory.IsSubPathOf(
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData))
&& Constant.Version != "1.0.0")
{
Directory.CreateDirectory(DataLocation.PortableDataPath);
}

// Specify here so this method does not rely on other environment variables to initialise
var portableDataDir = Path.Combine(Directory.GetParent(Assembly.GetExecutingAssembly().Location.NonNull()).ToString(), "UserData");
var roamingDataDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "FlowLauncher");
var portableDataDir = DataLocation.PortableDataPath;
var roamingDataDir = DataLocation.RoamingDataPath;


// Get full path to the .dead files for each case
var portableDataDeleteFilePath = Path.Combine(portableDataDir, DataLocation.DeletionIndicatorFile);
var roamingDataDeleteFilePath = Path.Combine(roamingDataDir, DataLocation.DeletionIndicatorFile);

// If the data folder in %appdata% is marked for deletion,
// If the data folder in %AppData% is marked for deletion,
// delete it and prompt the user to pick the portable data location
if (File.Exists(roamingDataDeleteFilePath))
{
FilesFolders.RemoveFolderIfExists(roamingDataDir);

if (MessageBox.Show("Flow Launcher has detected you enabled portable mode, " +
"would you like to move it to a different location?", string.Empty,
MessageBoxButton.YesNo) == MessageBoxResult.Yes)
MessageBoxButton.YesNo) == MessageBoxResult.Yes)
{
FilesFolders.OpenPath(Constant.RootDirectory);

Expand All @@ -175,7 +122,7 @@ public void PreStartCleanUpAfterPortabilityUpdate()
FilesFolders.RemoveFolderIfExists(portableDataDir);

MessageBox.Show("Flow Launcher has detected you disabled portable mode, " +
"the relevant shortcuts and uninstaller entry have been created");
"the relevant shortcuts and uninstaller entry have been created");
}
}

Expand All @@ -187,8 +134,8 @@ public bool CanUpdatePortability()
if (roamingLocationExists && portableLocationExists)
{
MessageBox.Show(string.Format("Flow Launcher detected your user data exists both in {0} and " +
"{1}. {2}{2}Please delete {1} in order to proceed. No changes have occurred.",
DataLocation.PortableDataPath, DataLocation.RoamingDataPath, Environment.NewLine));
"{1}. {2}{2}Please delete {1} in order to proceed. No changes have occurred.",
DataLocation.PortableDataPath, DataLocation.RoamingDataPath, Environment.NewLine));

return false;
}
Expand Down
6 changes: 3 additions & 3 deletions Flow.Launcher.Core/Flow.Launcher.Core.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0-windows</TargetFramework>
<TargetFramework>net8.0-windows</TargetFramework>
<UseWpf>true</UseWpf>
<UseWindowsForms>true</UseWindowsForms>
<OutputType>Library</OutputType>
Expand Down Expand Up @@ -54,11 +54,11 @@

<ItemGroup>
<PackageReference Include="Droplex" Version="1.7.0" />
<PackageReference Include="FSharp.Core" Version="7.0.401" />
<PackageReference Include="FSharp.Core" Version="8.0.100" />
<PackageReference Include="Meziantou.Framework.Win32.Jobs" Version="3.2.1" />
<PackageReference Include="Microsoft.IO.RecyclableMemoryStream" Version="3.0.0" />
<PackageReference Include="squirrel.windows" Version="1.5.2" NoWarn="NU1701" />
<PackageReference Include="StreamJsonRpc" Version="2.17.11" />
<PackageReference Include="Velopack" Version="0.0.359" />
</ItemGroup>

<ItemGroup>
Expand Down