Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ paket-files/
# New to Visual Studio
*.VC.db

## Wox specific
## Flow Launcher specific
Output/*
/Python.Runtime.dll
Thumbs.db
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

namespace Wox.Core.Configuration
namespace Flow.Launcher.Core.Configuration
{
public interface IPortable
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
using System.IO;
using System.Reflection;
using System.Windows;
using Wox.Infrastructure;
using Wox.Infrastructure.Logger;
using Wox.Infrastructure.UserSettings;
using Wox.Plugin.SharedCommands;
using Flow.Launcher.Infrastructure;
using Flow.Launcher.Infrastructure.Logger;
using Flow.Launcher.Infrastructure.UserSettings;
using Flow.Launcher.Plugin.SharedCommands;
using System.Linq;

namespace Wox.Core.Configuration
namespace Flow.Launcher.Core.Configuration
{
public class Portable : IPortable
{
Expand All @@ -19,7 +20,11 @@ public class Portable : IPortable
/// <returns></returns>
private UpdateManager NewUpdateManager()
{
return new UpdateManager(string.Empty, Constant.Wox, Constant.RootDirectory);
var applicationFolderName = Constant.ApplicationDirectory
.Split(new[] { Path.DirectorySeparatorChar }, StringSplitOptions.None)
.Last();

return new UpdateManager(string.Empty, applicationFolderName, Constant.RootDirectory);
}

public void DisablePortableMode()
Expand All @@ -36,7 +41,7 @@ public void DisablePortableMode()
#endif
IndicateDeletion(DataLocation.PortableDataPath);

MessageBox.Show("Wox needs to restart to finish disabling portable mode, " +
MessageBox.Show("Flow Launcher needs to restart to finish disabling portable mode, " +
"after the restart your portable data profile will be deleted and roaming data profile kept");

UpdateManager.RestartApp(Constant.ApplicationFileName);
Expand Down Expand Up @@ -64,7 +69,7 @@ public void EnablePortableMode()
#endif
IndicateDeletion(DataLocation.RoamingDataPath);

MessageBox.Show("Wox needs to restart to finish enabling portable mode, " +
MessageBox.Show("Flow Launcher needs to restart to finish enabling portable mode, " +
"after the restart your roaming data profile will be deleted and portable data profile kept");

UpdateManager.RestartApp(Constant.ApplicationFileName);
Expand Down Expand Up @@ -126,7 +131,7 @@ public void CreateUninstallerEntry()
.CreateSubKey("Uninstall", RegistryKeyPermissionCheck.ReadWriteSubTree)) {; }

var key = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Default)
.CreateSubKey(uninstallRegSubKey + "\\" + Constant.Wox, RegistryKeyPermissionCheck.ReadWriteSubTree);
.CreateSubKey(uninstallRegSubKey + "\\" + Constant.FlowLauncher, RegistryKeyPermissionCheck.ReadWriteSubTree);
key.SetValue("DisplayIcon", Constant.ApplicationDirectory + "\\app.ico", RegistryValueKind.String);

using (var portabilityUpdater = NewUpdateManager())
Expand All @@ -142,13 +147,13 @@ internal void IndicateDeletion(string filePathTodelete)

///<summary>
///This method should be run at first before all methods during start up and should be run before determining which data location
///will be used for Wox.
///will be used for Flow Launcher.
///</summary>
public void PreStartCleanUpAfterPortabilityUpdate()
{
// Specify here so this method does not rely on other environment variables to initialise
var portableDataPath = Path.Combine(Directory.GetParent(Assembly.GetExecutingAssembly().Location.NonNull()).ToString(), "UserData");
var roamingDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Wox");
var roamingDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "FlowLauncher");

bool DataLocationPortableDeleteRequired = false;
bool DataLocationRoamingDeleteRequired = false;
Expand All @@ -163,7 +168,7 @@ public void PreStartCleanUpAfterPortabilityUpdate()
{
FilesFolders.RemoveFolderIfExists(roamingDataPath);

if (MessageBox.Show("Wox has detected you enabled portable mode, " +
if (MessageBox.Show("Flow Launcher has detected you enabled portable mode, " +
"would you like to move it to a different location?", string.Empty,
MessageBoxButton.YesNo) == MessageBoxResult.Yes)
{
Expand All @@ -179,7 +184,7 @@ public void PreStartCleanUpAfterPortabilityUpdate()
{
FilesFolders.RemoveFolderIfExists(portableDataPath);

MessageBox.Show("Wox has detected you disabled portable mode, " +
MessageBox.Show("Flow Launcher has detected you disabled portable mode, " +
"the relevant shortcuts and uninstaller entry have been created");

return;
Expand All @@ -193,7 +198,7 @@ public bool CanUpdatePortability()

if(roamingLocationExists && portableLocationExists)
{
MessageBox.Show(string.Format("Wox detected your user data exists both in {0} and " +
MessageBox.Show(string.Format("Flow Launcher detected your user data exists both in {0} and " +
"{1}. {2}{2}Please delete {1} in order to proceed. No changes have occured.",
DataLocation.PortableDataPath, DataLocation.RoamingDataPath, Environment.NewLine));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<UseWindowsForms>true</UseWindowsForms>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Wox.Core</RootNamespace>
<AssemblyName>Wox.Core</AssemblyName>
<RootNamespace>Flow.Launcher.Core</RootNamespace>
<AssemblyName>Flow.Launcher.Core</AssemblyName>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
Expand Down Expand Up @@ -68,8 +68,8 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Wox.Infrastructure\Wox.Infrastructure.csproj" />
<ProjectReference Include="..\Wox.Plugin\Wox.Plugin.csproj" />
<ProjectReference Include="..\Flow.Launcher.Infrastructure\Flow.Launcher.Infrastructure.csproj" />
<ProjectReference Include="..\Flow.Launcher.Plugin\Flow.Launcher.Plugin.csproj" />
</ItemGroup>

</Project>
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using System;
using System.Diagnostics;
using Wox.Plugin;
using Flow.Launcher.Plugin;

namespace Wox.Core.Plugin
namespace Flow.Launcher.Core.Plugin
{
internal class ExecutablePlugin : JsonRPCPlugin
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@

/* We basically follow the Json-RPC 2.0 spec (http://www.jsonrpc.org/specification) to invoke methods between Wox and other plugins,
/* We basically follow the Json-RPC 2.0 spec (http://www.jsonrpc.org/specification) to invoke methods between Flow Launcher and other plugins,
* like python or other self-execute program. But, we added addtional infos (proxy and so on) into rpc request. Also, we didn't use the
* "id" and "jsonrpc" in the request, since it's not so useful in our request model.
*
* When execute a query:
* Wox -------JsonRPCServerRequestModel--------> client
* Wox <------JsonRPCQueryResponseModel--------- client
* Flow Launcher -------JsonRPCServerRequestModel--------> client
* Flow Launcher <------JsonRPCQueryResponseModel--------- client
*
* When execute a action (which mean user select an item in reulst item):
* Wox -------JsonRPCServerRequestModel--------> client
* Wox <------JsonRPCResponseModel-------------- client
* Flow Launcher -------JsonRPCServerRequestModel--------> client
* Flow Launcher <------JsonRPCResponseModel-------------- client
*
*/

