Skip to content

Commit a460aef

Browse files
committed
add PluginsManager
1 parent 920668d commit a460aef

File tree

7 files changed

+164
-0
lines changed

7 files changed

+164
-0
lines changed

Flow.Launcher.sln

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Flow.Launcher", "Flow.Launc
2020
{59BD9891-3837-438A-958D-ADC7F91F6F7E} = {59BD9891-3837-438A-958D-ADC7F91F6F7E}
2121
{C21BFF9C-2C99-4B5F-B7C9-A5E6DDDB37B0} = {C21BFF9C-2C99-4B5F-B7C9-A5E6DDDB37B0}
2222
{F35190AA-4758-4D9E-A193-E3BDF6AD3567} = {F35190AA-4758-4D9E-A193-E3BDF6AD3567}
23+
{70CB72BC-1CD6-453D-9CA5-F7E2441426FE} = {70CB72BC-1CD6-453D-9CA5-F7E2441426FE}
2324
{9B130CC5-14FB-41FF-B310-0A95B6894C37} = {9B130CC5-14FB-41FF-B310-0A95B6894C37}
2425
{FDED22C8-B637-42E8-824A-63B5B6E05A3A} = {FDED22C8-B637-42E8-824A-63B5B6E05A3A}
2526
{A3DCCBCA-ACC1-421D-B16E-210896234C26} = {A3DCCBCA-ACC1-421D-B16E-210896234C26}
@@ -71,6 +72,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Flow.Launcher.Plugin.Explor
7172
EndProject
7273
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Flow.Launcher.Plugin.ProcessKiller", "Plugins\Flow.Launcher.Plugin.ProcessKiller\Flow.Launcher.Plugin.ProcessKiller.csproj", "{588088F4-3262-4F9F-9663-A05DE12534C3}"
7374
EndProject
75+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Flow.Launcher.Plugin.PluginsManager", "Plugins\Flow.Launcher.Plugin.PluginManager\Flow.Launcher.Plugin.PluginsManager.csproj", "{70CB72BC-1CD6-453D-9CA5-F7E2441426FE}"
76+
EndProject
7477
Global
7578
GlobalSection(SolutionConfigurationPlatforms) = preSolution
7679
Debug|Any CPU = Debug|Any CPU
@@ -298,6 +301,18 @@ Global
298301
{588088F4-3262-4F9F-9663-A05DE12534C3}.Release|x64.Build.0 = Release|Any CPU
299302
{588088F4-3262-4F9F-9663-A05DE12534C3}.Release|x86.ActiveCfg = Release|Any CPU
300303
{588088F4-3262-4F9F-9663-A05DE12534C3}.Release|x86.Build.0 = Release|Any CPU
304+
{70CB72BC-1CD6-453D-9CA5-F7E2441426FE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
305+
{70CB72BC-1CD6-453D-9CA5-F7E2441426FE}.Debug|Any CPU.Build.0 = Debug|Any CPU
306+
{70CB72BC-1CD6-453D-9CA5-F7E2441426FE}.Debug|x64.ActiveCfg = Debug|Any CPU
307+
{70CB72BC-1CD6-453D-9CA5-F7E2441426FE}.Debug|x64.Build.0 = Debug|Any CPU
308+
{70CB72BC-1CD6-453D-9CA5-F7E2441426FE}.Debug|x86.ActiveCfg = Debug|Any CPU
309+
{70CB72BC-1CD6-453D-9CA5-F7E2441426FE}.Debug|x86.Build.0 = Debug|Any CPU
310+
{70CB72BC-1CD6-453D-9CA5-F7E2441426FE}.Release|Any CPU.ActiveCfg = Release|Any CPU
311+
{70CB72BC-1CD6-453D-9CA5-F7E2441426FE}.Release|Any CPU.Build.0 = Release|Any CPU
312+
{70CB72BC-1CD6-453D-9CA5-F7E2441426FE}.Release|x64.ActiveCfg = Release|Any CPU
313+
{70CB72BC-1CD6-453D-9CA5-F7E2441426FE}.Release|x64.Build.0 = Release|Any CPU
314+
{70CB72BC-1CD6-453D-9CA5-F7E2441426FE}.Release|x86.ActiveCfg = Release|Any CPU
315+
{70CB72BC-1CD6-453D-9CA5-F7E2441426FE}.Release|x86.Build.0 = Release|Any CPU
301316
EndGlobalSection
302317
GlobalSection(SolutionProperties) = preSolution
303318
HideSolutionNode = FALSE
@@ -316,6 +331,7 @@ Global
316331
{59BD9891-3837-438A-958D-ADC7F91F6F7E} = {3A73F5A7-0335-40D8-BF7C-F20BE5D0BA87}
317332
{F9C4C081-4CC3-4146-95F1-E102B4E10A5F} = {3A73F5A7-0335-40D8-BF7C-F20BE5D0BA87}
318333
{588088F4-3262-4F9F-9663-A05DE12534C3} = {3A73F5A7-0335-40D8-BF7C-F20BE5D0BA87}
334+
{70CB72BC-1CD6-453D-9CA5-F7E2441426FE} = {3A73F5A7-0335-40D8-BF7C-F20BE5D0BA87}
319335
EndGlobalSection
320336
GlobalSection(ExtensibilityGlobals) = postSolution
321337
SolutionGuid = {F26ACB50-3F6C-4907-B0C9-1ADACC1D0DED}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
2+
3+
<PropertyGroup>
4+
<OutputType>Library</OutputType>
5+
<TargetFramework>netcoreapp3.1</TargetFramework>
6+
<UseWPF>true</UseWPF>
7+
<UseWindowsForms>true</UseWindowsForms>
8+
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
9+
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
10+
</PropertyGroup>
11+
12+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
13+
<OutputPath>..\..\Output\Debug\Plugins\Flow.Launcher.Plugin.PluginsManager</OutputPath>
14+
</PropertyGroup>
15+
16+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
17+
<OutputPath>..\..\Output\Release\Plugins\Flow.Launcher.Plugin.PluginsManager</OutputPath>
18+
</PropertyGroup>
19+
20+
<ItemGroup>
21+
<ProjectReference Include="..\..\Flow.Launcher.Infrastructure\Flow.Launcher.Infrastructure.csproj" />
22+
<ProjectReference Include="..\..\Flow.Launcher.Plugin\Flow.Launcher.Plugin.csproj" />
23+
</ItemGroup>
24+
25+
<ItemGroup>
26+
<None Include="plugin.json">
27+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
28+
</None>
29+
</ItemGroup>
30+
</Project>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Text;
4+
5+
namespace Flow.Launcher.Plugin.PluginsManager
6+
{
7+
class Main
8+
{
9+
}
10+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Text;
4+
5+
namespace Flow.Launcher.Plugin.PluginsManager
6+
{
7+
internal class Plugin
8+
{
9+
public string Name { get; set; }
10+
public string Url { get; set; }
11+
public string Version { get; set; }
12+
}
13+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
using Flow.Launcher.Infrastructure.Http;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Net;
5+
using System.Text;
6+
7+
namespace Flow.Launcher.Plugin.PluginsManager
8+
{
9+
internal class PluginsManager
10+
{
11+
internal void PluginInstall(Plugin plugin)
12+
{
13+
if (PluginExists())
14+
{
15+
//prompt user if want to install
16+
17+
return;
18+
}
19+
20+
PluginDowload(plugin.Url, "");
21+
}
22+
23+
private void PluginDowload(string downloadUrl, string toFilePath)
24+
{
25+
using (var wc = new WebClient { Proxy = Http.WebProxy() })
26+
{
27+
wc.DownloadFile(downloadUrl, toFilePath);
28+
}
29+
}
30+
31+
internal void PluginUpdate()
32+
{
33+
34+
}
35+
36+
internal bool PluginExists()
37+
{
38+
return false;
39+
}
40+
41+
internal void PluginsManifestSiteOpen()
42+
{
43+
44+
}
45+
}
46+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using Flow.Launcher.Infrastructure.Http;
2+
using Flow.Launcher.Infrastructure.Logger;
3+
using Newtonsoft.Json;
4+
using System;
5+
using System.Collections.Generic;
6+
using System.Net;
7+
using System.Text;
8+
9+
namespace Flow.Launcher.Plugin.PluginsManager
10+
{
11+
class PluginsManifest
12+
{
13+
public List<Plugin> Plugins { get; private set; }
14+
public PluginsManifest()
15+
{
16+
var json = string.Empty;
17+
18+
using (var wc = new WebClient { Proxy = Http.WebProxy() })
19+
{
20+
try
21+
{
22+
json = wc.DownloadString("https://raw.githubusercontent.com/Flow-Launcher/Flow.Launcher.PluginsManifest/main/plugins.json");
23+
}
24+
catch (Exception e)
25+
{
26+
Log.Exception("|PluginManagement.GetManifest|Encountered error trying to download plugins manifest", e);
27+
28+
Plugins = new List<Plugin>();
29+
}
30+
}
31+
32+
Plugins = !string.IsNullOrEmpty(json) ? JsonConvert.DeserializeObject<List<Plugin>>(json) : new List<Plugin>();
33+
}
34+
}
35+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"ID": "9f8f9b14-2518-4907-b211-35ab6290dee7",
3+
"ActionKeywords": [
4+
"pm"
5+
],
6+
"Name": "Plugins Manager",
7+
"Description": "Management of installing, uninstalling or updating Flow Launcher plugins",
8+
"Author": "Jeremy Wu",
9+
"Version": "1.0.0",
10+
"Language": "csharp",
11+
"Website": "https://github.com/Flow-Launcher/Flow.Launcher",
12+
"ExecuteFileName": "Flow.Launcher.Plugin.PluginsManager.dll",
13+
"IcoPath": "Images\\pluginsmanager.png"
14+
}

0 commit comments

Comments
 (0)