Add 'src/modules/launcher/' from commit '28acd466b352a807910cebbc74477d3173b31511'
git-subtree-dir: src/modules/launcher git-subtree-mainline:852689b3dfgit-subtree-split:28acd466b3
65
src/modules/launcher/.gitattributes
vendored
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
###############################################################################
|
||||||
|
# Set default behavior to automatically normalize line endings.
|
||||||
|
###############################################################################
|
||||||
|
* text=auto
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Set default behavior for command prompt diff.
|
||||||
|
#
|
||||||
|
# This is need for earlier builds of msysgit that does not have it on by
|
||||||
|
# default for csharp files.
|
||||||
|
# Note: This is only used by command line
|
||||||
|
###############################################################################
|
||||||
|
#*.cs diff=csharp
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Set the merge driver for project and solution files
|
||||||
|
#
|
||||||
|
# Merging from the command prompt will add diff markers to the files if there
|
||||||
|
# are conflicts (Merging from VS is not affected by the settings below, in VS
|
||||||
|
# the diff markers are never inserted). Diff markers may cause the following
|
||||||
|
# file extensions to fail to load in VS. An alternative would be to treat
|
||||||
|
# these files as binary and thus will always conflict and require user
|
||||||
|
# intervention with every merge. To do so, just uncomment the entries below
|
||||||
|
###############################################################################
|
||||||
|
#*.sln merge=binary
|
||||||
|
#*.csproj merge=binary
|
||||||
|
#*.vbproj merge=binary
|
||||||
|
#*.vcxproj merge=binary
|
||||||
|
#*.vcproj merge=binary
|
||||||
|
#*.dbproj merge=binary
|
||||||
|
#*.fsproj merge=binary
|
||||||
|
#*.lsproj merge=binary
|
||||||
|
#*.wixproj merge=binary
|
||||||
|
#*.modelproj merge=binary
|
||||||
|
#*.sqlproj merge=binary
|
||||||
|
#*.wwaproj merge=binary
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# behavior for image files
|
||||||
|
#
|
||||||
|
# image files are treated as binary by default.
|
||||||
|
###############################################################################
|
||||||
|
#*.jpg binary
|
||||||
|
#*.png binary
|
||||||
|
#*.gif binary
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# diff behavior for common document formats
|
||||||
|
#
|
||||||
|
# Convert binary document formats to text before diffing them. This feature
|
||||||
|
# is only available from the command line. Turn it on by uncommenting the
|
||||||
|
# entries below.
|
||||||
|
###############################################################################
|
||||||
|
#*.doc diff=astextplain
|
||||||
|
#*.DOC diff=astextplain
|
||||||
|
#*.docx diff=astextplain
|
||||||
|
#*.DOCX diff=astextplain
|
||||||
|
#*.dot diff=astextplain
|
||||||
|
#*.DOT diff=astextplain
|
||||||
|
#*.pdf diff=astextplain
|
||||||
|
#*.PDF diff=astextplain
|
||||||
|
#*.rtf diff=astextplain
|
||||||
|
#*.RTF diff=astextplain
|
||||||
|
|
||||||
|
PythonHome/* linguist-vendored
|
||||||
303
src/modules/launcher/.gitignore
vendored
Normal file
@@ -0,0 +1,303 @@
|
|||||||
|
## https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
||||||
|
## Ignore Visual Studio temporary files, build results, and
|
||||||
|
## files generated by popular Visual Studio add-ons.
|
||||||
|
|
||||||
|
# User-specific files
|
||||||
|
*.suo
|
||||||
|
*.user
|
||||||
|
*.userosscache
|
||||||
|
*.sln.docstates
|
||||||
|
|
||||||
|
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||||
|
*.userprefs
|
||||||
|
|
||||||
|
# Build results
|
||||||
|
[Dd]ebug/
|
||||||
|
[Dd]ebugPublic/
|
||||||
|
[Rr]elease/
|
||||||
|
[Rr]eleases/
|
||||||
|
x64/
|
||||||
|
x86/
|
||||||
|
bld/
|
||||||
|
[Bb]in/
|
||||||
|
[Oo]bj/
|
||||||
|
[Ll]og/
|
||||||
|
|
||||||
|
# Visual Studio 2015 cache/options directory
|
||||||
|
.vs/
|
||||||
|
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||||
|
#wwwroot/
|
||||||
|
|
||||||
|
# MSTest test Results
|
||||||
|
[Tt]est[Rr]esult*/
|
||||||
|
[Bb]uild[Ll]og.*
|
||||||
|
|
||||||
|
# NUNIT
|
||||||
|
*.VisualState.xml
|
||||||
|
TestResult.xml
|
||||||
|
|
||||||
|
# Build Results of an ATL Project
|
||||||
|
[Dd]ebugPS/
|
||||||
|
[Rr]eleasePS/
|
||||||
|
dlldata.c
|
||||||
|
|
||||||
|
# DNX
|
||||||
|
project.lock.json
|
||||||
|
artifacts/
|
||||||
|
|
||||||
|
*_i.c
|
||||||
|
*_p.c
|
||||||
|
*_i.h
|
||||||
|
*.ilk
|
||||||
|
*.meta
|
||||||
|
*.obj
|
||||||
|
*.pch
|
||||||
|
*.pdb
|
||||||
|
*.pgc
|
||||||
|
*.pgd
|
||||||
|
*.rsp
|
||||||
|
*.sbr
|
||||||
|
*.tlb
|
||||||
|
*.tli
|
||||||
|
*.tlh
|
||||||
|
*.tmp
|
||||||
|
*.tmp_proj
|
||||||
|
*.log
|
||||||
|
*.vspscc
|
||||||
|
*.vssscc
|
||||||
|
.builds
|
||||||
|
*.pidb
|
||||||
|
*.svclog
|
||||||
|
*.scc
|
||||||
|
|
||||||
|
# Chutzpah Test files
|
||||||
|
_Chutzpah*
|
||||||
|
|
||||||
|
# Visual C++ cache files
|
||||||
|
ipch/
|
||||||
|
*.aps
|
||||||
|
*.ncb
|
||||||
|
*.opendb
|
||||||
|
*.opensdf
|
||||||
|
*.sdf
|
||||||
|
*.cachefile
|
||||||
|
|
||||||
|
# Visual Studio profiler
|
||||||
|
*.psess
|
||||||
|
*.vsp
|
||||||
|
*.vspx
|
||||||
|
*.sap
|
||||||
|
|
||||||
|
# TFS 2012 Local Workspace
|
||||||
|
$tf/
|
||||||
|
|
||||||
|
# Guidance Automation Toolkit
|
||||||
|
*.gpState
|
||||||
|
|
||||||
|
# ReSharper is a .NET coding add-in
|
||||||
|
_ReSharper*/
|
||||||
|
*.[Rr]e[Ss]harper
|
||||||
|
*.DotSettings.user
|
||||||
|
|
||||||
|
# JustCode is a .NET coding add-in
|
||||||
|
.JustCode
|
||||||
|
|
||||||
|
# TeamCity is a build add-in
|
||||||
|
_TeamCity*
|
||||||
|
|
||||||
|
# DotCover is a Code Coverage Tool
|
||||||
|
*.dotCover
|
||||||
|
|
||||||
|
# NCrunch
|
||||||
|
_NCrunch_*
|
||||||
|
.*crunch*.local.xml
|
||||||
|
nCrunchTemp_*
|
||||||
|
|
||||||
|
# MightyMoose
|
||||||
|
*.mm.*
|
||||||
|
AutoTest.Net/
|
||||||
|
|
||||||
|
# Web workbench (sass)
|
||||||
|
.sass-cache/
|
||||||
|
|
||||||
|
# Installshield output folder
|
||||||
|
[Ee]xpress/
|
||||||
|
|
||||||
|
# DocProject is a documentation generator add-in
|
||||||
|
DocProject/buildhelp/
|
||||||
|
DocProject/Help/*.HxT
|
||||||
|
DocProject/Help/*.HxC
|
||||||
|
DocProject/Help/*.hhc
|
||||||
|
DocProject/Help/*.hhk
|
||||||
|
DocProject/Help/*.hhp
|
||||||
|
DocProject/Help/Html2
|
||||||
|
DocProject/Help/html
|
||||||
|
|
||||||
|
# Click-Once directory
|
||||||
|
publish/
|
||||||
|
|
||||||
|
# Publish Web Output
|
||||||
|
*.[Pp]ublish.xml
|
||||||
|
*.azurePubxml
|
||||||
|
# TODO: Comment the next line if you want to checkin your web deploy settings
|
||||||
|
# but database connection strings (with potential passwords) will be unencrypted
|
||||||
|
*.pubxml
|
||||||
|
*.publishproj
|
||||||
|
|
||||||
|
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||||
|
# checkin your Azure Web App publish settings, but sensitive information contained
|
||||||
|
# in these scripts will be unencrypted
|
||||||
|
PublishScripts/
|
||||||
|
|
||||||
|
# NuGet Packages
|
||||||
|
*.nupkg
|
||||||
|
# The packages folder can be ignored because of Package Restore
|
||||||
|
**/packages/*
|
||||||
|
# except build/, which is used as an MSBuild target.
|
||||||
|
!**/packages/build/
|
||||||
|
# Uncomment if necessary however generally it will be regenerated when needed
|
||||||
|
#!**/packages/repositories.config
|
||||||
|
# NuGet v3's project.json files produces more ignoreable files
|
||||||
|
*.nuget.props
|
||||||
|
*.nuget.targets
|
||||||
|
|
||||||
|
# Microsoft Azure Build Output
|
||||||
|
csx/
|
||||||
|
*.build.csdef
|
||||||
|
|
||||||
|
# Microsoft Azure Emulator
|
||||||
|
ecf/
|
||||||
|
rcf/
|
||||||
|
|
||||||
|
# Windows Store app package directories and files
|
||||||
|
AppPackages/
|
||||||
|
BundleArtifacts/
|
||||||
|
Package.StoreAssociation.xml
|
||||||
|
_pkginfo.txt
|
||||||
|
|
||||||
|
# Visual Studio cache files
|
||||||
|
# files ending in .cache can be ignored
|
||||||
|
*.[Cc]ache
|
||||||
|
# but keep track of directories ending in .cache
|
||||||
|
!*.[Cc]ache/
|
||||||
|
|
||||||
|
# Others
|
||||||
|
ClientBin/
|
||||||
|
~$*
|
||||||
|
*~
|
||||||
|
*.dbmdl
|
||||||
|
*.dbproj.schemaview
|
||||||
|
*.pfx
|
||||||
|
*.publishsettings
|
||||||
|
node_modules/
|
||||||
|
orleans.codegen.cs
|
||||||
|
|
||||||
|
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||||
|
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||||
|
#bower_components/
|
||||||
|
|
||||||
|
# RIA/Silverlight projects
|
||||||
|
Generated_Code/
|
||||||
|
|
||||||
|
# Backup & report files from converting an old project file
|
||||||
|
# to a newer Visual Studio version. Backup files are not needed,
|
||||||
|
# because we have git ;-)
|
||||||
|
_UpgradeReport_Files/
|
||||||
|
Backup*/
|
||||||
|
UpgradeLog*.XML
|
||||||
|
UpgradeLog*.htm
|
||||||
|
|
||||||
|
# SQL Server files
|
||||||
|
*.mdf
|
||||||
|
*.ldf
|
||||||
|
|
||||||
|
# Business Intelligence projects
|
||||||
|
*.rdl.data
|
||||||
|
*.bim.layout
|
||||||
|
*.bim_*.settings
|
||||||
|
|
||||||
|
# Microsoft Fakes
|
||||||
|
FakesAssemblies/
|
||||||
|
|
||||||
|
# GhostDoc plugin setting file
|
||||||
|
*.GhostDoc.xml
|
||||||
|
|
||||||
|
# Node.js Tools for Visual Studio
|
||||||
|
.ntvs_analysis.dat
|
||||||
|
|
||||||
|
# Visual Studio 6 build log
|
||||||
|
*.plg
|
||||||
|
|
||||||
|
# Visual Studio 6 workspace options file
|
||||||
|
*.opt
|
||||||
|
|
||||||
|
# Visual Studio LightSwitch build output
|
||||||
|
**/*.HTMLClient/GeneratedArtifacts
|
||||||
|
**/*.DesktopClient/GeneratedArtifacts
|
||||||
|
**/*.DesktopClient/ModelManifest.xml
|
||||||
|
**/*.Server/GeneratedArtifacts
|
||||||
|
**/*.Server/ModelManifest.xml
|
||||||
|
_Pvt_Extensions
|
||||||
|
|
||||||
|
# Paket dependency manager
|
||||||
|
.paket/paket.exe
|
||||||
|
paket-files/
|
||||||
|
|
||||||
|
# FAKE - F# Make
|
||||||
|
.fake/
|
||||||
|
|
||||||
|
# JetBrains Rider
|
||||||
|
.idea/
|
||||||
|
*.sln.iml
|
||||||
|
|
||||||
|
## https://github.com/github/gitignore/blob/master/C%2B%2B.gitignore
|
||||||
|
## C++
|
||||||
|
|
||||||
|
# Compiled Object files
|
||||||
|
*.slo
|
||||||
|
*.lo
|
||||||
|
*.o
|
||||||
|
*.obj
|
||||||
|
|
||||||
|
# Precompiled Headers
|
||||||
|
*.gch
|
||||||
|
*.pch
|
||||||
|
|
||||||
|
# Compiled Dynamic libraries
|
||||||
|
*.so
|
||||||
|
*.dylib
|
||||||
|
*.dll
|
||||||
|
|
||||||
|
# Fortran module files
|
||||||
|
*.mod
|
||||||
|
|
||||||
|
# Compiled Static libraries
|
||||||
|
*.lai
|
||||||
|
*.la
|
||||||
|
*.a
|
||||||
|
*.lib
|
||||||
|
|
||||||
|
# Executables
|
||||||
|
*.exe
|
||||||
|
*.out
|
||||||
|
*.app
|
||||||
|
|
||||||
|
# New to Visual Studio
|
||||||
|
*.VC.db
|
||||||
|
|
||||||
|
## Wox specific
|
||||||
|
Output/*
|
||||||
|
/Python.Runtime.dll
|
||||||
|
Thumbs.db
|
||||||
|
RELEASES
|
||||||
|
|
||||||
|
|
||||||
|
*.sublime-*
|
||||||
|
*.dgml
|
||||||
|
migrateToAutomaticPackageRestore.ps1
|
||||||
|
*.pyd
|
||||||
|
*.pyc
|
||||||
|
*/pinyindb/*
|
||||||
|
*.diagsession
|
||||||
|
Output-Performance.txt
|
||||||
|
*.diff
|
||||||
4
src/modules/launcher/Deploy/local_build.ps1
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
New-Alias nuget.exe ".\packages\NuGet.CommandLine.*\tools\NuGet.exe"
|
||||||
|
$env:APPVEYOR_BUILD_FOLDER = Convert-Path .
|
||||||
|
$env:APPVEYOR_BUILD_VERSION = "1.2.0"
|
||||||
|
& .\Deploy\squirrel_installer.ps1
|
||||||
BIN
src/modules/launcher/Doc/app.ico
Normal file
|
After Width: | Height: | Size: 32 KiB |
BIN
src/modules/launcher/Doc/app.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
src/modules/launcher/Doc/app.psd
Normal file
BIN
src/modules/launcher/Doc/app_error.png
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
src/modules/launcher/Doc/app_error.psd
Normal file
102
src/modules/launcher/ISSUE_TEMPLATE.md
Normal file
@@ -0,0 +1,102 @@
|
|||||||
|
<!--
|
||||||
|
===================================================
|
||||||
|
DO NOT DELETE UNTIL YOU HAVE READ THE FIRST SECTION
|
||||||
|
===================================================
|
||||||
|
|
||||||
|
To be able to help you we need enough information to find
|
||||||
|
what is causing your issue. Please follow the instructions
|
||||||
|
and type the requested information where prompted.
|
||||||
|
|
||||||
|
===================================================
|
||||||
|
中文版说明,请仔细阅读并在填写后删除此说明段落,无效的反馈会被直接关闭
|
||||||
|
===================================================
|
||||||
|
请遵循以下说明,提供我们所需要的信息来,这样我们才能找出导致你
|
||||||
|
遇到的问题的原因,来更好的帮助你。
|
||||||
|
如果可以的话,请附上一份英文的翻译(哪怕是直接使用谷歌翻译)
|
||||||
|
请注意,无效的反馈(尤其是没有填写下面那些信息的反馈)会被直接关闭!
|
||||||
|
-->
|
||||||
|
|
||||||
|
### Are you submitting a bug report?
|
||||||
|
|
||||||
|
(write your answer here)
|
||||||
|
|
||||||
|
<!--
|
||||||
|
If your answer is "Yes", please follow the instructions below.
|
||||||
|
|
||||||
|
If your answer is "No", you may delete everything below and then proceed
|
||||||
|
to write your concern.
|
||||||
|
|
||||||
|
你是否是在提交一个bug(软件缺陷)?
|
||||||
|
如果你的答案是『是的』,请继续回答下面的提问。
|
||||||
|
如果你的答案是『不是』,你可以删除下面的一切,然后说出你的想法。
|
||||||
|
-->
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Some problems are known of and there are
|
||||||
|
already workarounds or existing issues.
|
||||||
|
|
||||||
|
Known problems for 1.3.183:
|
||||||
|
We are aware of the following issues and the following workarounds exist:
|
||||||
|
1. `System.NullReferenceException`: https://github.com/Wox-launcher/Wox/releases/tag/v1.3.475
|
||||||
|
2. `System.UriFormatException`: delete your old theme file
|
||||||
|
3. `System.Threading.Tasks.TaskCanceledException`: https://github.com/Wox-launcher/Wox/releases/tag/v1.3.475
|
||||||
|
4. `System.AggregateException`: see https://github.com/Wox-launcher/Wox/issues/1777
|
||||||
|
|
||||||
|
If none of them match your case, please continue.
|
||||||
|
|
||||||
|
已知问题及解决方案:(略,如果有任何问题请继续提问)
|
||||||
|
-->
|
||||||
|
|
||||||
|
### Steps to reproduce
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Write what steps you took in order for this problem to happen.
|
||||||
|
If you do not provide any steps, we cannot replicate your problem
|
||||||
|
and will not be able to help you.
|
||||||
|
|
||||||
|
复现问题的步骤:
|
||||||
|
在此按顺序一步步说明在问题发生前你做了什么操作。
|
||||||
|
如果你没法说明你的步骤,那么我们无法复现你的问题,也就无法帮助你了。
|
||||||
|
-->
|
||||||
|
|
||||||
|
1.
|
||||||
|
2.
|
||||||
|
3.
|
||||||
|
|
||||||
|
### Wox Error Window text
|
||||||
|
<!--
|
||||||
|
Paste below the logs generated by the Wox error reporter.
|
||||||
|
|
||||||
|
请在此处粘贴 Wox 错误报告程序提供的日志。
|
||||||
|
-->
|
||||||
|
|
||||||
|
(paste here)
|
||||||
|
|
||||||
|
|
||||||
|
### Detailed logs
|
||||||
|
<!--
|
||||||
|
Please also provide detailed logs. The latest log file
|
||||||
|
can be found here: %APPDATA%\Wox\Logs\version\<date>.txt
|
||||||
|
Drag and drop that file below this comment.
|
||||||
|
In some cases you can skip uploading the the logs, but the chances
|
||||||
|
of us being able to solve the problem will be higher if you do.
|
||||||
|
|
||||||
|
详细日志:
|
||||||
|
请在此处提供详细日志。你可以在这个目录找到最新的日志:
|
||||||
|
%APPDATA%\Wox\Logs\version\<date>.txt
|
||||||
|
直接拖放文件到这个评论就可以上传(国内大部分地区可能需要翻墙才能上传,作为备选方案可以考虑直接在此粘贴文件内容)
|
||||||
|
-->
|
||||||
|
|
||||||
|
(drop your log file here)
|
||||||
|
|
||||||
|
### Screenshots (optional)
|
||||||
|
<!--
|
||||||
|
If you think it will be helpful to provide a screenshot
|
||||||
|
to better describe your problem, upload it below
|
||||||
|
|
||||||
|
截图(可选)
|
||||||
|
如果你认为截图能够有助于说明你的问题,请在下面上传它。
|
||||||
|
-->
|
||||||
|
|
||||||
|
(drop your screenshot here)
|
||||||
|
|
||||||
115
src/modules/launcher/JsonRPC/wox.py
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import print_function
|
||||||
|
import json
|
||||||
|
import sys
|
||||||
|
import inspect
|
||||||
|
|
||||||
|
class Wox(object):
|
||||||
|
"""
|
||||||
|
Wox python plugin base
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
rpc_request = json.loads(sys.argv[1])
|
||||||
|
# proxy is not working now
|
||||||
|
self.proxy = rpc_request.get("proxy",{})
|
||||||
|
request_method_name = rpc_request.get("method")
|
||||||
|
request_parameters = rpc_request.get("parameters")
|
||||||
|
methods = inspect.getmembers(self, predicate=inspect.ismethod)
|
||||||
|
|
||||||
|
request_method = dict(methods)[request_method_name]
|
||||||
|
results = request_method(*request_parameters)
|
||||||
|
|
||||||
|
if request_method_name == "query" or request_method_name == "context_menu":
|
||||||
|
print(json.dumps({"result": results}))
|
||||||
|
|
||||||
|
def query(self,query):
|
||||||
|
"""
|
||||||
|
sub class need to override this method
|
||||||
|
"""
|
||||||
|
return []
|
||||||
|
|
||||||
|
def context_menu(self, data):
|
||||||
|
"""
|
||||||
|
optional context menu entries for a result
|
||||||
|
"""
|
||||||
|
return []
|
||||||
|
|
||||||
|
def debug(self,msg):
|
||||||
|
"""
|
||||||
|
alert msg
|
||||||
|
"""
|
||||||
|
print("DEBUG:{}".format(msg))
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
|
class WoxAPI(object):
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def change_query(cls,query,requery = False):
|
||||||
|
"""
|
||||||
|
change wox query
|
||||||
|
"""
|
||||||
|
print(json.dumps({"method": "Wox.ChangeQuery","parameters":[query,requery]}))
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def shell_run(cls,cmd):
|
||||||
|
"""
|
||||||
|
run shell commands
|
||||||
|
"""
|
||||||
|
print(json.dumps({"method": "Wox.ShellRun","parameters":[cmd]}))
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def close_app(cls):
|
||||||
|
"""
|
||||||
|
close wox
|
||||||
|
"""
|
||||||
|
print(json.dumps({"method": "Wox.CloseApp","parameters":[]}))
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def hide_app(cls):
|
||||||
|
"""
|
||||||
|
hide wox
|
||||||
|
"""
|
||||||
|
print(json.dumps({"method": "Wox.HideApp","parameters":[]}))
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def show_app(cls):
|
||||||
|
"""
|
||||||
|
show wox
|
||||||
|
"""
|
||||||
|
print(json.dumps({"method": "Wox.ShowApp","parameters":[]}))
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def show_msg(cls,title,sub_title,ico_path=""):
|
||||||
|
"""
|
||||||
|
show messagebox
|
||||||
|
"""
|
||||||
|
print(json.dumps({"method": "Wox.ShowMsg","parameters":[title,sub_title,ico_path]}))
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def open_setting_dialog(cls):
|
||||||
|
"""
|
||||||
|
open setting dialog
|
||||||
|
"""
|
||||||
|
print(json.dumps({"method": "Wox.OpenSettingDialog","parameters":[]}))
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def start_loadingbar(cls):
|
||||||
|
"""
|
||||||
|
start loading animation in wox
|
||||||
|
"""
|
||||||
|
print(json.dumps({"method": "Wox.StartLoadingBar","parameters":[]}))
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def stop_loadingbar(cls):
|
||||||
|
"""
|
||||||
|
stop loading animation in wox
|
||||||
|
"""
|
||||||
|
print(json.dumps({"method": "Wox.StopLoadingBar","parameters":[]}))
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def reload_plugins(cls):
|
||||||
|
"""
|
||||||
|
reload all wox plugins
|
||||||
|
"""
|
||||||
|
print(json.dumps({"method": "Wox.ReloadPlugins","parameters":[]}))
|
||||||
20
src/modules/launcher/LICENSE
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2015 Wox
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
the Software without restriction, including without limitation the rights to
|
||||||
|
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||||
|
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
|
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
|
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
6
src/modules/launcher/Plugins/HelloWorldCSharp/App.config
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<configuration>
|
||||||
|
<startup>
|
||||||
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
|
||||||
|
</startup>
|
||||||
|
</configuration>
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="14.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>{03FFA443-5F50-48D5-8869-F3DF316803AA}</ProjectGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>HelloWorldCSharp</RootNamespace>
|
||||||
|
<AssemblyName>HelloWorldCSharp</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>..\..\Output\Debug\Plugins\HelloWorldCSharp\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<Prefer32Bit>false</Prefer32Bit>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>..\..\Output\Release\Plugins\HelloWorldCSharp\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<Prefer32Bit>false</Prefer32Bit>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<StartupObject />
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Net.Http" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Main.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="App.config" />
|
||||||
|
<None Include="plugin.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\Wox.Plugin\Wox.Plugin.csproj">
|
||||||
|
<Project>{8451ECDD-2EA4-4966-BB0A-7BBC40138E80}</Project>
|
||||||
|
<Name>Wox.Plugin</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup />
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Include="Images\app.png">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
</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>
|
||||||
BIN
src/modules/launcher/Plugins/HelloWorldCSharp/Images/app.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
28
src/modules/launcher/Plugins/HelloWorldCSharp/Main.cs
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Wox.Plugin;
|
||||||
|
|
||||||
|
namespace HelloWorldCSharp
|
||||||
|
{
|
||||||
|
class Main : IPlugin
|
||||||
|
{
|
||||||
|
public List<Result> Query(Query query)
|
||||||
|
{
|
||||||
|
var result = new Result
|
||||||
|
{
|
||||||
|
Title = "Hello World from CSharp",
|
||||||
|
SubTitle = $"Query: {query.Search}",
|
||||||
|
IcoPath = "app.png"
|
||||||
|
};
|
||||||
|
return new List<Result> {result};
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Init(PluginInitContext context)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("HelloWorldCSharp")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("HelloWorldCSharp")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © 2016")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
|
[assembly: Guid("03ffa443-5f50-48d5-8869-f3df316803aa")]
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
|
// by using the '*' as shown below:
|
||||||
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||||
13
src/modules/launcher/Plugins/HelloWorldCSharp/plugin.json
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"ID":"CEA0FDFC6D3B4085823D60DC76F28844",
|
||||||
|
"ActionKeyword":"hc",
|
||||||
|
"Name":"Hello World CSharp",
|
||||||
|
"Description":"Hello World CSharp",
|
||||||
|
"Author":"happlebao",
|
||||||
|
"Version":"1.0.0",
|
||||||
|
"Language":"csharp",
|
||||||
|
"Website":"https://github.com/Wox-launcher/Wox",
|
||||||
|
"ExecuteFileName":"HelloWorldCSharp.dll",
|
||||||
|
"IcoPath":"app.png",
|
||||||
|
"Disabled": true
|
||||||
|
}
|
||||||
BIN
src/modules/launcher/Plugins/HelloWorldPython/Images/app.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
27
src/modules/launcher/Plugins/HelloWorldPython/main.py
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from wox import Wox
|
||||||
|
|
||||||
|
class HelloWorld(Wox):
|
||||||
|
|
||||||
|
def query(self, query):
|
||||||
|
results = []
|
||||||
|
results.append({
|
||||||
|
"Title": "Hello World",
|
||||||
|
"SubTitle": "Query: {}".format(query),
|
||||||
|
"IcoPath":"Images/app.ico",
|
||||||
|
"ContextData": "ctxData"
|
||||||
|
})
|
||||||
|
return results
|
||||||
|
|
||||||
|
def context_menu(self, data):
|
||||||
|
results = []
|
||||||
|
results.append({
|
||||||
|
"Title": "Context menu entry",
|
||||||
|
"SubTitle": "Data: {}".format(data),
|
||||||
|
"IcoPath":"Images/app.ico"
|
||||||
|
})
|
||||||
|
return results
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
HelloWorld()
|
||||||
12
src/modules/launcher/Plugins/HelloWorldPython/plugin.json
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"ID":"2f4e384e-76ce-45c3-aea2-b16f5e5c328f",
|
||||||
|
"ActionKeyword":"h",
|
||||||
|
"Name":"Hello World Python",
|
||||||
|
"Description":"Hello World",
|
||||||
|
"Author":"happlebao",
|
||||||
|
"Version":"1.0",
|
||||||
|
"Language":"python",
|
||||||
|
"Website":"https://github.com/Wox-launcher/Wox",
|
||||||
|
"IcoPath":"Images\\app.png",
|
||||||
|
"ExecuteFileName":"main.py"
|
||||||
|
}
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
using BinaryAnalysis.UnidecodeSharp;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
|
||||||
|
namespace Wox.Plugin.BrowserBookmark
|
||||||
|
{
|
||||||
|
public class Bookmark : IEquatable<Bookmark>, IEqualityComparer<Bookmark>
|
||||||
|
{
|
||||||
|
private string m_Name;
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return m_Name;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
m_Name = value;
|
||||||
|
PinyinName = m_Name.Unidecode();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public string PinyinName { get; private set; }
|
||||||
|
public string Url { get; set; }
|
||||||
|
public string Source { get; set; }
|
||||||
|
public int Score { get; set; }
|
||||||
|
|
||||||
|
/* TODO: since Source maybe unimportant, we just need to compare Name and Url */
|
||||||
|
public bool Equals(Bookmark other)
|
||||||
|
{
|
||||||
|
return Equals(this, other);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Equals(Bookmark x, Bookmark y)
|
||||||
|
{
|
||||||
|
if (Object.ReferenceEquals(x, y)) return true;
|
||||||
|
if (Object.ReferenceEquals(x, null) || Object.ReferenceEquals(y, null))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return x.Name == y.Name && x.Url == y.Url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int GetHashCode(Bookmark bookmark)
|
||||||
|
{
|
||||||
|
if (Object.ReferenceEquals(bookmark, null)) return 0;
|
||||||
|
int hashName = bookmark.Name == null ? 0 : bookmark.Name.GetHashCode();
|
||||||
|
int hashUrl = bookmark.Url == null ? 0 : bookmark.Url.GetHashCode();
|
||||||
|
return hashName ^ hashUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override int GetHashCode()
|
||||||
|
{
|
||||||
|
return GetHashCode(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
|
namespace Wox.Plugin.BrowserBookmark
|
||||||
|
{
|
||||||
|
public class ChromeBookmarks
|
||||||
|
{
|
||||||
|
private List<Bookmark> bookmarks = new List<Bookmark>();
|
||||||
|
|
||||||
|
public List<Bookmark> GetBookmarks()
|
||||||
|
{
|
||||||
|
bookmarks.Clear();
|
||||||
|
LoadChromeBookmarks();
|
||||||
|
|
||||||
|
return bookmarks;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ParseChromeBookmarks(String path, string source)
|
||||||
|
{
|
||||||
|
if (!File.Exists(path)) return;
|
||||||
|
|
||||||
|
string all = File.ReadAllText(path);
|
||||||
|
Regex nameRegex = new Regex("\"name\": \"(?<name>.*?)\"");
|
||||||
|
MatchCollection nameCollection = nameRegex.Matches(all);
|
||||||
|
Regex typeRegex = new Regex("\"type\": \"(?<type>.*?)\"");
|
||||||
|
MatchCollection typeCollection = typeRegex.Matches(all);
|
||||||
|
Regex urlRegex = new Regex("\"url\": \"(?<url>.*?)\"");
|
||||||
|
MatchCollection urlCollection = urlRegex.Matches(all);
|
||||||
|
|
||||||
|
List<string> names = (from Match match in nameCollection select match.Groups["name"].Value).ToList();
|
||||||
|
List<string> types = (from Match match in typeCollection select match.Groups["type"].Value).ToList();
|
||||||
|
List<string> urls = (from Match match in urlCollection select match.Groups["url"].Value).ToList();
|
||||||
|
|
||||||
|
int urlIndex = 0;
|
||||||
|
for (int i = 0; i < names.Count; i++)
|
||||||
|
{
|
||||||
|
string name = DecodeUnicode(names[i]);
|
||||||
|
string type = types[i];
|
||||||
|
if (type == "url")
|
||||||
|
{
|
||||||
|
string url = urls[urlIndex];
|
||||||
|
urlIndex++;
|
||||||
|
|
||||||
|
if (url == null) continue;
|
||||||
|
if (url.StartsWith("javascript:", StringComparison.OrdinalIgnoreCase)) continue;
|
||||||
|
if (url.StartsWith("vbscript:", StringComparison.OrdinalIgnoreCase)) continue;
|
||||||
|
|
||||||
|
bookmarks.Add(new Bookmark()
|
||||||
|
{
|
||||||
|
Name = name,
|
||||||
|
Url = url,
|
||||||
|
Source = source
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadChromeBookmarks(string path, string name)
|
||||||
|
{
|
||||||
|
if (!Directory.Exists(path)) return;
|
||||||
|
var paths = Directory.GetDirectories(path);
|
||||||
|
|
||||||
|
foreach (var profile in paths)
|
||||||
|
{
|
||||||
|
if (File.Exists(Path.Combine(profile, "Bookmarks")))
|
||||||
|
ParseChromeBookmarks(Path.Combine(profile, "Bookmarks"), name + (Path.GetFileName(profile) == "Default" ? "" : (" (" + Path.GetFileName(profile) + ")")));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadChromeBookmarks()
|
||||||
|
{
|
||||||
|
String platformPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
|
||||||
|
LoadChromeBookmarks(Path.Combine(platformPath, @"Google\Chrome\User Data"), "Google Chrome");
|
||||||
|
LoadChromeBookmarks(Path.Combine(platformPath, @"Google\Chrome SxS\User Data"), "Google Chrome Canary");
|
||||||
|
LoadChromeBookmarks(Path.Combine(platformPath, @"Chromium\User Data"), "Chromium");
|
||||||
|
}
|
||||||
|
|
||||||
|
private String DecodeUnicode(String dataStr)
|
||||||
|
{
|
||||||
|
Regex reg = new Regex(@"(?i)\\[uU]([0-9a-f]{4})");
|
||||||
|
return reg.Replace(dataStr, m => ((char)Convert.ToInt32(m.Groups[1].Value, 16)).ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using Wox.Infrastructure;
|
||||||
|
|
||||||
|
namespace Wox.Plugin.BrowserBookmark.Commands
|
||||||
|
{
|
||||||
|
internal static class Bookmarks
|
||||||
|
{
|
||||||
|
internal static bool MatchProgram(Bookmark bookmark, string queryString)
|
||||||
|
{
|
||||||
|
if (StringMatcher.FuzzySearch(queryString, bookmark.Name).IsSearchPrecisionScoreMet()) return true;
|
||||||
|
if (StringMatcher.FuzzySearch(queryString, bookmark.PinyinName).IsSearchPrecisionScoreMet()) return true;
|
||||||
|
if (StringMatcher.FuzzySearch(queryString, bookmark.Url).IsSearchPrecisionScoreMet()) return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static List<Bookmark> LoadAllBookmarks()
|
||||||
|
{
|
||||||
|
var allbookmarks = new List<Bookmark>();
|
||||||
|
|
||||||
|
var chromeBookmarks = new ChromeBookmarks();
|
||||||
|
var mozBookmarks = new FirefoxBookmarks();
|
||||||
|
|
||||||
|
//TODO: Let the user select which browser's bookmarks are displayed
|
||||||
|
// Add Firefox bookmarks
|
||||||
|
mozBookmarks.GetBookmarks().ForEach(x => allbookmarks.Add(x));
|
||||||
|
|
||||||
|
// Add Chrome bookmarks
|
||||||
|
chromeBookmarks.GetBookmarks().ForEach(x => allbookmarks.Add(x));
|
||||||
|
|
||||||
|
return allbookmarks.Distinct().ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,129 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Data.SQLite;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace Wox.Plugin.BrowserBookmark
|
||||||
|
{
|
||||||
|
public class FirefoxBookmarks
|
||||||
|
{
|
||||||
|
private const string queryAllBookmarks = @"SELECT moz_places.url, moz_bookmarks.title
|
||||||
|
FROM moz_places
|
||||||
|
INNER JOIN moz_bookmarks ON (
|
||||||
|
moz_bookmarks.fk NOT NULL AND moz_bookmarks.fk = moz_places.id
|
||||||
|
)
|
||||||
|
ORDER BY moz_places.visit_count DESC
|
||||||
|
";
|
||||||
|
|
||||||
|
private const string dbPathFormat = "Data Source ={0};Version=3;New=False;Compress=True;";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Searches the places.sqlite db and returns all bookmarks
|
||||||
|
/// </summary>
|
||||||
|
public List<Bookmark> GetBookmarks()
|
||||||
|
{
|
||||||
|
// Return empty list if the places.sqlite file cannot be found
|
||||||
|
if (string.IsNullOrEmpty(PlacesPath) || !File.Exists(PlacesPath))
|
||||||
|
return new List<Bookmark>();
|
||||||
|
|
||||||
|
var bookmarList = new List<Bookmark>();
|
||||||
|
|
||||||
|
// create the connection string and init the connection
|
||||||
|
string dbPath = string.Format(dbPathFormat, PlacesPath);
|
||||||
|
using (var dbConnection = new SQLiteConnection(dbPath))
|
||||||
|
{
|
||||||
|
// Open connection to the database file and execute the query
|
||||||
|
dbConnection.Open();
|
||||||
|
var reader = new SQLiteCommand(queryAllBookmarks, dbConnection).ExecuteReader();
|
||||||
|
|
||||||
|
// return results in List<Bookmark> format
|
||||||
|
bookmarList = reader.Select(x => new Bookmark()
|
||||||
|
{
|
||||||
|
Name = (x["title"] is DBNull) ? string.Empty : x["title"].ToString(),
|
||||||
|
Url = x["url"].ToString()
|
||||||
|
}).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
return bookmarList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Path to places.sqlite
|
||||||
|
/// </summary>
|
||||||
|
private string PlacesPath
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
var profileFolderPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @"Mozilla\Firefox");
|
||||||
|
var profileIni = Path.Combine(profileFolderPath, @"profiles.ini");
|
||||||
|
|
||||||
|
if (!File.Exists(profileIni))
|
||||||
|
return string.Empty;
|
||||||
|
|
||||||
|
// get firefox default profile directory from profiles.ini
|
||||||
|
string ini;
|
||||||
|
using (var sReader = new StreamReader(profileIni)) {
|
||||||
|
ini = sReader.ReadToEnd();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Current profiles.ini structure example as of Firefox version 69.0.1
|
||||||
|
|
||||||
|
[Install736426B0AF4A39CB]
|
||||||
|
Default=Profiles/7789f565.default-release <== this is the default profile this plugin will get the bookmarks from. When opened Firefox will load the default profile
|
||||||
|
Locked=1
|
||||||
|
|
||||||
|
[Profile2]
|
||||||
|
Name=newblahprofile
|
||||||
|
IsRelative=0
|
||||||
|
Path=C:\t6h2yuq8.newblahprofile <== Note this is a custom location path for the profile user can set, we need to cater for this in code.
|
||||||
|
|
||||||
|
[Profile1]
|
||||||
|
Name=default
|
||||||
|
IsRelative=1
|
||||||
|
Path=Profiles/cydum7q4.default
|
||||||
|
Default=1
|
||||||
|
|
||||||
|
[Profile0]
|
||||||
|
Name=default-release
|
||||||
|
IsRelative=1
|
||||||
|
Path=Profiles/7789f565.default-release
|
||||||
|
|
||||||
|
[General]
|
||||||
|
StartWithLastProfile=1
|
||||||
|
Version=2
|
||||||
|
*/
|
||||||
|
|
||||||
|
var lines = ini.Split(new string[] { "\r\n" }, StringSplitOptions.None).ToList();
|
||||||
|
|
||||||
|
var defaultProfileFolderNameRaw = lines.Where(x => x.Contains("Default=") && x != "Default=1").FirstOrDefault() ?? string.Empty;
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(defaultProfileFolderNameRaw))
|
||||||
|
return string.Empty;
|
||||||
|
|
||||||
|
var defaultProfileFolderName = defaultProfileFolderNameRaw.Split('=').Last();
|
||||||
|
|
||||||
|
var indexOfDefaultProfileAtttributePath = lines.IndexOf("Path="+ defaultProfileFolderName);
|
||||||
|
|
||||||
|
// Seen in the example above, the IsRelative attribute is always above the Path attribute
|
||||||
|
var relativeAttribute = lines[indexOfDefaultProfileAtttributePath - 1];
|
||||||
|
|
||||||
|
return relativeAttribute == "0" // See above, the profile is located in a custom location, path is not relative, so IsRelative=0
|
||||||
|
? defaultProfileFolderName + @"\places.sqlite"
|
||||||
|
: Path.Combine(profileFolderPath, defaultProfileFolderName) + @"\places.sqlite";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Extensions
|
||||||
|
{
|
||||||
|
public static IEnumerable<T> Select<T>(this SQLiteDataReader reader, Func<SQLiteDataReader, T> projection)
|
||||||
|
{
|
||||||
|
while (reader.Read())
|
||||||
|
{
|
||||||
|
yield return projection(reader);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
After Width: | Height: | Size: 4.4 KiB |
@@ -0,0 +1,9 @@
|
|||||||
|
<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">
|
||||||
|
|
||||||
|
<!--Plugin Info-->
|
||||||
|
<system:String x:Key="wox_plugin_browserbookmark_plugin_name">Browser Bookmarks</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_browserbookmark_plugin_description">Search your browser bookmarks</system:String>
|
||||||
|
|
||||||
|
</ResourceDictionary>
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
<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">
|
||||||
|
|
||||||
|
<!--Eklenti Bilgisi-->
|
||||||
|
<system:String x:Key="wox_plugin_browserbookmark_plugin_name">Yer İşaretleri</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_browserbookmark_plugin_description">Tarayıcılarınızdaki yer işaretlerini arayın.</system:String>
|
||||||
|
|
||||||
|
</ResourceDictionary>
|
||||||
@@ -0,0 +1,99 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using Wox.Infrastructure.Storage;
|
||||||
|
using Wox.Plugin.BrowserBookmark.Commands;
|
||||||
|
using Wox.Plugin.BrowserBookmark.Models;
|
||||||
|
using Wox.Plugin.BrowserBookmark.Views;
|
||||||
|
using Wox.Plugin.SharedCommands;
|
||||||
|
|
||||||
|
namespace Wox.Plugin.BrowserBookmark
|
||||||
|
{
|
||||||
|
public class Main : ISettingProvider, IPlugin, IReloadable, IPluginI18n, ISavable
|
||||||
|
{
|
||||||
|
private PluginInitContext context;
|
||||||
|
|
||||||
|
private List<Bookmark> cachedBookmarks = new List<Bookmark>();
|
||||||
|
|
||||||
|
private readonly Settings _settings;
|
||||||
|
private readonly PluginJsonStorage<Settings> _storage;
|
||||||
|
|
||||||
|
public Main()
|
||||||
|
{
|
||||||
|
_storage = new PluginJsonStorage<Settings>();
|
||||||
|
_settings = _storage.Load();
|
||||||
|
|
||||||
|
cachedBookmarks = Bookmarks.LoadAllBookmarks();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Init(PluginInitContext context)
|
||||||
|
{
|
||||||
|
this.context = context;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Result> Query(Query query)
|
||||||
|
{
|
||||||
|
string param = query.GetAllRemainingParameter().TrimStart();
|
||||||
|
|
||||||
|
// Should top results be returned? (true if no search parameters have been passed)
|
||||||
|
var topResults = string.IsNullOrEmpty(param);
|
||||||
|
|
||||||
|
var returnList = cachedBookmarks;
|
||||||
|
|
||||||
|
if (!topResults)
|
||||||
|
{
|
||||||
|
// Since we mixed chrome and firefox bookmarks, we should order them again
|
||||||
|
returnList = cachedBookmarks.Where(o => Bookmarks.MatchProgram(o, param)).ToList();
|
||||||
|
returnList = returnList.OrderByDescending(o => o.Score).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
return returnList.Select(c => new Result()
|
||||||
|
{
|
||||||
|
Title = c.Name,
|
||||||
|
SubTitle = c.Url,
|
||||||
|
IcoPath = @"Images\bookmark.png",
|
||||||
|
Score = 5,
|
||||||
|
Action = (e) =>
|
||||||
|
{
|
||||||
|
if (_settings.OpenInNewBrowserWindow)
|
||||||
|
{
|
||||||
|
c.Url.NewBrowserWindow(_settings.BrowserPath);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
c.Url.NewTabInBrowser(_settings.BrowserPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ReloadData()
|
||||||
|
{
|
||||||
|
cachedBookmarks.Clear();
|
||||||
|
|
||||||
|
cachedBookmarks = Bookmarks.LoadAllBookmarks();
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GetTranslatedPluginTitle()
|
||||||
|
{
|
||||||
|
return context.API.GetTranslation("wox_plugin_browserbookmark_plugin_name");
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GetTranslatedPluginDescription()
|
||||||
|
{
|
||||||
|
return context.API.GetTranslation("wox_plugin_browserbookmark_plugin_description");
|
||||||
|
}
|
||||||
|
|
||||||
|
public Control CreateSettingPanel()
|
||||||
|
{
|
||||||
|
return new SettingsControl(_settings);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Save()
|
||||||
|
{
|
||||||
|
_storage.Save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
namespace Wox.Plugin.BrowserBookmark.Models
|
||||||
|
{
|
||||||
|
public class Settings : BaseModel
|
||||||
|
{
|
||||||
|
public bool OpenInNewBrowserWindow { get; set; } = true;
|
||||||
|
|
||||||
|
public string BrowserPath { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("Wox.Plugin.BrowserBookmark")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("Oracle Corporation")]
|
||||||
|
[assembly: AssemblyProduct("Wox.Plugin.BrowserBookmark")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © Oracle Corporation 2014")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
|
[assembly: Guid("7dd2e33e-d029-4661-8f1d-594e82cef077")]
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
|
// by using the '*' as shown below:
|
||||||
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
<UserControl x:Class="Wox.Plugin.BrowserBookmark.Views.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"
|
||||||
|
Background="White"
|
||||||
|
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 bookmark in:" Margin="40 3 0 8"/>
|
||||||
|
<RadioButton Name="NewWindowBrowser" GroupName="OpenSearchBehaviour" Content="New window" Click="OnNewBrowserWindowClick" Margin="10" />
|
||||||
|
<RadioButton 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="Set browser from path:" 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="Choose" />
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
using Microsoft.Win32;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using Wox.Plugin.BrowserBookmark.Models;
|
||||||
|
|
||||||
|
namespace Wox.Plugin.BrowserBookmark.Views
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for BrowserBookmark.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class SettingsControl : UserControl
|
||||||
|
{
|
||||||
|
private readonly Settings _settings;
|
||||||
|
|
||||||
|
public SettingsControl(Settings settings)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_settings = settings;
|
||||||
|
browserPathBox.Text = _settings.BrowserPath;
|
||||||
|
NewWindowBrowser.IsChecked = _settings.OpenInNewBrowserWindow;
|
||||||
|
NewTabInBrowser.IsChecked = !_settings.OpenInNewBrowserWindow;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnNewBrowserWindowClick(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
_settings.OpenInNewBrowserWindow = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnNewTabClick(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
_settings.OpenInNewBrowserWindow = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnChooseClick(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
var fileBrowserDialog = new OpenFileDialog();
|
||||||
|
fileBrowserDialog.Filter = "Application(*.exe)|*.exe|All files|*.*";
|
||||||
|
fileBrowserDialog.CheckFileExists = true;
|
||||||
|
fileBrowserDialog.CheckPathExists = true;
|
||||||
|
if (fileBrowserDialog.ShowDialog() == true)
|
||||||
|
{
|
||||||
|
browserPathBox.Text = fileBrowserDialog.FileName;
|
||||||
|
_settings.BrowserPath = fileBrowserDialog.FileName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,126 @@
|
|||||||
|
<?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>{9B130CC5-14FB-41FF-B310-0A95B6894C37}</ProjectGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>Wox.Plugin.BrowserBookmark</RootNamespace>
|
||||||
|
<AssemblyName>Wox.Plugin.BrowserBookmark</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
|
||||||
|
<RestorePackages>true</RestorePackages>
|
||||||
|
<TargetFrameworkProfile />
|
||||||
|
<NuGetPackageImportStamp>
|
||||||
|
</NuGetPackageImportStamp>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>..\..\Output\Debug\Plugins\Wox.Plugin.BrowserBookmark\</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.BrowserBookmark\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<Prefer32Bit>false</Prefer32Bit>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="PresentationCore" />
|
||||||
|
<Reference Include="PresentationFramework" />
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Xaml" />
|
||||||
|
<Reference Include="WindowsBase" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Bookmark.cs" />
|
||||||
|
<Compile Include="ChromeBookmarks.cs" />
|
||||||
|
<Compile Include="Commands\Bookmarks.cs" />
|
||||||
|
<Compile Include="FirefoxBookmarks.cs" />
|
||||||
|
<Compile Include="Main.cs" />
|
||||||
|
<Compile Include="Models\Settings.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<Compile Include="Views\SettingsControl.xaml.cs">
|
||||||
|
<DependentUpon>SettingsControl.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="app.config" />
|
||||||
|
<None Include="plugin.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Include="Images\bookmark.png">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Include="Languages\en.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Include="x64\SQLite.Interop.dll">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Include="x86\SQLite.Interop.dll">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
</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>
|
||||||
|
<Content Include="Languages\tr.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Page Include="Views\SettingsControl.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="System.Data.SQLite">
|
||||||
|
<Version>1.0.111</Version>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="System.Data.SQLite.Core">
|
||||||
|
<Version>1.0.111</Version>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="UnidecodeSharp">
|
||||||
|
<Version>1.0.0</Version>
|
||||||
|
</PackageReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.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>
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<configuration>
|
||||||
|
<configSections>
|
||||||
|
|
||||||
|
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
|
||||||
|
</configSections>
|
||||||
|
<startup>
|
||||||
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
|
||||||
|
</startup>
|
||||||
|
<entityFramework>
|
||||||
|
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
|
||||||
|
<parameters>
|
||||||
|
<parameter value="mssqllocaldb" />
|
||||||
|
</parameters>
|
||||||
|
</defaultConnectionFactory>
|
||||||
|
<providers>
|
||||||
|
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
|
||||||
|
<provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
|
||||||
|
</providers>
|
||||||
|
</entityFramework>
|
||||||
|
|
||||||
|
</configuration>
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"ID":"0ECADE17459B49F587BF81DC3A125110",
|
||||||
|
"ActionKeyword":"b",
|
||||||
|
"Name":"Browser Bookmarks",
|
||||||
|
"Description":"Search your browser bookmarks",
|
||||||
|
"Author":"qianlifeng, Ioannis G.",
|
||||||
|
"Version":"1.1",
|
||||||
|
"Language":"csharp",
|
||||||
|
"Website":"http://www.getwox.com/plugin",
|
||||||
|
"ExecuteFileName":"Wox.Plugin.browserBookmark.dll",
|
||||||
|
"IcoPath":"Images\\bookmark.png"
|
||||||
|
}
|
||||||
|
After Width: | Height: | Size: 597 B |
@@ -0,0 +1,10 @@
|
|||||||
|
<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_caculator_plugin_name">Rechner</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_caculator_plugin_description">Stellt mathematische Berechnungen bereit.(Versuche 5*3-2 in Wox)</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_calculator_not_a_number">Keine Zahl (NaN)</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_calculator_expression_not_complete">Ausdruck falsch oder nicht vollständig (Klammern vergessen?)</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_calculator_copy_number_to_clipboard">Diese Zahl in die Zwischenablage kopieren</system:String>
|
||||||
|
</ResourceDictionary>
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<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_caculator_plugin_name">Calculator</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_caculator_plugin_description">Allows to do mathematical calculations.(Try 5*3-2 in Wox)</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_calculator_not_a_number">Not a number (NaN)</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_calculator_expression_not_complete">Expression wrong or incomplete (Did you forget some parentheses?)</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_calculator_copy_number_to_clipboard">Copy this number to the clipboard</system:String>
|
||||||
|
</ResourceDictionary>
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<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_caculator_plugin_name">Kalkulator</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_caculator_plugin_description">Szybkie wykonywanie obliczeń matematycznych. (Spróbuj wpisać 5*3-2 w oknie Woxa)</system:String>
|
||||||
|
|
||||||
|
</ResourceDictionary>
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<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_caculator_plugin_name">Hesap Makinesi</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_caculator_plugin_description">Matematiksel hesaplamalar yapmaya yarar. (5*3-2 yazmayı deneyin)</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_calculator_not_a_number">Sayı değil (NaN)</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_calculator_expression_not_complete">İfade hatalı ya da eksik. (Parantez koymayı mı unuttunuz?)</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_calculator_copy_number_to_clipboard">Bu sayıyı panoya kopyala</system:String>
|
||||||
|
</ResourceDictionary>
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<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_caculator_plugin_name">计算器</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_caculator_plugin_description">为Wox提供数学计算能力。(试着在Wox输入 5*3-2)</system:String>
|
||||||
|
|
||||||
|
</ResourceDictionary>
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<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_caculator_plugin_name">計算機</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_caculator_plugin_description">為 Wox 提供數學計算功能。(試著在 Wox 輸入 5*3-2)</system:String>
|
||||||
|
|
||||||
|
</ResourceDictionary>
|
||||||
115
src/modules/launcher/Plugins/Wox.Plugin.Calculator/Main.cs
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Windows;
|
||||||
|
using Mages.Core;
|
||||||
|
|
||||||
|
namespace Wox.Plugin.Caculator
|
||||||
|
{
|
||||||
|
public class Main : IPlugin, IPluginI18n
|
||||||
|
{
|
||||||
|
private static readonly Regex RegValidExpressChar = new Regex(
|
||||||
|
@"^(" +
|
||||||
|
@"ceil|floor|exp|pi|e|max|min|det|abs|log|ln|sqrt|" +
|
||||||
|
@"sin|cos|tan|arcsin|arccos|arctan|" +
|
||||||
|
@"eigval|eigvec|eig|sum|polar|plot|round|sort|real|zeta|" +
|
||||||
|
@"bin2dec|hex2dec|oct2dec|" +
|
||||||
|
@"==|~=|&&|\|\||" +
|
||||||
|
@"[ei]|[0-9]|[\+\-\*\/\^\., ""]|[\(\)\|\!\[\]]" +
|
||||||
|
@")+$", RegexOptions.Compiled);
|
||||||
|
private static readonly Regex RegBrackets = new Regex(@"[\(\)\[\]]", RegexOptions.Compiled);
|
||||||
|
private static readonly Engine MagesEngine;
|
||||||
|
private PluginInitContext Context { get; set; }
|
||||||
|
|
||||||
|
static Main()
|
||||||
|
{
|
||||||
|
MagesEngine = new Engine();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Result> Query(Query query)
|
||||||
|
{
|
||||||
|
if (query.Search.Length <= 2 // don't affect when user only input "e" or "i" keyword
|
||||||
|
|| !RegValidExpressChar.IsMatch(query.Search)
|
||||||
|
|| !IsBracketComplete(query.Search)) return new List<Result>();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = MagesEngine.Interpret(query.Search);
|
||||||
|
|
||||||
|
if (result.ToString() == "NaN")
|
||||||
|
result = Context.API.GetTranslation("wox_plugin_calculator_not_a_number");
|
||||||
|
|
||||||
|
if (result is Function)
|
||||||
|
result = Context.API.GetTranslation("wox_plugin_calculator_expression_not_complete");
|
||||||
|
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(result?.ToString()))
|
||||||
|
{
|
||||||
|
return new List<Result>
|
||||||
|
{
|
||||||
|
new Result
|
||||||
|
{
|
||||||
|
Title = result.ToString(),
|
||||||
|
IcoPath = "Images/calculator.png",
|
||||||
|
Score = 300,
|
||||||
|
SubTitle = Context.API.GetTranslation("wox_plugin_calculator_copy_number_to_clipboard"),
|
||||||
|
Action = c =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Clipboard.SetText(result.ToString());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (ExternalException)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Copy failed, please try later");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
// ignored
|
||||||
|
}
|
||||||
|
|
||||||
|
return new List<Result>();
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool IsBracketComplete(string query)
|
||||||
|
{
|
||||||
|
var matchs = RegBrackets.Matches(query);
|
||||||
|
var leftBracketCount = 0;
|
||||||
|
foreach (Match match in matchs)
|
||||||
|
{
|
||||||
|
if (match.Value == "(" || match.Value == "[")
|
||||||
|
{
|
||||||
|
leftBracketCount++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
leftBracketCount--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return leftBracketCount == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Init(PluginInitContext context)
|
||||||
|
{
|
||||||
|
Context = context;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GetTranslatedPluginTitle()
|
||||||
|
{
|
||||||
|
return Context.API.GetTranslation("wox_plugin_caculator_plugin_name");
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GetTranslatedPluginDescription()
|
||||||
|
{
|
||||||
|
return Context.API.GetTranslation("wox_plugin_caculator_plugin_description");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,95 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Wox.Plugin.Caculator
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Tries to convert all numbers in a text from one culture format to another.
|
||||||
|
/// </summary>
|
||||||
|
public class NumberTranslator
|
||||||
|
{
|
||||||
|
private readonly CultureInfo sourceCulture;
|
||||||
|
private readonly CultureInfo targetCulture;
|
||||||
|
private readonly Regex splitRegexForSource;
|
||||||
|
private readonly Regex splitRegexForTarget;
|
||||||
|
|
||||||
|
private NumberTranslator(CultureInfo sourceCulture, CultureInfo targetCulture)
|
||||||
|
{
|
||||||
|
this.sourceCulture = sourceCulture;
|
||||||
|
this.targetCulture = targetCulture;
|
||||||
|
|
||||||
|
this.splitRegexForSource = GetSplitRegex(this.sourceCulture);
|
||||||
|
this.splitRegexForTarget = GetSplitRegex(this.targetCulture);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create a new <see cref="NumberTranslator"/> - returns null if no number conversion
|
||||||
|
/// is required between the cultures.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sourceCulture">source culture</param>
|
||||||
|
/// <param name="targetCulture">target culture</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static NumberTranslator Create(CultureInfo sourceCulture, CultureInfo targetCulture)
|
||||||
|
{
|
||||||
|
bool conversionRequired = sourceCulture.NumberFormat.NumberDecimalSeparator != targetCulture.NumberFormat.NumberDecimalSeparator
|
||||||
|
|| sourceCulture.NumberFormat.PercentGroupSeparator != targetCulture.NumberFormat.PercentGroupSeparator
|
||||||
|
|| sourceCulture.NumberFormat.NumberGroupSizes != targetCulture.NumberFormat.NumberGroupSizes;
|
||||||
|
return conversionRequired
|
||||||
|
? new NumberTranslator(sourceCulture, targetCulture)
|
||||||
|
: null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Translate from source to target culture.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="input"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string Translate(string input)
|
||||||
|
{
|
||||||
|
return this.Translate(input, this.sourceCulture, this.targetCulture, this.splitRegexForSource);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Translate from target to source culture.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="input"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string TranslateBack(string input)
|
||||||
|
{
|
||||||
|
return this.Translate(input, this.targetCulture, this.sourceCulture, this.splitRegexForTarget);
|
||||||
|
}
|
||||||
|
|
||||||
|
private string Translate(string input, CultureInfo cultureFrom, CultureInfo cultureTo, Regex splitRegex)
|
||||||
|
{
|
||||||
|
var outputBuilder = new StringBuilder();
|
||||||
|
|
||||||
|
string[] tokens = splitRegex.Split(input);
|
||||||
|
foreach (string token in tokens)
|
||||||
|
{
|
||||||
|
decimal number;
|
||||||
|
outputBuilder.Append(
|
||||||
|
decimal.TryParse(token, NumberStyles.Number, cultureFrom, out number)
|
||||||
|
? number.ToString(cultureTo)
|
||||||
|
: token);
|
||||||
|
}
|
||||||
|
|
||||||
|
return outputBuilder.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private Regex GetSplitRegex(CultureInfo culture)
|
||||||
|
{
|
||||||
|
var splitPattern = $"((?:\\d|{Regex.Escape(culture.NumberFormat.NumberDecimalSeparator)}";
|
||||||
|
if (!string.IsNullOrEmpty(culture.NumberFormat.NumberGroupSeparator))
|
||||||
|
{
|
||||||
|
splitPattern += $"|{Regex.Escape(culture.NumberFormat.NumberGroupSeparator)}";
|
||||||
|
}
|
||||||
|
splitPattern += ")+)";
|
||||||
|
return new Regex(splitPattern);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
[assembly: AssemblyTitle("Wox.Plugin.Caculator")]
|
||||||
|
[assembly: Guid("ba698b90-59ed-4c2e-bce1-497eb2f9e76f")]
|
||||||
@@ -0,0 +1,143 @@
|
|||||||
|
<?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>{59BD9891-3837-438A-958D-ADC7F91F6F7E}</ProjectGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>Wox.Plugin.Caculator</RootNamespace>
|
||||||
|
<AssemblyName>Wox.Plugin.Caculator</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
|
||||||
|
<TargetFrameworkProfile />
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>..\..\Output\Debug\Plugins\Wox.Plugin.Caculator\</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.Caculator\</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="Mages.Core, Version=1.5.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\..\packages\Mages.1.5.0\lib\net35\Mages.Core.dll</HintPath>
|
||||||
|
<Private>True</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="PresentationCore" />
|
||||||
|
<Reference Include="PresentationFramework" />
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="..\..\SolutionAssemblyInfo.cs">
|
||||||
|
<Link>Properties\SolutionAssemblyInfo.cs</Link>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="NumberTranslator.cs" />
|
||||||
|
<Compile Include="Main.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
</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\calculator.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>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="JetBrains.Annotations">
|
||||||
|
<Version>10.3.0</Version>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="Mages">
|
||||||
|
<Version>1.5.0</Version>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="System.Runtime">
|
||||||
|
<Version>4.0.0</Version>
|
||||||
|
</PackageReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<PostBuildEvent>
|
||||||
|
</PostBuildEvent>
|
||||||
|
</PropertyGroup>
|
||||||
|
<!-- 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>
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"ID":"CEA0FDFC6D3B4085823D60DC76F28855",
|
||||||
|
"ActionKeyword":"*",
|
||||||
|
"Name":"Calculator",
|
||||||
|
"Description":"Provide mathematical calculations.(Try 5*3-2 in Wox)",
|
||||||
|
"Author":"cxfksword",
|
||||||
|
"Version":"1.0.0",
|
||||||
|
"Language":"csharp",
|
||||||
|
"Website":"http://www.wox.one/plugin",
|
||||||
|
"ExecuteFileName":"Wox.Plugin.Caculator.dll",
|
||||||
|
"IcoPath":"Images\\calculator.png"
|
||||||
|
}
|
||||||
BIN
src/modules/launcher/Plugins/Wox.Plugin.Color/Images/color.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
@@ -0,0 +1,8 @@
|
|||||||
|
<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_color_plugin_name">Farben</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_color_plugin_description">Stellt eine HEX-Farben Vorschau bereit. (Versuche #000 in Wox)</system:String>
|
||||||
|
|
||||||
|
</ResourceDictionary>
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<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_color_plugin_name">Colors</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_color_plugin_description">Allows to preview colors using hex values.(Try #000 in Wox)</system:String>
|
||||||
|
|
||||||
|
</ResourceDictionary>
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<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_color_plugin_name">Kolory</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_color_plugin_description">Podgląd kolorów po wpisaniu ich kodu szesnastkowego. (Spróbuj wpisać #000 w oknie Woxa)</system:String>
|
||||||
|
|
||||||
|
</ResourceDictionary>
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<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_color_plugin_name">Renkler</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_color_plugin_description">Hex kodunu girdiğiniz renkleri görüntülemeye yarar.(#000 yazmayı deneyin)</system:String>
|
||||||
|
|
||||||
|
</ResourceDictionary>
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<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_color_plugin_name">颜色</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_color_plugin_description">提供在Wox查询hex颜色。(尝试在Wox中输入#000)</system:String>
|
||||||
|
|
||||||
|
</ResourceDictionary>
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
<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_color_plugin_name">顏色</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_color_plugin_description">提供在 Wox 查詢 hex 顏色。(試著在 Wox 中輸入 #000)</system:String>
|
||||||
|
</ResourceDictionary>
|
||||||
121
src/modules/launcher/Plugins/Wox.Plugin.Color/Main.cs
Normal file
@@ -0,0 +1,121 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Drawing.Imaging;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
namespace Wox.Plugin.Color
|
||||||
|
{
|
||||||
|
public sealed class ColorsPlugin : IPlugin, IPluginI18n
|
||||||
|
{
|
||||||
|
private string DIR_PATH = Path.Combine(Path.GetTempPath(), @"Plugins\Colors\");
|
||||||
|
private PluginInitContext context;
|
||||||
|
private const int IMG_SIZE = 32;
|
||||||
|
|
||||||
|
private DirectoryInfo ColorsDirectory { get; set; }
|
||||||
|
|
||||||
|
public ColorsPlugin()
|
||||||
|
{
|
||||||
|
if (!Directory.Exists(DIR_PATH))
|
||||||
|
{
|
||||||
|
ColorsDirectory = Directory.CreateDirectory(DIR_PATH);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ColorsDirectory = new DirectoryInfo(DIR_PATH);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Result> Query(Query query)
|
||||||
|
{
|
||||||
|
var raw = query.Search;
|
||||||
|
if (!IsAvailable(raw)) return new List<Result>(0);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var cached = Find(raw);
|
||||||
|
if (cached.Length == 0)
|
||||||
|
{
|
||||||
|
var path = CreateImage(raw);
|
||||||
|
return new List<Result>
|
||||||
|
{
|
||||||
|
new Result
|
||||||
|
{
|
||||||
|
Title = raw,
|
||||||
|
IcoPath = path,
|
||||||
|
Action = _ =>
|
||||||
|
{
|
||||||
|
Clipboard.SetText(raw);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return cached.Select(x => new Result
|
||||||
|
{
|
||||||
|
Title = raw,
|
||||||
|
IcoPath = x.FullName,
|
||||||
|
Action = _ =>
|
||||||
|
{
|
||||||
|
Clipboard.SetText(raw);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}).ToList();
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
// todo: log
|
||||||
|
return new List<Result>(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool IsAvailable(string query)
|
||||||
|
{
|
||||||
|
// todo: rgb, names
|
||||||
|
var length = query.Length - 1; // minus `#` sign
|
||||||
|
return query.StartsWith("#") && (length == 3 || length == 6);
|
||||||
|
}
|
||||||
|
|
||||||
|
public FileInfo[] Find(string name)
|
||||||
|
{
|
||||||
|
var file = string.Format("{0}.png", name.Substring(1));
|
||||||
|
return ColorsDirectory.GetFiles(file, SearchOption.TopDirectoryOnly);
|
||||||
|
}
|
||||||
|
|
||||||
|
private string CreateImage(string name)
|
||||||
|
{
|
||||||
|
using (var bitmap = new Bitmap(IMG_SIZE, IMG_SIZE))
|
||||||
|
using (var graphics = Graphics.FromImage(bitmap))
|
||||||
|
{
|
||||||
|
var color = ColorTranslator.FromHtml(name);
|
||||||
|
graphics.Clear(color);
|
||||||
|
|
||||||
|
var path = CreateFileName(name);
|
||||||
|
bitmap.Save(path, ImageFormat.Png);
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private string CreateFileName(string name)
|
||||||
|
{
|
||||||
|
return string.Format("{0}{1}.png", ColorsDirectory.FullName, name.Substring(1));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Init(PluginInitContext context)
|
||||||
|
{
|
||||||
|
this.context = context;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public string GetTranslatedPluginTitle()
|
||||||
|
{
|
||||||
|
return context.API.GetTranslation("wox_plugin_color_plugin_name");
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GetTranslatedPluginDescription()
|
||||||
|
{
|
||||||
|
return context.API.GetTranslation("wox_plugin_color_plugin_description");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
[assembly: AssemblyTitle("Wox.Plugin.Color")]
|
||||||
|
[assembly: Guid("46b03f84-5bf7-4ed4-a69b-f0274c8b3776")]
|
||||||
@@ -0,0 +1,130 @@
|
|||||||
|
<?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>{F35190AA-4758-4D9E-A193-E3BDF6AD3567}</ProjectGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>Wox.Plugin.Color</RootNamespace>
|
||||||
|
<AssemblyName>Wox.Plugin.Color</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.Color\</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.Color\</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.Core" />
|
||||||
|
<Reference Include="System.Drawing" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="..\..\SolutionAssemblyInfo.cs">
|
||||||
|
<Link>Properties\SolutionAssemblyInfo.cs</Link>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Main.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="Images\color.png">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
</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>
|
||||||
|
<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>
|
||||||
|
</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>
|
||||||
12
src/modules/launcher/Plugins/Wox.Plugin.Color/plugin.json
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"ID":"9B36CE6181FC47FBB597AA2C29CD9B0A",
|
||||||
|
"ActionKeyword":"*",
|
||||||
|
"Name":"Colors",
|
||||||
|
"Description":"Provide hex color preview.(Try #000 in Wox)",
|
||||||
|
"Author":"qianlifeng",
|
||||||
|
"Version":"1.0.0",
|
||||||
|
"Language":"csharp",
|
||||||
|
"Website":"http://www.wox.one/plugin",
|
||||||
|
"ExecuteFileName":"Wox.Plugin.Color.dll",
|
||||||
|
"IcoPath":"Images\\color.png"
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
using System.Diagnostics;
|
||||||
|
using System.Drawing;
|
||||||
|
|
||||||
|
namespace Wox.Plugin.ControlPanel
|
||||||
|
{
|
||||||
|
//from:https://raw.githubusercontent.com/CoenraadS/Windows-Control-Panel-Items
|
||||||
|
public class ControlPanelItem
|
||||||
|
{
|
||||||
|
public string LocalizedString { get; private set; }
|
||||||
|
public string InfoTip { get; private set; }
|
||||||
|
public string GUID { get; private set; }
|
||||||
|
public ProcessStartInfo ExecutablePath { get; private set; }
|
||||||
|
public Icon Icon { get; private set; }
|
||||||
|
public int Score { get; set; }
|
||||||
|
|
||||||
|
public ControlPanelItem(string newLocalizedString, string newInfoTip, string newGUID, ProcessStartInfo newExecutablePath, Icon newIcon)
|
||||||
|
{
|
||||||
|
LocalizedString = newLocalizedString;
|
||||||
|
InfoTip = newInfoTip;
|
||||||
|
ExecutablePath = newExecutablePath;
|
||||||
|
Icon = newIcon;
|
||||||
|
GUID = newGUID;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,339 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Text;
|
||||||
|
using Microsoft.Win32;
|
||||||
|
|
||||||
|
namespace Wox.Plugin.ControlPanel
|
||||||
|
{
|
||||||
|
//from:https://raw.githubusercontent.com/CoenraadS/Windows-Control-Panel-Items
|
||||||
|
public static class ControlPanelList
|
||||||
|
{
|
||||||
|
private const uint GROUP_ICON = 14;
|
||||||
|
private const uint LOAD_LIBRARY_AS_DATAFILE = 0x00000002;
|
||||||
|
private const string CONTROL = @"%SystemRoot%\System32\control.exe";
|
||||||
|
|
||||||
|
private delegate bool EnumResNameDelegate(
|
||||||
|
IntPtr hModule,
|
||||||
|
IntPtr lpszType,
|
||||||
|
IntPtr lpszName,
|
||||||
|
IntPtr lParam);
|
||||||
|
|
||||||
|
[DllImport("kernel32.dll", EntryPoint = "EnumResourceNamesW", CharSet = CharSet.Unicode, SetLastError = true)]
|
||||||
|
static extern bool EnumResourceNamesWithID(IntPtr hModule, uint lpszType, EnumResNameDelegate lpEnumFunc, IntPtr lParam);
|
||||||
|
|
||||||
|
[DllImport("kernel32.dll", SetLastError = true)]
|
||||||
|
static extern IntPtr LoadLibraryEx(string lpFileName, IntPtr hFile, uint dwFlags);
|
||||||
|
|
||||||
|
[DllImport("kernel32.dll", SetLastError = true)]
|
||||||
|
static extern bool FreeLibrary(IntPtr hModule);
|
||||||
|
|
||||||
|
[DllImport("user32.dll", CharSet = CharSet.Auto)]
|
||||||
|
static extern int LoadString(IntPtr hInstance, uint uID, StringBuilder lpBuffer, int nBufferMax);
|
||||||
|
|
||||||
|
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
|
||||||
|
static extern IntPtr LoadImage(IntPtr hinst, IntPtr lpszName, uint uType,
|
||||||
|
int cxDesired, int cyDesired, uint fuLoad);
|
||||||
|
|
||||||
|
[DllImport("user32.dll", CharSet = CharSet.Auto)]
|
||||||
|
extern static bool DestroyIcon(IntPtr handle);
|
||||||
|
|
||||||
|
[DllImport("kernel32.dll")]
|
||||||
|
static extern IntPtr FindResource(IntPtr hModule, IntPtr lpName, IntPtr lpType);
|
||||||
|
|
||||||
|
static IntPtr defaultIconPtr;
|
||||||
|
|
||||||
|
|
||||||
|
static RegistryKey nameSpace = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ControlPanel\\NameSpace");
|
||||||
|
static RegistryKey clsid = Registry.ClassesRoot.OpenSubKey("CLSID");
|
||||||
|
|
||||||
|
public static List<ControlPanelItem> Create(uint iconSize)
|
||||||
|
{
|
||||||
|
int size = (int)iconSize;
|
||||||
|
RegistryKey currentKey;
|
||||||
|
ProcessStartInfo executablePath;
|
||||||
|
List<ControlPanelItem> controlPanelItems = new List<ControlPanelItem>();
|
||||||
|
string localizedString;
|
||||||
|
string infoTip;
|
||||||
|
Icon myIcon;
|
||||||
|
|
||||||
|
foreach (string key in nameSpace.GetSubKeyNames())
|
||||||
|
{
|
||||||
|
currentKey = clsid.OpenSubKey(key);
|
||||||
|
if (currentKey != null)
|
||||||
|
{
|
||||||
|
executablePath = getExecutablePath(currentKey);
|
||||||
|
|
||||||
|
if (!(executablePath == null)) //Cannot have item without executable path
|
||||||
|
{
|
||||||
|
localizedString = getLocalizedString(currentKey);
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(localizedString))//Cannot have item without Title
|
||||||
|
{
|
||||||
|
infoTip = getInfoTip(currentKey);
|
||||||
|
|
||||||
|
myIcon = getIcon(currentKey, size);
|
||||||
|
|
||||||
|
controlPanelItems.Add(new ControlPanelItem(localizedString, infoTip, key, executablePath, myIcon));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return controlPanelItems;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static ProcessStartInfo getExecutablePath(RegistryKey currentKey)
|
||||||
|
{
|
||||||
|
ProcessStartInfo executablePath = new ProcessStartInfo();
|
||||||
|
string applicationName;
|
||||||
|
|
||||||
|
if (currentKey.GetValue("System.ApplicationName") != null)
|
||||||
|
{
|
||||||
|
//CPL Files (usually native MS items)
|
||||||
|
applicationName = currentKey.GetValue("System.ApplicationName").ToString();
|
||||||
|
executablePath.FileName = Environment.ExpandEnvironmentVariables(CONTROL);
|
||||||
|
executablePath.Arguments = "-name " + applicationName;
|
||||||
|
}
|
||||||
|
else if (currentKey.OpenSubKey("Shell\\Open\\Command") != null && currentKey.OpenSubKey("Shell\\Open\\Command").GetValue(null) != null)
|
||||||
|
{
|
||||||
|
//Other files (usually third party items)
|
||||||
|
string input = "\"" + Environment.ExpandEnvironmentVariables(currentKey.OpenSubKey("Shell\\Open\\Command").GetValue(null).ToString()) + "\"";
|
||||||
|
executablePath.FileName = "cmd.exe";
|
||||||
|
executablePath.Arguments = "/C " + input;
|
||||||
|
executablePath.WindowStyle = ProcessWindowStyle.Hidden;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return executablePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string getLocalizedString(RegistryKey currentKey)
|
||||||
|
{
|
||||||
|
IntPtr dataFilePointer;
|
||||||
|
string[] localizedStringRaw;
|
||||||
|
uint stringTableIndex;
|
||||||
|
StringBuilder resource;
|
||||||
|
string localizedString;
|
||||||
|
|
||||||
|
if (currentKey.GetValue("LocalizedString") != null)
|
||||||
|
{
|
||||||
|
localizedStringRaw = currentKey.GetValue("LocalizedString").ToString().Split(new[] { ",-" }, StringSplitOptions.None);
|
||||||
|
|
||||||
|
if (localizedStringRaw.Length > 1)
|
||||||
|
{
|
||||||
|
if (localizedStringRaw[0][0] == '@')
|
||||||
|
{
|
||||||
|
localizedStringRaw[0] = localizedStringRaw[0].Substring(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
localizedStringRaw[0] = Environment.ExpandEnvironmentVariables(localizedStringRaw[0]);
|
||||||
|
|
||||||
|
dataFilePointer = LoadLibraryEx(localizedStringRaw[0], IntPtr.Zero, LOAD_LIBRARY_AS_DATAFILE); //Load file with strings
|
||||||
|
|
||||||
|
stringTableIndex = sanitizeUint(localizedStringRaw[1]);
|
||||||
|
|
||||||
|
resource = new StringBuilder(255);
|
||||||
|
LoadString(dataFilePointer, stringTableIndex, resource, resource.Capacity + 1); //Extract needed string
|
||||||
|
FreeLibrary(dataFilePointer);
|
||||||
|
|
||||||
|
localizedString = resource.ToString();
|
||||||
|
|
||||||
|
//Some apps don't return a string, although they do have a stringIndex. Use Default value.
|
||||||
|
|
||||||
|
if (String.IsNullOrEmpty(localizedString))
|
||||||
|
{
|
||||||
|
if (currentKey.GetValue(null) != null)
|
||||||
|
{
|
||||||
|
localizedString = currentKey.GetValue(null).ToString();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return null; //Cannot have item without title.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
localizedString = localizedStringRaw[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (currentKey.GetValue(null) != null)
|
||||||
|
{
|
||||||
|
localizedString = currentKey.GetValue(null).ToString();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return null; //Cannot have item without title.
|
||||||
|
}
|
||||||
|
return localizedString;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string getInfoTip(RegistryKey currentKey)
|
||||||
|
{
|
||||||
|
IntPtr dataFilePointer;
|
||||||
|
string[] infoTipRaw;
|
||||||
|
uint stringTableIndex;
|
||||||
|
StringBuilder resource;
|
||||||
|
string infoTip = "";
|
||||||
|
|
||||||
|
if (currentKey.GetValue("InfoTip") != null)
|
||||||
|
{
|
||||||
|
infoTipRaw = currentKey.GetValue("InfoTip").ToString().Split(new[] { ",-" }, StringSplitOptions.None);
|
||||||
|
|
||||||
|
if (infoTipRaw.Length == 2)
|
||||||
|
{
|
||||||
|
if (infoTipRaw[0][0] == '@')
|
||||||
|
{
|
||||||
|
infoTipRaw[0] = infoTipRaw[0].Substring(1);
|
||||||
|
}
|
||||||
|
infoTipRaw[0] = Environment.ExpandEnvironmentVariables(infoTipRaw[0]);
|
||||||
|
|
||||||
|
dataFilePointer = LoadLibraryEx(infoTipRaw[0], IntPtr.Zero, LOAD_LIBRARY_AS_DATAFILE); //Load file with strings
|
||||||
|
|
||||||
|
stringTableIndex = sanitizeUint(infoTipRaw[1]);
|
||||||
|
|
||||||
|
resource = new StringBuilder(255);
|
||||||
|
LoadString(dataFilePointer, stringTableIndex, resource, resource.Capacity + 1); //Extract needed string
|
||||||
|
FreeLibrary(dataFilePointer);
|
||||||
|
|
||||||
|
infoTip = resource.ToString();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
infoTip = currentKey.GetValue("InfoTip").ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
infoTip = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
return infoTip;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Icon getIcon(RegistryKey currentKey, int iconSize)
|
||||||
|
{
|
||||||
|
IntPtr iconPtr = IntPtr.Zero;
|
||||||
|
List<string> iconString;
|
||||||
|
IntPtr dataFilePointer;
|
||||||
|
IntPtr iconIndex;
|
||||||
|
Icon myIcon = null;
|
||||||
|
|
||||||
|
if (currentKey.OpenSubKey("DefaultIcon") != null)
|
||||||
|
{
|
||||||
|
if (currentKey.OpenSubKey("DefaultIcon").GetValue(null) != null)
|
||||||
|
{
|
||||||
|
iconString = new List<string>(currentKey.OpenSubKey("DefaultIcon").GetValue(null).ToString().Split(new[] { ',' }, 2));
|
||||||
|
if (string.IsNullOrEmpty(iconString[0]))
|
||||||
|
{
|
||||||
|
// fallback to default icon
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (iconString[0][0] == '@')
|
||||||
|
{
|
||||||
|
iconString[0] = iconString[0].Substring(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
dataFilePointer = LoadLibraryEx(iconString[0], IntPtr.Zero, LOAD_LIBRARY_AS_DATAFILE);
|
||||||
|
|
||||||
|
if (iconString.Count == 2)
|
||||||
|
{
|
||||||
|
iconIndex = (IntPtr)sanitizeUint(iconString[1]);
|
||||||
|
|
||||||
|
iconPtr = LoadImage(dataFilePointer, iconIndex, 1, iconSize, iconSize, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (iconPtr == IntPtr.Zero)
|
||||||
|
{
|
||||||
|
defaultIconPtr = IntPtr.Zero;
|
||||||
|
EnumResourceNamesWithID(dataFilePointer, GROUP_ICON, EnumRes, IntPtr.Zero); //Iterate through resources.
|
||||||
|
|
||||||
|
iconPtr = LoadImage(dataFilePointer, defaultIconPtr, 1, iconSize, iconSize, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
FreeLibrary(dataFilePointer);
|
||||||
|
|
||||||
|
if (iconPtr != IntPtr.Zero)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
myIcon = Icon.FromHandle(iconPtr);
|
||||||
|
myIcon = (Icon)myIcon.Clone(); //Remove pointer dependancy.
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
//Silently fail for now.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (iconPtr != IntPtr.Zero)
|
||||||
|
{
|
||||||
|
DestroyIcon(iconPtr);
|
||||||
|
}
|
||||||
|
return myIcon;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static uint sanitizeUint(string args) //Remove all chars before and after first set of digits.
|
||||||
|
{
|
||||||
|
int x = 0;
|
||||||
|
|
||||||
|
while (x < args.Length && !Char.IsDigit(args[x]))
|
||||||
|
{
|
||||||
|
args = args.Substring(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
x = 0;
|
||||||
|
|
||||||
|
while (x < args.Length && Char.IsDigit(args[x]))
|
||||||
|
{
|
||||||
|
x++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (x < args.Length)
|
||||||
|
{
|
||||||
|
args = args.Remove(x);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*If the logic is correct, this should never through an exception.
|
||||||
|
* If there is an exception, then need to analyze what the input is.
|
||||||
|
* Returning the wrong number will cause more errors */
|
||||||
|
return Convert.ToUInt32(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool IS_INTRESOURCE(IntPtr value)
|
||||||
|
{
|
||||||
|
if (((uint)value) > ushort.MaxValue)
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static uint GET_RESOURCE_ID(IntPtr value)
|
||||||
|
{
|
||||||
|
if (IS_INTRESOURCE(value))
|
||||||
|
return (uint)value;
|
||||||
|
throw new NotSupportedException("value is not an ID!");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string GET_RESOURCE_NAME(IntPtr value)
|
||||||
|
{
|
||||||
|
if (IS_INTRESOURCE(value))
|
||||||
|
return value.ToString();
|
||||||
|
return Marshal.PtrToStringUni(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool EnumRes(IntPtr hModule, IntPtr lpszType, IntPtr lpszName, IntPtr lParam)
|
||||||
|
{
|
||||||
|
defaultIconPtr = lpszName;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
After Width: | Height: | Size: 1.3 KiB |
@@ -0,0 +1,8 @@
|
|||||||
|
<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_controlpanel_plugin_name">Systemsteuerung</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_controlpanel_plugin_description">Suche in der Systemsteuerung</system:String>
|
||||||
|
|
||||||
|
</ResourceDictionary>
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<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_controlpanel_plugin_name">Control Panel</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_controlpanel_plugin_description">Search within the Control Panel</system:String>
|
||||||
|
|
||||||
|
</ResourceDictionary>
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<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_controlpanel_plugin_name">Panel sterowania</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_controlpanel_plugin_description">Szybie wyszukiwanie ustawień w panelu sterowania</system:String>
|
||||||
|
|
||||||
|
</ResourceDictionary>
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<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_controlpanel_plugin_name">Denetim Masası</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_controlpanel_plugin_description">Denetim Masası'nda arama yapın.</system:String>
|
||||||
|
|
||||||
|
</ResourceDictionary>
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<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_controlpanel_plugin_name">控制面板</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_controlpanel_plugin_description">搜索控制面板</system:String>
|
||||||
|
|
||||||
|
</ResourceDictionary>
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<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_controlpanel_plugin_name">控制台</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_controlpanel_plugin_description">搜尋控制台</system:String>
|
||||||
|
|
||||||
|
</ResourceDictionary>
|
||||||
99
src/modules/launcher/Plugins/Wox.Plugin.ControlPanel/Main.cs
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Wox.Infrastructure;
|
||||||
|
|
||||||
|
namespace Wox.Plugin.ControlPanel
|
||||||
|
{
|
||||||
|
public class Main : IPlugin, IPluginI18n
|
||||||
|
{
|
||||||
|
private PluginInitContext context;
|
||||||
|
private List<ControlPanelItem> controlPanelItems = new List<ControlPanelItem>();
|
||||||
|
private string iconFolder;
|
||||||
|
private string fileType;
|
||||||
|
|
||||||
|
public void Init(PluginInitContext context)
|
||||||
|
{
|
||||||
|
this.context = context;
|
||||||
|
controlPanelItems = ControlPanelList.Create(48);
|
||||||
|
iconFolder = Path.Combine(context.CurrentPluginMetadata.PluginDirectory, @"Images\ControlPanelIcons\");
|
||||||
|
fileType = ".bmp";
|
||||||
|
|
||||||
|
if (!Directory.Exists(iconFolder))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(iconFolder);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (ControlPanelItem item in controlPanelItems)
|
||||||
|
{
|
||||||
|
if (!File.Exists(iconFolder + item.GUID + fileType) && item.Icon != null)
|
||||||
|
{
|
||||||
|
item.Icon.ToBitmap().Save(iconFolder + item.GUID + fileType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Result> Query(Query query)
|
||||||
|
{
|
||||||
|
List<Result> results = new List<Result>();
|
||||||
|
|
||||||
|
foreach (var item in controlPanelItems)
|
||||||
|
{
|
||||||
|
var titleMatch = StringMatcher.FuzzySearch(query.Search, item.LocalizedString);
|
||||||
|
var subTitleMatch = StringMatcher.FuzzySearch(query.Search, item.InfoTip);
|
||||||
|
|
||||||
|
item.Score = Math.Max(titleMatch.Score, subTitleMatch.Score);
|
||||||
|
if (item.Score > 0)
|
||||||
|
{
|
||||||
|
var result = new Result
|
||||||
|
{
|
||||||
|
Title = item.LocalizedString,
|
||||||
|
SubTitle = item.InfoTip,
|
||||||
|
Score = item.Score,
|
||||||
|
IcoPath = Path.Combine(context.CurrentPluginMetadata.PluginDirectory,
|
||||||
|
@"Images\\ControlPanelIcons\\" + item.GUID + fileType),
|
||||||
|
Action = e =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Process.Start(item.ExecutablePath);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
//Silently Fail for now.. todo
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (item.Score == titleMatch.Score)
|
||||||
|
{
|
||||||
|
result.TitleHighlightData = titleMatch.MatchData;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result.SubTitleHighlightData = subTitleMatch.MatchData;
|
||||||
|
}
|
||||||
|
|
||||||
|
results.Add(result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Result> panelItems = results.OrderByDescending(o => o.Score).Take(5).ToList();
|
||||||
|
return panelItems;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GetTranslatedPluginTitle()
|
||||||
|
{
|
||||||
|
return context.API.GetTranslation("wox_plugin_controlpanel_plugin_name");
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GetTranslatedPluginDescription()
|
||||||
|
{
|
||||||
|
return context.API.GetTranslation("wox_plugin_controlpanel_plugin_description");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
[assembly: AssemblyTitle("Wox.Plugin.ControlPanel")]
|
||||||
|
[assembly: Guid("59141b10-8941-4e90-a0a6-bc9385a04cc6")]
|
||||||
@@ -0,0 +1,132 @@
|
|||||||
|
<?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>{1EE20B48-82FB-48A2-8086-675D6DDAB4F0}</ProjectGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>Wox.Plugin.ControlPanel</RootNamespace>
|
||||||
|
<AssemblyName>Wox.Plugin.ControlPanel</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.ControlPanel\</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.ControlPanel\</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="PresentationFramework" />
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Drawing" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="..\..\SolutionAssemblyInfo.cs">
|
||||||
|
<Link>Properties\SolutionAssemblyInfo.cs</Link>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Main.cs" />
|
||||||
|
<Compile Include="ControlPanelItem.cs" />
|
||||||
|
<Compile Include="ControlPanelList.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
</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\ControlPanel.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>
|
||||||
|
</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>
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"ID":"209621585B9B4D81813913C507C058C6",
|
||||||
|
"ActionKeyword":"*",
|
||||||
|
"Name":"Control Panel",
|
||||||
|
"Description":"Search within the Control Panel.",
|
||||||
|
"Author":"CoenraadS",
|
||||||
|
"Version":"1.0.0",
|
||||||
|
"Language":"csharp",
|
||||||
|
"Website":"http://www.wox.one/plugin",
|
||||||
|
"ExecuteFileName":"Wox.Plugin.ControlPanel.dll",
|
||||||
|
"IcoPath":"Images\\ControlPanel.png"
|
||||||
|
}
|
||||||
63
src/modules/launcher/Plugins/Wox.Plugin.Everything/.gitattributes
vendored
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
###############################################################################
|
||||||
|
# Set default behavior to automatically normalize line endings.
|
||||||
|
###############################################################################
|
||||||
|
* text=auto
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Set default behavior for command prompt diff.
|
||||||
|
#
|
||||||
|
# This is need for earlier builds of msysgit that does not have it on by
|
||||||
|
# default for csharp files.
|
||||||
|
# Note: This is only used by command line
|
||||||
|
###############################################################################
|
||||||
|
#*.cs diff=csharp
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Set the merge driver for project and solution files
|
||||||
|
#
|
||||||
|
# Merging from the command prompt will add diff markers to the files if there
|
||||||
|
# are conflicts (Merging from VS is not affected by the settings below, in VS
|
||||||
|
# the diff markers are never inserted). Diff markers may cause the following
|
||||||
|
# file extensions to fail to load in VS. An alternative would be to treat
|
||||||
|
# these files as binary and thus will always conflict and require user
|
||||||
|
# intervention with every merge. To do so, just uncomment the entries below
|
||||||
|
###############################################################################
|
||||||
|
#*.sln merge=binary
|
||||||
|
#*.csproj merge=binary
|
||||||
|
#*.vbproj merge=binary
|
||||||
|
#*.vcxproj merge=binary
|
||||||
|
#*.vcproj merge=binary
|
||||||
|
#*.dbproj merge=binary
|
||||||
|
#*.fsproj merge=binary
|
||||||
|
#*.lsproj merge=binary
|
||||||
|
#*.wixproj merge=binary
|
||||||
|
#*.modelproj merge=binary
|
||||||
|
#*.sqlproj merge=binary
|
||||||
|
#*.wwaproj merge=binary
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# behavior for image files
|
||||||
|
#
|
||||||
|
# image files are treated as binary by default.
|
||||||
|
###############################################################################
|
||||||
|
#*.jpg binary
|
||||||
|
#*.png binary
|
||||||
|
#*.gif binary
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# diff behavior for common document formats
|
||||||
|
#
|
||||||
|
# Convert binary document formats to text before diffing them. This feature
|
||||||
|
# is only available from the command line. Turn it on by uncommenting the
|
||||||
|
# entries below.
|
||||||
|
###############################################################################
|
||||||
|
#*.doc diff=astextplain
|
||||||
|
#*.DOC diff=astextplain
|
||||||
|
#*.docx diff=astextplain
|
||||||
|
#*.DOCX diff=astextplain
|
||||||
|
#*.dot diff=astextplain
|
||||||
|
#*.DOT diff=astextplain
|
||||||
|
#*.pdf diff=astextplain
|
||||||
|
#*.PDF diff=astextplain
|
||||||
|
#*.rtf diff=astextplain
|
||||||
|
#*.RTF diff=astextplain
|
||||||
156
src/modules/launcher/Plugins/Wox.Plugin.Everything/.gitignore
vendored
Normal file
@@ -0,0 +1,156 @@
|
|||||||
|
## Ignore Visual Studio temporary files, build results, and
|
||||||
|
## files generated by popular Visual Studio add-ons.
|
||||||
|
|
||||||
|
# User-specific files
|
||||||
|
*.suo
|
||||||
|
*.user
|
||||||
|
*.sln.docstates
|
||||||
|
|
||||||
|
# Build results
|
||||||
|
|
||||||
|
[Dd]ebug/
|
||||||
|
[Rr]elease/
|
||||||
|
x64/
|
||||||
|
build/
|
||||||
|
[Bb]in/
|
||||||
|
[Oo]bj/
|
||||||
|
|
||||||
|
# Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets
|
||||||
|
!packages/*/build/
|
||||||
|
|
||||||
|
# MSTest test Results
|
||||||
|
[Tt]est[Rr]esult*/
|
||||||
|
[Bb]uild[Ll]og.*
|
||||||
|
|
||||||
|
*_i.c
|
||||||
|
*_p.c
|
||||||
|
*.ilk
|
||||||
|
*.meta
|
||||||
|
*.obj
|
||||||
|
*.pch
|
||||||
|
*.pdb
|
||||||
|
*.pgc
|
||||||
|
*.pgd
|
||||||
|
*.rsp
|
||||||
|
*.sbr
|
||||||
|
*.tlb
|
||||||
|
*.tli
|
||||||
|
*.tlh
|
||||||
|
*.tmp
|
||||||
|
*.tmp_proj
|
||||||
|
*.log
|
||||||
|
*.vspscc
|
||||||
|
*.vssscc
|
||||||
|
.builds
|
||||||
|
*.pidb
|
||||||
|
*.log
|
||||||
|
*.scc
|
||||||
|
|
||||||
|
# Visual C++ cache files
|
||||||
|
ipch/
|
||||||
|
*.aps
|
||||||
|
*.ncb
|
||||||
|
*.opensdf
|
||||||
|
*.sdf
|
||||||
|
*.cachefile
|
||||||
|
|
||||||
|
# Visual Studio profiler
|
||||||
|
*.psess
|
||||||
|
*.vsp
|
||||||
|
*.vspx
|
||||||
|
|
||||||
|
# Guidance Automation Toolkit
|
||||||
|
*.gpState
|
||||||
|
|
||||||
|
# ReSharper is a .NET coding add-in
|
||||||
|
_ReSharper*/
|
||||||
|
*.[Rr]e[Ss]harper
|
||||||
|
|
||||||
|
# TeamCity is a build add-in
|
||||||
|
_TeamCity*
|
||||||
|
|
||||||
|
# DotCover is a Code Coverage Tool
|
||||||
|
*.dotCover
|
||||||
|
|
||||||
|
# NCrunch
|
||||||
|
*.ncrunch*
|
||||||
|
.*crunch*.local.xml
|
||||||
|
|
||||||
|
# Installshield output folder
|
||||||
|
[Ee]xpress/
|
||||||
|
|
||||||
|
# DocProject is a documentation generator add-in
|
||||||
|
DocProject/buildhelp/
|
||||||
|
DocProject/Help/*.HxT
|
||||||
|
DocProject/Help/*.HxC
|
||||||
|
DocProject/Help/*.hhc
|
||||||
|
DocProject/Help/*.hhk
|
||||||
|
DocProject/Help/*.hhp
|
||||||
|
DocProject/Help/Html2
|
||||||
|
DocProject/Help/html
|
||||||
|
|
||||||
|
# Click-Once directory
|
||||||
|
publish/
|
||||||
|
|
||||||
|
# Publish Web Output
|
||||||
|
*.Publish.xml
|
||||||
|
|
||||||
|
# NuGet Packages Directory
|
||||||
|
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
|
||||||
|
packages/
|
||||||
|
|
||||||
|
# Windows Azure Build Output
|
||||||
|
csx
|
||||||
|
*.build.csdef
|
||||||
|
|
||||||
|
# Windows Store app package directory
|
||||||
|
AppPackages/
|
||||||
|
|
||||||
|
# Others
|
||||||
|
sql/
|
||||||
|
*.Cache
|
||||||
|
ClientBin/
|
||||||
|
[Ss]tyle[Cc]op.*
|
||||||
|
~$*
|
||||||
|
*~
|
||||||
|
*.dbmdl
|
||||||
|
*.[Pp]ublish.xml
|
||||||
|
*.pfx
|
||||||
|
*.publishsettings
|
||||||
|
|
||||||
|
# RIA/Silverlight projects
|
||||||
|
Generated_Code/
|
||||||
|
|
||||||
|
# Backup & report files from converting an old project file to a newer
|
||||||
|
# Visual Studio version. Backup files are not needed, because we have git ;-)
|
||||||
|
_UpgradeReport_Files/
|
||||||
|
Backup*/
|
||||||
|
UpgradeLog*.XML
|
||||||
|
UpgradeLog*.htm
|
||||||
|
|
||||||
|
# SQL Server files
|
||||||
|
App_Data/*.mdf
|
||||||
|
App_Data/*.ldf
|
||||||
|
|
||||||
|
|
||||||
|
#LightSwitch generated files
|
||||||
|
GeneratedArtifacts/
|
||||||
|
_Pvt_Extensions/
|
||||||
|
ModelManifest.xml
|
||||||
|
|
||||||
|
# =========================
|
||||||
|
# Windows detritus
|
||||||
|
# =========================
|
||||||
|
|
||||||
|
# Windows image file caches
|
||||||
|
Thumbs.db
|
||||||
|
ehthumbs.db
|
||||||
|
|
||||||
|
# Folder config file
|
||||||
|
Desktop.ini
|
||||||
|
|
||||||
|
# Recycle Bin used on file shares
|
||||||
|
$RECYCLE.BIN/
|
||||||
|
|
||||||
|
# Mac desktop service store files
|
||||||
|
.DS_Store
|
||||||
@@ -0,0 +1,218 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
|
using Wox.Infrastructure.Logger;
|
||||||
|
using Wox.Plugin.Everything.Everything.Exceptions;
|
||||||
|
|
||||||
|
namespace Wox.Plugin.Everything.Everything
|
||||||
|
{
|
||||||
|
public interface IEverythingApi
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Searches the specified key word.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="keyWord">The key word.</param>
|
||||||
|
/// <param name="token">token that allow cancellation</param>
|
||||||
|
/// <param name="offset">The offset.</param>
|
||||||
|
/// <param name="maxCount">The max count.</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
List<SearchResult> Search(string keyWord, CancellationToken token, int offset = 0, int maxCount = 100);
|
||||||
|
|
||||||
|
void Load(string sdkPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
public sealed class EverythingApi : IEverythingApi
|
||||||
|
{
|
||||||
|
private const int BufferSize = 4096;
|
||||||
|
|
||||||
|
private readonly object _syncObject = new object();
|
||||||
|
// cached buffer to remove redundant allocations.
|
||||||
|
private readonly StringBuilder _buffer = new StringBuilder(BufferSize);
|
||||||
|
|
||||||
|
public enum StateCode
|
||||||
|
{
|
||||||
|
OK,
|
||||||
|
MemoryError,
|
||||||
|
IPCError,
|
||||||
|
RegisterClassExError,
|
||||||
|
CreateWindowError,
|
||||||
|
CreateThreadError,
|
||||||
|
InvalidIndexError,
|
||||||
|
InvalidCallError
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value indicating whether [match path].
|
||||||
|
/// </summary>
|
||||||
|
/// <value><c>true</c> if [match path]; otherwise, <c>false</c>.</value>
|
||||||
|
public bool MatchPath
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return EverythingApiDllImport.Everything_GetMatchPath();
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
EverythingApiDllImport.Everything_SetMatchPath(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value indicating whether [match case].
|
||||||
|
/// </summary>
|
||||||
|
/// <value><c>true</c> if [match case]; otherwise, <c>false</c>.</value>
|
||||||
|
public bool MatchCase
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return EverythingApiDllImport.Everything_GetMatchCase();
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
EverythingApiDllImport.Everything_SetMatchCase(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value indicating whether [match whole word].
|
||||||
|
/// </summary>
|
||||||
|
/// <value><c>true</c> if [match whole word]; otherwise, <c>false</c>.</value>
|
||||||
|
public bool MatchWholeWord
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return EverythingApiDllImport.Everything_GetMatchWholeWord();
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
EverythingApiDllImport.Everything_SetMatchWholeWord(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value indicating whether [enable regex].
|
||||||
|
/// </summary>
|
||||||
|
/// <value><c>true</c> if [enable regex]; otherwise, <c>false</c>.</value>
|
||||||
|
public bool EnableRegex
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return EverythingApiDllImport.Everything_GetRegex();
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
EverythingApiDllImport.Everything_SetRegex(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Resets this instance.
|
||||||
|
/// </summary>
|
||||||
|
public void Reset()
|
||||||
|
{
|
||||||
|
lock (_syncObject)
|
||||||
|
{
|
||||||
|
EverythingApiDllImport.Everything_Reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Searches the specified key word and reset the everything API afterwards
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="keyWord">The key word.</param>
|
||||||
|
/// <param name="token">when cancelled the current search will stop and exit (and would not reset)</param>
|
||||||
|
/// <param name="offset">The offset.</param>
|
||||||
|
/// <param name="maxCount">The max count.</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public List<SearchResult> Search(string keyWord, CancellationToken token, int offset = 0, int maxCount = 100)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(keyWord))
|
||||||
|
throw new ArgumentNullException(nameof(keyWord));
|
||||||
|
|
||||||
|
if (offset < 0)
|
||||||
|
throw new ArgumentOutOfRangeException(nameof(offset));
|
||||||
|
|
||||||
|
if (maxCount < 0)
|
||||||
|
throw new ArgumentOutOfRangeException(nameof(maxCount));
|
||||||
|
|
||||||
|
lock (_syncObject)
|
||||||
|
{
|
||||||
|
if (keyWord.StartsWith("@"))
|
||||||
|
{
|
||||||
|
EverythingApiDllImport.Everything_SetRegex(true);
|
||||||
|
keyWord = keyWord.Substring(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
EverythingApiDllImport.Everything_SetSearchW(keyWord);
|
||||||
|
EverythingApiDllImport.Everything_SetOffset(offset);
|
||||||
|
EverythingApiDllImport.Everything_SetMax(maxCount);
|
||||||
|
|
||||||
|
if (token.IsCancellationRequested)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!EverythingApiDllImport.Everything_QueryW(true))
|
||||||
|
{
|
||||||
|
CheckAndThrowExceptionOnError();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
var results = new List<SearchResult>();
|
||||||
|
for (int idx = 0; idx < EverythingApiDllImport.Everything_GetNumResults(); ++idx)
|
||||||
|
{
|
||||||
|
if (token.IsCancellationRequested)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
EverythingApiDllImport.Everything_GetResultFullPathNameW(idx, _buffer, BufferSize);
|
||||||
|
|
||||||
|
var result = new SearchResult { FullPath = _buffer.ToString() };
|
||||||
|
if (EverythingApiDllImport.Everything_IsFolderResult(idx))
|
||||||
|
result.Type = ResultType.Folder;
|
||||||
|
else if (EverythingApiDllImport.Everything_IsFileResult(idx))
|
||||||
|
result.Type = ResultType.File;
|
||||||
|
|
||||||
|
results.Add(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
Reset();
|
||||||
|
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport("kernel32.dll")]
|
||||||
|
private static extern int LoadLibrary(string name);
|
||||||
|
|
||||||
|
public void Load(string sdkPath)
|
||||||
|
{
|
||||||
|
LoadLibrary(sdkPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void CheckAndThrowExceptionOnError()
|
||||||
|
{
|
||||||
|
switch (EverythingApiDllImport.Everything_GetLastError())
|
||||||
|
{
|
||||||
|
case StateCode.CreateThreadError:
|
||||||
|
throw new CreateThreadException();
|
||||||
|
case StateCode.CreateWindowError:
|
||||||
|
throw new CreateWindowException();
|
||||||
|
case StateCode.InvalidCallError:
|
||||||
|
throw new InvalidCallException();
|
||||||
|
case StateCode.InvalidIndexError:
|
||||||
|
throw new InvalidIndexException();
|
||||||
|
case StateCode.IPCError:
|
||||||
|
throw new IPCErrorException();
|
||||||
|
case StateCode.MemoryError:
|
||||||
|
throw new MemoryErrorException();
|
||||||
|
case StateCode.RegisterClassExError:
|
||||||
|
throw new RegisterClassExException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,92 @@
|
|||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Wox.Plugin.Everything.Everything
|
||||||
|
{
|
||||||
|
public sealed class EverythingApiDllImport
|
||||||
|
{
|
||||||
|
[DllImport(Main.DLL, CharSet = CharSet.Unicode)]
|
||||||
|
internal static extern int Everything_SetSearchW(string lpSearchString);
|
||||||
|
|
||||||
|
[DllImport(Main.DLL)]
|
||||||
|
internal static extern void Everything_SetMatchPath(bool bEnable);
|
||||||
|
|
||||||
|
[DllImport(Main.DLL)]
|
||||||
|
internal static extern void Everything_SetMatchCase(bool bEnable);
|
||||||
|
|
||||||
|
[DllImport(Main.DLL)]
|
||||||
|
internal static extern void Everything_SetMatchWholeWord(bool bEnable);
|
||||||
|
|
||||||
|
[DllImport(Main.DLL)]
|
||||||
|
internal static extern void Everything_SetRegex(bool bEnable);
|
||||||
|
|
||||||
|
[DllImport(Main.DLL)]
|
||||||
|
internal static extern void Everything_SetMax(int dwMax);
|
||||||
|
|
||||||
|
[DllImport(Main.DLL)]
|
||||||
|
internal static extern void Everything_SetOffset(int dwOffset);
|
||||||
|
|
||||||
|
[DllImport(Main.DLL)]
|
||||||
|
internal static extern bool Everything_GetMatchPath();
|
||||||
|
|
||||||
|
[DllImport(Main.DLL)]
|
||||||
|
internal static extern bool Everything_GetMatchCase();
|
||||||
|
|
||||||
|
[DllImport(Main.DLL)]
|
||||||
|
internal static extern bool Everything_GetMatchWholeWord();
|
||||||
|
|
||||||
|
[DllImport(Main.DLL)]
|
||||||
|
internal static extern bool Everything_GetRegex();
|
||||||
|
|
||||||
|
[DllImport(Main.DLL)]
|
||||||
|
internal static extern uint Everything_GetMax();
|
||||||
|
|
||||||
|
[DllImport(Main.DLL)]
|
||||||
|
internal static extern uint Everything_GetOffset();
|
||||||
|
|
||||||
|
[DllImport(Main.DLL, CharSet = CharSet.Unicode)]
|
||||||
|
internal static extern string Everything_GetSearchW();
|
||||||
|
|
||||||
|
[DllImport(Main.DLL)]
|
||||||
|
internal static extern EverythingApi.StateCode Everything_GetLastError();
|
||||||
|
|
||||||
|
[DllImport(Main.DLL, CharSet = CharSet.Unicode)]
|
||||||
|
internal static extern bool Everything_QueryW(bool bWait);
|
||||||
|
|
||||||
|
[DllImport(Main.DLL)]
|
||||||
|
internal static extern void Everything_SortResultsByPath();
|
||||||
|
|
||||||
|
[DllImport(Main.DLL)]
|
||||||
|
internal static extern int Everything_GetNumFileResults();
|
||||||
|
|
||||||
|
[DllImport(Main.DLL)]
|
||||||
|
internal static extern int Everything_GetNumFolderResults();
|
||||||
|
|
||||||
|
[DllImport(Main.DLL)]
|
||||||
|
internal static extern int Everything_GetNumResults();
|
||||||
|
|
||||||
|
[DllImport(Main.DLL)]
|
||||||
|
internal static extern int Everything_GetTotFileResults();
|
||||||
|
|
||||||
|
[DllImport(Main.DLL)]
|
||||||
|
internal static extern int Everything_GetTotFolderResults();
|
||||||
|
|
||||||
|
[DllImport(Main.DLL)]
|
||||||
|
internal static extern int Everything_GetTotResults();
|
||||||
|
|
||||||
|
[DllImport(Main.DLL)]
|
||||||
|
internal static extern bool Everything_IsVolumeResult(int nIndex);
|
||||||
|
|
||||||
|
[DllImport(Main.DLL)]
|
||||||
|
internal static extern bool Everything_IsFolderResult(int nIndex);
|
||||||
|
|
||||||
|
[DllImport(Main.DLL)]
|
||||||
|
internal static extern bool Everything_IsFileResult(int nIndex);
|
||||||
|
|
||||||
|
[DllImport(Main.DLL, CharSet = CharSet.Unicode)]
|
||||||
|
internal static extern void Everything_GetResultFullPathNameW(int nIndex, StringBuilder lpString, int nMaxCount);
|
||||||
|
|
||||||
|
[DllImport(Main.DLL)]
|
||||||
|
internal static extern void Everything_Reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Wox.Plugin.Everything.Everything
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public class CreateThreadException : ApplicationException
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Wox.Plugin.Everything.Everything
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public class CreateWindowException : ApplicationException
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Wox.Plugin.Everything.Everything
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public class IPCErrorException : ApplicationException
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Wox.Plugin.Everything.Everything
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public class InvalidCallException : ApplicationException
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Wox.Plugin.Everything.Everything
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public class InvalidIndexException : ApplicationException
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Wox.Plugin.Everything.Everything.Exceptions
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public class MemoryErrorException : ApplicationException
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Wox.Plugin.Everything.Everything
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public class RegisterClassExException : ApplicationException
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
namespace Wox.Plugin.Everything.Everything
|
||||||
|
{
|
||||||
|
public enum ResultType
|
||||||
|
{
|
||||||
|
Volume,
|
||||||
|
Folder,
|
||||||
|
File
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
namespace Wox.Plugin.Everything.Everything
|
||||||
|
{
|
||||||
|
public class SearchResult
|
||||||
|
{
|
||||||
|
public string FullPath { get; set; }
|
||||||
|
public ResultType Type { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
<UserControl x:Class="Wox.Plugin.Everything.EverythingSettings"
|
||||||
|
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"
|
||||||
|
Loaded="View_Loaded"
|
||||||
|
d:DesignHeight="300" d:DesignWidth="300">
|
||||||
|
<Border BorderBrush="Gray" Margin="10" BorderThickness="1">
|
||||||
|
<Grid Margin="10" VerticalAlignment="Top" >
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition/>
|
||||||
|
<RowDefinition/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto"></ColumnDefinition>
|
||||||
|
<ColumnDefinition Width="*"></ColumnDefinition>
|
||||||
|
<ColumnDefinition Width="Auto"></ColumnDefinition>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<CheckBox Grid.Row="0" Grid.ColumnSpan="3" x:Name="UseLocationAsWorkingDir" Content="{DynamicResource wox_plugin_everything_use_location_as_working_dir}" Margin="10" HorizontalAlignment="Left" />
|
||||||
|
<Label Grid.Row="1" Margin="10" Content="{DynamicResource wox_plugin_everything_editor_path}" HorizontalAlignment="Left"/>
|
||||||
|
<Label Grid.Row="1" Grid.Column="1" x:Name="EditorPath" Margin="10" HorizontalAlignment="Stretch" />
|
||||||
|
<Button Grid.Row="1" Grid.Column="2" x:Name="OpenEditorPath" Content="..." Margin="10" HorizontalAlignment="Right" Click="EditorPath_Clicked"/>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
</UserControl>
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using Microsoft.Win32;
|
||||||
|
|
||||||
|
namespace Wox.Plugin.Everything
|
||||||
|
{
|
||||||
|
public partial class EverythingSettings : UserControl
|
||||||
|
{
|
||||||
|
private readonly Settings _settings;
|
||||||
|
|
||||||
|
public EverythingSettings(Settings settings)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_settings = settings;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void View_Loaded(object sender, RoutedEventArgs re)
|
||||||
|
{
|
||||||
|
UseLocationAsWorkingDir.IsChecked = _settings.UseLocationAsWorkingDir;
|
||||||
|
|
||||||
|
UseLocationAsWorkingDir.Checked += (o, e) =>
|
||||||
|
{
|
||||||
|
_settings.UseLocationAsWorkingDir = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
UseLocationAsWorkingDir.Unchecked += (o, e) =>
|
||||||
|
{
|
||||||
|
_settings.UseLocationAsWorkingDir = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
EditorPath.Content = _settings.EditorPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void EditorPath_Clicked(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
OpenFileDialog openFileDialog = new OpenFileDialog();
|
||||||
|
openFileDialog.Filter = "Executable File(*.exe)| *.exe";
|
||||||
|
if (!string.IsNullOrEmpty(_settings.EditorPath))
|
||||||
|
openFileDialog.InitialDirectory = System.IO.Path.GetDirectoryName(_settings.EditorPath);
|
||||||
|
|
||||||
|
if (openFileDialog.ShowDialog() == true)
|
||||||
|
{
|
||||||
|
_settings.EditorPath = openFileDialog.FileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
EditorPath.Content = _settings.EditorPath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 290 B |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 468 B |
|
After Width: | Height: | Size: 634 B |
|
After Width: | Height: | Size: 738 B |
@@ -0,0 +1,18 @@
|
|||||||
|
<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_everything_is_not_running">Everything Service läuft nicht</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_everything_query_error">Everything Plugin hat einen Fehler (drücke Enter zum kopieren der Fehlernachricht)</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_everything_copied">kopiert</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_everything_canot_start">Kann {0} nicht starten</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_everything_open_containing_folder">Öffne enthaltenden Ordner</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_everything_open_with_editor">Openen met {0}</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_everything_editor_path">Editor pad</system:String>
|
||||||
|
|
||||||
|
<system:String x:Key="wox_plugin_everything_plugin_name">Everything</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_everything_plugin_description">Suche Dateien mit Everything</system:String>
|
||||||
|
|
||||||
|
<system:String x:Key="wox_plugin_everything_use_location_as_working_dir">Verwenden Suchergebnis Standort als ausführbare Arbeitsverzeichnis</system:String>
|
||||||
|
|
||||||
|
</ResourceDictionary>
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
<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_everything_is_not_running">Everything Service is not running</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_everything_query_error">Error while querying Everything</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_everything_copied">Copied</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_everything_canot_start">Can’t start {0}</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_everything_open_containing_folder">Open parent folder</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_everything_open_with_editor">Open with {0}</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_everything_editor_path">Editor Path</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_everything_copy_path">Copy path</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_everything_copy">Copy</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_everything_delete">Delete</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_everything_canot_delete">Can't delete {0}</system:String>
|
||||||
|
|
||||||
|
<system:String x:Key="wox_plugin_everything_plugin_name">Everything</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_everything_plugin_description">Search on-disk files using Everything</system:String>
|
||||||
|
|
||||||
|
<system:String x:Key="wox_plugin_everything_use_location_as_working_dir">Use search result's location as executable working directory</system:String>
|
||||||
|
|
||||||
|
</ResourceDictionary>
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
<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_everything_is_not_running">Everything Service nie jest uruchomiony</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_everything_query_error">Wystąpił błąd podczas pobierania wyników z Everything</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_everything_copied">Skopiowano</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_everything_canot_start">Nie udało się uruchomić {0}</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_everything_open_containing_folder">Otwórz folder nadrzędny.</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_everything_open_with_editor">Otwórz za pomocą {0}</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_everything_editor_path">Ścieżka edytora</system:String>
|
||||||
|
|
||||||
|
<system:String x:Key="wox_plugin_everything_plugin_name">Everything</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_everything_plugin_description">Szukaj w plikach na dysku używając programu Everything</system:String>
|
||||||
|
|
||||||
|
</ResourceDictionary>
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
<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_everything_is_not_running">Everything Servisi çalışmıyor</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_everything_query_error">Sorgu Everything üzerinde çalıştırılırken hata oluştu</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_everything_copied">Kopyalandı</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_everything_canot_start">{0} başlatılamıyor</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_everything_open_containing_folder">İçeren klasörü aç</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_everything_open_with_editor">{0} ile aç</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_everything_editor_path">Düzenleyici Konumu</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_everything_copy_path">Konumu Kopyala</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_everything_copy">Kopyala</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_everything_delete">Sil</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_everything_canot_delete">{0} silinemiyor</system:String>
|
||||||
|
|
||||||
|
<system:String x:Key="wox_plugin_everything_plugin_name">Everything</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_everything_plugin_description">Everything programı yardımıyla diskteki dosyalarınızı arayın.</system:String>
|
||||||
|
|
||||||
|
<system:String x:Key="wox_plugin_everything_use_location_as_working_dir">Programın çalışma klasörü olarak sonuç klasörünü kullan</system:String>
|
||||||
|
|
||||||
|
</ResourceDictionary>
|
||||||