fix location null

This commit is contained in:
bao-qian
2016-11-29 01:55:11 +00:00
parent 70f8a771a9
commit 6b640ea55e

View File

@@ -216,7 +216,6 @@ namespace Wox.Plugin.Program.Programs
public string LogoUri { get; set; } public string LogoUri { get; set; }
public string LogoPath { get; set; } public string LogoPath { get; set; }
public string Location { get; set; }
public UWP Package { get; set; } public UWP Package { get; set; }
private int Score(string query) private int Score(string query)
@@ -232,7 +231,7 @@ namespace Wox.Plugin.Program.Programs
{ {
var result = new Result var result = new Result
{ {
SubTitle = Location, SubTitle = Package.Location,
Icon = Logo, Icon = Logo,
Score = Score(query), Score = Score(query),
ContextData = this, ContextData = this,
@@ -268,7 +267,7 @@ namespace Wox.Plugin.Program.Programs
Title = api.GetTranslation("wox_plugin_program_open_containing_folder"), Title = api.GetTranslation("wox_plugin_program_open_containing_folder"),
Action = _ => Action = _ =>
{ {
var hide = Main.StartProcess(new ProcessStartInfo(Location)); var hide = Main.StartProcess(new ProcessStartInfo(Package.Location));
return hide; return hide;
}, },
IcoPath = "Images/folder.png" IcoPath = "Images/folder.png"
@@ -304,9 +303,8 @@ namespace Wox.Plugin.Program.Programs
DisplayName = manifestApp.GetStringValue("DisplayName"); DisplayName = manifestApp.GetStringValue("DisplayName");
Description = manifestApp.GetStringValue("Description"); Description = manifestApp.GetStringValue("Description");
BackgroundColor = manifestApp.GetStringValue("BackgroundColor"); BackgroundColor = manifestApp.GetStringValue("BackgroundColor");
Location = Location;
Package = package; Package = package;
DisplayName = ResourceFromPri(package.FullName, DisplayName); DisplayName = ResourceFromPri(package.FullName, DisplayName);
Description = ResourceFromPri(package.FullName, Description); Description = ResourceFromPri(package.FullName, Description);
LogoUri = LogoUriFromManifest(manifestApp); LogoUri = LogoUriFromManifest(manifestApp);
@@ -348,7 +346,7 @@ namespace Wox.Plugin.Program.Programs
} }
else else
{ {
Log.Error($"Load {source} failed, null or empty result. Package location: <{Location}>."); Log.Error($"Load {source} failed, null or empty result. Package location: <{Package.Location}>.");
return string.Empty; return string.Empty;
} }
} }
@@ -359,7 +357,7 @@ namespace Wox.Plugin.Program.Programs
// for // for
// Microsoft.MicrosoftOfficeHub_17.7608.23501.0_x64__8wekyb3d8bbwe: ms-resource://Microsoft.MicrosoftOfficeHub/officehubintl/AppManifest_GetOffice_Description // Microsoft.MicrosoftOfficeHub_17.7608.23501.0_x64__8wekyb3d8bbwe: ms-resource://Microsoft.MicrosoftOfficeHub/officehubintl/AppManifest_GetOffice_Description
// Microsoft.BingFoodAndDrink_3.0.4.336_x64__8wekyb3d8bbwe: ms-resource:AppDescription // Microsoft.BingFoodAndDrink_3.0.4.336_x64__8wekyb3d8bbwe: ms-resource:AppDescription
Log.Error($"Load {source} failed, HResult error code: {hResult}. Package location: <{Location}>."); Log.Error($"Load {source} failed, HResult error code: {hResult}. Package location: <{Package.Location}>.");
var exception = Marshal.GetExceptionForHR((int)hResult); var exception = Marshal.GetExceptionForHR((int)hResult);
Log.Exception(exception); Log.Exception(exception);
return string.Empty; return string.Empty;
@@ -402,12 +400,12 @@ namespace Wox.Plugin.Program.Programs
string path; string path;
if (uri.Contains("\\")) if (uri.Contains("\\"))
{ {
path = Path.Combine(Location, uri); path = Path.Combine(Package.Location, uri);
} }
else else
{ {
// for C:\Windows\MiracastView etc // for C:\Windows\MiracastView etc
path = Path.Combine(Location, "Assets", uri); path = Path.Combine(Package.Location, "Assets", uri);
} }
var extension = Path.GetExtension(path); var extension = Path.GetExtension(path);