Add 'src/modules/launcher/' from commit '28acd466b352a807910cebbc74477d3173b31511'

git-subtree-dir: src/modules/launcher
git-subtree-mainline: 852689b3df
git-subtree-split: 28acd466b3
This commit is contained in:
Alekhya Reddy Kommuru
2020-03-10 14:15:29 -07:00
487 changed files with 28191 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 873 B

View File

@@ -0,0 +1,11 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<system:String x:Key="wox_plugin_url_open_url">Öffne URL:{0}</system:String>
<system:String x:Key="wox_plugin_url_canot_open_url">Kann URL nicht öffnen:{0}</system:String>
<system:String x:Key="wox_plugin_url_plugin_name">URL</system:String>
<system:String x:Key="wox_plugin_url_plugin_description">Öffne eine eingegebene URL mit Wox</system:String>
</ResourceDictionary>

View File

@@ -0,0 +1,14 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<system:String x:Key="wox_plugin_url_open_url">Open url:{0}</system:String>
<system:String x:Key="wox_plugin_url_canot_open_url">Can't open url:{0}</system:String>
<system:String x:Key="wox_plugin_url_plugin_name">URL</system:String>
<system:String x:Key="wox_plugin_url_plugin_description">Open the typed URL from Wox</system:String>
<system:String x:Key="wox_plugin_url_plugin_set_tip">Please set your browser path:</system:String>
<system:String x:Key="wox_plugin_url_plugin_choose">Choose</system:String>
<system:String x:Key="wox_plugin_url_plugin_filter">Application(*.exe)|*.exe|All files|*.*</system:String>
</ResourceDictionary>

View File

@@ -0,0 +1,11 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<system:String x:Key="wox_plugin_url_open_url">次のURLを開く:{0}</system:String>
<system:String x:Key="wox_plugin_url_canot_open_url">次のURLを開くことができません:{0}</system:String>
<system:String x:Key="wox_plugin_url_plugin_name">URL</system:String>
<system:String x:Key="wox_plugin_url_plugin_description">入力したURLをWoxから開くプラグインです。</system:String>
</ResourceDictionary>

View File

@@ -0,0 +1,11 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<system:String x:Key="wox_plugin_url_open_url">Otwórz adres URL: {0}</system:String>
<system:String x:Key="wox_plugin_url_canot_open_url">Nie udało się otworzyć adresu: {0}</system:String>
<system:String x:Key="wox_plugin_url_plugin_name">URL</system:String>
<system:String x:Key="wox_plugin_url_plugin_description">Otwórz wpisany adres URL z poziomu Woxa</system:String>
</ResourceDictionary>

View File

@@ -0,0 +1,14 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<system:String x:Key="wox_plugin_url_open_url">URL'yi Aç: {0}</system:String>
<system:String x:Key="wox_plugin_url_canot_open_url">URL Açılamıyor: {0}</system:String>
<system:String x:Key="wox_plugin_url_plugin_name">URL</system:String>
<system:String x:Key="wox_plugin_url_plugin_description">Wox'a yazılan URL'leri açar</system:String>
<system:String x:Key="wox_plugin_url_plugin_set_tip">Tarayıcınızın konumunu ayarlayın:</system:String>
<system:String x:Key="wox_plugin_url_plugin_choose">Seç</system:String>
<system:String x:Key="wox_plugin_url_plugin_filter">Programlar (*.exe)|*.exe|Tüm Dosyalar|*.*</system:String>
</ResourceDictionary>

View File

@@ -0,0 +1,14 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<system:String x:Key="wox_plugin_url_open_url">打开链接:{0}</system:String>
<system:String x:Key="wox_plugin_url_canot_open_url">无法打开链接:{0}</system:String>
<system:String x:Key="wox_plugin_url_plugin_name">URL</system:String>
<system:String x:Key="wox_plugin_url_plugin_description">从Wox打开链接</system:String>
<system:String x:Key="wox_plugin_url_plugin_set_tip">请设置你的浏览器路径:</system:String>
<system:String x:Key="wox_plugin_url_plugin_choose">选择</system:String>
<system:String x:Key="wox_plugin_url_plugin_filter">程序文件(*.exe)|*.exe|所有文件|*.*</system:String>
</ResourceDictionary>

View File

@@ -0,0 +1,11 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<system:String x:Key="wox_plugin_url_open_url">開啟連結:{0}</system:String>
<system:String x:Key="wox_plugin_url_canot_open_url">無法開啟連結:{0}</system:String>
<system:String x:Key="wox_plugin_url_plugin_name">URL</system:String>
<system:String x:Key="wox_plugin_url_plugin_description">從 Wox 開啟連結</system:String>
</ResourceDictionary>

