Skip to content

Commit

Permalink
Enhanced StartMenu Items Retrival and Display
Browse files Browse the repository at this point in the history
- Optmized start menu icons refresh
- Fixed damaged shortcuts bug
  • Loading branch information
gerardbalaoro committed Mar 9, 2019
1 parent ddaaaeb commit 9e45f1d
Show file tree
Hide file tree
Showing 58 changed files with 903 additions and 689 deletions.
35 changes: 35 additions & 0 deletions Metro Tile Customizer/Core.vb
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
Imports System.IO
Imports System.Xml

Module ColorBoxes
Public Main As New List(Of Control)
Public Accents As New List(Of Control)
Public Other As New List(Of Control)
End Module

Module Core
Public ProgramDataItems = Directory.GetFiles(Environment.GetFolderPath(Environment.SpecialFolder.CommonStartMenu) & "\Programs", "*.lnk", SearchOption.AllDirectories)
Public AppDataItems = Directory.GetFiles(Environment.GetFolderPath(Environment.SpecialFolder.StartMenu) & "\Programs", "*.lnk", SearchOption.AllDirectories)
Public StartMenuItems As New DataTable

Sub New()
StartMenuItems.Columns.Add("path")
StartMenuItems.Columns.Add("name")
End Sub

Public Function AppData(Optional Path As String = Nothing)
Return String.Join("\", My.Computer.FileSystem.SpecialDirectories.Temp & "\MetroTileChanger", Path)
End Function

Public Sub GetStartMenuItems()
StartMenuItems.Rows.Clear()

For Each Item In AppDataItems
StartMenuItems.Rows.Add(Item, Path.GetFileNameWithoutExtension(Item))
Next
For Each Item In ProgramDataItems
StartMenuItems.Rows.Add(Item, Path.GetFileNameWithoutExtension(Item))
Next
StartMenuItems.DefaultView.Sort = "name asc"
End Sub
End Module
10 changes: 2 additions & 8 deletions Metro Tile Customizer/FodyWeavers.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Weavers>
<Costura>
<IncludeAssemblies>
MetroFramework
MetroFramework.Design
MetroFramework.Fonts
</IncludeAssemblies>
</Costura>
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<Costura CreateTemporaryAssemblies="true" DisableCompression="true" />
</Weavers>
111 changes: 111 additions & 0 deletions Metro Tile Customizer/FodyWeavers.xsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
<xs:element name="Weavers">
<xs:complexType>
<xs:all>
<xs:element name="Costura" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:all>
<xs:element minOccurs="0" maxOccurs="1" name="ExcludeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="IncludeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="Unmanaged32Assemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of unmanaged 32 bit assembly names to include, delimited with line breaks.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="Unmanaged64Assemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of unmanaged 64 bit assembly names to include, delimited with line breaks.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="PreloadOrder" type="xs:string">
<xs:annotation>
<xs:documentation>The order of preloaded assemblies, delimited with line breaks.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:all>
<xs:attribute name="CreateTemporaryAssemblies" type="xs:boolean">
<xs:annotation>
<xs:documentation>This will copy embedded files to disk before loading them into memory. This is helpful for some scenarios that expected an assembly to be loaded from a physical file.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="IncludeDebugSymbols" type="xs:boolean">
<xs:annotation>
<xs:documentation>Controls if .pdbs for reference assemblies are also embedded.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="DisableCompression" type="xs:boolean">
<xs:annotation>
<xs:documentation>Embedded assemblies are compressed by default, and uncompressed when they are loaded. You can turn compression off with this option.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="DisableCleanup" type="xs:boolean">
<xs:annotation>
<xs:documentation>As part of Costura, embedded assemblies are no longer included as part of the build. This cleanup can be turned off.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="LoadAtModuleInit" type="xs:boolean">
<xs:annotation>
<xs:documentation>Costura by default will load as part of the module initialization. This flag disables that behavior. Make sure you call CosturaUtility.Initialize() somewhere in your code.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="IgnoreSatelliteAssemblies" type="xs:boolean">
<xs:annotation>
<xs:documentation>Costura will by default use assemblies with a name like 'resources.dll' as a satellite resource and prepend the output path. This flag disables that behavior.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="ExcludeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with |</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="IncludeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of assembly names to include from the default action of "embed all Copy Local references", delimited with |.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Unmanaged32Assemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of unmanaged 32 bit assembly names to include, delimited with |.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Unmanaged64Assemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of unmanaged 64 bit assembly names to include, delimited with |.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="PreloadOrder" type="xs:string">
<xs:annotation>
<xs:documentation>The order of preloaded assemblies, delimited with |.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:all>
<xs:attribute name="VerifyAssembly" type="xs:boolean">
<xs:annotation>
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
<xs:annotation>
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="GenerateXsd" type="xs:boolean">
<xs:annotation>
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>
53 changes: 53 additions & 0 deletions Metro Tile Customizer/LnkFile.vb
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
Imports Shell32
Imports System.IO
Imports System.IO.Path
Imports System.Text.RegularExpressions

Public Class LnkFile
Public Property Path As String

Public ReadOnly Property Target As String
Get
Dim Obj As Object
Obj = CreateObject("WScript.Shell")
Dim Shortcut As Object
Shortcut = Obj.CreateShortcut(Path)
Dim TargetPath As String = Shortcut.TargetPath
If File.Exists(TargetPath) Then
Return TargetPath
Else
Return TargetPath.Replace("Program Files (x86)", "Program Files")
End If
End Get
End Property

Public ReadOnly Property TargetIcon
Get
Try
Return Icon.ExtractAssociatedIcon(Target).ToBitmap()
Catch ex As Exception
Return Nothing
End Try
End Get
End Property

Public ReadOnly Property VisualManifest As String
Get
Return Regex.Replace(Target, "\.[E|e][X|x][E|e]", ".visualelementsmanifest.xml")
End Get
End Property

Public ReadOnly Property Name As String
Get
Return GetFileNameWithoutExtension(Path)
End Get
End Property

Public Sub New(Path As String)
Me.Path = Path
End Sub

Public Sub Refresh()
File.SetLastWriteTime(Path, Now)
End Sub
End Class
Loading

0 comments on commit 9e45f1d

Please sign in to comment.