using System.Collections.Generic;
using System.Linq;
using Wox.Plugin;
using Flow.Launcher.Plugin;

namespace Wox.Core.Plugin
namespace Flow.Launcher.Core.Plugin
{
public class JsonRPCErrorModel
{
Expand Down Expand Up @@ -98,7 +98,7 @@ private string ReplaceEscapes(string str)
}

/// <summary>
/// Json RPC Request that Wox sent to client
/// Json RPC Request that Flow Launcher sent to client
/// </summary>
public class JsonRPCServerRequestModel : JsonRPCRequestModel
{
Expand All @@ -110,7 +110,7 @@ public override string ToString()
}

/// <summary>
/// Json RPC Request(in query response) that client sent to Wox
/// Json RPC Request(in query response) that client sent to Flow Launcher
/// </summary>
public class JsonRPCClientRequestModel : JsonRPCRequestModel
{
Expand All @@ -124,9 +124,9 @@ public override string ToString()
}

/// <summary>
/// Represent the json-rpc result item that client send to Wox
/// Represent the json-rpc result item that client send to Flow Launcher
/// Typically, we will send back this request model to client after user select the result item
/// But if the request method starts with "Wox.", we will invoke the public APIs we expose.
/// But if the request method starts with "Flow Launcher.", we will invoke the public APIs we expose.
/// </summary>
public class JsonRPCResult : Result
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
using System.Threading.Tasks;
using System.Windows.Forms;
using Newtonsoft.Json;
using Wox.Infrastructure.Exception;
using Wox.Infrastructure.Logger;
using Wox.Plugin;
using Flow.Launcher.Infrastructure.Exception;
using Flow.Launcher.Infrastructure.Logger;
using Flow.Launcher.Plugin;

namespace Wox.Core.Plugin
namespace Flow.Launcher.Core.Plugin
{
/// <summary>
/// Represent the plugin that using JsonPRC
Expand Down Expand Up @@ -77,19 +77,19 @@ private List<Result> DeserializedResult(string output)

if (!String.IsNullOrEmpty(result1.JsonRPCAction.Method))
{
if (result1.JsonRPCAction.Method.StartsWith("Wox."))
if (result1.JsonRPCAction.Method.StartsWith("Flow.Launcher."))
{
ExecuteWoxAPI(result1.JsonRPCAction.Method.Substring(4), result1.JsonRPCAction.Parameters);
ExecuteFlowLauncherAPI(result1.JsonRPCAction.Method.Substring(4), result1.JsonRPCAction.Parameters);
}
else
{
string actionReponse = ExecuteCallback(result1.JsonRPCAction);
JsonRPCRequestModel jsonRpcRequestModel = JsonConvert.DeserializeObject<JsonRPCRequestModel>(actionReponse);
if (jsonRpcRequestModel != null
&& !String.IsNullOrEmpty(jsonRpcRequestModel.Method)
&& jsonRpcRequestModel.Method.StartsWith("Wox."))
&& jsonRpcRequestModel.Method.StartsWith("Flow.Launcher."))
{
ExecuteWoxAPI(jsonRpcRequestModel.Method.Substring(4), jsonRpcRequestModel.Parameters);
ExecuteFlowLauncherAPI(jsonRpcRequestModel.Method.Substring(4), jsonRpcRequestModel.Parameters);
}
}
}
Expand All @@ -105,7 +105,7 @@ private List<Result> DeserializedResult(string output)
}
}