View File

@@ -0,0 +1,143 @@
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Windows.Controls;
using Wox.Infrastructure.Storage;
using Wox.Plugin.SharedCommands;
namespace Wox.Plugin.Url
{
public class Main : ISettingProvider,IPlugin, IPluginI18n, ISavable
{
//based on https://gist.github.com/dperini/729294
private const string urlPattern = "^" +
// protocol identifier
"(?:(?:https?|ftp)://|)" +
// user:pass authentication
"(?:\\S+(?::\\S*)?@)?" +
"(?:" +
// IP address exclusion
// private & local networks
"(?!(?:10|127)(?:\\.\\d{1,3}){3})" +
"(?!(?:169\\.254|192\\.168)(?:\\.\\d{1,3}){2})" +
"(?!172\\.(?:1[6-9]|2\\d|3[0-1])(?:\\.\\d{1,3}){2})" +
// IP address dotted notation octets
// excludes loopback network 0.0.0.0
// excludes reserved space >= 224.0.0.0
// excludes network & broacast addresses
// (first & last IP address of each class)
"(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])" +
"(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}" +
"(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))" +
"|" +
// host name
"(?:(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)" +
// domain name
"(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*" +
// TLD identifier
"(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))" +
")" +
// port number
"(?::\\d{2,5})?" +
// resource path
"(?:/\\S*)?" +
"$";
Regex reg = new Regex(urlPattern, RegexOptions.Compiled | RegexOptions.IgnoreCase);
private PluginInitContext context;
private readonly Settings _settings;
private readonly PluginJsonStorage<Settings> _storage;
public Main()
{
_storage = new PluginJsonStorage<Settings>();
_settings = _storage.Load();
}
public void Save()
{
_storage.Save();
}
public List<Result> Query(Query query)
{
var raw = query.Search;
if (IsURL(raw))
{
return new List<Result>
{
new Result
{
Title = raw,
SubTitle = string.Format(context.API.GetTranslation("wox_plugin_url_open_url"),raw),
IcoPath = "Images/url.png",
Score = 8,
Action = _ =>
{
if (!raw.ToLower().StartsWith("http"))
{
raw = "http://" + raw;
}
try
{
if (_settings.OpenInNewBrowserWindow)
{
raw.NewBrowserWindow(_settings.BrowserPath);
}
else
{
raw.NewTabInBrowser(_settings.BrowserPath);
}
return true;
}
catch(Exception ex)
{
context.API.ShowMsg(string.Format(context.API.GetTranslation("wox_plugin_url_canot_open_url"), raw));
return false;
}
}
}
};
}
return new List<Result>(0);
}
public Control CreateSettingPanel()
{
return new SettingsControl(context.API,_settings);
}
public bool IsURL(string raw)
{
raw = raw.ToLower();
if (reg.Match(raw).Value == raw) return true;
if (raw == "localhost" || raw.StartsWith("localhost:") ||
raw == "http://localhost" || raw.StartsWith("http://localhost:") ||
raw == "https://localhost" || raw.StartsWith("https://localhost:")
)
{
return true;
}
return false;
}
public void Init(PluginInitContext context)
{
this.context = context;
}
public string GetTranslatedPluginTitle()
{
return context.API.GetTranslation("wox_plugin_url_plugin_name");
}
public string GetTranslatedPluginDescription()
{
return context.API.GetTranslation("wox_plugin_url_plugin_description");
}
}
}

View File

@@ -0,0 +1,5 @@
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Wox.Plugin.Url")]
[assembly: Guid("ea42b60d-34ff-4656-8ee1-012afa397d3e")]

View File

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Wox.Plugin.Url
{
public class Settings
{
public string BrowserPath { get; set; }
public bool OpenInNewBrowserWindow { get; set; } = true;
}
}

View File

@@ -0,0 +1,23 @@
<UserControl x:Class="Wox.Plugin.Url.SettingsControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="500">
<Grid Margin="10,10,10,0">
<Grid.RowDefinitions>
<RowDefinition Height="40" />
<RowDefinition />
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal" Grid.Row="0">
<Label Content="Open search in:" Margin="40 3 0 8" />
<RadioButton x:Name="NewWindowBrowser" GroupName="OpenSearchBehaviour" Content="New window" Click="OnNewBrowserWindowClick" Margin="10" />
<RadioButton x:Name="NewTabInBrowser" GroupName="OpenSearchBehaviour" Content="New tab" Click="OnNewTabClick" Margin="10" />
</StackPanel>
<StackPanel VerticalAlignment="Top" Grid.Row="1" Height="106" Margin="41,13,0,0">
<Label Content="{DynamicResource wox_plugin_url_plugin_set_tip}" Height="28" Margin="0,0,155,0" HorizontalAlignment="Left" Width="290" />
<TextBox x:Name="browserPathBox" HorizontalAlignment="Left" Height="34" Margin="5,0,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="311" RenderTransformOrigin="0.502,-1.668" />
<Button x:Name="viewButton" HorizontalAlignment="Left" Margin="340,-33,-1,0" Width="100" Height="28" Click="OnChooseClick" FontSize="10" Content="{DynamicResource wox_plugin_url_plugin_choose}" />
</StackPanel>
</Grid>
</UserControl>

