Cleanup Editor cmd args (#4022)
This commit is contained in:
parent
f5dc197e8b
commit
2b62244806
|
@ -2,7 +2,6 @@
|
|||
// 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.Windows;
|
||||
using FancyZonesEditor.Models;
|
||||
|
||||
|
|
|
@ -21,9 +21,7 @@ namespace FancyZonesEditor
|
|||
{
|
||||
private enum CmdArgs
|
||||
{
|
||||
MonitorHandle = 1,
|
||||
X_Y_Width_Height,
|
||||
ResolutionKey,
|
||||
X_Y_Width_Height = 1,
|
||||
ActiveZoneSetTmpFile,
|
||||
AppliedZoneSetTmpFile,
|
||||
CustomZoneSetsTmpFile,
|
||||
|
@ -217,8 +215,6 @@ namespace FancyZonesEditor
|
|||
|
||||
public static Rect WorkArea { get; private set; }
|
||||
|
||||
public static uint Monitor { get; private set; }
|
||||
|
||||
public static string UniqueKey { get; private set; }
|
||||
|
||||
public static string ActiveZoneSetUUid { get; private set; }
|
||||
|
@ -246,8 +242,6 @@ namespace FancyZonesEditor
|
|||
|
||||
private static string _customZoneSetsTmpFile;
|
||||
|
||||
public static string WorkAreaKey { get; private set; }
|
||||
|
||||
// UpdateLayoutModels
|
||||
// Update the five default layouts based on the new ZoneCount
|
||||
private void UpdateLayoutModels()
|
||||
|
@ -414,16 +408,10 @@ namespace FancyZonesEditor
|
|||
private void ParseCommandLineArgs()
|
||||
{
|
||||
WorkArea = SystemParameters.WorkArea;
|
||||
Monitor = 0;
|
||||
|
||||
string[] args = Environment.GetCommandLineArgs();
|
||||
if (args.Length == 7)
|
||||
if (args.Length == 5)
|
||||
{
|
||||
if (uint.TryParse(args[(int)CmdArgs.MonitorHandle], out uint monitor))
|
||||
{
|
||||
Monitor = monitor;
|
||||
}
|
||||
|
||||
var parsedLocation = args[(int)CmdArgs.X_Y_Width_Height].Split('_');
|
||||
var x = int.Parse(parsedLocation[0]);
|
||||
var y = int.Parse(parsedLocation[1]);
|
||||
|
@ -432,8 +420,6 @@ namespace FancyZonesEditor
|
|||
|
||||
WorkArea = new Rect(x, y, width, height);
|
||||
|
||||
WorkAreaKey = args[(int)CmdArgs.ResolutionKey];
|
||||
|
||||
_activeZoneSetTmpFile = args[(int)CmdArgs.ActiveZoneSetTmpFile];
|
||||
_appliedZoneSetTmpFile = args[(int)CmdArgs.AppliedZoneSetTmpFile];
|
||||
_customZoneSetsTmpFile = args[(int)CmdArgs.CustomZoneSetsTmpFile];
|
||||
|
|
|
@ -445,9 +445,6 @@ void FancyZones::ToggleEditor() noexcept
|
|||
} })
|
||||
.wait();
|
||||
|
||||
const auto& fancyZonesData = JSONHelpers::FancyZonesDataInstance();
|
||||
fancyZonesData.CustomZoneSetsToJsonFile(ZoneWindowUtils::GetCustomZoneSetsTmpPath());
|
||||
|
||||
const auto taskbar_x_offset = mi.rcWork.left - mi.rcMonitor.left;
|
||||
const auto taskbar_y_offset = mi.rcWork.top - mi.rcMonitor.top;
|
||||
const auto x = mi.rcMonitor.left + taskbar_x_offset;
|
||||
|
@ -460,6 +457,9 @@ void FancyZones::ToggleEditor() noexcept
|
|||
std::to_wstring(width) + L"_" +
|
||||
std::to_wstring(height);
|
||||
|
||||
const auto& fancyZonesData = JSONHelpers::FancyZonesDataInstance();
|
||||
fancyZonesData.CustomZoneSetsToJsonFile(ZoneWindowUtils::GetCustomZoneSetsTmpPath());
|
||||
|
||||
const auto deviceInfo = fancyZonesData.FindDeviceInfo(zoneWindow->UniqueId());
|
||||
if (!deviceInfo.has_value())
|
||||
{
|
||||
|
@ -470,12 +470,10 @@ void FancyZones::ToggleEditor() noexcept
|
|||
fancyZonesData.SerializeDeviceInfoToTmpFile(deviceInfoJson, ZoneWindowUtils::GetActiveZoneSetTmpPath());
|
||||
|
||||
const std::wstring params =
|
||||
/*1*/ std::to_wstring(reinterpret_cast<UINT_PTR>(monitor)) + L" " +
|
||||
/*2*/ editorLocation + L" " +
|
||||
/*3*/ zoneWindow->WorkAreaKey() + L" " +
|
||||
/*4*/ L"\"" + ZoneWindowUtils::GetActiveZoneSetTmpPath() + L"\" " +
|
||||
/*5*/ L"\"" + ZoneWindowUtils::GetAppliedZoneSetTmpPath() + L"\" " +
|
||||
/*6*/ L"\"" + ZoneWindowUtils::GetCustomZoneSetsTmpPath() + L"\"";
|
||||
/*1*/ editorLocation + L" " +
|
||||
/*2*/ L"\"" + ZoneWindowUtils::GetActiveZoneSetTmpPath() + L"\" " +
|
||||
/*3*/ L"\"" + ZoneWindowUtils::GetAppliedZoneSetTmpPath() + L"\" " +
|
||||
/*4*/ L"\"" + ZoneWindowUtils::GetCustomZoneSetsTmpPath() + L"\"";
|
||||
|
||||
SHELLEXECUTEINFO sei{ sizeof(sei) };
|
||||
sei.fMask = { SEE_MASK_NOCLOSEPROCESS | SEE_MASK_FLAG_NO_UI };
|
||||
|
|
Loading…
Reference in a new issue