Skip to content

Commit

Permalink
Bump version to 1.9
Browse files Browse the repository at this point in the history
  • Loading branch information
krlvm committed Jan 26, 2022
1 parent 8e15bd2 commit d4a9919
Show file tree
Hide file tree
Showing 9 changed files with 2,587 additions and 14 deletions.
10 changes: 10 additions & 0 deletions BeautySearch/BeautySearch.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Installer\ScriptInstaller.cs" />
<Compile Include="UI\TopAppsEditorForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="UI\TopAppsEditorForm.Designer.cs">
<DependentUpon>TopAppsEditorForm.cs</DependentUpon>
</Compile>
<Compile Include="Utility.cs" />
<EmbeddedResource Include="UI\InstallationForm.resx">
<DependentUpon>InstallationForm.cs</DependentUpon>
Expand All @@ -100,6 +106,9 @@
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<EmbeddedResource Include="UI\TopAppsEditorForm.resx">
<DependentUpon>TopAppsEditorForm.cs</DependentUpon>
</EmbeddedResource>
<None Include="app.manifest" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
Expand Down Expand Up @@ -130,6 +139,7 @@
<EmbeddedResource Include="BeautySearch.js" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="TopAppsEditor.html" />
<EmbeddedResource Include="BeautySearchLoader.js" />
<Content Include="icon.ico" />
</ItemGroup>
Expand Down
8 changes: 7 additions & 1 deletion BeautySearch/Installer/ScriptInstaller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,11 @@ private static bool InjectController()
return true;
}

public static string GetCurrentUserSearchAppDataDirectory()
{
return $@"{Path.GetPathRoot(Environment.SystemDirectory)}Users\{localUsername}\AppData\Local\Packages\{SEARCH_APP_NAME}";
}

public static string FindControllerFile()
{
// *laughs*
Expand All @@ -260,7 +265,8 @@ public static string FindControllerFile()

public static void ClearIconCache()
{
string ICON_CACHE_DIR = $@"{Path.GetPathRoot(Environment.SystemDirectory)}Users\{localUsername}\AppData\Local\Packages\{SEARCH_APP_NAME}\LocalState\AppIconCache";
string ICON_CACHE_DIR = $@"{GetCurrentUserSearchAppDataDirectory()}\LocalState\AppIconCache";
MessageBox.Show(ICON_CACHE_DIR);
if (Directory.Exists(ICON_CACHE_DIR))
{
Directory.Delete(ICON_CACHE_DIR, true);
Expand Down
4 changes: 2 additions & 2 deletions BeautySearch/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// 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("1.8.1.0")]
[assembly: AssemblyFileVersion("1.8.1.0")]
[assembly: AssemblyVersion("1.9.0.0")]
[assembly: AssemblyFileVersion("1.9.0.0")]
225 changes: 225 additions & 0 deletions BeautySearch/TopAppsEditor.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,225 @@
<!--
BeautySearch - Windows 10 Search Window appearance tweaker
This file provides user interface for editing Top Apps section
It is being loaded into Internet Explorer WebView, so it is not
possible to use ES6 language features in JavaScript code
-->

<!DOCTYPE html>
<html lang="en">

<head>
<title>Top Apps section editor</title>
<meta http-equiv="X-UA-Compatible" content="IE=11">
<meta name="viewport" content="width=device-width, initial-scale=1">

<style>
* {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
-ms-user-select: none;
}

html, body {
margin: 0;
width: 100vw;
height: 100vh;
overflow-x: hidden;
}

#container {
display: flex;
flex-direction: column;
height: 100vh;
}

#controls {
display: flex;
margin: 8px;
}
#controls > * {
flex-grow: 1;
}

#table-wrapper {
flex-grow: 1;
margin: 12px;
display: flex;
flex-direction: column;
overflow-y: auto;
overflow-x: hidden;
}

#apps-table {
height: 100vh;
width: 100%;
overflow-y: auto;
overflow-x: hidden;
}
#apps-table, #apps-table td {
border: 0.1px solid rgb(36, 36, 36);
border-collapse: collapse;
}
#apps-table td {
padding: 6px;
cursor: default;
display: flex;
align-items: center;
}
#apps-table tr:hover {
background-color: rgb(220, 220, 220);
}

.selected {
background-color: rgb(210, 210, 210) !important;
}