View File

@@ -0,0 +1,61 @@
using System;
using System.Collections.Generic;
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 Microsoft.Win32;
namespace Wox.Plugin.Url
{
/// <summary>
/// SettingsControl.xaml 的交互逻辑
/// </summary>
public partial class SettingsControl : UserControl
{
private Settings _settings;
private IPublicAPI _woxAPI;
public SettingsControl(IPublicAPI woxAPI,Settings settings)
{
InitializeComponent();
_settings = settings;
_woxAPI = woxAPI;
browserPathBox.Text = _settings.BrowserPath;
NewWindowBrowser.IsChecked = _settings.OpenInNewBrowserWindow;
NewTabInBrowser.IsChecked = !_settings.OpenInNewBrowserWindow;
}
private void OnChooseClick(object sender, RoutedEventArgs e)
{
var fileBrowserDialog = new OpenFileDialog();
fileBrowserDialog.Filter = _woxAPI.GetTranslation("wox_plugin_url_plugin_filter"); ;
fileBrowserDialog.CheckFileExists = true;
fileBrowserDialog.CheckPathExists = true;
if (fileBrowserDialog.ShowDialog() == true)
{
browserPathBox.Text = fileBrowserDialog.FileName;
_settings.BrowserPath = fileBrowserDialog.FileName;
}
}
private void OnNewBrowserWindowClick(object sender, RoutedEventArgs e)
{
_settings.OpenInNewBrowserWindow = true;
}
private void OnNewTabClick(object sender, RoutedEventArgs e)
{
_settings.OpenInNewBrowserWindow = false;
}
}
}

View File

@@ -0,0 +1,140 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{A3DCCBCA-ACC1-421D-B16E-210896234C26}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Wox.Plugin.Url</RootNamespace>
<AssemblyName>Wox.Plugin.Url</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\Output\Debug\Plugins\Wox.Plugin.Url\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\Output\Release\Plugins\Wox.Plugin.Url\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="JetBrains.Annotations, Version=10.3.0.0, Culture=neutral, PublicKeyToken=1010a0d8d6380325, processorArchitecture=MSIL">
<HintPath>..\..\packages\JetBrains.Annotations.10.3.0\lib\net\JetBrains.Annotations.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xaml" />
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\SolutionAssemblyInfo.cs">
<Link>Properties\SolutionAssemblyInfo.cs</Link>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Main.cs" />
<Compile Include="Settings.cs" />
<Compile Include="SettingsControl.xaml.cs">
<DependentUpon>SettingsControl.xaml</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="plugin.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Wox.Infrastructure\Wox.Infrastructure.csproj">
<Project>{4FD29318-A8AB-4D8F-AA47-60BC241B8DA3}</Project>
<Name>Wox.Infrastructure</Name>
</ProjectReference>
<ProjectReference Include="..\..\Wox.Plugin\Wox.Plugin.csproj">
<Project>{8451ecdd-2ea4-4966-bb0a-7bbc40138e80}</Project>
<Name>Wox.Plugin</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="Images\url.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Content Include="Languages\en.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<Content Include="Languages\zh-cn.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<Content Include="Languages\zh-tw.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<Content Include="Languages\de.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<Content Include="Languages\pl.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<Content Include="Languages\tr.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Page Include="SettingsControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<PackageReference Include="JetBrains.Annotations">
<Version>10.3.0</Version>
</PackageReference>
<PackageReference Include="System.Runtime">
<Version>4.0.0</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -0,0 +1,12 @@
{
"ID":"0308FD86DE0A4DEE8D62B9B535370992",
"ActionKeyword":"*",
"Name":"URL",
"Description":"Open the typed URL from Wox",
"Author":"qianlifeng",
"Version":"1.0.0",
"Language":"csharp",
"Website":"http://www.wox.one/plugin",
"ExecuteFileName":"Wox.Plugin.Url.dll",
"IcoPath":"Images\\url.png"
}