private void ExecuteWoxAPI(string method, object[] parameters)
private void ExecuteFlowLauncherAPI(string method, object[] parameters)
{
MethodInfo methodInfo = PluginManager.API.GetType().GetMethod(method);
if (methodInfo != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
using System.IO;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Wox.Infrastructure.Exception;
using Wox.Infrastructure.Logger;
using Wox.Plugin;
using Flow.Launcher.Infrastructure.Exception;
using Flow.Launcher.Infrastructure.Logger;
using Flow.Launcher.Plugin;

namespace Wox.Core.Plugin
namespace Flow.Launcher.Core.Plugin
{

internal abstract class PluginConfig
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
using System.Windows;
using ICSharpCode.SharpZipLib.Zip;
using Newtonsoft.Json;
using Wox.Plugin;
using Flow.Launcher.Plugin;

namespace Wox.Core.Plugin
namespace Flow.Launcher.Core.Plugin
{
internal class PluginInstaller
{
internal static void Install(string path)
{
if (File.Exists(path))
{
string tempFoler = Path.Combine(Path.GetTempPath(), "wox\\plugins");
string tempFoler = Path.Combine(Path.GetTempPath(), "flowlauncher\\plugins");
if (Directory.Exists(tempFoler))
{
Directory.Delete(tempFoler, true);
Expand Down Expand Up @@ -77,13 +77,13 @@ internal static void Install(string path)
//exsiting plugins may be has loaded by application,
//if we try to delelte those kind of plugins, we will get a error that indicate the
//file is been used now.
//current solution is to restart wox. Ugly.
//current solution is to restart Flow Launcher. Ugly.
//if (MainWindow.Initialized)
//{
// Plugins.Initialize();
//}
if (MessageBox.Show($"You have installed plugin {plugin.Name} successfully.{Environment.NewLine}" +
"Restart Wox to take effect?",
"Restart Flow Launcher to take effect?",
"Install plugin", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
{
PluginManager.API.RestarApp();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Wox.Infrastructure;
using Wox.Infrastructure.Logger;
using Wox.Infrastructure.Storage;
using Wox.Infrastructure.UserSettings;
using Wox.Plugin;
using Flow.Launcher.Infrastructure;
using Flow.Launcher.Infrastructure.Logger;
using Flow.Launcher.Infrastructure.Storage;
using Flow.Launcher.Infrastructure.UserSettings;
using Flow.Launcher.Plugin;

namespace Wox.Core.Plugin
namespace Flow.Launcher.Core.Plugin
{
/// <summary>
/// The entry for managing Wox plugins
/// The entry for managing Flow Launcher plugins
/// </summary>
public static class PluginManager
{
private static IEnumerable<PluginPair> _contextMenuPlugins;

/// <summary>
/// Directories that will hold Wox plugin directory
/// Directories that will hold Flow Launcher plugin directory
/// </summary>

public static List<PluginPair> AllPlugins { get; private set; }
Expand All @@ -44,7 +44,7 @@ private static void ValidateUserDirectory()

private static void DeletePythonBinding()
{
const string binding = "wox.py";
const string binding = "flowlauncher.py";
var directory = DataLocation.PluginsDirectory;
foreach (var subDirectory in Directory.GetDirectories(directory))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
using System.Linq;
using System.Reflection;
using System.Runtime.Loader;
using Wox.Infrastructure;
using Wox.Infrastructure.Exception;
using Wox.Infrastructure.Logger;
using Wox.Infrastructure.UserSettings;
using Wox.Plugin;
using Flow.Launcher.Infrastructure;
using Flow.Launcher.Infrastructure.Exception;
using Flow.Launcher.Infrastructure.Logger;
using Flow.Launcher.Infrastructure.UserSettings;
using Flow.Launcher.Plugin;

namespace Wox.Core.Plugin
namespace Flow.Launcher.Core.Plugin
{
public static class PluginsLoader
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using System;
using System.Diagnostics;
using System.IO;
using Wox.Infrastructure;
using Wox.Plugin;
using Flow.Launcher.Infrastructure;
using Flow.Launcher.Plugin;

namespace Wox.Core.Plugin
namespace Flow.Launcher.Core.Plugin
{
internal class PythonPlugin : JsonRPCPlugin
{
Expand Down
Loading