.app-icon {
width: 32px;
height: 32px;
margin-right: 12px;
}
</style>

<script>
var data;

var selected;
var selectedId = -1;

var total;
var maxUsage;

function importJson(raw) {
data = JSON.parse(raw);

var apps = [];
for (var i = 0; i < data.length; i++) {
var entry = data[i];
if (entry['System.Kind'].Value != 'program') continue;

var encodedPath = entry['System.Tile.EncodedTargetPath'].Value;
var tilePath = entry['System.Tile.SmallLogoPath'].Value;

var iconPath;
if (tilePath == 'N/A') {
iconPath = encodedPath;
} else {
var identity = entry['System.Identity'].Value;
iconPath = entry['System.AppUserModel.PackageFullName'].Value + '?ms-resource://' + identity.substring(0, identity.indexOf('_')) + '/Files/' + tilePath;
}

var used = parseInt(entry['System.Software.TimesUsed'].Value);
maxUsage = Math.max(maxUsage, used);

apps.push({
id: i,
name: entry['System.ItemNameDisplay'].Value,
used: used,
icon: window.external.LoadIcon(iconPath, tilePath != 'N/A')
});
}
apps = apps.sort(function(a, b) {
return b.used - a.used;
});
total = apps.length;

var table = document.getElementById('apps-table');
for (var i = 0; i < apps.length; i++) {
var app = apps[i];
var style = i == 4 ? ' style="border-bottom: 3px double darkblue !important"' : '';
var icon = app.icon != null ? app.icon : 'Qk1CAAAAAAAAAD4AAAAoAAAAAQAAAAEAAAABAAEAAAAAAAQAAAB0EgAAdBIAAAAAAAAAAAAAAAAAAP///wCAAAAA';
table.innerHTML += '<tr class="app-row"' + style + '><td data-id="' + app.id + '"><img class="app-icon" src="data:image/png;base64,' + app.icon + '"/>' + app.name + '</td></tr>'
}

var rows = queryRows();
for (var i = 0; i < rows.length; i++) {
(function() {
var row = rows[i];
var id = i;
row.addEventListener('click', function(event) {
select(row, id);
});
})();
}

document.getElementById('controls').style.display = null;
}

function exportJson() {
var cur = 5000;
var rows = queryRows();
for (var i = 0; i < rows.length; i++) {
var id = rows[i].querySelector('td').dataset.id;
data[id]['System.Software.TimesUsed'].Value = Math.max(0, cur -= 250 * (i <= 5 ? 2 : 0.5));
}

return JSON.stringify(data);
}


function queryRows() {
return document.querySelectorAll('.app-row');
}

function select(row, id) {
if (selected != null) {
selected.classList.remove('selected');
}
row.classList.add('selected');
selected = row;
selectedId = id;
}


function swapSelectedWith(id) {
var target = queryRows()[id];
var buf = target.innerHTML;
target.innerHTML = selected.innerHTML;
selected.innerHTML = buf;
select(target, id);
return target;
}

function moveUp() {
if (selectedId == -1 || selectedId == 0) return;
swapSelectedWith(selectedId - 1);
}
function moveDown() {
if (selectedId == -1 || selectedId == total - 1) return;
swapSelectedWith(selectedId + 1);
}
function moveTop() {
if (selectedId == -1 || selectedId == 0) return;
for (var id = selectedId; id >= 0; id--) {
var target = swapSelectedWith(id);
if (id == 0) target.scrollIntoView();
}
}
function moveBottom() {
if (selectedId == -1 || selectedId == total - 1) return;
for (var id = selectedId; id <= total - 1; id++) {
var target = swapSelectedWith(id);
if (id == total - 1) target.scrollIntoView();
}
}
</script>
</head>

<body>
<div id="container">
<div id="controls">
<button onclick="moveTop()" style="margin-right: 16px;">Move to the Top</button>
<button onclick="moveUp()" style="margin-right: 16px;">Move Up</button>
<button onclick="moveDown()" style="margin-right: 16px;">Move Down</button>
<button onclick="moveBottom()">Move to the Bottom</button>
</div>
<div id="table-wrapper">
<table id="apps-table"></table>
</div>
</div>
</body>

</html>
Loading

0 comments on commit d4a9919

Please sign in to comment.