mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Merge remote-tracking branch 'upstream/dev' into RenderImprovement
This commit is contained in:
commit
3aa54d1153
26 changed files with 129 additions and 140 deletions
|
|
@ -3,10 +3,10 @@ using System.Collections.Generic;
|
|||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Text.Json;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Newtonsoft.Json;
|
||||
using Flow.Launcher.Infrastructure.Exception;
|
||||
using Flow.Launcher.Infrastructure.Logger;
|
||||
using Flow.Launcher.Plugin;
|
||||
|
|
@ -65,7 +65,7 @@ namespace Flow.Launcher.Core.Plugin
|
|||
{
|
||||
List<Result> results = new List<Result>();
|
||||
|
||||
JsonRPCQueryResponseModel queryResponseModel = JsonConvert.DeserializeObject<JsonRPCQueryResponseModel>(output);
|
||||
JsonRPCQueryResponseModel queryResponseModel = JsonSerializer.Deserialize<JsonRPCQueryResponseModel>(output);
|
||||
if (queryResponseModel.Result == null) return null;
|
||||
|
||||
foreach (JsonRPCResult result in queryResponseModel.Result)
|
||||
|
|
@ -84,7 +84,7 @@ namespace Flow.Launcher.Core.Plugin
|
|||
else
|
||||
{
|
||||
string actionReponse = ExecuteCallback(result1.JsonRPCAction);
|
||||
JsonRPCRequestModel jsonRpcRequestModel = JsonConvert.DeserializeObject<JsonRPCRequestModel>(actionReponse);
|
||||
JsonRPCRequestModel jsonRpcRequestModel = JsonSerializer.Deserialize<JsonRPCRequestModel>(actionReponse);
|
||||
if (jsonRpcRequestModel != null
|
||||
&& !String.IsNullOrEmpty(jsonRpcRequestModel.Method)
|
||||
&& jsonRpcRequestModel.Method.StartsWith("Flow.Launcher."))
|
||||
|
|
|
|||
|
|
@ -2,10 +2,10 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
using Newtonsoft.Json;
|
||||
using Flow.Launcher.Infrastructure;
|
||||
using Flow.Launcher.Infrastructure.Logger;
|
||||
using Flow.Launcher.Plugin;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace Flow.Launcher.Core.Plugin
|
||||
{
|
||||
|
|
@ -61,7 +61,7 @@ namespace Flow.Launcher.Core.Plugin
|
|||
PluginMetadata metadata;
|
||||
try
|
||||
{
|
||||
metadata = JsonConvert.DeserializeObject<PluginMetadata>(File.ReadAllText(configPath));
|
||||
metadata = JsonSerializer.Deserialize<PluginMetadata>(File.ReadAllText(configPath));
|
||||
metadata.PluginDirectory = pluginDirectory;
|
||||
// for plugins which doesn't has ActionKeywords key
|
||||
metadata.ActionKeywords = metadata.ActionKeywords ?? new List<string> { metadata.ActionKeyword };
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ using Flow.Launcher.Plugin.SharedCommands;
|
|||
using Flow.Launcher.Infrastructure;
|
||||
using Flow.Launcher.Infrastructure.Http;
|
||||
using Flow.Launcher.Infrastructure.Logger;
|
||||
using System.IO;
|
||||
using Flow.Launcher.Infrastructure.UserSettings;
|
||||
using Flow.Launcher.Plugin;
|
||||
using System.Text.Json.Serialization;
|
||||
|
|
|
|||
|
|
@ -49,7 +49,6 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
<PackageReference Include="NLog.Schema" Version="4.7.0-rc1" />
|
||||
<PackageReference Include="NLog.Web.AspNetCore" Version="4.9.0" />
|
||||
<PackageReference Include="System.Drawing.Common" Version="4.7.0" />
|
||||
|
|
|
|||
|
|
@ -1,12 +1,18 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Flow.Launcher.Infrastructure
|
||||
{
|
||||
public static class Helper
|
||||
{
|
||||
static Helper()
|
||||
{
|
||||
jsonFormattedSerializerOptions.Converters.Add(new JsonStringEnumConverter());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// http://www.yinwang.org/blog-cn/2015/11/21/programming-philosophy
|
||||
/// </summary>
|
||||
|
|
@ -65,13 +71,18 @@ namespace Flow.Launcher.Infrastructure
|
|||
}
|
||||
}
|
||||
|
||||
private static readonly JsonSerializerOptions jsonFormattedSerializerOptions = new JsonSerializerOptions
|
||||
{
|
||||
WriteIndented = true
|
||||
};
|
||||
|
||||
public static string Formatted<T>(this T t)
|
||||
{
|
||||
var formatted = JsonConvert.SerializeObject(
|
||||
t,
|
||||
Formatting.Indented,
|
||||
new StringEnumConverter()
|
||||
);
|
||||
var formatted = JsonSerializer.Serialize(t, new JsonSerializerOptions
|
||||
{
|
||||
WriteIndented = true
|
||||
});
|
||||
|
||||
return formatted;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ namespace Flow.Launcher.Infrastructure.Logger
|
|||
public static void Exception(string message, System.Exception e)
|
||||
{
|
||||
#if DEBUG
|
||||
throw e;
|
||||
throw e;
|
||||
#else
|
||||
if (FormatValid(message))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
using System;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using Newtonsoft.Json;
|
||||
using System.Text.Json;
|
||||
using Flow.Launcher.Infrastructure.Logger;
|
||||
|
||||
namespace Flow.Launcher.Infrastructure.Storage
|
||||
|
|
@ -11,7 +11,7 @@ namespace Flow.Launcher.Infrastructure.Storage
|
|||
/// </summary>
|
||||
public class JsonStrorage<T>
|
||||
{
|
||||
private readonly JsonSerializerSettings _serializerSettings;
|
||||
private readonly JsonSerializerOptions _serializerSettings;
|
||||
private T _data;
|
||||
// need a new directory name
|
||||
public const string DirectoryName = "Settings";
|
||||
|
|
@ -24,10 +24,9 @@ namespace Flow.Launcher.Infrastructure.Storage
|
|||
{
|
||||
// use property initialization instead of DefaultValueAttribute
|
||||
// easier and flexible for default value of object
|
||||
_serializerSettings = new JsonSerializerSettings
|
||||
_serializerSettings = new JsonSerializerOptions
|
||||
{
|
||||
ObjectCreationHandling = ObjectCreationHandling.Replace,
|
||||
NullValueHandling = NullValueHandling.Ignore
|
||||
IgnoreNullValues = false
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -56,7 +55,7 @@ namespace Flow.Launcher.Infrastructure.Storage
|
|||
{
|
||||
try
|
||||
{
|
||||
_data = JsonConvert.DeserializeObject<T>(searlized, _serializerSettings);
|
||||
_data = JsonSerializer.Deserialize<T>(searlized, _serializerSettings);
|
||||
}
|
||||
catch (JsonException e)
|
||||
{
|
||||
|
|
@ -77,7 +76,7 @@ namespace Flow.Launcher.Infrastructure.Storage
|
|||
BackupOriginFile();
|
||||
}
|
||||
|
||||
_data = JsonConvert.DeserializeObject<T>("{}", _serializerSettings);
|
||||
_data = JsonSerializer.Deserialize<T>("{}", _serializerSettings);
|
||||
Save();
|
||||
}
|
||||
|
||||
|
|
@ -94,7 +93,8 @@ namespace Flow.Launcher.Infrastructure.Storage
|
|||
|
||||
public void Save()
|
||||
{
|
||||
string serialized = JsonConvert.SerializeObject(_data, Formatting.Indented);
|
||||
string serialized = JsonSerializer.Serialize(_data, new JsonSerializerOptions() { WriteIndented = true });
|
||||
|
||||
File.WriteAllText(FilePath, serialized);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Drawing;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using System.Text.Json.Serialization;
|
||||
using Flow.Launcher.Plugin;
|
||||
|
||||
namespace Flow.Launcher.Infrastructure.UserSettings
|
||||
|
|
@ -16,7 +15,8 @@ namespace Flow.Launcher.Infrastructure.UserSettings
|
|||
public bool ShowOpenResultHotkey { get; set; } = true;
|
||||
public string Language
|
||||
{
|
||||
get => language; set {
|
||||
get => language; set
|
||||
{
|
||||
language = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
|
|
@ -73,9 +73,7 @@ namespace Flow.Launcher.Infrastructure.UserSettings
|
|||
public int MaxResultsToShow { get; set; } = 5;
|
||||
public int ActivateTimes { get; set; }
|
||||
|
||||
// Order defaults to 0 or -1, so 1 will let this property appear last
|
||||
[JsonProperty(Order = 1)]
|
||||
public PluginsSettings PluginSettings { get; set; } = new PluginsSettings();
|
||||
|
||||
public ObservableCollection<CustomPluginHotkey> CustomPluginHotkeys { get; set; } = new ObservableCollection<CustomPluginHotkey>();
|
||||
|
||||
public bool DontPromptUpdateMsg { get; set; }
|
||||
|
|
@ -100,8 +98,12 @@ namespace Flow.Launcher.Infrastructure.UserSettings
|
|||
|
||||
public HttpProxy Proxy { get; set; } = new HttpProxy();
|
||||
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
[JsonConverter(typeof(JsonStringEnumConverter))]
|
||||
public LastQueryMode LastQueryMode { get; set; } = LastQueryMode.Selected;
|
||||
|
||||
|
||||
// This needs to be loaded last by staying at the bottom
|
||||
public PluginsSettings PluginSettings { get; set; } = new PluginsSettings();
|
||||
}
|
||||
|
||||
public enum LastQueryMode
|
||||
|
|
|
|||
|
|
@ -62,7 +62,6 @@
|
|||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
|
||||
<PackageReference Include="JetBrains.Annotations" Version="2019.1.3" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
@ -1,11 +1,10 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Newtonsoft.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Flow.Launcher.Plugin
|
||||
{
|
||||
[JsonObject(MemberSerialization.OptOut)]
|
||||
public class PluginMetadata : BaseModel
|
||||
{
|
||||
private string _pluginDirectory;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
|
||||
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
|
|
@ -81,7 +81,7 @@
|
|||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="PropertyChanged.Fody" Version="2.5.13" />
|
||||
<PackageReference Include="PropertyChanged.Fody" Version="3.3.1" />
|
||||
<PackageReference Include="SharpVectors" Version="1.7.1" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
@ -94,8 +94,4 @@
|
|||
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
|
||||
<Exec Command="taskkill /f /fi "IMAGENAME eq Flow.Launcher.exe"" />
|
||||
</Target>
|
||||
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||
<Exec Command="powershell.exe -NoProfile -ExecutionPolicy Bypass -File $(SolutionDir)Scripts\post_build.ps1 $(ConfigurationName) $(SolutionDir) $(TargetPath)" />
|
||||
</Target>
|
||||
</Project>
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using Flow.Launcher.Plugin;
|
||||
|
||||
namespace Flow.Launcher.Storage
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using System.Text.Json;
|
||||
using Flow.Launcher.Plugin;
|
||||
|
||||
namespace Flow.Launcher.Storage
|
||||
|
|
@ -8,7 +8,6 @@ namespace Flow.Launcher.Storage
|
|||
// todo this class is not thread safe.... but used from multiple threads.
|
||||
public class TopMostRecord
|
||||
{
|
||||
[JsonProperty]
|
||||
private Dictionary<string, Record> records = new Dictionary<string, Record>();
|
||||
|
||||
internal bool IsTopMost(Result result)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
using Flow.Launcher.Infrastructure.Storage;
|
||||
using Flow.Launcher.Plugin;
|
||||
|
||||
|
|
@ -7,7 +6,6 @@ namespace Flow.Launcher.Storage
|
|||
{
|
||||
public class UserSelectedRecord
|
||||
{
|
||||
[JsonProperty]
|
||||
private Dictionary<string, int> records = new Dictionary<string, int>();
|
||||
|
||||
public void Add(Result result)
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
|
||||
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
|
||||
<ApplicationIcon />
|
||||
<StartupObject />
|
||||
</PropertyGroup>
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Flow.Launcher.Plugin.Explorer.Search.FolderLinks
|
||||
{
|
||||
[JsonObject(MemberSerialization.OptIn)]
|
||||
public class FolderLink
|
||||
{
|
||||
[JsonProperty]
|
||||
public string Path { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public string Nickname
|
||||
{
|
||||
get
|
||||
|
|
|
|||
|
|
@ -1,28 +1,22 @@
|
|||
using Flow.Launcher.Plugin.Explorer.Search;
|
||||
using Flow.Launcher.Plugin.Explorer.Search.FolderLinks;
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Flow.Launcher.Plugin.Explorer
|
||||
{
|
||||
public class Settings
|
||||
{
|
||||
[JsonProperty]
|
||||
public int MaxResult { get; set; } = 100;
|
||||
|
||||
[JsonProperty]
|
||||
public List<FolderLink> QuickFolderAccessLinks { get; set; } = new List<FolderLink>();
|
||||
|
||||
[JsonProperty]
|
||||
public bool UseWindowsIndexForDirectorySearch { get; set; } = true;
|
||||
|
||||
[JsonProperty]
|
||||
public List<FolderLink> IndexSearchExcludedSubdirectoryPaths { get; set; } = new List<FolderLink>();
|
||||
|
||||
[JsonProperty]
|
||||
public string SearchActionKeyword { get; set; } = Query.GlobalPluginWildcardSign;
|
||||
|
||||
[JsonProperty]
|
||||
public string FileContentSearchActionKeyword { get; set; } = Constants.DefaultContentSearchActionKeyword;
|
||||
}
|
||||
}
|
||||
|
|
@ -10,6 +10,7 @@
|
|||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
|
||||
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
using System.IO;
|
||||
using System.Windows.Media;
|
||||
using JetBrains.Annotations;
|
||||
using Newtonsoft.Json;
|
||||
using Flow.Launcher.Infrastructure.Image;
|
||||
using Flow.Launcher.Infrastructure;
|
||||
using System.Reflection;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Flow.Launcher.Plugin.WebSearch
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using Newtonsoft.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using Flow.Launcher.Plugin.WebSearch.SuggestionSources;
|
||||
|
||||
namespace Flow.Launcher.Plugin.WebSearch
|
||||
|
|
|
|||
|
|
@ -2,10 +2,9 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text.Json;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Flow.Launcher.Infrastructure.Http;
|
||||
using Flow.Launcher.Infrastructure.Logger;
|
||||
using System.Net.Http;
|
||||
|
|
@ -35,25 +34,20 @@ namespace Flow.Launcher.Plugin.WebSearch.SuggestionSources
|
|||
Match match = _reg.Match(result);
|
||||
if (match.Success)
|
||||
{
|
||||
JContainer json;
|
||||
JsonDocument json;
|
||||
try
|
||||
{
|
||||
json = JsonConvert.DeserializeObject(match.Groups[1].Value) as JContainer;
|
||||
json = JsonDocument.Parse(match.Groups[1].Value);
|
||||
}
|
||||
catch (JsonSerializationException e)
|
||||
catch(JsonException e)
|
||||
{
|
||||
Log.Exception("|Baidu.Suggestions|can't parse suggestions", e);
|
||||
return new List<string>();
|
||||
}
|
||||
|
||||
if (json != null)
|
||||
{
|
||||
var results = json["s"] as JArray;
|
||||
if (results != null)
|
||||
{
|
||||
return results.OfType<JValue>().Select(o => o.Value).OfType<string>().ToList();
|
||||
}
|
||||
}
|
||||
var results = json?.RootElement.GetProperty("s");
|
||||
|
||||
return results?.EnumerateArray().Select(o => o.GetString()).ToList() ?? new List<string>();
|
||||
}
|
||||
|
||||
return new List<string>();
|
||||
|
|
|
|||
|
|
@ -3,11 +3,11 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Flow.Launcher.Infrastructure.Http;
|
||||
using Flow.Launcher.Infrastructure.Logger;
|
||||
using System.Net.Http;
|
||||
using System.Text.Json;
|
||||
using System.IO;
|
||||
|
||||
namespace Flow.Launcher.Plugin.WebSearch.SuggestionSources
|
||||
{
|
||||
|
|
@ -15,37 +15,32 @@ namespace Flow.Launcher.Plugin.WebSearch.SuggestionSources
|
|||
{
|
||||
public override async Task<List<string>> Suggestions(string query)
|
||||
{
|
||||
string result;
|
||||
Stream resultStream;
|
||||
try
|
||||
{
|
||||
const string api = "https://www.google.com/complete/search?output=chrome&q=";
|
||||
result = await Http.GetAsync(api + Uri.EscapeUriString(query)).ConfigureAwait(false);
|
||||
resultStream = await Http.GetStreamAsync(api + Uri.EscapeUriString(query)).ConfigureAwait(false);
|
||||
}
|
||||
catch (HttpRequestException e)
|
||||
{
|
||||
Log.Exception("|Google.Suggestions|Can't get suggestion from google", e);
|
||||
return new List<string>();
|
||||
}
|
||||
if (string.IsNullOrEmpty(result)) return new List<string>();
|
||||
JContainer json;
|
||||
if (resultStream.Length == 0) return new List<string>();
|
||||
JsonDocument json;
|
||||
try
|
||||
{
|
||||
json = JsonConvert.DeserializeObject(result) as JContainer;
|
||||
json = await JsonDocument.ParseAsync(resultStream);
|
||||
}
|
||||
catch (JsonSerializationException e)
|
||||
catch (JsonException e)
|
||||
{
|
||||
Log.Exception("|Google.Suggestions|can't parse suggestions", e);
|
||||
return new List<string>();
|
||||
}
|
||||
if (json != null)
|
||||
{
|
||||
var results = json[1] as JContainer;
|
||||
if (results != null)
|
||||
{
|
||||
return results.OfType<JValue>().Select(o => o.Value).OfType<string>().ToList();
|
||||
}
|
||||
}
|
||||
return new List<string>();
|
||||
|
||||
var results = json?.RootElement.EnumerateArray().ElementAt(1);
|
||||
|
||||
return results?.EnumerateArray().Select(o => o.GetString()).ToList() ?? new List<string>();
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
param(
|
||||
[string]$config = "Release",
|
||||
[string]$solution,
|
||||
[string]$targetpath
|
||||
[string]$solution = (Join-Path $PSScriptRoot ".." -Resolve)
|
||||
)
|
||||
Write-Host "Config: $config"
|
||||
|
||||
function Build-Version {
|
||||
if ([string]::IsNullOrEmpty($env:flowVersion)) {
|
||||
$v = (Get-Command ${TargetPath}).FileVersionInfo.FileVersion
|
||||
$targetPath = Join-Path $solution "Output/Release/Flow.Launcher.dll" -Resolve
|
||||
$v = (Get-Command ${targetPath}).FileVersionInfo.FileVersion
|
||||
} else {
|
||||
$v = $env:flowVersion
|
||||
}
|
||||
|
|
@ -31,13 +31,9 @@ function Build-Path {
|
|||
return $p
|
||||
}
|
||||
|
||||
function Copy-Resources ($path, $config) {
|
||||
$project = "$path\Flow.Launcher"
|
||||
$output = "$path\Output"
|
||||
$target = "$output\$config"
|
||||
Copy-Item -Recurse -Force $project\Images\* $target\Images\
|
||||
function Copy-Resources ($path) {
|
||||
# making version static as multiple versions can exist in the nuget folder and in the case a breaking change is introduced.
|
||||
Copy-Item -Force $env:USERPROFILE\.nuget\packages\squirrel.windows\1.5.2\tools\Squirrel.exe $output\Update.exe
|
||||
Copy-Item -Force $env:USERPROFILE\.nuget\packages\squirrel.windows\1.5.2\tools\Squirrel.exe $path\Output\Update.exe
|
||||
}
|
||||
|
||||
function Delete-Unused ($path, $config) {
|
||||
|
|
@ -55,17 +51,6 @@ function Validate-Directory ($output) {
|
|||
New-Item $output -ItemType Directory -Force
|
||||
}
|
||||
|
||||
function Zip-Release ($path, $version, $output) {
|
||||
Write-Host "Begin zip release"
|
||||
|
||||
$content = "$path\Output\Release\*"
|
||||
$zipFile = "$output\Flow-Launcher-v$version.zip"
|
||||
|
||||
Compress-Archive -Force -Path $content -DestinationPath $zipFile
|
||||
|
||||
Write-Host "End zip release"
|
||||
}
|
||||
|
||||
function Pack-Squirrel-Installer ($path, $version, $output) {
|
||||
# msbuild based installer generation is not working in appveyor, not sure why
|
||||
Write-Host "Begin pack squirrel installer"
|
||||
|
|
@ -75,6 +60,8 @@ function Pack-Squirrel-Installer ($path, $version, $output) {
|
|||
|
||||
Write-Host "Packing: $spec"
|
||||
Write-Host "Input path: $input"
|
||||
# making version static as multiple versions can exist in the nuget folder and in the case a breaking change is introduced.
|
||||
New-Alias Nuget $env:USERPROFILE\.nuget\packages\NuGet.CommandLine\5.4.0\tools\NuGet.exe -Force
|
||||
# TODO: can we use dotnet pack here?
|
||||
nuget pack $spec -Version $version -BasePath $input -OutputDirectory $output -Properties Configuration=Release
|
||||
|
||||
|
|
@ -100,40 +87,30 @@ function Pack-Squirrel-Installer ($path, $version, $output) {
|
|||
Write-Host "End pack squirrel installer"
|
||||
}
|
||||
|
||||
function IsDotNetCoreAppSelfContainedPublishEvent{
|
||||
return Test-Path $solution\Output\Release\coreclr.dll
|
||||
}
|
||||
function Publish-Self-Contained ($p) {
|
||||
|
||||
function FixPublishLastWriteDateTimeError ($solutionPath) {
|
||||
#Fix error from publishing self contained app, when nuget tries to pack core dll references throws the error 'The DateTimeOffset specified cannot be converted into a Zip file timestamp'
|
||||
gci -path "$solutionPath\Output\Release" -rec -file *.dll | Where-Object {$_.LastWriteTime -lt (Get-Date).AddYears(-20)} | % { try { $_.LastWriteTime = '01/01/2000 00:00:00' } catch {} }
|
||||
$csproj = Join-Path "$p" "Flow.Launcher/Flow.Launcher.csproj" -Resolve
|
||||
$profile = Join-Path "$p" "Flow.Launcher/Properties/PublishProfiles/NetCore3.1-SelfContained.pubxml" -Resolve
|
||||
|
||||
# we call dotnet publish on the main project.
|
||||
# The other projects should have been built in Release at this point.
|
||||
dotnet publish -c Release $csproj /p:PublishProfile=$profile
|
||||
}
|
||||
|
||||
function Main {
|
||||
$p = Build-Path
|
||||
$v = Build-Version
|
||||
Copy-Resources $p $config
|
||||
Copy-Resources $p
|
||||
|
||||
if ($config -eq "Release"){
|
||||
|
||||
if(IsDotNetCoreAppSelfContainedPublishEvent) {
|
||||
FixPublishLastWriteDateTimeError $p
|
||||
}
|
||||
|
||||
Delete-Unused $p $config
|
||||
|
||||
Publish-Self-Contained $p
|
||||
|
||||
$o = "$p\Output\Packages"
|
||||
Validate-Directory $o
|
||||
# making version static as multiple versions can exist in the nuget folder and in the case a breaking change is introduced.
|
||||
New-Alias Nuget $env:USERPROFILE\.nuget\packages\NuGet.CommandLine\5.4.0\tools\NuGet.exe -Force
|
||||
Pack-Squirrel-Installer $p $v $o
|
||||
|
||||
$isInCI = $env:APPVEYOR
|
||||
if ($isInCI) {
|
||||
Zip-Release $p $v $o
|
||||
}
|
||||
|
||||
Write-Host "List output directory"
|
||||
Get-ChildItem $o
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,6 @@ using System.Runtime.InteropServices;
|
|||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: ComVisible(false)]
|
||||
[assembly: AssemblyVersion("1.6.0")]
|
||||
[assembly: AssemblyFileVersion("1.6.0")]
|
||||
[assembly: AssemblyInformationalVersion("1.6.0")]
|
||||
[assembly: AssemblyVersion("1.7.0")]
|
||||
[assembly: AssemblyFileVersion("1.7.0")]
|
||||
[assembly: AssemblyInformationalVersion("1.7.0")]
|
||||
43
appveyor.yml
43
appveyor.yml
|
|
@ -1,4 +1,4 @@
|
|||
version: '1.6.0.{build}'
|
||||
version: '1.7.0.{build}'
|
||||
|
||||
init:
|
||||
- ps: |
|
||||
|
|
@ -26,17 +26,42 @@ before_build:
|
|||
build:
|
||||
project: Flow.Launcher.sln
|
||||
verbosity: minimal
|
||||
after_build:
|
||||
- ps: .\Scripts\post_build.ps1
|
||||
|
||||
artifacts:
|
||||
- path: 'Output\Packages\Flow-Launcher-*.zip'
|
||||
name: Zip
|
||||
- path: 'Output\Release\Flow.Launcher.Plugin.*.nupkg'
|
||||
name: Plugin nupkg
|
||||
- path: 'Output\Packages\Flow-Launcher-*.exe'
|
||||
name: Squirrel Installer
|
||||
- path: 'Output\Packages\FlowLauncher-*-full.nupkg'
|
||||
name: Squirrel nupkg
|
||||
- path: 'Output\Packages\RELEASES'
|
||||
name: Squirrel RELEASES
|
||||
|
||||
deploy:
|
||||
provider: NuGet
|
||||
artifact: /.*\.nupkg/
|
||||
api_key:
|
||||
secure: n80IeWR3pN81p0w4uXq4mO0TdTXoJSHHFL+yTB9YBJ0Wni2DjZGYwOFdaWzW4hRi
|
||||
on:
|
||||
branch: master
|
||||
- provider: NuGet
|
||||
artifact: Plugin nupkg
|
||||
api_key:
|
||||
secure: n80IeWR3pN81p0w4uXq4mO0TdTXoJSHHFL+yTB9YBJ0Wni2DjZGYwOFdaWzW4hRi
|
||||
on:
|
||||
branch: master
|
||||
|
||||
- provider: GitHub
|
||||
release: v$(flowVersion)
|
||||
auth_token:
|
||||
secure: ij4UeXUYQBDJxn2YRAAhUOjklOGVKDB87Hn5J8tKIzj13yatoI7sLM666QDQFEgv
|
||||
artifact: Squirrel Installer, Squirrel nupkg, Squirrel RELEASES
|
||||
draft: true
|
||||
force_update: true
|
||||
on:
|
||||
branch: master
|
||||
|
||||
- provider: GitHub
|
||||
release: v$(flowVersion)
|
||||
auth_token:
|
||||
secure: ij4UeXUYQBDJxn2YRAAhUOjklOGVKDB87Hn5J8tKIzj13yatoI7sLM666QDQFEgv
|
||||
artifact: Squirrel Installer, Squirrel nupkg, Squirrel RELEASES
|
||||
force_update: true
|
||||
on:
|
||||
APPVEYOR_REPO_TAG: true
|
||||
Loading…
Reference in a new issue