mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-29 16:36:40 +01:00
Compare commits
5 Commits
dev/migrie
...
v0.15.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1a397bf4fd | ||
|
|
eedba11a7b | ||
|
|
89832b5224 | ||
|
|
5d46c6a313 | ||
|
|
6794afac0c |
@@ -59,7 +59,7 @@ build:
|
||||
- from: 'installer\PowerToysSetup\x64\Release'
|
||||
to: 'Build_Installer_Output'
|
||||
include:
|
||||
- 'PowerToysSetup.msi'
|
||||
- 'PowerToysSetup-*.msi'
|
||||
signing_options:
|
||||
sign_inline: true # This does signing a soon as this command completes
|
||||
# - !!buildcommand
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
xmlns:desktop="http://schemas.microsoft.com/appx/manifest/desktop/windows10"
|
||||
xmlns:desktop4="http://schemas.microsoft.com/appx/manifest/desktop/windows10/4"
|
||||
xmlns:desktop5="http://schemas.microsoft.com/appx/manifest/desktop/windows10/5" IgnorableNamespaces="desktop4">
|
||||
<Identity Name="Microsoft.PowerToys" Version="0.15.1.0" Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US" ProcessorArchitecture="x64" />
|
||||
<Identity Name="Microsoft.PowerToys" Version="0.15.2.0" Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US" ProcessorArchitecture="x64" />
|
||||
<Properties>
|
||||
<DisplayName>PowerToys</DisplayName>
|
||||
<PublisherDisplayName>Microsoft Corporation</PublisherDisplayName>
|
||||
|
||||
@@ -1,4 +1,14 @@
|
||||
cd /D "%~dp0"
|
||||
|
||||
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsDevCmd.bat" -arch=amd64 -host_arch=amd64 -winsdk=10.0.18362.0
|
||||
|
||||
powershell -file update_appxmanifest_version.ps1 || exit /b 1
|
||||
|
||||
call makeappx build /v /overwrite /f PackagingLayout.xml /id "PowerToys-x64" /op bin\ || exit /b 1
|
||||
|
||||
setlocal EnableDelayedExpansion
|
||||
for /f "tokens=3delims=<>" %%i in ('findstr "<Version>" "..\Version.props"') do (
|
||||
set MSIXVERSION=%%i
|
||||
)
|
||||
setlocal DisableDelayedExpansion
|
||||
ren "bin\PowerToys-x64.msix" PowerToysSetup-%MSIXVERSION%-x64.msix
|
||||
|
||||
5
installer/MSIX/update_appxmanifest_version.ps1
Normal file
5
installer/MSIX/update_appxmanifest_version.ps1
Normal file
@@ -0,0 +1,5 @@
|
||||
$version = ([xml](Get-Content ..\Version.props)).Project.PropertyGroup.Version
|
||||
|
||||
(Get-Content appxmanifest.xml) `
|
||||
-replace '(Name="[\.\w]+"\sVersion=")([\d\.]+)"', -join('${1}', $version, '.0"') `
|
||||
| Out-File -Encoding utf8 appxmanifest.xml
|
||||
@@ -1,13 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" InitialTargets="EnsureNuGetPackageBuildImports" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\packages\WiX.3.11.2\build\wix.props" Condition="Exists('..\packages\WiX.3.11.2\build\wix.props')" />
|
||||
<Import Project="$(SolutionDir)Version.props" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Release</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x64</Platform>
|
||||
<ProductVersion>3.10</ProductVersion>
|
||||
<ProjectGuid>022a9d30-7c4f-416d-a9df-5ff2661cc0ad</ProjectGuid>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<OutputName>PowerToysSetup</OutputName>
|
||||
<OutputName>PowerToysSetup-$(Version)-$(Platform)</OutputName>
|
||||
<OutputType>Package</OutputType>
|
||||
<SuppressAclReset>True</SuppressAclReset>
|
||||
<NuGetPackageImportStamp>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<Product Id="*"
|
||||
Name="PowerToys (Preview)"
|
||||
Language="1033"
|
||||
Version="0.15.1"
|
||||
Version="$(var.Version)"
|
||||
Manufacturer="Microsoft"
|
||||
UpgradeCode="42B84BF7-5FBF-473B-9C8B-049DC16F7708">
|
||||
|
||||
@@ -18,9 +18,9 @@
|
||||
|
||||
<Upgrade Id="42B84BF7-5FBF-473B-9C8B-049DC16F7708">
|
||||
<UpgradeVersion
|
||||
Minimum="0.11.0" Maximum="0.14.1"
|
||||
Minimum="0.11.0" Maximum="$(var.Version)"
|
||||
Property="PREVIOUSVERSIONSINSTALLED"
|
||||
IncludeMinimum="yes" IncludeMaximum="yes" />
|
||||
IncludeMinimum="yes" IncludeMaximum="no" />
|
||||
</Upgrade>
|
||||
|
||||
<MediaTemplate EmbedCab="yes" />
|
||||
|
||||
7
installer/Version.props
Normal file
7
installer/Version.props
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Version>0.15.2</Version>
|
||||
<DefineConstants>Version=$(Version);</DefineConstants>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -1,5 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\..\installer\Version.props" />
|
||||
<Target Name="GenerateVersionData" BeforeTargets="PrepareForBuild">
|
||||
<ItemGroup>
|
||||
<HeaderLines Include="#pragma once" />
|
||||
<HeaderLines Include="#define VERSION_MAJOR $(Version.Split('.')[0])" />
|
||||
<HeaderLines Include="#define VERSION_MINOR $(Version.Split('.')[1])" />
|
||||
<HeaderLines Include="#define VERSION_REVISION $(Version.Split('.')[2])" />
|
||||
</ItemGroup>
|
||||
<WriteLinesToFile
|
||||
File="Generated Files\version_gen.h"
|
||||
Lines="@(HeaderLines)"
|
||||
Overwrite="true"
|
||||
Encoding="Unicode"
|
||||
WriteOnlyWhenDifferent="true" />
|
||||
</Target>
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
|
||||
@@ -3,16 +3,14 @@
|
||||
#define STRINGIZE2(s) #s
|
||||
#define STRINGIZE(s) STRINGIZE2(s)
|
||||
|
||||
#define VERSION_MAJOR 0
|
||||
#define VERSION_MINOR 15
|
||||
#define VERSION_REVISION 1
|
||||
|
||||
#define FILE_VERSION VERSION_MAJOR, VERSION_MINOR, VERSION_REVISION, 0
|
||||
#define FILE_VERSION_STRING STRINGIZE(VERSION_MAJOR) "." STRINGIZE(VERSION_MINOR) "." STRINGIZE(VERSION_REVISION) ".0"
|
||||
#include "Generated Files\version_gen.h"
|
||||
|
||||
#define PRODUCT_VERSION FILE_VERSION
|
||||
#define PRODUCT_VERSION_STRING FILE_VERSION_STRING
|
||||
#define FILE_VERSION VERSION_MAJOR, VERSION_MINOR, VERSION_REVISION, 0
|
||||
#define FILE_VERSION_STRING \
|
||||
STRINGIZE(VERSION_MAJOR) \
|
||||
"." STRINGIZE(VERSION_MINOR) "." STRINGIZE(VERSION_REVISION) ".0"
|
||||
#define PRODUCT_VERSION FILE_VERSION
|
||||
#define PRODUCT_VERSION_STRING FILE_VERSION_STRING
|
||||
#define COMPANY_NAME "Microsoft Corporation"
|
||||
|
||||
#define COMPANY_NAME "Microsoft Corporation"
|
||||
#define COPYRIGHT_NOTE "Copyright (C) 2019 Microsoft Corporation"
|
||||
|
||||
#define COPYRIGHT_NOTE "Copyright (C) 2019 Microsoft Corporation"
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace FancyZonesEditor
|
||||
EditorOverlay mainEditor = EditorOverlay.Current;
|
||||
if (mainEditor.DataContext is LayoutModel model)
|
||||
{
|
||||
model.Persist(mainEditor.GetZoneRects());
|
||||
model.Persist();
|
||||
}
|
||||
|
||||
_choosing = true;
|
||||
|
||||
@@ -1,6 +1,48 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<Import Project="..\..\..\..\..\installer\Version.props" />
|
||||
<!-- We don't have GenerateAssemblyInfo task until we use .net core, so we generate it with WriteLinesToFile -->
|
||||
<PropertyGroup>
|
||||
<AssemblyTitle>FancyZonesEditor</AssemblyTitle>
|
||||
<AssemblyCompany>Microsoft Corp.</AssemblyCompany>
|
||||
<AssemblyCopyright>Copyright (C) 2019 Microsoft Corp.</AssemblyCopyright>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<AssemblyVersionFiles Include="Generated Files\AssemblyInfo.cs"/>
|
||||
</ItemGroup>
|
||||
<Target Name="GenerateAssemblyInfo" BeforeTargets="PrepareForBuild">
|
||||
<ItemGroup>
|
||||
<HeaderLines Include="// Copyright (c) Microsoft Corporation" />
|
||||
<HeaderLines Include="// The Microsoft Corporation licenses this file to you under the MIT license." />
|
||||
<HeaderLines Include="// See the LICENSE file in the project root for more information." />
|
||||
|
||||
<HeaderLines Include="#pragma warning disable SA1516" />
|
||||
<HeaderLines Include="using System.Reflection%3b" />
|
||||
<HeaderLines Include="using System.Runtime.InteropServices%3b" />
|
||||
<HeaderLines Include="using System.Windows%3b" />
|
||||
<HeaderLines Include="[assembly: AssemblyTitle("$(AssemblyTitle)")]" />
|
||||
<HeaderLines Include="[assembly: AssemblyDescription("")]" />
|
||||
<HeaderLines Include="[assembly: AssemblyConfiguration("")]" />
|
||||
<HeaderLines Include="[assembly: AssemblyCompany("$(AssemblyCompany)")]" />
|
||||
<HeaderLines Include="[assembly: AssemblyCopyright("$(AssemblyCopyright)")]" />
|
||||
<HeaderLines Include="[assembly: AssemblyProduct("$(AssemblyTitle)")]" />
|
||||
<HeaderLines Include="[assembly: AssemblyTrademark("")]" />
|
||||
<HeaderLines Include="[assembly: AssemblyCulture("")]" />
|
||||
<HeaderLines Include="[assembly: ComVisible(false)]" />
|
||||
<HeaderLines Include="[assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)]" />
|
||||
<HeaderLines Include="[assembly: AssemblyVersion("$(Version).0")]" />
|
||||
<HeaderLines Include="[assembly: AssemblyFileVersion("$(Version).0")]" />
|
||||
</ItemGroup>
|
||||
|
||||
<WriteLinesToFile
|
||||
File="Generated Files\AssemblyInfo.cs"
|
||||
Lines="@(HeaderLines)"
|
||||
Overwrite="true"
|
||||
Encoding="Unicode"
|
||||
WriteOnlyWhenDifferent="true" />
|
||||
</Target>
|
||||
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
@@ -163,7 +205,7 @@
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs">
|
||||
<Compile Include="Generated Files\AssemblyInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
|
||||
@@ -150,11 +150,11 @@ namespace FancyZonesEditor
|
||||
{
|
||||
if (model is GridLayoutModel)
|
||||
{
|
||||
model.Apply(mainEditor.GetZoneRects());
|
||||
model.Apply();
|
||||
}
|
||||
else
|
||||
{
|
||||
model.Apply((model as CanvasLayoutModel).Zones.ToArray());
|
||||
model.Apply();
|
||||
}
|
||||
|
||||
Close();
|
||||
|
||||
@@ -117,46 +117,53 @@ namespace FancyZonesEditor.Models
|
||||
// Implements the LayoutModel.PersistData abstract method
|
||||
protected override void PersistData()
|
||||
{
|
||||
FileStream outputStream = File.Open(Settings.AppliedZoneSetTmpFile, FileMode.Create);
|
||||
JsonWriterOptions writerOptions = new JsonWriterOptions
|
||||
try
|
||||
{
|
||||
SkipValidation = true,
|
||||
};
|
||||
using (var writer = new Utf8JsonWriter(outputStream, writerOptions))
|
||||
{
|
||||
writer.WriteStartObject();
|
||||
writer.WriteString("uuid", "{" + Guid.ToString().ToUpper() + "}");
|
||||
writer.WriteString("name", Name);
|
||||
|
||||
writer.WriteString("type", "canvas");
|
||||
|
||||
writer.WriteStartObject("info");
|
||||
|
||||
writer.WriteNumber("ref-width", _referenceWidth);
|
||||
writer.WriteNumber("ref-height", _referenceHeight);
|
||||
|
||||
writer.WriteStartArray("zones");
|
||||
foreach (Int32Rect rect in Zones)
|
||||
FileStream outputStream = File.Open(Settings.AppliedZoneSetTmpFile, FileMode.Create);
|
||||
JsonWriterOptions writerOptions = new JsonWriterOptions
|
||||
{
|
||||
SkipValidation = true,
|
||||
};
|
||||
using (var writer = new Utf8JsonWriter(outputStream, writerOptions))
|
||||
{
|
||||
writer.WriteStartObject();
|
||||
writer.WriteNumber("X", rect.X);
|
||||
writer.WriteNumber("Y", rect.Y);
|
||||
writer.WriteNumber("width", rect.Width);
|
||||
writer.WriteNumber("height", rect.Height);
|
||||
writer.WriteString("uuid", "{" + Guid.ToString().ToUpper() + "}");
|
||||
writer.WriteString("name", Name);
|
||||
|
||||
writer.WriteString("type", "canvas");
|
||||
|
||||
writer.WriteStartObject("info");
|
||||
|
||||
writer.WriteNumber("ref-width", _referenceWidth);
|
||||
writer.WriteNumber("ref-height", _referenceHeight);
|
||||
|
||||
writer.WriteStartArray("zones");
|
||||
foreach (Int32Rect rect in Zones)
|
||||
{
|
||||
writer.WriteStartObject();
|
||||
writer.WriteNumber("X", rect.X);
|
||||
writer.WriteNumber("Y", rect.Y);
|
||||
writer.WriteNumber("width", rect.Width);
|
||||
writer.WriteNumber("height", rect.Height);
|
||||
writer.WriteEndObject();
|
||||
}
|
||||
|
||||
writer.WriteEndArray();
|
||||
|
||||
// end info object
|
||||
writer.WriteEndObject();
|
||||
|
||||
// end root object
|
||||
writer.WriteEndObject();
|
||||
writer.Flush();
|
||||
}
|
||||
|
||||
writer.WriteEndArray();
|
||||
|
||||
// end info object
|
||||
writer.WriteEndObject();
|
||||
|
||||
// end root object
|
||||
writer.WriteEndObject();
|
||||
writer.Flush();
|
||||
outputStream.Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ShowExceptionMessageBox("Error persisting canvas layout", ex);
|
||||
}
|
||||
|
||||
outputStream.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,10 +2,11 @@
|
||||
// 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.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Windows;
|
||||
|
||||
namespace FancyZonesEditor.Models
|
||||
{
|
||||
@@ -170,59 +171,66 @@ namespace FancyZonesEditor.Models
|
||||
// Implements the LayoutModel.PersistData abstract method
|
||||
protected override void PersistData()
|
||||
{
|
||||
FileStream outputStream = File.Open(Settings.AppliedZoneSetTmpFile, FileMode.Create);
|
||||
using (var writer = new Utf8JsonWriter(outputStream, options: default))
|
||||
try
|
||||
{
|
||||
writer.WriteStartObject();
|
||||
writer.WriteString("uuid", "{" + Guid.ToString().ToUpper() + "}");
|
||||
writer.WriteString("name", Name);
|
||||
|
||||
writer.WriteString("type", "grid");
|
||||
|
||||
writer.WriteStartObject("info");
|
||||
|
||||
writer.WriteNumber("rows", Rows);
|
||||
writer.WriteNumber("columns", Columns);
|
||||
|
||||
writer.WriteStartArray("rows-percentage");
|
||||
for (int row = 0; row < Rows; row++)
|
||||
FileStream outputStream = File.Open(Settings.AppliedZoneSetTmpFile, FileMode.Create);
|
||||
using (var writer = new Utf8JsonWriter(outputStream, options: default))
|
||||
{
|
||||
writer.WriteNumberValue(RowPercents[row]);
|
||||
}
|
||||
writer.WriteStartObject();
|
||||
writer.WriteString("uuid", "{" + Guid.ToString().ToUpper() + "}");
|
||||
writer.WriteString("name", Name);
|
||||
|
||||
writer.WriteEndArray();
|
||||
writer.WriteString("type", "grid");
|
||||
|
||||
writer.WriteStartArray("columns-percentage");
|
||||
for (int col = 0; col < Columns; col++)
|
||||
{
|
||||
writer.WriteNumberValue(ColumnPercents[col]);
|
||||
}
|
||||
writer.WriteStartObject("info");
|
||||
|
||||
writer.WriteEndArray();
|
||||
writer.WriteNumber("rows", Rows);
|
||||
writer.WriteNumber("columns", Columns);
|
||||
|
||||
writer.WriteStartArray("cell-child-map");
|
||||
for (int row = 0; row < Rows; row++)
|
||||
{
|
||||
writer.WriteStartArray();
|
||||
for (int col = 0; col < Columns; col++)
|
||||
writer.WriteStartArray("rows-percentage");
|
||||
for (int row = 0; row < Rows; row++)
|
||||
{
|
||||
writer.WriteNumberValue(CellChildMap[row, col]);
|
||||
writer.WriteNumberValue(RowPercents[row]);
|
||||
}
|
||||
|
||||
writer.WriteEndArray();
|
||||
|
||||
writer.WriteStartArray("columns-percentage");
|
||||
for (int col = 0; col < Columns; col++)
|
||||
{
|
||||
writer.WriteNumberValue(ColumnPercents[col]);
|
||||
}
|
||||
|
||||
writer.WriteEndArray();
|
||||
|
||||
writer.WriteStartArray("cell-child-map");
|
||||
for (int row = 0; row < Rows; row++)
|
||||
{
|
||||
writer.WriteStartArray();
|
||||
for (int col = 0; col < Columns; col++)
|
||||
{
|
||||
writer.WriteNumberValue(CellChildMap[row, col]);
|
||||
}
|
||||
|
||||
writer.WriteEndArray();
|
||||
}
|
||||
|
||||
writer.WriteEndArray();
|
||||
|
||||
// end info object
|
||||
writer.WriteEndObject();
|
||||
|
||||
// end root object
|
||||
writer.WriteEndObject();
|
||||
writer.Flush();
|
||||
}
|
||||
|
||||
writer.WriteEndArray();
|
||||
|
||||
// end info object
|
||||
writer.WriteEndObject();
|
||||
|
||||
// end root object
|
||||
writer.WriteEndObject();
|
||||
writer.Flush();
|
||||
outputStream.Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ShowExceptionMessageBox("Error persisting grid layout", ex);
|
||||
}
|
||||
|
||||
outputStream.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,8 +27,12 @@ namespace FancyZonesEditor.Models
|
||||
// Manages common properties and base persistence
|
||||
public abstract class LayoutModel : INotifyPropertyChanged
|
||||
{
|
||||
private static readonly string _registryPath = Settings.RegistryPath + "\\Layouts";
|
||||
private static readonly string _fullRegistryPath = Settings.FullRegistryPath + "\\Layouts";
|
||||
public static void ShowExceptionMessageBox(string message, Exception ex)
|
||||
{
|
||||
string title = "FancyZones Editor Exception Handler";
|
||||
string fullMessage = "Please report the bug to https://github.com/microsoft/PowerToys/issues \n" + message + ": " + ex.Message;
|
||||
MessageBox.Show(fullMessage, title);
|
||||
}
|
||||
|
||||
protected LayoutModel()
|
||||
{
|
||||
@@ -133,19 +137,26 @@ namespace FancyZonesEditor.Models
|
||||
|
||||
public static void SerializeDeletedCustomZoneSets()
|
||||
{
|
||||
FileStream outputStream = File.Open(Settings.CustomZoneSetsTmpFile, FileMode.Create);
|
||||
var writer = new Utf8JsonWriter(outputStream, options: default);
|
||||
writer.WriteStartObject();
|
||||
writer.WriteStartArray("deleted-custom-zone-sets");
|
||||
foreach (string zoneSet in _deletedCustomModels)
|
||||
try
|
||||
{
|
||||
writer.WriteStringValue(zoneSet);
|
||||
}
|
||||
FileStream outputStream = File.Open(Settings.CustomZoneSetsTmpFile, FileMode.Create);
|
||||
var writer = new Utf8JsonWriter(outputStream, options: default);
|
||||
writer.WriteStartObject();
|
||||
writer.WriteStartArray("deleted-custom-zone-sets");
|
||||
foreach (string zoneSet in _deletedCustomModels)
|
||||
{
|
||||
writer.WriteStringValue(zoneSet);
|
||||
}
|
||||
|
||||
writer.WriteEndArray();
|
||||
writer.WriteEndObject();
|
||||
writer.Flush();
|
||||
outputStream.Close();
|
||||
writer.WriteEndArray();
|
||||
writer.WriteEndObject();
|
||||
writer.Flush();
|
||||
outputStream.Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ShowExceptionMessageBox("Error serializing deleted layouts", ex);
|
||||
}
|
||||
}
|
||||
|
||||
// Loads all the custom Layouts from tmp file passed by FancuZonesLib
|
||||
@@ -153,79 +164,81 @@ namespace FancyZonesEditor.Models
|
||||
{
|
||||
_customModels = new ObservableCollection<LayoutModel>();
|
||||
|
||||
FileStream inputStream = File.Open(Settings.CustomZoneSetsTmpFile, FileMode.Open);
|
||||
JsonDocument jsonObject;
|
||||
try
|
||||
{
|
||||
jsonObject = JsonDocument.Parse(inputStream, options: default);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return _customModels;
|
||||
}
|
||||
FileStream inputStream = File.Open(Settings.CustomZoneSetsTmpFile, FileMode.Open);
|
||||
JsonDocument jsonObject = JsonDocument.Parse(inputStream, options: default);
|
||||
JsonElement.ArrayEnumerator customZoneSetsEnumerator = jsonObject.RootElement.GetProperty("custom-zone-sets").EnumerateArray();
|
||||
|
||||
JsonElement.ArrayEnumerator customZoneSetsEnumerator = jsonObject.RootElement.GetProperty("custom-zone-sets").EnumerateArray();
|
||||
while (customZoneSetsEnumerator.MoveNext())
|
||||
{
|
||||
var current = customZoneSetsEnumerator.Current;
|
||||
string name = current.GetProperty("name").GetString();
|
||||
string type = current.GetProperty("type").GetString();
|
||||
string uuid = current.GetProperty("uuid").GetString();
|
||||
var info = current.GetProperty("info");
|
||||
if (type.Equals("grid"))
|
||||
while (customZoneSetsEnumerator.MoveNext())
|
||||
{
|
||||
int rows = info.GetProperty("rows").GetInt32();
|
||||
int columns = info.GetProperty("columns").GetInt32();
|
||||
int[] rowsPercentage = new int[rows];
|
||||
JsonElement.ArrayEnumerator rowsPercentageEnumerator = info.GetProperty("rows-percentage").EnumerateArray();
|
||||
int i = 0;
|
||||
while (rowsPercentageEnumerator.MoveNext())
|
||||
var current = customZoneSetsEnumerator.Current;
|
||||
string name = current.GetProperty("name").GetString();
|
||||
string type = current.GetProperty("type").GetString();
|
||||
string uuid = current.GetProperty("uuid").GetString();
|
||||
var info = current.GetProperty("info");
|
||||
if (type.Equals("grid"))
|
||||
{
|
||||
rowsPercentage[i++] = rowsPercentageEnumerator.Current.GetInt32();
|
||||
}
|
||||
|
||||
i = 0;
|
||||
int[] columnsPercentage = new int[columns];
|
||||
JsonElement.ArrayEnumerator columnsPercentageEnumerator = info.GetProperty("columns-percentage").EnumerateArray();
|
||||
while (columnsPercentageEnumerator.MoveNext())
|
||||
{
|
||||
columnsPercentage[i++] = columnsPercentageEnumerator.Current.GetInt32();
|
||||
}
|
||||
|
||||
i = 0;
|
||||
JsonElement.ArrayEnumerator cellChildMapRows = info.GetProperty("cell-child-map").EnumerateArray();
|
||||
int[,] cellChildMap = new int[rows, columns];
|
||||
while (cellChildMapRows.MoveNext())
|
||||
{
|
||||
int j = 0;
|
||||
JsonElement.ArrayEnumerator cellChildMapRowElems = cellChildMapRows.Current.EnumerateArray();
|
||||
while (cellChildMapRowElems.MoveNext())
|
||||
int rows = info.GetProperty("rows").GetInt32();
|
||||
int columns = info.GetProperty("columns").GetInt32();
|
||||
int[] rowsPercentage = new int[rows];
|
||||
JsonElement.ArrayEnumerator rowsPercentageEnumerator = info.GetProperty("rows-percentage").EnumerateArray();
|
||||
int i = 0;
|
||||
while (rowsPercentageEnumerator.MoveNext())
|
||||
{
|
||||
cellChildMap[i, j++] = cellChildMapRowElems.Current.GetInt32();
|
||||
rowsPercentage[i++] = rowsPercentageEnumerator.Current.GetInt32();
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
i = 0;
|
||||
int[] columnsPercentage = new int[columns];
|
||||
JsonElement.ArrayEnumerator columnsPercentageEnumerator = info.GetProperty("columns-percentage").EnumerateArray();
|
||||
while (columnsPercentageEnumerator.MoveNext())
|
||||
{
|
||||
columnsPercentage[i++] = columnsPercentageEnumerator.Current.GetInt32();
|
||||
}
|
||||
|
||||
_customModels.Add(new GridLayoutModel(uuid, name, LayoutType.Custom, rows, columns, rowsPercentage, columnsPercentage, cellChildMap));
|
||||
}
|
||||
else if (type.Equals("canvas"))
|
||||
{
|
||||
int referenceWidth = info.GetProperty("ref-width").GetInt32();
|
||||
int referenceHeight = info.GetProperty("ref-height").GetInt32();
|
||||
JsonElement.ArrayEnumerator zonesEnumerator = info.GetProperty("zones").EnumerateArray();
|
||||
IList<Int32Rect> zones = new List<Int32Rect>();
|
||||
while (zonesEnumerator.MoveNext())
|
||||
i = 0;
|
||||
JsonElement.ArrayEnumerator cellChildMapRows = info.GetProperty("cell-child-map").EnumerateArray();
|
||||
int[,] cellChildMap = new int[rows, columns];
|
||||
while (cellChildMapRows.MoveNext())
|
||||
{
|
||||
int j = 0;
|
||||
JsonElement.ArrayEnumerator cellChildMapRowElems = cellChildMapRows.Current.EnumerateArray();
|
||||
while (cellChildMapRowElems.MoveNext())
|
||||
{
|
||||
cellChildMap[i, j++] = cellChildMapRowElems.Current.GetInt32();
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
_customModels.Add(new GridLayoutModel(uuid, name, LayoutType.Custom, rows, columns, rowsPercentage, columnsPercentage, cellChildMap));
|
||||
}
|
||||
else if (type.Equals("canvas"))
|
||||
{
|
||||
int x = zonesEnumerator.Current.GetProperty("X").GetInt32();
|
||||
int y = zonesEnumerator.Current.GetProperty("Y").GetInt32();
|
||||
int width = zonesEnumerator.Current.GetProperty("width").GetInt32();
|
||||
int height = zonesEnumerator.Current.GetProperty("height").GetInt32();
|
||||
zones.Add(new Int32Rect(x, y, width, height));
|
||||
}
|
||||
int referenceWidth = info.GetProperty("ref-width").GetInt32();
|
||||
int referenceHeight = info.GetProperty("ref-height").GetInt32();
|
||||
JsonElement.ArrayEnumerator zonesEnumerator = info.GetProperty("zones").EnumerateArray();
|
||||
IList<Int32Rect> zones = new List<Int32Rect>();
|
||||
while (zonesEnumerator.MoveNext())
|
||||
{
|
||||
int x = zonesEnumerator.Current.GetProperty("X").GetInt32();
|
||||
int y = zonesEnumerator.Current.GetProperty("Y").GetInt32();
|
||||
int width = zonesEnumerator.Current.GetProperty("width").GetInt32();
|
||||
int height = zonesEnumerator.Current.GetProperty("height").GetInt32();
|
||||
zones.Add(new Int32Rect(x, y, width, height));
|
||||
}
|
||||
|
||||
_customModels.Add(new CanvasLayoutModel(uuid, name, LayoutType.Custom, referenceWidth, referenceHeight, zones));
|
||||
_customModels.Add(new CanvasLayoutModel(uuid, name, LayoutType.Custom, referenceWidth, referenceHeight, zones));
|
||||
}
|
||||
}
|
||||
|
||||
inputStream.Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ShowExceptionMessageBox("Error loading custom layouts", ex);
|
||||
return new ObservableCollection<LayoutModel>();
|
||||
}
|
||||
|
||||
return _customModels;
|
||||
@@ -239,56 +252,62 @@ namespace FancyZonesEditor.Models
|
||||
|
||||
public abstract LayoutModel Clone();
|
||||
|
||||
public void Persist(System.Windows.Int32Rect[] zones)
|
||||
public void Persist()
|
||||
{
|
||||
PersistData();
|
||||
Apply(zones);
|
||||
Apply();
|
||||
}
|
||||
|
||||
public void Apply(System.Windows.Int32Rect[] zones)
|
||||
public void Apply()
|
||||
{
|
||||
int zoneCount = zones.Length;
|
||||
FileStream outputStream = File.Open(Settings.ActiveZoneSetTmpFile, FileMode.Create);
|
||||
var writer = new Utf8JsonWriter(outputStream, options: default);
|
||||
|
||||
writer.WriteStartObject();
|
||||
writer.WriteString("device-id", Settings.UniqueKey);
|
||||
|
||||
writer.WriteStartObject("active-zoneset");
|
||||
writer.WriteString("uuid", "{" + Guid.ToString().ToUpper() + "}");
|
||||
switch (Type)
|
||||
try
|
||||
{
|
||||
case LayoutType.Focus:
|
||||
writer.WriteString("type", "focus");
|
||||
break;
|
||||
case LayoutType.Rows:
|
||||
writer.WriteString("type", "rows");
|
||||
break;
|
||||
case LayoutType.Columns:
|
||||
writer.WriteString("type", "columns");
|
||||
break;
|
||||
case LayoutType.Grid:
|
||||
writer.WriteString("type", "grid");
|
||||
break;
|
||||
case LayoutType.PriorityGrid:
|
||||
writer.WriteString("type", "priority-grid");
|
||||
break;
|
||||
case LayoutType.Custom:
|
||||
writer.WriteString("type", "custom");
|
||||
break;
|
||||
FileStream outputStream = File.Open(Settings.ActiveZoneSetTmpFile, FileMode.Create);
|
||||
var writer = new Utf8JsonWriter(outputStream, options: default);
|
||||
|
||||
writer.WriteStartObject();
|
||||
writer.WriteString("device-id", Settings.UniqueKey);
|
||||
|
||||
writer.WriteStartObject("active-zoneset");
|
||||
writer.WriteString("uuid", "{" + Guid.ToString().ToUpper() + "}");
|
||||
switch (Type)
|
||||
{
|
||||
case LayoutType.Focus:
|
||||
writer.WriteString("type", "focus");
|
||||
break;
|
||||
case LayoutType.Rows:
|
||||
writer.WriteString("type", "rows");
|
||||
break;
|
||||
case LayoutType.Columns:
|
||||
writer.WriteString("type", "columns");
|
||||
break;
|
||||
case LayoutType.Grid:
|
||||
writer.WriteString("type", "grid");
|
||||
break;
|
||||
case LayoutType.PriorityGrid:
|
||||
writer.WriteString("type", "priority-grid");
|
||||
break;
|
||||
case LayoutType.Custom:
|
||||
writer.WriteString("type", "custom");
|
||||
break;
|
||||
}
|
||||
|
||||
writer.WriteEndObject();
|
||||
|
||||
Settings settings = ((App)Application.Current).ZoneSettings;
|
||||
|
||||
writer.WriteBoolean("editor-show-spacing", settings.ShowSpacing);
|
||||
writer.WriteNumber("editor-spacing", settings.Spacing);
|
||||
writer.WriteNumber("editor-zone-count", settings.ZoneCount);
|
||||
|
||||
writer.WriteEndObject();
|
||||
writer.Flush();
|
||||
outputStream.Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ShowExceptionMessageBox("Error applying layout", ex);
|
||||
}
|
||||
|
||||
writer.WriteEndObject();
|
||||
|
||||
Settings settings = ((App)Application.Current).ZoneSettings;
|
||||
|
||||
writer.WriteBoolean("editor-show-spacing", settings.ShowSpacing);
|
||||
writer.WriteNumber("editor-spacing", settings.Spacing);
|
||||
writer.WriteNumber("editor-zone-count", settings.ZoneCount);
|
||||
|
||||
writer.WriteEndObject();
|
||||
writer.Flush();
|
||||
outputStream.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -354,48 +354,56 @@ namespace FancyZonesEditor
|
||||
|
||||
private void ParseDeviceInfoData()
|
||||
{
|
||||
FileStream inputStream = File.Open(Settings.ActiveZoneSetTmpFile, FileMode.Open);
|
||||
var jsonObject = JsonDocument.Parse(inputStream, options: default).RootElement;
|
||||
|
||||
UniqueKey = jsonObject.GetProperty("device-id").GetString();
|
||||
ActiveZoneSetUUid = jsonObject.GetProperty("active-zoneset").GetProperty("uuid").GetString();
|
||||
string layoutType = jsonObject.GetProperty("active-zoneset").GetProperty("type").GetString();
|
||||
|
||||
if (ActiveZoneSetUUid == "null" || layoutType == "blank")
|
||||
try
|
||||
{
|
||||
// Default selection is Focus
|
||||
ActiveZoneSetLayoutType = LayoutType.Focus;
|
||||
_showSpacing = true;
|
||||
_spacing = 16;
|
||||
_zoneCount = 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (layoutType)
|
||||
FileStream inputStream = File.Open(Settings.ActiveZoneSetTmpFile, FileMode.Open);
|
||||
var jsonObject = JsonDocument.Parse(inputStream, options: default).RootElement;
|
||||
|
||||
UniqueKey = jsonObject.GetProperty("device-id").GetString();
|
||||
ActiveZoneSetUUid = jsonObject.GetProperty("active-zoneset").GetProperty("uuid").GetString();
|
||||
string layoutType = jsonObject.GetProperty("active-zoneset").GetProperty("type").GetString();
|
||||
|
||||
if (ActiveZoneSetUUid == "null" || layoutType == "blank")
|
||||
{
|
||||
case "focus":
|
||||
ActiveZoneSetLayoutType = LayoutType.Focus;
|
||||
break;
|
||||
case "columns":
|
||||
ActiveZoneSetLayoutType = LayoutType.Columns;
|
||||
break;
|
||||
case "rows":
|
||||
ActiveZoneSetLayoutType = LayoutType.Rows;
|
||||
break;
|
||||
case "grid":
|
||||
ActiveZoneSetLayoutType = LayoutType.Grid;
|
||||
break;
|
||||
case "priority-grid":
|
||||
ActiveZoneSetLayoutType = LayoutType.PriorityGrid;
|
||||
break;
|
||||
case "custom":
|
||||
ActiveZoneSetLayoutType = LayoutType.Custom;
|
||||
break;
|
||||
// Default selection is Focus
|
||||
ActiveZoneSetLayoutType = LayoutType.Focus;
|
||||
_showSpacing = true;
|
||||
_spacing = 16;
|
||||
_zoneCount = 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (layoutType)
|
||||
{
|
||||
case "focus":
|
||||
ActiveZoneSetLayoutType = LayoutType.Focus;
|
||||
break;
|
||||
case "columns":
|
||||
ActiveZoneSetLayoutType = LayoutType.Columns;
|
||||
break;
|
||||
case "rows":
|
||||
ActiveZoneSetLayoutType = LayoutType.Rows;
|
||||
break;
|
||||
case "grid":
|
||||
ActiveZoneSetLayoutType = LayoutType.Grid;
|
||||
break;
|
||||
case "priority-grid":
|
||||
ActiveZoneSetLayoutType = LayoutType.PriorityGrid;
|
||||
break;
|
||||
case "custom":
|
||||
ActiveZoneSetLayoutType = LayoutType.Custom;
|
||||
break;
|
||||
}
|
||||
|
||||
_showSpacing = jsonObject.GetProperty("editor-show-spacing").GetBoolean();
|
||||
_spacing = jsonObject.GetProperty("editor-spacing").GetInt32();
|
||||
_zoneCount = jsonObject.GetProperty("editor-zone-count").GetInt32();
|
||||
}
|
||||
|
||||
_showSpacing = jsonObject.GetProperty("editor-show-spacing").GetBoolean();
|
||||
_spacing = jsonObject.GetProperty("editor-spacing").GetInt32();
|
||||
_zoneCount = jsonObject.GetProperty("editor-zone-count").GetInt32();
|
||||
inputStream.Close();
|
||||
} catch (Exception ex)
|
||||
{
|
||||
LayoutModel.ShowExceptionMessageBox("Error parsing device info data", ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
// 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.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("FancyZonesEditor")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Microsoft Corp.")]
|
||||
[assembly: AssemblyProduct("FancyZonesEditor")]
|
||||
[assembly: AssemblyCopyright("Copyright (C) 2019 Microsoft Corp.")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// In order to begin building localizable applications, set
|
||||
// <UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
|
||||
// inside a <PropertyGroup>. For example, if you are using US english
|
||||
// in your source files, set the <UICulture> to en-US. Then uncomment
|
||||
// the NeutralResourceLanguage attribute below. Update the "en-US" in
|
||||
// the line below to match the UICulture setting in the project file.
|
||||
|
||||
// [assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
|
||||
// ThemeInfo.None = where theme specific resource dictionaries are located
|
||||
// (used if a resource is not found in the page,
|
||||
// or application resource dictionaries)
|
||||
// ThemeInfo.SourceAssembly = where the generic resource dictionary is located
|
||||
// (used if a resource is not found in the page,
|
||||
// app, or any theme specific resource dictionaries)
|
||||
[assembly: ThemeInfo(
|
||||
ResourceDictionaryLocation.None,
|
||||
ResourceDictionaryLocation.SourceAssembly)]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("0.15.1.0")]
|
||||
[assembly: AssemblyFileVersion("0.15.1.0")]
|
||||
@@ -165,7 +165,7 @@ export class GeneralSettings extends React.Component <any, any> {
|
||||
/>)
|
||||
}
|
||||
<ChoiceGroupSettingsControl
|
||||
setting={{display_name: 'Chose Settings color',
|
||||
setting={{display_name: 'Choose Settings color',
|
||||
value: this.state.settings.general.theme,
|
||||
options: [
|
||||
{ key: 'system', text: 'System default app mode'},
|
||||
|
||||
10
src/settings/settings-html/dist/bundle.js
vendored
10
src/settings/settings-html/dist/bundle.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user