mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-09 04:37:30 +02:00
Add winalfred workflow installer
This commit is contained in:
8
WinAlfred.WorkflowInstaller/App.xaml
Normal file
8
WinAlfred.WorkflowInstaller/App.xaml
Normal file
@@ -0,0 +1,8 @@
|
||||
<Application x:Class="WinAlfred.WorkflowInstaller.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
StartupUri="MainWindow.xaml">
|
||||
<Application.Resources>
|
||||
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
16
WinAlfred.WorkflowInstaller/App.xaml.cs
Normal file
16
WinAlfred.WorkflowInstaller/App.xaml.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
|
||||
namespace WinAlfred.WorkflowInstaller
|
||||
{
|
||||
/// <summary>
|
||||
/// App.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class App : Application
|
||||
{
|
||||
}
|
||||
}
|
||||
217
WinAlfred.WorkflowInstaller/IniParser.cs
Normal file
217
WinAlfred.WorkflowInstaller/IniParser.cs
Normal file
@@ -0,0 +1,217 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
|
||||
namespace WinAlfred.Helper
|
||||
{
|
||||
public class IniParser
|
||||
{
|
||||
private Hashtable keyPairs = new Hashtable();
|
||||
private String iniFilePath;
|
||||
|
||||
private struct SectionPair
|
||||
{
|
||||
public String Section;
|
||||
public String Key;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Opens the INI file at the given path and enumerates the values in the IniParser.
|
||||
/// </summary>
|
||||
/// <param name="iniPath">Full path to INI file.</param>
|
||||
public IniParser(String iniPath)
|
||||
{
|
||||
TextReader iniFile = null;
|
||||
String strLine = null;
|
||||
String currentRoot = null;
|
||||
String[] keyPair = null;
|
||||
|
||||
iniFilePath = iniPath;
|
||||
|
||||
if (File.Exists(iniPath))
|
||||
{
|
||||
try
|
||||
{
|
||||
iniFile = new StreamReader(iniPath);
|
||||
|
||||
strLine = iniFile.ReadLine();
|
||||
|
||||
while (strLine != null)
|
||||
{
|
||||
strLine = strLine.Trim();
|
||||
|
||||
if (strLine != "")
|
||||
{
|
||||
if (strLine.StartsWith("[") && strLine.EndsWith("]"))
|
||||
{
|
||||
currentRoot = strLine.Substring(1, strLine.Length - 2).ToUpper();
|
||||
}
|
||||
else
|
||||
{
|
||||
keyPair = strLine.Split(new char[] { '=' }, 2);
|
||||
|
||||
SectionPair sectionPair;
|
||||
String value = null;
|
||||
|
||||
if (currentRoot == null)
|
||||
currentRoot = "ROOT";
|
||||
|
||||
sectionPair.Section = currentRoot;
|
||||
sectionPair.Key = keyPair[0].ToUpper().Trim();
|
||||
|
||||
if (keyPair.Length > 1)
|
||||
value = keyPair[1];
|
||||
|
||||
keyPairs.Add(sectionPair, value.Trim());
|
||||
}
|
||||
}
|
||||
|
||||
strLine = iniFile.ReadLine();
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (iniFile != null)
|
||||
iniFile.Close();
|
||||
}
|
||||
}
|
||||
else
|
||||
throw new FileNotFoundException("Unable to locate " + iniPath);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the value for the given section, key pair.
|
||||
/// </summary>
|
||||
/// <param name="sectionName">Section name.</param>
|
||||
/// <param name="settingName">Key name.</param>
|
||||
public String GetSetting(String sectionName, String settingName)
|
||||
{
|
||||
SectionPair sectionPair;
|
||||
sectionPair.Section = sectionName.ToUpper().Trim();
|
||||
sectionPair.Key = settingName.ToUpper().Trim();
|
||||
|
||||
return (String)keyPairs[sectionPair];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enumerates all lines for given section.
|
||||
/// </summary>
|
||||
/// <param name="sectionName">Section to enum.</param>
|
||||
public String[] EnumSection(String sectionName)
|
||||
{
|
||||
ArrayList tmpArray = new ArrayList();
|
||||
|
||||
foreach (SectionPair pair in keyPairs.Keys)
|
||||
{
|
||||
if (pair.Section == sectionName.ToUpper())
|
||||
tmpArray.Add(pair.Key);
|
||||
}
|
||||
|
||||
return (String[])tmpArray.ToArray(typeof(String));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds or replaces a setting to the table to be saved.
|
||||
/// </summary>
|
||||
/// <param name="sectionName">Section to add under.</param>
|
||||
/// <param name="settingName">Key name to add.</param>
|
||||
/// <param name="settingValue">Value of key.</param>
|
||||
public void AddSetting(String sectionName, String settingName, String settingValue)
|
||||
{
|
||||
SectionPair sectionPair;
|
||||
sectionPair.Section = sectionName.ToUpper();
|
||||
sectionPair.Key = settingName.ToUpper();
|
||||
|
||||
if (keyPairs.ContainsKey(sectionPair))
|
||||
keyPairs.Remove(sectionPair);
|
||||
|
||||
keyPairs.Add(sectionPair, settingValue);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds or replaces a setting to the table to be saved with a null value.
|
||||
/// </summary>
|
||||
/// <param name="sectionName">Section to add under.</param>
|
||||
/// <param name="settingName">Key name to add.</param>
|
||||
public void AddSetting(String sectionName, String settingName)
|
||||
{
|
||||
AddSetting(sectionName, settingName, null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove a setting.
|
||||
/// </summary>
|
||||
/// <param name="sectionName">Section to add under.</param>
|
||||
/// <param name="settingName">Key name to add.</param>
|
||||
public void DeleteSetting(String sectionName, String settingName)
|
||||
{
|
||||
SectionPair sectionPair;
|
||||
sectionPair.Section = sectionName.ToUpper();
|
||||
sectionPair.Key = settingName.ToUpper();
|
||||
|
||||
if (keyPairs.ContainsKey(sectionPair))
|
||||
keyPairs.Remove(sectionPair);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Save settings to new file.
|
||||
/// </summary>
|
||||
/// <param name="newFilePath">New file path.</param>
|
||||
public void SaveSettings(String newFilePath)
|
||||
{
|
||||
ArrayList sections = new ArrayList();
|
||||
String tmpValue = "";
|
||||
String strToSave = "";
|
||||
|
||||
foreach (SectionPair sectionPair in keyPairs.Keys)
|
||||
{
|
||||
if (!sections.Contains(sectionPair.Section))
|
||||
sections.Add(sectionPair.Section);
|
||||
}
|
||||
|
||||
foreach (String section in sections)
|
||||
{
|
||||
strToSave += ("[" + section + "]\r\n");
|
||||
|
||||
foreach (SectionPair sectionPair in keyPairs.Keys)
|
||||
{
|
||||
if (sectionPair.Section == section)
|
||||
{
|
||||
tmpValue = (String)keyPairs[sectionPair];
|
||||
|
||||
if (tmpValue != null)
|
||||
tmpValue = "=" + tmpValue;
|
||||
|
||||
strToSave += (sectionPair.Key + tmpValue + "\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
strToSave += "\r\n";
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
TextWriter tw = new StreamWriter(newFilePath);
|
||||
tw.Write(strToSave);
|
||||
tw.Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Save settings back to ini file.
|
||||
/// </summary>
|
||||
public void SaveSettings()
|
||||
{
|
||||
SaveSettings(iniFilePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
8
WinAlfred.WorkflowInstaller/MainWindow.xaml
Normal file
8
WinAlfred.WorkflowInstaller/MainWindow.xaml
Normal file
@@ -0,0 +1,8 @@
|
||||
<Window x:Class="WinAlfred.WorkflowInstaller.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
Title="MainWindow" Height="350" Width="525">
|
||||
<Grid>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
278
WinAlfred.WorkflowInstaller/MainWindow.xaml.cs
Normal file
278
WinAlfred.WorkflowInstaller/MainWindow.xaml.cs
Normal file
@@ -0,0 +1,278 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using ICSharpCode.SharpZipLib.Zip;
|
||||
using Microsoft.Win32;
|
||||
using WinAlfred.Helper;
|
||||
using WinAlfred.Plugin;
|
||||
using Path = System.IO.Path;
|
||||
|
||||
namespace WinAlfred.WorkflowInstaller
|
||||
{
|
||||
|
||||
public partial class MainWindow
|
||||
{
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
Loaded += MainWindow_Loaded;
|
||||
string[] param = Environment.GetCommandLineArgs();
|
||||
if (param.Length == 2)
|
||||
{
|
||||
string workflowPath = param[1];
|
||||
//string workflowPath = @"c:\Users\Scott\Desktop\Desktop.winalfred";
|
||||
if (workflowPath.EndsWith(".winalfred"))
|
||||
{
|
||||
InstallWorkflow(workflowPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void InstallWorkflow(string path)
|
||||
{
|
||||
if (File.Exists(path))
|
||||
{
|
||||
string tempFoler = System.IO.Path.GetTempPath() + "\\winalfred\\workflows";
|
||||
if (Directory.Exists(tempFoler))
|
||||
{
|
||||
Directory.Delete(tempFoler, true);
|
||||
}
|
||||
UnZip(path, tempFoler, true);
|
||||
|
||||
string iniPath = tempFoler + "\\plugin.ini";
|
||||
if (!File.Exists(iniPath))
|
||||
{
|
||||
MessageBox.Show("Install failed: config is missing");
|
||||
Close();
|
||||
return;
|
||||
}
|
||||
|
||||
PluginMetadata plugin = GetMetadataFromIni(tempFoler);
|
||||
if (plugin == null || plugin.Name == null)
|
||||
{
|
||||
MessageBox.Show("Install failed: config of this workflow is invalid");
|
||||
Close();
|
||||
return;
|
||||
}
|
||||
|
||||
string pluginFolerPath = AppDomain.CurrentDomain.BaseDirectory + "Plugins";
|
||||
if (!Directory.Exists(pluginFolerPath))
|
||||
{
|
||||
MessageBox.Show("Install failed: cound't find workflow directory");
|
||||
Close();
|
||||
return;
|
||||
}
|
||||
|
||||
string newPluginPath = pluginFolerPath + "\\" + plugin.Name;
|
||||
string content = string.Format(
|
||||
"Do you want to install following workflow?\r\nName: {0}\r\nVersion: {1}\r\nAuthor: {2}",
|
||||
plugin.Name, plugin.Version, plugin.Author);
|
||||
if (Directory.Exists(newPluginPath))
|
||||
{
|
||||
PluginMetadata existingPlugin = GetMetadataFromIni(newPluginPath);
|
||||
if (existingPlugin == null || existingPlugin.Name == null)
|
||||
{
|
||||
//maybe broken plugin, just delete it
|
||||
Directory.Delete(newPluginPath, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
content = string.Format(
|
||||
"Do you want to update following workflow?\r\nName: {0}\r\nOld Version: {1}\r\nNew Version: {2}\r\nAuthor: {3}",
|
||||
plugin.Name, existingPlugin.Version, plugin.Version, plugin.Author);
|
||||
}
|
||||
}
|
||||
|
||||
MessageBoxResult result = MessageBox.Show(content, "Install workflow",
|
||||
MessageBoxButton.YesNo, MessageBoxImage.Question);
|
||||
if (result == MessageBoxResult.Yes)
|
||||
{
|
||||
if (Directory.Exists(newPluginPath))
|
||||
{
|
||||
Directory.Delete(newPluginPath, true);
|
||||
}
|
||||
UnZip(path, newPluginPath, true);
|
||||
Directory.Delete(tempFoler, true);
|
||||
|
||||
|
||||
string winalfred = AppDomain.CurrentDomain.BaseDirectory + "WinAlfred.exe";
|
||||
if (File.Exists(winalfred))
|
||||
{
|
||||
Process.Start(winalfred, "refreshWorkflows");
|
||||
MessageBox.Show("You have installed workflow " + plugin.Name + " successfully.");
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("You have installed workflow " + plugin.Name + " successfully. Please restart your winalfred to use new workflow.");
|
||||
}
|
||||
Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static PluginMetadata GetMetadataFromIni(string directory)
|
||||
{
|
||||
string iniPath = directory + "\\plugin.ini";
|
||||
|
||||
if (!File.Exists(iniPath))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
PluginMetadata metadata = new PluginMetadata();
|
||||
IniParser ini = new IniParser(iniPath);
|
||||
metadata.Name = ini.GetSetting("plugin", "Name");
|
||||
metadata.Author = ini.GetSetting("plugin", "Author");
|
||||
metadata.Description = ini.GetSetting("plugin", "Description");
|
||||
metadata.Language = ini.GetSetting("plugin", "Language");
|
||||
metadata.Version = ini.GetSetting("plugin", "Version");
|
||||
metadata.PluginType = PluginType.ThirdParty;
|
||||
metadata.ActionKeyword = ini.GetSetting("plugin", "ActionKeyword");
|
||||
metadata.ExecuteFilePath = directory + "\\" + ini.GetSetting("plugin", "ExecuteFile");
|
||||
metadata.PluginDirecotry = directory + "\\";
|
||||
metadata.ExecuteFileName = ini.GetSetting("plugin", "ExecuteFile");
|
||||
|
||||
if (!AllowedLanguage.IsAllowed(metadata.Language))
|
||||
{
|
||||
string error = string.Format("Parse ini {0} failed: invalid language {1}", iniPath,
|
||||
metadata.Language);
|
||||
return null;
|
||||
}
|
||||
if (!File.Exists(metadata.ExecuteFilePath))
|
||||
{
|
||||
string error = string.Format("Parse ini {0} failed: ExecuteFilePath didn't exist {1}", iniPath,
|
||||
metadata.ExecuteFilePath);
|
||||
return null;
|
||||
}
|
||||
|
||||
return metadata;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// unzip
|
||||
/// </summary>
|
||||
/// <param name="zipedFile">The ziped file.</param>
|
||||
/// <param name="strDirectory">The STR directory.</param>
|
||||
/// <param name="overWrite">overwirte</param>
|
||||
public void UnZip(string zipedFile, string strDirectory, bool overWrite)
|
||||
{
|
||||
if (strDirectory == "")
|
||||
strDirectory = Directory.GetCurrentDirectory();
|
||||
if (!strDirectory.EndsWith("\\"))
|
||||
strDirectory = strDirectory + "\\";
|
||||
|
||||
using (ZipInputStream s = new ZipInputStream(File.OpenRead(zipedFile)))
|
||||
{
|
||||
ZipEntry theEntry;
|
||||
|
||||
while ((theEntry = s.GetNextEntry()) != null)
|
||||
{
|
||||
string directoryName = "";
|
||||
string pathToZip = "";
|
||||
pathToZip = theEntry.Name;
|
||||
|
||||
if (pathToZip != "")
|
||||
directoryName = Path.GetDirectoryName(pathToZip) + "\\";
|
||||
|
||||
string fileName = Path.GetFileName(pathToZip);
|
||||
|
||||
Directory.CreateDirectory(strDirectory + directoryName);
|
||||
|
||||
if (fileName != "")
|
||||
{
|
||||
if ((File.Exists(strDirectory + directoryName + fileName) && overWrite) || (!File.Exists(strDirectory + directoryName + fileName)))
|
||||
{
|
||||
using (FileStream streamWriter = File.Create(strDirectory + directoryName + fileName))
|
||||
{
|
||||
byte[] data = new byte[2048];
|
||||
while (true)
|
||||
{
|
||||
int size = s.Read(data, 0, data.Length);
|
||||
|
||||
if (size > 0)
|
||||
streamWriter.Write(data, 0, size);
|
||||
else
|
||||
break;
|
||||
}
|
||||
streamWriter.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
s.Close();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
string filePath = Directory.GetCurrentDirectory() + "\\WinAlfred.WorkflowInstaller.exe";
|
||||
string iconPath = Directory.GetCurrentDirectory() + "\\app.ico";
|
||||
|
||||
SaveReg(filePath, ".winalfred", iconPath, false);
|
||||
}
|
||||
|
||||
[DllImport("shell32.dll")]
|
||||
private static extern void SHChangeNotify(uint wEventId, uint uFlags, IntPtr dwItem1, IntPtr dwItem2);
|
||||
|
||||
private static void SaveReg(string filePath, string fileType, string iconPath, bool overrides)
|
||||
{
|
||||
RegistryKey classRootKey = Registry.ClassesRoot.OpenSubKey("", true);
|
||||
RegistryKey winAlfredKey = classRootKey.OpenSubKey(fileType, true);
|
||||
if (winAlfredKey != null)
|
||||
{
|
||||
if (!overrides)
|
||||
{
|
||||
return;
|
||||
}
|
||||
classRootKey.DeleteSubKeyTree(fileType);
|
||||
}
|
||||
classRootKey.CreateSubKey(fileType);
|
||||
winAlfredKey = classRootKey.OpenSubKey(fileType, true);
|
||||
winAlfredKey.SetValue("", "winalfred.winalfred");
|
||||
winAlfredKey.SetValue("Content Type", "application/winalfred");
|
||||
|
||||
RegistryKey iconKey = winAlfredKey.CreateSubKey("DefaultIcon");
|
||||
iconKey.SetValue("", iconPath);
|
||||
|
||||
winAlfredKey.CreateSubKey("shell");
|
||||
RegistryKey shellKey = winAlfredKey.OpenSubKey("shell", true);
|
||||
shellKey.SetValue("", "Open");
|
||||
RegistryKey openKey = shellKey.CreateSubKey("open");
|
||||
openKey.SetValue("", "Open with winalfred");
|
||||
|
||||
openKey = shellKey.OpenSubKey("open", true);
|
||||
openKey.CreateSubKey("command");
|
||||
RegistryKey commandKey = openKey.OpenSubKey("command", true);
|
||||
string pathString = "\"" + filePath + "\" \"%1\"";
|
||||
commandKey.SetValue("", pathString);
|
||||
|
||||
//refresh cache
|
||||
SHChangeNotify(0x8000000, 0, IntPtr.Zero, IntPtr.Zero);
|
||||
}
|
||||
}
|
||||
}
|
||||
55
WinAlfred.WorkflowInstaller/Properties/AssemblyInfo.cs
Normal file
55
WinAlfred.WorkflowInstaller/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using System.Reflection;
|
||||
using System.Resources;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows;
|
||||
|
||||
// 有关程序集的常规信息通过以下
|
||||
// 特性集控制。更改这些特性值可修改
|
||||
// 与程序集关联的信息。
|
||||
[assembly: AssemblyTitle("WinAlfred.WorkflowInstaller")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("qianlifeng")]
|
||||
[assembly: AssemblyProduct("WinAlfred.WorkflowInstaller")]
|
||||
[assembly: AssemblyCopyright("Copyright © Microsoft 2014")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// 将 ComVisible 设置为 false 使此程序集中的类型
|
||||
// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型,
|
||||
// 则将该类型上的 ComVisible 特性设置为 true。
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
//若要开始生成可本地化的应用程序,请在
|
||||
//<PropertyGroup> 中的 .csproj 文件中
|
||||
//设置 <UICulture>CultureYouAreCodingWith</UICulture>。例如,如果您在源文件中
|
||||
//使用的是美国英语,请将 <UICulture> 设置为 en-US。然后取消
|
||||
//对以下 NeutralResourceLanguage 特性的注释。更新
|
||||
//以下行中的“en-US”以匹配项目文件中的 UICulture 设置。
|
||||
|
||||
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
|
||||
|
||||
|
||||
[assembly: ThemeInfo(
|
||||
ResourceDictionaryLocation.None, //主题特定资源词典所处位置
|
||||
//(在页面或应用程序资源词典中
|
||||
// 未找到某个资源的情况下使用)
|
||||
ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置
|
||||
//(在页面、应用程序或任何主题特定资源词典中
|
||||
// 未找到某个资源的情况下使用)
|
||||
)]
|
||||
|
||||
|
||||
// 程序集的版本信息由下面四个值组成:
|
||||
//
|
||||
// 主版本
|
||||
// 次版本
|
||||
// 生成号
|
||||
// 修订号
|
||||
//
|
||||
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
|
||||
// 方法是按如下所示使用“*”:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
71
WinAlfred.WorkflowInstaller/Properties/Resources.Designer.cs
generated
Normal file
71
WinAlfred.WorkflowInstaller/Properties/Resources.Designer.cs
generated
Normal file
@@ -0,0 +1,71 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 此代码由工具生成。
|
||||
// 运行时版本: 4.0.30319.18052
|
||||
//
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||
// 重新生成代码,这些更改将丢失。
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace WinAlfred.WorkflowInstaller.Properties
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 一个强类型的资源类,用于查找本地化的字符串等。
|
||||
/// </summary>
|
||||
// 此类是由 StronglyTypedResourceBuilder
|
||||
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
|
||||
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
|
||||
// (以 /str 作为命令选项),或重新生成 VS 项目。
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources
|
||||
{
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 返回此类使用的、缓存的 ResourceManager 实例。
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((resourceMan == null))
|
||||
{
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WinAlfred.WorkflowInstaller.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 为所有资源查找重写当前线程的 CurrentUICulture 属性,
|
||||
/// 方法是使用此强类型资源类。
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture
|
||||
{
|
||||
get
|
||||
{
|
||||
return resourceCulture;
|
||||
}
|
||||
set
|
||||
{
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
117
WinAlfred.WorkflowInstaller/Properties/Resources.resx
Normal file
117
WinAlfred.WorkflowInstaller/Properties/Resources.resx
Normal file
@@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
30
WinAlfred.WorkflowInstaller/Properties/Settings.Designer.cs
generated
Normal file
30
WinAlfred.WorkflowInstaller/Properties/Settings.Designer.cs
generated
Normal file
@@ -0,0 +1,30 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.18052
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace WinAlfred.WorkflowInstaller.Properties
|
||||
{
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
|
||||
{
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default
|
||||
{
|
||||
get
|
||||
{
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
7
WinAlfred.WorkflowInstaller/Properties/Settings.settings
Normal file
7
WinAlfred.WorkflowInstaller/Properties/Settings.settings
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
||||
129
WinAlfred.WorkflowInstaller/WinAlfred.WorkflowInstaller.csproj
Normal file
129
WinAlfred.WorkflowInstaller/WinAlfred.WorkflowInstaller.csproj
Normal file
@@ -0,0 +1,129 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.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>{FAFCAD04-C37E-477B-88C9-0C945E4FB928}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>WinAlfred.WorkflowInstaller</RootNamespace>
|
||||
<AssemblyName>WinAlfred.WorkflowInstaller</AssemblyName>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
|
||||
<RestorePackages>true</RestorePackages>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationIcon>app.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="ICSharpCode.SharpZipLib">
|
||||
<HintPath>..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="App.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Page Include="MainWindow.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Compile Include="App.xaml.cs">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="IniParser.cs" />
|
||||
<Compile Include="MainWindow.xaml.cs">
|
||||
<DependentUpon>MainWindow.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<None Include="app.manifest">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<None Include="packages.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<AppDesigner Include="Properties\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="app.ico">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\WinAlfred.Plugin\WinAlfred.Plugin.csproj">
|
||||
<Project>{8451ECDD-2EA4-4966-BB0A-7BBC40138E80}</Project>
|
||||
<Name>WinAlfred.Plugin</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>xcopy /Y $(TargetPath) $(SolutionDir)WinAlfred\bin\Debug\
|
||||
xcopy /Y $(TargetDir)ICSharpCode.SharpZipLib.dll $(SolutionDir)WinAlfred\bin\Debug\</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<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>
|
||||
BIN
WinAlfred.WorkflowInstaller/app.ico
Normal file
BIN
WinAlfred.WorkflowInstaller/app.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 361 KiB |
55
WinAlfred.WorkflowInstaller/app.manifest
Normal file
55
WinAlfred.WorkflowInstaller/app.manifest
Normal file
@@ -0,0 +1,55 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
||||
<security>
|
||||
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<!-- UAC 清单选项
|
||||
如果要更改 Windows 用户帐户控制级别,请用以下节点之一替换
|
||||
requestedExecutionLevel 节点。
|
||||
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
|
||||
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
|
||||
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
|
||||
|
||||
指定 requestedExecutionLevel 节点将会禁用文件和注册表虚拟化。
|
||||
如果要利用文件和注册表虚拟化实现向后
|
||||
兼容性,则删除 requestedExecutionLevel 节点。
|
||||
-->
|
||||
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<!-- 此应用程序设计使用的所有 Windows 版本的列表。
|
||||
Windows 将会自动选择最兼容的环境。-->
|
||||
|
||||
<!-- 如果应用程序设计为使用 Windows Vista,请取消注释以下 supportedOS 节点-->
|
||||
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"></supportedOS>-->
|
||||
|
||||
<!-- 如果应用程序设计使用 Windows 7,请取消注释以下 supportedOS 节点-->
|
||||
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>-->
|
||||
|
||||
<!-- 如果应用程序设计为使用 Windows 8,请取消注释以下 supportedOS 节点-->
|
||||
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"></supportedOS>-->
|
||||
|
||||
</application>
|
||||
</compatibility>
|
||||
|
||||
<!-- 启用 Windows 公共控件和对话框的主题(Windows XP 和更高版本) -->
|
||||
<!-- <dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity
|
||||
type="win32"
|
||||
name="Microsoft.Windows.Common-Controls"
|
||||
version="6.0.0.0"
|
||||
processorArchitecture="*"
|
||||
publicKeyToken="6595b64144ccf1df"
|
||||
language="*"
|
||||
/>
|
||||
</dependentAssembly>
|
||||
</dependency>-->
|
||||
|
||||
</asmv1:assembly>
|
||||
4
WinAlfred.WorkflowInstaller/packages.config
Normal file
4
WinAlfred.WorkflowInstaller/packages.config
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="SharpZipLib" version="0.86.0" targetFramework="net35" />
|
||||
</packages>
|
||||
Reference in New Issue
Block a user