mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-08 12:18:50 +02:00
Fix potential issues in control panel.
This commit is contained in:
@@ -51,7 +51,7 @@ namespace Wox.Plugin.SystemPlugins.ControlPanel
|
|||||||
|
|
||||||
foreach (ControlPanelItem item in controlPanelItems)
|
foreach (ControlPanelItem item in controlPanelItems)
|
||||||
{
|
{
|
||||||
if (!File.Exists(iconFolder + item.LocalizedString + fileType))
|
if (!File.Exists(iconFolder + item.LocalizedString + fileType) && item.Icon != null)
|
||||||
{
|
{
|
||||||
item.Icon.ToBitmap().Save(iconFolder + item.LocalizedString + fileType);
|
item.Icon.ToBitmap().Save(iconFolder + item.LocalizedString + fileType);
|
||||||
}
|
}
|
||||||
@@ -101,7 +101,7 @@ namespace Wox.Plugin.SystemPlugins.ControlPanel
|
|||||||
if (item.InfoTip != null && (item.Score = matcher.Evaluate(item.InfoTip).Score) > 0) return true;
|
if (item.InfoTip != null && (item.Score = matcher.Evaluate(item.InfoTip).Score) > 0) return true;
|
||||||
|
|
||||||
if (item.LocalizedString != null && (item.Score = matcher.Evaluate(item.LocalizedString.Unidecode()).Score) > 0) return true;
|
if (item.LocalizedString != null && (item.Score = matcher.Evaluate(item.LocalizedString.Unidecode()).Score) > 0) return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -298,7 +298,12 @@ namespace Wox.Plugin.SystemPlugins.ControlPanel
|
|||||||
args = args.Remove(x);
|
args = args.Remove(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Convert.ToUInt32(args);
|
uint size;
|
||||||
|
if (uint.TryParse(args, out size))
|
||||||
|
{
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool IS_INTRESOURCE(IntPtr value)
|
private static bool IS_INTRESOURCE(IntPtr value)
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ namespace Wox.Helper
|
|||||||
static FontWeightConverter fontWeightConverter = new FontWeightConverter();
|
static FontWeightConverter fontWeightConverter = new FontWeightConverter();
|
||||||
public static FontWeight GetFontWeightFromInvariantStringOrNormal(string value)
|
public static FontWeight GetFontWeightFromInvariantStringOrNormal(string value)
|
||||||
{
|
{
|
||||||
|
if (value == null) return FontWeights.Normal;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return (FontWeight) fontWeightConverter.ConvertFromInvariantString(value);
|
return (FontWeight) fontWeightConverter.ConvertFromInvariantString(value);
|
||||||
@@ -24,7 +26,9 @@ namespace Wox.Helper
|
|||||||
|
|
||||||
static FontStyleConverter fontStyleConverter = new FontStyleConverter();
|
static FontStyleConverter fontStyleConverter = new FontStyleConverter();
|
||||||
public static FontStyle GetFontStyleFromInvariantStringOrNormal(string value)
|
public static FontStyle GetFontStyleFromInvariantStringOrNormal(string value)
|
||||||
{
|
{
|
||||||
|
if (value == null) return FontStyles.Normal;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return (FontStyle)fontStyleConverter.ConvertFromInvariantString(value);
|
return (FontStyle)fontStyleConverter.ConvertFromInvariantString(value);
|
||||||
@@ -37,7 +41,8 @@ namespace Wox.Helper
|
|||||||
|
|
||||||
static FontStretchConverter fontStretchConverter = new FontStretchConverter();
|
static FontStretchConverter fontStretchConverter = new FontStretchConverter();
|
||||||
public static FontStretch GetFontStretchFromInvariantStringOrNormal(string value)
|
public static FontStretch GetFontStretchFromInvariantStringOrNormal(string value)
|
||||||
{
|
{
|
||||||
|
if (value == null) return FontStretches.Normal;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return (FontStretch)fontStretchConverter.ConvertFromInvariantString(value);
|
return (FontStretch)fontStretchConverter.ConvertFromInvariantString(value);
|
||||||
|
|||||||
Reference in New Issue
Block a user