Stylecop compliance

This commit is contained in:
Tomas Raies
2020-04-08 00:19:00 -07:00
committed by Tomas Agustin Raies
parent 443b3c8b82
commit a85b84fd56
17 changed files with 260 additions and 183 deletions

View File

@@ -1,5 +1,7 @@
using System;
using System.Collections.Generic;
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Text;
namespace Microsoft.PowerToys.Settings.UI.Lib
@@ -7,33 +9,42 @@ namespace Microsoft.PowerToys.Settings.UI.Lib
public class HotkeySettings
{
public bool win { get; set; }
public bool ctrl { get; set; }
public bool alt { get; set; }
public bool shift { get; set; }
public string key { get; set; }
public int code { get; set; }
public override string ToString()
{
StringBuilder output = new StringBuilder();
if (win)
if (this.win)
{
output.Append("Win + ");
}
if (ctrl)
if (this.ctrl)
{
output.Append("Ctrl + ");
}
if (alt)
if (this.alt)
{
output.Append("Alt + ");
}
if (shift)
if (this.shift)
{
output.Append("Shift + ");
}
output.Append(key);
output.Append(this.key);
return output.ToString();
}
}

View File

@@ -0,0 +1,39 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace Microsoft.PowerToys.Settings.UI.Lib
{
public class PowerLauncherProperties
{
public bool enable_powerlauncher { get; set; }
public string search_result_preference { get; set; }
public string search_type_preference { get; set; }
public int maximum_number_of_results { get; set; }
public HotkeySettings open_powerlauncher { get; set; }
public HotkeySettings open_file_location { get; set; }
public HotkeySettings copy_path_location { get; set; }
public HotkeySettings open_console { get; set; }
public bool override_win_r_key { get; set; }
public bool override_win_s_key { get; set; }
public PowerLauncherProperties()
{
this.open_powerlauncher = new HotkeySettings();
this.open_file_location = new HotkeySettings();
this.copy_path_location = new HotkeySettings();
this.open_console = new HotkeySettings();
this.search_result_preference = "most_recently_used";
this.search_type_preference = "application_name";
}
}
}

View File

@@ -1,13 +1,13 @@
using System;
using System.Collections.Generic;
using System.Text;
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace Microsoft.PowerToys.Settings.UI.Lib
{
public class PowerLauncherSettings : BasePTModuleSettings
{
public PowerLauncherProperties properties { get; set; }
public PowerLauncherSettings()
{
this.properties = new PowerLauncherProperties();
@@ -15,28 +15,4 @@ namespace Microsoft.PowerToys.Settings.UI.Lib
this.name = "_unset_";
}
}
public class PowerLauncherProperties
{
public bool enable_powerlauncher { get; set; }
public string search_result_preference { get; set; }
public string search_type_preference { get; set; }
public int maximum_number_of_results { get; set; }
public HotkeySettings open_powerlauncher { get; set; }
public HotkeySettings open_file_location { get; set; }
public HotkeySettings copy_path_location { get; set; }
public HotkeySettings open_console { get; set; }
public bool override_win_r_key { get; set; }
public bool override_win_s_key { get; set; }
public PowerLauncherProperties()
{
open_powerlauncher = new HotkeySettings();
open_file_location = new HotkeySettings();
copy_path_location = new HotkeySettings();
open_console = new HotkeySettings();
search_result_preference = "most_recently_used";
search_type_preference = "application_name";
}
}
}

View File

@@ -10,10 +10,10 @@ using System.Text.Json.Serialization;
namespace Microsoft.PowerToys.Settings.UI.Lib
{
public class PowerPreviewProperties
{
public BoolProperty IDS_PREVPANE_SVG_BOOL_TOGGLE_CONTROLL { get; set; }
public BoolProperty PREVPANE_MD_BOOL_TOGGLE_CONTROLL_ID { get; set; }
public PowerPreviewProperties()

View File

@@ -20,10 +20,13 @@ namespace Microsoft.PowerToys.Settings.UI.Lib
}
public BoolProperty bool_persist_input { get; set; }
public BoolProperty bool_mru_enabled { get; set; }
public IntProperty int_max_mru_size { get; set; }
public BoolProperty bool_show_icon_on_menu { get; set; }
public BoolProperty bool_show_extended_menu { get; set; }
}
}

View File

@@ -30,4 +30,4 @@ namespace Microsoft.PowerToys.Settings.UI.Lib
return JsonSerializer.Serialize(this);
}
}
}
}

View File

@@ -1,18 +1,15 @@
using System;
using System.Collections.Generic;
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.IO;
using System.Text;
using System.Text.Json;
namespace Microsoft.PowerToys.Settings.UI.Lib
{
public static class SettingsUtils
{
private static string LocalApplicationDataFolder()
{
return Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
}
public static bool SettingsFolderExists(string powertoy)
{
return Directory.Exists(Path.Combine(LocalApplicationDataFolder(), $"Microsoft\\PowerToys\\{powertoy}"));
@@ -59,16 +56,22 @@ namespace Microsoft.PowerToys.Settings.UI.Lib
// Save settings to a json file.
public static void SaveSettings(string jsonSettings, string powertoy)
{
if(jsonSettings != null)
if (jsonSettings != null)
{
if (!SettingsFolderExists(powertoy))
{
CreateSettingsFolder(powertoy);
}
System.IO.File.WriteAllText(
SettingsUtils.GetSettingsPath(powertoy),
jsonSettings);
}
}
private static string LocalApplicationDataFolder()
{
return Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
}
}
}

View File

@@ -10,7 +10,6 @@ using System.Text.Json.Serialization;
namespace Microsoft.PowerToys.Settings.UI.Lib
{
public class SndPowerPreviewSettings
{
[JsonPropertyName("File Explorer Preview")]

View File

@@ -22,4 +22,4 @@ namespace Microsoft.PowerToys.Settings.UI.Lib
return JsonSerializer.Serialize(this);
}
}
}
}