diff --git a/Preview/Easy Link File Viewer 01.png b/Preview/Easy Link File Viewer 01.png
index b27b15a..30cca2b 100644
Binary files a/Preview/Easy Link File Viewer 01.png and b/Preview/Easy Link File Viewer 01.png differ
diff --git a/Preview/Easy Link File Viewer 02.png b/Preview/Easy Link File Viewer 02.png
index 5195c83..7ed8a77 100644
Binary files a/Preview/Easy Link File Viewer 02.png and b/Preview/Easy Link File Viewer 02.png differ
diff --git a/Preview/Easy Link File Viewer 03.png b/Preview/Easy Link File Viewer 03.png
new file mode 100644
index 0000000..d732f9b
Binary files /dev/null and b/Preview/Easy Link File Viewer 03.png differ
diff --git a/README.md b/README.md
index fe9e5f4..0ab0eba 100644
--- a/README.md
+++ b/README.md
@@ -30,6 +30,8 @@ It is an alternative to the built-in shell-extension in **Windows** operating sy
![](Preview/Easy%20Link%20File%20Viewer%2002.png)
+![](Preview/Easy%20Link%20File%20Viewer%2003.png)
+
### 3rd party resources:
PNG images included in this repository are from Visual Studio 2017 Image Library.
diff --git a/src/App.config b/src/App.config
index cf3df4d..7e8019a 100644
--- a/src/App.config
+++ b/src/App.config
@@ -13,6 +13,9 @@
0
+
+ 10
+
\ No newline at end of file
diff --git a/src/DevCase/FileOrFolderNameEditor.vb b/src/DevCase/FileOrFolderNameEditor.vb
new file mode 100644
index 0000000..75f4c1c
--- /dev/null
+++ b/src/DevCase/FileOrFolderNameEditor.vb
@@ -0,0 +1,127 @@
+' This source-code is freely distributed as part of "DevCase for .NET Framework".
+'
+' Maybe you would like to consider to buy this powerful set of libraries to support me.
+' You can do loads of things with my apis for a big amount of diverse thematics.
+'
+' Here is a link to the purchase page:
+' https://codecanyon.net/item/elektrokit-class-library-for-net/19260282
+'
+' Thank you.
+
+#Region " Option Statements "
+
+Option Strict On
+Option Explicit On
+Option Infer Off
+
+#End Region
+
+#Region " Imports "
+
+Imports System.ComponentModel
+Imports System.Drawing.Design
+Imports System.IO
+Imports System.Text
+Imports System.Windows.Forms.Design
+Imports DevCase.UserControls.Controls
+
+#End Region
+
+#Region " FileOrFolderNameEditor "
+
+Namespace DevCase.Core.Design
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Provides a user interface for selecting a file or folder name.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ Friend Class FileOrFolderNameEditor : Inherits UITypeEditor
+
+#Region " Constructors "
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Initializes a new instance of the class.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ Public Sub New()
+ MyBase.New()
+ End Sub
+
+#End Region
+
+#Region " Public Methods "
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Gets the editor style used by the method.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' An that can be used to gain additional context information.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' A value that indicates the style of editor used
+ ''' by the method.
+ '''
+ ''' If the does not support this method,
+ ''' then will return .
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ Public Overrides Function GetEditStyle(ByVal context As ITypeDescriptorContext) As UITypeEditorEditStyle
+ Return UITypeEditorEditStyle.Modal
+ End Function
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Edits the specified object's value using the editor style indicated by the method.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' An that can be used to gain additional context information.
+ '''
+ '''
+ '''
+ ''' An that this editor can use to obtain services.
+ '''
+ '''
+ '''
+ ''' The object to edit.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' The new value of the object.
+ '''
+ ''' If the value of the object has not changed, this should return the same object it was passed.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ Public Overrides Function EditValue(ByVal context As ITypeDescriptorContext, ByVal provider As IServiceProvider, ByVal value As Object) As Object
+
+ Using dlg As New OpenFileOrFolderDialog() With {
+ .Title = "Select a file or folder...",
+ .AutoUpgradeEnabled = True,
+ .DereferenceLinks = True,
+ .RestoreDirectory = True,
+ .ShowHelp = False
+ }
+
+ If (dlg.ShowDialog = DialogResult.OK) Then
+ Return dlg.ItemName
+ End If
+ End Using
+
+ Return MyBase.EditValue(context, provider, value)
+
+ End Function
+
+#End Region
+
+ End Class
+
+End Namespace
+
+#End Region
diff --git a/src/DevCase/FileSizeConverter.vb b/src/DevCase/FileSizeConverter.vb
new file mode 100644
index 0000000..30bc727
--- /dev/null
+++ b/src/DevCase/FileSizeConverter.vb
@@ -0,0 +1,189 @@
+' This source-code is freely distributed as part of "DevCase for .NET Framework".
+'
+' Maybe you would like to consider to buy this powerful set of libraries to support me.
+' You can do loads of things with my apis for a big amount of diverse thematics.
+'
+' Here is a link to the purchase page:
+' https://codecanyon.net/item/elektrokit-class-library-for-net/19260282
+'
+' Thank you.
+
+#Region " Usage Examples "
+
+'
+'
+'Public ReadOnly Property FileSize As Long = 2048 ' Bytes
+
+'
+'
+'Public ReadOnly Property FileSize As New Filesize(2048, SizeUnits.Byte)
+
+#End Region
+
+#Region " Option Statements "
+
+Option Strict On
+Option Explicit On
+Option Infer Off
+
+#End Region
+
+#Region " Imports "
+
+Imports System.ComponentModel
+Imports System.ComponentModel.Design.Serialization
+Imports System.Globalization
+
+Imports DevCase.Core.IO
+
+#End Region
+
+#Region " FileSizeConverter "
+
+Namespace DevCase.Core.Design
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Provides a type converter to convert from a file size specified in bytes,
+ ''' to a rounded file size string using the most approximated unit of size.
+ '''
+ ''' Conversion examples:
+ '''
+ ''' Input value -> Result string
+ '''
+ ''' 793 -> 793 Bytes
+ '''
+ ''' 1533 -> 1,49 KB
+ '''
+ ''' 2049 -> 2,00 KB
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ ''' This is a code example.
+ '''
+ ''' <TypeConverter(GetType(FileSizeConverter))>
+ ''' <Browsable(True)>
+ ''' Public ReadOnly Property FileSize As Long = 2048 ' Bytes
+ '''
+ ''' <TypeConverter(GetType(FileSizeConverter))>
+ ''' <Browsable(True)>
+ ''' Public ReadOnly Property FileSize As New Filesize(2048, SizeUnits.Byte)
+ '''
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ Friend Class FileSizeConverter : Inherits TypeConverter
+
+#Region " Constructors "
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Initializes a new instance of the class.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ Public Sub New()
+ MyBase.New()
+ End Sub
+
+#End Region
+
+#Region " Public Methods "
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Determines if this converter can convert an object in the given source type to the native type of the converter.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' An that provides a format context.
+ '''
+ '''
+ '''
+ ''' A that represents the type from which you want to convert.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' if this converter can perform the operation; otherwise, .
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ Public Overrides Function CanConvertFrom(ByVal context As ITypeDescriptorContext, ByVal sourceType As Type) As Boolean
+
+ Return False
+
+ End Function
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Returns whether this converter can convert the object to the specified type, using the specified context.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' An that provides a format context.
+ '''
+ '''
+ '''
+ ''' A that represents the type you want to convert to.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' if this converter can perform the conversion; otherwise, .
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ Public Overloads Overrides Function CanConvertTo(ByVal context As ITypeDescriptorContext, ByVal destinationType As Type) As Boolean
+
+ If (destinationType = GetType(InstanceDescriptor)) Then
+ Return True
+ End If
+
+ Return MyBase.CanConvertTo(context, destinationType)
+
+ End Function
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Converts the specified object to another type.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' An that provides a format context.
+ '''
+ '''
+ '''
+ ''' A that specifies the culture to represent the number.
+ '''
+ '''
+ '''
+ ''' The object to convert.
+ '''
+ '''
+ '''
+ ''' The type to convert the object to.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' An that represents the converted value.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ Public Overrides Function ConvertTo(ByVal context As ITypeDescriptorContext, ByVal culture As CultureInfo, ByVal value As Object, ByVal destinationType As Type) As Object
+
+ If (destinationType Is Nothing) Then
+ Throw New ArgumentNullException("destinationType")
+ End If
+
+ If (destinationType Is GetType(String)) Then
+ If (TypeOf value Is Filesize) Then
+ Return DirectCast(value, Filesize).ToString()
+ End If
+
+ Return New Filesize(CType(value, Double), SizeUnits.Byte).ToString()
+ End If
+
+ Return MyBase.ConvertTo(context, culture, value, destinationType)
+
+ End Function
+
+#End Region
+
+ End Class
+
+End Namespace
+
+#End Region
diff --git a/src/DevCase/FileUtil.vb b/src/DevCase/FileUtil.vb
new file mode 100644
index 0000000..b216bfd
--- /dev/null
+++ b/src/DevCase/FileUtil.vb
@@ -0,0 +1,103 @@
+' ***********************************************************************
+' Author : ElektroStudios
+' Modified : 29-April-2017
+' ***********************************************************************
+
+#Region " Public Members Summary "
+
+#Region " Methods "
+
+' OpenInExplorer(String)
+' OpenInExplorer(FileInfo)
+
+#End Region
+
+#End Region
+
+#Region " Option Statements "
+
+Option Strict On
+Option Explicit On
+Option Infer Off
+
+#End Region
+
+#Region " Imports "
+
+Imports System.IO
+
+#End Region
+
+#Region " Files "
+
+Namespace DevCase.Core.IO.Tools
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Contains file related utilities.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ Friend NotInheritable Class FileUtil
+
+#Region " Constructors "
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Prevents a default instance of the class from being created.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ Private Sub New()
+
+ End Sub
+
+#End Region
+
+#Region " Public Methods "
+
+#End Region
+
+#Region " Private Methods "
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Opens the specified file or folder in Explorer.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' The file or folder path.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' File or directory not found.;itemPath
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+
+ Friend Shared Sub InternalOpenInExplorer(ByVal itemPath As String)
+
+ Dim arguments As String
+
+ If File.Exists(itemPath) Then
+ Dim file As New FileInfo(itemPath)
+ arguments = String.Format("/Select,""{0}""", Path.Combine(file.DirectoryName, file.Name))
+
+ ElseIf Directory.Exists(itemPath) Then
+ Dim dir As New DirectoryInfo(itemPath)
+ arguments = String.Format("""{0}""", dir.FullName)
+
+ Else
+ Throw New FileNotFoundException("File or directory not found.", fileName:=itemPath)
+
+ End If
+
+ Using p As Process = Process.Start("Explorer.exe", arguments)
+ End Using
+
+ End Sub
+
+#End Region
+
+ End Class
+
+End Namespace
+
+#End Region
diff --git a/src/DevCase/Filesize.vb b/src/DevCase/Filesize.vb
new file mode 100644
index 0000000..1a93774
--- /dev/null
+++ b/src/DevCase/Filesize.vb
@@ -0,0 +1,474 @@
+' This source-code is freely distributed as part of "DevCase for .NET Framework".
+'
+' Maybe you would like to consider to buy this powerful set of libraries to support me.
+' You can do loads of things with my apis for a big amount of diverse thematics.
+'
+' Here is a link to the purchase page:
+' https://codecanyon.net/item/elektrokit-class-library-for-net/19260282
+'
+' Thank you.
+
+#Region " Public Members Summary "
+
+#Region " Constructors "
+
+' New(Double, SizeUnits)
+
+#End Region
+
+#Region " Properties "
+
+' Size(SizeUnits) As Double
+' Size(SizeUnits, Integer, Opt: NumberFormatInfo) As String
+' SizeRounded As Double
+' SizeRounded(Integer, Opt: NumberFormatInfo) As String
+' SizeUnit As SizeUnits
+' SizeUnitNameShort As String
+' SizeUnitNameLong As String
+
+#End Region
+
+#Region " Functions "
+
+' ToString() As String
+
+#End Region
+
+#End Region
+
+#Region " Option Statements "
+
+Option Strict On
+Option Explicit On
+Option Infer Off
+
+#End Region
+
+#Region " Imports "
+
+Imports System.ComponentModel
+Imports System.Globalization
+Imports System.Xml.Serialization
+
+Imports DevCase.Core.IO
+Imports DevCase.Core.Design
+
+#End Region
+
+#Region " Filesize "
+
+Namespace DevCase.Core.IO
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Defines a filesize.
+ '''
+ ''' Provides methods to round or convert a filesize between different units of size.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ ''' This is a code example that performs a simple conversion between units of size.
+ '''
+ ''' Dim fs As New Filesize(1073741824, Filesize.SizeUnits.Byte)
+ '''
+ ''' Dim b As Double = fs.Size(Filesize.SizeUnits.Byte)
+ ''' Dim kb As Double = fs.Size(Filesize.SizeUnits.KiloByte)
+ ''' Dim mb As Double = fs.Size(Filesize.SizeUnits.MegaByte)
+ ''' Dim gb As Double = fs.Size(Filesize.SizeUnits.GigaByte)
+ ''' Dim tb As Double = fs.Size(Filesize.SizeUnits.TeraByte)
+ ''' Dim pb As Double = fs.Size(Filesize.SizeUnits.PetaByte)
+ '''
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ ''' This is a code example that rounds a filesize in bytes, to its most approximated unit of size.
+ '''
+ ''' For Each sizeUnit As Filesize.SizeUnits In [Enum].GetValues(GetType(Filesize.SizeUnits))
+ '''
+ ''' Dim fsize As New Filesize(sizeUnit, Filesize.SizeUnits.Byte)
+ '''
+ ''' Dim stringFormat As String =
+ ''' String.Format("{0} Bytes rounded to {1} {2}.",
+ ''' fsize.Size(Filesize.SizeUnits.Byte, CultureInfo.CurrentCulture.NumberFormat),
+ ''' fsize.SizeRounded(decimalPrecision:=2, numberFormatInfo:=Nothing),
+ ''' fsize.SizeUnitNameLong)
+ '''
+ ''' Console.WriteLine(stringFormat)
+ '''
+ ''' Next sizeUnit
+ '''
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ ''' This is a code example that converts a Terabyte (1099511627776 Bytes) to other units of size.
+ '''
+ ''' Dim fsize As New Filesize(Filesize.SizeUnits.TeraByte, Filesize.SizeUnits.Byte)
+ '''
+ ''' For Each sizeUnit As Filesize.SizeUnits In [Enum].GetValues(GetType(Filesize.SizeUnits))
+ '''
+ ''' Dim stringFormat As String =
+ ''' String.Format("{0} Bytes equals to {1} {2}.",
+ ''' fsize.Size(Filesize.SizeUnits.Byte, Nothing, CultureInfo.CurrentCulture.NumberFormat),
+ ''' fsize.Size(sizeUnit, 2, CultureInfo.CurrentCulture.NumberFormat),
+ ''' sizeUnit.ToString())
+ '''
+ ''' Console.WriteLine(stringFormat)
+ '''
+ ''' Next sizeUnit
+ '''
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+
+
+ Friend NotInheritable Class Filesize
+
+#Region " Private Fields "
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' The filesize, in Bytes.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ Private ReadOnly bytesB As Double
+
+#End Region
+
+#Region " Properties "
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Gets the filesize, in the specified unit of size.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' The unit of size.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' The filesize.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ Public ReadOnly Property Size(ByVal sizeUnit As SizeUnits) As Double
+
+ Get
+ Return Me.Convert(size:=Me.bytesB, fromUnit:=SizeUnits.Byte, toUnit:=sizeUnit)
+ End Get
+ End Property
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Gets the filesize, in the specified unit of size, using the specified numeric format.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' The unit of size.
+ '''
+ '''
+ '''
+ ''' A custom format provider.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' The filesize.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ Public ReadOnly Property Size(ByVal sizeUnit As SizeUnits,
+ ByVal decimalPrecision As Integer,
+ Optional ByVal numberFormatInfo As NumberFormatInfo = Nothing) As String
+
+ Get
+ If (numberFormatInfo Is Nothing) Then
+ numberFormatInfo = CultureInfo.CurrentCulture.NumberFormat
+ End If
+ Return Me.Size(sizeUnit).ToString(String.Format("N{0}", decimalPrecision), numberFormatInfo)
+ End Get
+ End Property
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Gets the filesize, rounded using the most approximated unit of size.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' The rounded filesize.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ Public ReadOnly Property SizeRounded As Double
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Gets the filesize, rounded using the most approximated unit of size, with the specified decimal precision.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' The decimal precision.
+ '''
+ '''
+ '''
+ ''' A format provider.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' The rounded value, with the specified decimal precision.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ Public ReadOnly Property SizeRounded(ByVal decimalPrecision As Integer,
+ Optional ByVal numberFormatInfo As NumberFormatInfo = Nothing) As String
+
+ Get
+ If numberFormatInfo Is Nothing Then
+ numberFormatInfo = CultureInfo.CurrentCulture.NumberFormat
+ End If
+ Return Me.SizeRounded.ToString(String.Format("N{0}", decimalPrecision), numberFormatInfo)
+ End Get
+ End Property
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Gets the used to round the .
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' The .
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ Public ReadOnly Property SizeUnit As SizeUnits
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Gets the short name of the used to round the .
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' The short name of the .
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ Public ReadOnly Property SizeUnitNameShort As String
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Gets the long name of the used to round the .
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' The short long of the .
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ Public ReadOnly Property SizeUnitNameLong As String
+
+#End Region
+
+#Region " Constructors "
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Prevents a default instance of the class from being created.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ Private Sub New()
+ End Sub
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Initializes a new instance of the class.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' The filesize.
+ '''
+ '''
+ '''
+ ''' The unit of size.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+
+ Public Sub New(ByVal size As Double, ByVal sizeUnit As SizeUnits)
+
+ Me.bytesB = Global.System.Convert.ToDouble(size * sizeUnit)
+
+ Select Case Math.Abs(Me.bytesB)
+
+ Case Is >= SizeUnits.Petabyte
+ Me.SizeRounded = (Me.bytesB / SizeUnits.Petabyte)
+ Me.SizeUnit = SizeUnits.Petabyte
+ Me.SizeUnitNameShort = "PB"
+ Me.SizeUnitNameLong = "PetaBytes"
+
+ Case Is >= SizeUnits.Terabyte
+ Me.SizeRounded = (Me.bytesB / SizeUnits.Terabyte)
+ Me.SizeUnit = SizeUnits.Terabyte
+ Me.SizeUnitNameShort = "TB"
+ Me.SizeUnitNameLong = "TeraBytes"
+
+ Case Is >= SizeUnits.Gigabyte
+ Me.SizeRounded = (Me.bytesB / SizeUnits.Gigabyte)
+ Me.SizeUnit = SizeUnits.Gigabyte
+ Me.SizeUnitNameShort = "GB"
+ Me.SizeUnitNameLong = "GigaBytes"
+
+ Case Is >= SizeUnits.Megabyte
+ Me.SizeRounded = (Me.bytesB / SizeUnits.Megabyte)
+ Me.SizeUnit = SizeUnits.Megabyte
+ Me.SizeUnitNameShort = "MB"
+ Me.SizeUnitNameLong = "MegaBytes"
+
+ Case Is >= SizeUnits.Kilobyte
+ Me.SizeRounded = (Me.bytesB / SizeUnits.Kilobyte)
+ Me.SizeUnit = SizeUnits.Kilobyte
+ Me.SizeUnitNameShort = "KB"
+ Me.SizeUnitNameLong = "KiloBytes"
+
+ Case Is >= SizeUnits.Byte, Is = 0
+ Me.SizeRounded = (Me.bytesB / SizeUnits.Byte)
+ Me.SizeUnit = SizeUnits.Byte
+ Me.SizeUnitNameShort = "Bytes"
+ Me.SizeUnitNameLong = "Bytes"
+
+ End Select
+
+ End Sub
+
+#End Region
+
+#Region " Public Methods "
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Returns a that represents this filesize.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' A that represents this filesize.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ Public Overrides Function ToString() As String
+ Return Me.ToString(CultureInfo.InvariantCulture.NumberFormat)
+ End Function
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Returns a that represents this filesize.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' A that represents this filesize.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ Public Overloads Function ToString(ByVal provider As IFormatProvider) As String
+ If Me.SizeUnit = SizeUnits.Byte Then
+ Return String.Format(provider, "{0:0.##} {1}", Math.Floor(Me.SizeRounded * 100) / 100, Me.SizeUnitNameShort)
+ Else
+ Return String.Format(provider, "{0:0.00} {1}", Math.Floor(Me.SizeRounded * 100) / 100, Me.SizeUnitNameShort)
+ End If
+ End Function
+
+#End Region
+
+#Region " Private Methods "
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Converts the specified filesize to a different unit of size.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' The filesize.
+ '''
+ '''
+ '''
+ ''' The unit size to convert from.
+ '''
+ '''
+ '''
+ ''' The unit size to convert to.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' The resulting value of the unit conversion.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+
+ Private Function Convert(ByVal size As Double,
+ ByVal fromUnit As SizeUnits,
+ ByVal toUnit As SizeUnits) As Double
+
+ Dim bytes As Double
+
+ If fromUnit = SizeUnits.Byte Then
+ bytes = size
+
+ Else
+ bytes = Global.System.Convert.ToDouble(size * fromUnit)
+
+ End If
+
+ If (toUnit < fromUnit) Then
+
+ Select Case toUnit
+
+ Case SizeUnits.Byte
+ Return bytes
+
+ Case SizeUnits.Kilobyte
+ Return (bytes / SizeUnits.Kilobyte)
+
+ Case SizeUnits.Megabyte
+ Return (bytes / SizeUnits.Megabyte)
+
+ Case SizeUnits.Gigabyte
+ Return (bytes / SizeUnits.Gigabyte)
+
+ Case SizeUnits.Terabyte
+ Return (bytes / SizeUnits.Terabyte)
+
+ Case SizeUnits.Petabyte
+ Return (bytes / SizeUnits.Petabyte)
+
+ Case Else
+ Throw New InvalidEnumArgumentException(argumentName:=NameOf(toUnit), invalidValue:=CInt(toUnit),
+ enumClass:=GetType(SizeUnits))
+
+ End Select
+
+ ElseIf (toUnit > fromUnit) Then
+
+ Select Case toUnit
+
+ Case SizeUnits.Byte
+ Return bytes
+
+ Case SizeUnits.Kilobyte
+ Return (bytes * SizeUnits.Kilobyte / SizeUnits.Kilobyte ^ 2)
+
+ Case SizeUnits.Megabyte
+ Return (bytes * SizeUnits.Megabyte / SizeUnits.Megabyte ^ 2)
+
+ Case SizeUnits.Gigabyte
+ Return (bytes * SizeUnits.Gigabyte / SizeUnits.Gigabyte ^ 2)
+
+ Case SizeUnits.Terabyte
+ Return (bytes * SizeUnits.Terabyte / SizeUnits.Terabyte ^ 2)
+
+ Case SizeUnits.Petabyte
+ Return (bytes * SizeUnits.Petabyte / SizeUnits.Petabyte ^ 2)
+
+ Case Else
+ Throw New InvalidEnumArgumentException(argumentName:=NameOf(toUnit), invalidValue:=CInt(toUnit),
+ enumClass:=GetType(SizeUnits))
+
+ End Select
+
+ Else ' If toUnit = fromUnit
+ Return bytes
+
+ End If
+
+ End Function
+
+#End Region
+
+ End Class
+
+End Namespace
+
+#End Region
diff --git a/src/DevCase/IconFileNameEditor.vb b/src/DevCase/IconFileNameEditor.vb
new file mode 100644
index 0000000..2e34808
--- /dev/null
+++ b/src/DevCase/IconFileNameEditor.vb
@@ -0,0 +1,80 @@
+' This source-code is freely distributed as part of "DevCase for .NET Framework".
+'
+' Maybe you would like to consider to buy this powerful set of libraries to support me.
+' You can do loads of things with my apis for a big amount of diverse thematics.
+'
+' Here is a link to the purchase page:
+' https://codecanyon.net/item/elektrokit-class-library-for-net/19260282
+'
+' Thank you.
+
+#Region " Option Statements "
+
+Option Strict On
+Option Explicit On
+Option Infer Off
+
+#End Region
+
+#Region " Imports "
+
+Imports System.Windows.Forms.Design
+
+#End Region
+
+#Region " IconFileNameEditor "
+
+Namespace DevCase.Core.Design
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Provides a user interface for selecting a icon file name.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ Friend Class IconFileNameEditor : Inherits FileNameEditor
+
+#Region " Constructors "
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Initializes a new instance of the class.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ Public Sub New()
+ MyBase.New()
+ End Sub
+
+#End Region
+
+#Region " Private Methods "
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Initializes the open file dialog when it is created.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' The to use to select a file name.
+ '''
+ Protected Overrides Sub InitializeDialog(ByVal dlg As OpenFileDialog)
+ MyBase.InitializeDialog(dlg)
+
+ With dlg
+ .Multiselect = False
+ .RestoreDirectory = True
+ .DereferenceLinks = True
+ .Filter = "Icon Files (*.ico;*.icl;*.exe;*.dll)|*.ico;*.icl;*.exe;*.dll|Icons|*.ico|Libraries|*.dll|Programs|*.exe"
+ .FilterIndex = 1
+ .SupportMultiDottedExtensions = True
+ End With
+ End Sub
+
+#End Region
+
+ End Class
+
+End Namespace
+
+#End Region
diff --git a/src/DevCase/ImageUtil.vb b/src/DevCase/ImageUtil.vb
index 8c2d8fb..19a2b88 100644
--- a/src/DevCase/ImageUtil.vb
+++ b/src/DevCase/ImageUtil.vb
@@ -53,6 +53,51 @@ Namespace DevCase.Core.Imaging.Tools
#Region " Public Methods "
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Extracts the icon associated for the specified directory.
+ '''
+ ''' Note: the maximum size of the returned icon only can be 32x32.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ ''' This is a code example.
+ '''
+ ''' Dim path As String = "C:\Windows"
+ ''' Dim ico As Icon = ExtractIconFromDirectory(path)
+ ''' Dim bmp As Bitmap = ico.ToBitmap()
+ ''' PictureBox1.BackgroundImage = bmp
+ '''
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' The full path to a directory.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' The resulting icon.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+
+ Public Shared Function ExtractIconFromDirectory(ByVal directoryPath As String) As Icon
+
+ ' Note that the icon returned by "SHGetFileInfo" function
+ ' is limited to "SHGetFileInfoFlags.IconSizeSmall" (16x16)
+ ' and "SHGetFileInfoFlags.IconSizeLarge" (32x32) icon size.
+
+ Dim shInfo As New ShellFileInfo()
+
+ Dim result As IntPtr = NativeMethods.SHGetFileInfo(directoryPath, FileAttributes.Directory, shInfo, CUInt(Marshal.SizeOf(shInfo)), SHGetFileInfoFlags.Icon Or SHGetFileInfoFlags.IconSizeLarge)
+
+ If (result = IntPtr.Zero) Then
+ Return Nothing
+ End If
+
+ Dim ico As Icon = TryCast(Icon.FromHandle(shInfo.IconHandle).Clone(), Icon)
+ NativeMethods.DestroyIcon(shInfo.IconHandle)
+ Return ico
+
+ End Function
+
''' ----------------------------------------------------------------------------------------------------
'''
''' Extracts the icon associated for the specified file.
@@ -95,12 +140,135 @@ Namespace DevCase.Core.Imaging.Tools
Return Nothing
End If
- Dim ico As Icon = TryCast(Drawing.Icon.FromHandle(shInfo.IconHandle).Clone(), Drawing.Icon)
+ Dim ico As Icon = TryCast(Icon.FromHandle(shInfo.IconHandle).Clone(), Icon)
+ NativeMethods.DestroyIcon(shInfo.IconHandle)
+ Return ico
+
+ End Function
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Extracts the icon associated for the specified file extension.
+ '''
+ ''' Note: the maximum size of the returned icon only can be 32x32.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ ''' This is a code example.
+ '''
+ ''' Dim ext As String = ".txt"
+ ''' Dim ico As Icon = ExtractIconFromFileExtension(ext)
+ ''' Dim bmp As Bitmap = ico.ToBitmap()
+ ''' PictureBox1.BackgroundImage = bmp
+ '''
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' The file extension.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' The resulting icon.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+
+ Public Shared Function ExtractIconFromFileExtension(ByVal ext As String) As Icon
+
+ ' Note that the icon returned by "SHGetFileInfo" function
+ ' is limited to "SHGetFileInfoFlags.IconSizeSmall" (16x16)
+ ' and "SHGetFileInfoFlags.IconSizeLarge" (32x32) icon size.
+
+ Dim shInfo As New ShellFileInfo()
+
+ Dim result As IntPtr = NativeMethods.SHGetFileInfo(ext, FileAttributes.Normal, shInfo, CUInt(Marshal.SizeOf(shInfo)), SHGetFileInfoFlags.UseFileAttributes Or SHGetFileInfoFlags.Icon Or SHGetFileInfoFlags.IconSizeLarge)
+ If (result = IntPtr.Zero) Then
+ result = NativeMethods.SHGetFileInfo(ext, FileAttributes.Normal, shInfo, CUInt(Marshal.SizeOf(shInfo)), SHGetFileInfoFlags.Icon Or SHGetFileInfoFlags.IconSizeLarge)
+ End If
+
+ If (result = IntPtr.Zero) Then
+ Return Nothing
+ End If
+
+ Dim ico As Icon = TryCast(Icon.FromHandle(shInfo.IconHandle).Clone(), Icon)
NativeMethods.DestroyIcon(shInfo.IconHandle)
Return ico
End Function
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Extracts a icon stored in the specified executable, dll or icon file.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ ''' This is a code example.
+ '''
+ ''' Dim ico As Icon = ExtractIconFromExecutableFile("C:\Windows\Explorer.exe", 0)
+ ''' Dim bmp As Bitmap = ico.ToBitmap()
+ ''' PictureBox1.BackgroundImage = bmp
+ '''
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' The source filepath.
+ '''
+ '''
+ '''
+ ''' The index of the icon to be extracted.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+
+ Public Shared Function ExtractIconFromExecutableFile(ByVal filepath As String,
+ ByVal iconIndex As Integer) As Icon
+
+ Return ImageUtil.ExtractIconFromExecutableFile(filepath, iconIndex, 0)
+
+ End Function
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Extracts a icon stored in the specified executable, dll or icon file.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ ''' This is a code example.
+ '''
+ ''' Dim ico As Icon = ExtractIconFromExecutableFile("C:\Windows\Explorer.exe", 0, 256)
+ ''' Dim bmp As Bitmap = ico.ToBitmap()
+ ''' PictureBox1.BackgroundImage = bmp
+ '''
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' The source filepath.
+ '''
+ '''
+ '''
+ ''' The index of the icon to be extracted.
+ '''
+ '''
+ '''
+ ''' The icon size, in pixels.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+
+ Public Shared Function ExtractIconFromExecutableFile(ByVal filepath As String,
+ ByVal iconIndex As Integer,
+ ByVal iconSize As Integer) As Icon
+
+ Dim hiconLarge As IntPtr
+ Dim result As Integer = NativeMethods.SHDefExtractIcon(filepath, iconIndex, 0, hiconLarge, Nothing, CUInt(iconSize))
+
+ If (CType(result, HResult) <> HResult.S_OK) Then
+ Marshal.ThrowExceptionForHR(result)
+ Return Nothing
+
+ Else
+ Dim ico As Icon = TryCast(Icon.FromHandle(hiconLarge).Clone(), Icon)
+ NativeMethods.DestroyIcon(hiconLarge)
+ Return ico
+
+ End If
+
+ End Function
+
#End Region
End Class
diff --git a/src/DevCase/OpenFileOrFolderDialog.vb b/src/DevCase/OpenFileOrFolderDialog.vb
new file mode 100644
index 0000000..ada9ed4
--- /dev/null
+++ b/src/DevCase/OpenFileOrFolderDialog.vb
@@ -0,0 +1,490 @@
+' This source-code is freely distributed as part of "DevCase for .NET Framework".
+'
+' Maybe you would like to consider to buy this powerful set of libraries to support me.
+' You can do loads of things with my apis for a big amount of diverse thematics.
+'
+' Here is a link to the purchase page:
+' https://codecanyon.net/item/elektrokit-class-library-for-net/19260282
+'
+' Thank you.
+
+#Region " Option Statements "
+
+Option Explicit On
+Option Strict On
+Option Infer Off
+
+#End Region
+
+#Region " Imports "
+
+Imports System.ComponentModel
+Imports System.IO
+
+#End Region
+
+#Region " OpenFileOrFolderDialog "
+
+Namespace DevCase.UserControls.Controls
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Displays a dialog box that prompts the user to open a (single) file or folder.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Original source-code:
+ '''
+ '''
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+
+
+
+
+
+
+
+
+ Friend Class OpenFileOrFolderDialog : Inherits CommonDialog
+
+#Region " Private Fields "
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' The underlying .
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ Protected WithEvents Dialog As OpenFileDialog
+
+#End Region
+
+#Region " Properties "
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Gets the custom places collection for this instance.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' The custom places collection for this instance.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+
+
+ Public ReadOnly Property CustomPlaces As FileDialogCustomPlacesCollection
+
+ Get
+ Return Me.Dialog.CustomPlaces
+ End Get
+ End Property
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Gets or sets the dialog box title.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' The dialog box title. The default value is an empty string ("").
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+
+
+
+ Public Property Title As String
+
+ Get
+ Return Me.Dialog.Title
+ End Get
+
+ Set(value As String)
+ Me.Dialog.Title = value
+ End Set
+ End Property
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Gets or sets a value indicating whether the Help button is displayed in the dialog box.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' if the dialog box includes a help button;
+ ''' otherwise, .
+ '''
+ ''' The default value is .
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+
+
+ Public Property ShowHelp As Boolean
+
+ Get
+ Return Me.Dialog.ShowHelp
+ End Get
+
+ Set(value As Boolean)
+ Me.Dialog.ShowHelp = value
+ End Set
+ End Property
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Gets or sets a value indicating whether the dialog box restores the directory
+ ''' to the previously selected directory before closing.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' if the dialog box restores the current directory
+ ''' to the previously selected directory if the user changed the directory while searching for files;
+ ''' otherwise, .
+ '''
+ ''' The default value is .
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+
+
+ Public Property RestoreDirectory As Boolean
+
+ Get
+ Return Me.Dialog.RestoreDirectory
+ End Get
+
+ Set(value As Boolean)
+ Me.Dialog.RestoreDirectory = value
+ End Set
+ End Property
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Gets or sets the initial directory displayed by the dialog box.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' The initial directory displayed by the dialog box. The default is an empty string ("").
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+
+
+ Public Property InitialDirectory As String
+
+ Get
+ Return Me.Dialog.InitialDirectory
+ End Get
+
+ Set(value As String)
+ Me.Dialog.InitialDirectory = value
+ End Set
+ End Property
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Gets or sets a value indicating whether this dialog box should
+ ''' automatically upgrade appearance and behavior when running on Windows Vista.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' if this System.Windows.Forms.FileDialog instance
+ ''' should automatically upgrade appearance and behavior when running on Windows Vista;
+ ''' otherwise, .
+ '''
+ ''' The default value is .
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+
+
+ Public Property AutoUpgradeEnabled As Boolean
+
+ Get
+ Return Me.Dialog.AutoUpgradeEnabled
+ End Get
+
+ Set(value As Boolean)
+ Me.Dialog.AutoUpgradeEnabled = value
+ End Set
+ End Property
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Gets or sets a value indicating whether the dialog box returns the location of the
+ ''' file referenced by the shortcut or whether it returns the location of the shortcut (.lnk).
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' if the dialog box returns the location of the file referenced by the shortcut;
+ ''' otherwise, .
+ '''
+ ''' The default value is .
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+
+
+ Public Property DereferenceLinks As Boolean
+
+ Get
+ Return Me.Dialog.DereferenceLinks
+ End Get
+
+ Set(value As Boolean)
+ Me.Dialog.DereferenceLinks = value
+ End Set
+ End Property
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Gets or sets a string containing the name of the item selected in the dialog box.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ ''' The name of the item selected in the dialog box.
+ '''
+ ''' The default value is an empty string ("").
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+
+
+ Public Property ItemName As String
+
+ Get
+ Try
+ If Not String.IsNullOrWhiteSpace(Me.Dialog.FileName) AndAlso
+ (Me.Dialog.FileName.EndsWith("Folder Selection.", StringComparison.OrdinalIgnoreCase) OrElse
+ Not File.Exists(Me.Dialog.FileName)) AndAlso
+ Not Directory.Exists(Me.Dialog.FileName) Then
+ Return Path.GetDirectoryName(Me.Dialog.FileName)
+ Else
+ Return Me.Dialog.FileName
+
+ End If
+
+ Catch
+ Return Me.Dialog.FileName
+ End Try
+ End Get
+
+ Set(ByVal value As String)
+ Me.Dialog.FileName = value
+ End Set
+ End Property
+
+#End Region
+
+#Region " Events "
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Occurs when the user clicks on the Open button on the dialog box to select a file or folder.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+
+ Public Event ItemOk As CancelEventHandler
+
+#End Region
+
+#Region " Constructors "
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Initializes a new instance of the class.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+
+ Public Sub New()
+ ' Set validate names to false. Otherwise, windows will not let you select "Folder Selection."
+ Me.Dialog = New OpenFileDialog With {
+ .Multiselect = False,
+ .ValidateNames = False,
+ .CheckFileExists = False,
+ .CheckPathExists = True
+ }
+ End Sub
+
+#End Region
+
+#Region " Public Methods "
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Runs a common dialog box with a default owner.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' if the user clicks OK in the dialog box;
+ ''' otherwise, .
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+
+ Public Shadows Function ShowDialog() As DialogResult
+ Return Me.ShowDialog(Nothing)
+ End Function
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Runs a common dialog box with a default owner.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Any object that implements that represents the
+ ''' top-level window that will own the modal dialog box.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' if the user clicks OK in the dialog box;
+ ''' otherwise, .
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+
+ Public Shadows Function ShowDialog(ByVal owner As IWin32Window) As DialogResult
+ ' Set initial directory (used when 'Me.dialog.FileName' is set from outside)
+ If Not (String.IsNullOrWhiteSpace(Me.Dialog.FileName)) Then
+ Try
+ If Directory.Exists(Me.Dialog.FileName) Then
+ Me.Dialog.InitialDirectory = Me.Dialog.FileName
+ Else
+ Me.Dialog.InitialDirectory = Path.GetDirectoryName(Me.Dialog.FileName)
+ End If
+
+ Catch
+ ' Do nothing
+ End Try
+ End If
+
+ ' Always default to "Folder Selection."
+ Me.Dialog.FileName = "Folder Selection."
+
+ If (owner Is Nothing) Then
+ Return Me.Dialog.ShowDialog()
+ Else
+ Return Me.Dialog.ShowDialog(owner)
+ End If
+ End Function
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Resets the properties of a common dialog box to their default values.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+
+ Public Overrides Sub Reset()
+ Me.Dialog.Reset()
+ End Sub
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Returns a string version of this object.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' A string version of this object.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+
+ Public Overrides Function ToString() As String
+ Return Me.Dialog.ToString()
+ End Function
+
+#End Region
+
+#Region " Event Invocators "
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Raises the System.Windows.Forms.FileDialog.FileOk event.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' A that contains the event data.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+
+ Protected Sub OnItemOk(ByVal e As CancelEventArgs)
+ If (Me.ItemOkEvent IsNot Nothing) Then
+ RaiseEvent ItemOk(Me, e)
+ End If
+ End Sub
+
+#End Region
+
+#Region " Event Handlers "
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Handles the event of the component.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' The source of the event.
+ '''
+ '''
+ '''
+ ''' The instance containing the event data.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+
+ Private Sub Dialog_OnFileOk(ByVal sender As Object, ByVal e As CancelEventArgs) Handles Dialog.FileOk
+ Me.OnItemOk(e)
+ End Sub
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Handles the event of the component.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' The source of the event.
+ '''
+ '''
+ '''
+ ''' The instance containing the event data.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+
+ Private Sub Dialog_OnFileOk(ByVal sender As Object, ByVal e As EventArgs) Handles Dialog.HelpRequest
+ Me.OnHelpRequest(e)
+ End Sub
+
+#End Region
+
+#Region " Private Methods "
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Specifies a common dialog box.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' A value that represents the window handle of the owner window for the common dialog box.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' if the dialog box was successfully run; otherwise, .
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+
+ Protected Overrides Function RunDialog(ByVal hwndOwner As IntPtr) As Boolean
+ Return True
+ End Function
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Releases the unmanaged resources used by the and optionally releases the managed resources.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' to release both managed and unmanaged resources;
+ ''' to release only unmanaged resources.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+
+ Protected Overrides Sub Dispose(disposing As Boolean)
+ Me.Dialog?.Dispose()
+ MyBase.Dispose(disposing)
+ End Sub
+
+#End Region
+
+ End Class
+
+End Namespace
+
+#End Region
\ No newline at end of file
diff --git a/src/DevCase/ShortcutFileInfo.vb b/src/DevCase/ShortcutFileInfo.vb
index 9e18bb8..b60e13b 100644
--- a/src/DevCase/ShortcutFileInfo.vb
+++ b/src/DevCase/ShortcutFileInfo.vb
@@ -40,6 +40,7 @@
' Name As String
' Target As String
' TargetArguments As String
+' TargetDisplayName As String
' ViewMode As Boolean
' WindowState As ShortcutWindowState
' WorkingDirectory As String
@@ -102,16 +103,19 @@ Option Infer Off
#Region " Imports "
Imports System.ComponentModel
+Imports System.Drawing.Design
Imports System.IO
Imports System.Runtime.InteropServices
Imports System.Security
Imports System.Security.AccessControl
Imports System.Text
+Imports System.Windows.Forms.Design
Imports System.Xml.Serialization
+
+Imports DevCase.Core.Design
Imports DevCase.Interop.Unmanaged.Win32
Imports DevCase.Interop.Unmanaged.Win32.Enums
Imports DevCase.Interop.Unmanaged.Win32.Interfaces
-Imports DevCase.Interop.Unmanaged.Win32.Structures
#End Region
@@ -151,7 +155,7 @@ Namespace DevCase.Core.IO
-
+
Friend NotInheritable Class ShortcutFileInfo : Inherits FileSystemInfo
#Region " Properties "
@@ -195,10 +199,11 @@ Namespace DevCase.Core.IO
''' The file attributes.
'''
''' ----------------------------------------------------------------------------------------------------
-
+
+
Public ReadOnly Property Length As Long
Get
Return New FileInfo(Me.FullName).Length
@@ -211,14 +216,14 @@ Namespace DevCase.Core.IO
''' ----------------------------------------------------------------------------------------------------
'''
- ''' Gets or sets the file attributes of the current shortcut file.
+ ''' Gets or sets the file attributes of the shortcut file.
'''
''' ----------------------------------------------------------------------------------------------------
'''
''' The file attributes.
'''
''' ----------------------------------------------------------------------------------------------------
-
+
@@ -235,14 +240,14 @@ Namespace DevCase.Core.IO
''' ----------------------------------------------------------------------------------------------------
'''
- ''' Gets or sets a value that determines if the current shortcut file is read-only.
+ ''' Gets or sets a value that determines if the shortcut file is read-only.
'''
''' ----------------------------------------------------------------------------------------------------
'''
- ''' if the current shortcut file is read-only; otherwise, .
+ ''' if the shortcut file is read-only; otherwise, .
'''
''' ----------------------------------------------------------------------------------------------------
-
+
@@ -325,14 +330,14 @@ Namespace DevCase.Core.IO
''' ----------------------------------------------------------------------------------------------------
'''
- ''' Gets or sets the creation time, in coordinated universal time (UTC) of the current shortcut file.
+ ''' Gets or sets the creation time, in coordinated universal time (UTC) of the shortcut file.
'''
''' ----------------------------------------------------------------------------------------------------
'''
''' The creation time UTC.
'''
''' ----------------------------------------------------------------------------------------------------
-
+
@@ -349,14 +354,14 @@ Namespace DevCase.Core.IO
''' ----------------------------------------------------------------------------------------------------
'''
- ''' Gets or sets the time, in coordinated universal time (UTC), the current shortcut file was last accessed.
+ ''' Gets or sets the time, in coordinated universal time (UTC), the shortcut file was last accessed.
'''
''' ----------------------------------------------------------------------------------------------------
'''
''' The last access time UTC.
'''
''' ----------------------------------------------------------------------------------------------------
-
+
@@ -373,14 +378,14 @@ Namespace DevCase.Core.IO
''' ----------------------------------------------------------------------------------------------------
'''
- ''' Gets or sets the time, in coordinated universal time (UTC), the current shortcut file was last written to.
+ ''' Gets or sets the time, in coordinated universal time (UTC), the shortcut file was last written to.
'''
''' ----------------------------------------------------------------------------------------------------
'''
''' The last write time UTC.
'''
''' ----------------------------------------------------------------------------------------------------
-
+
@@ -397,14 +402,14 @@ Namespace DevCase.Core.IO
''' ----------------------------------------------------------------------------------------------------
'''
- ''' Gets or sets the creation time of the current shortcut file.
+ ''' Gets or sets the creation time of the shortcut file.
'''
''' ----------------------------------------------------------------------------------------------------
'''
''' The creation time.
'''
''' ----------------------------------------------------------------------------------------------------
-
+
@@ -421,14 +426,14 @@ Namespace DevCase.Core.IO
''' ----------------------------------------------------------------------------------------------------
'''
- ''' Gets or sets the time the current shortcut file was last accessed.
+ ''' Gets or sets the time the shortcut file was last accessed.
'''
''' ----------------------------------------------------------------------------------------------------
'''
''' The last access time.
'''
''' ----------------------------------------------------------------------------------------------------
-
+
@@ -445,14 +450,14 @@ Namespace DevCase.Core.IO
''' ----------------------------------------------------------------------------------------------------
'''
- ''' Gets or sets the time the current shortcut file was last written to.
+ ''' Gets or sets the time the shortcut file was last written to.
'''
''' ----------------------------------------------------------------------------------------------------
'''
''' The last write time.
'''
''' ----------------------------------------------------------------------------------------------------
-
+
@@ -509,6 +514,7 @@ Namespace DevCase.Core.IO
+
Public Property Hotkey As Keys
Get
Return Me.hotkey_
@@ -531,13 +537,14 @@ Namespace DevCase.Core.IO
''' ----------------------------------------------------------------------------------------------------
'''
- ''' Gets or sets the full path to the icon file.
+ ''' Gets or sets the full path of the icon file.
'''
''' ----------------------------------------------------------------------------------------------------
-
+
+
Public Property Icon As String
Get
Return Me.icon_
@@ -553,17 +560,18 @@ Namespace DevCase.Core.IO
'''
''' ( Backing Field of property. )
'''
- ''' The full path to the icon file.
+ ''' The full path of the icon file.
'''
''' ----------------------------------------------------------------------------------------------------
Private icon_ As String
''' ----------------------------------------------------------------------------------------------------
'''
- ''' Gets or sets the index of the image to use for the icon file.
+ ''' Gets or sets the image index within the icon file.
'''
''' ----------------------------------------------------------------------------------------------------
-
+
+
@@ -582,7 +590,7 @@ Namespace DevCase.Core.IO
'''
''' ( Backing Field of property. )
'''
- ''' The index of the image to use for the icon file.
+ ''' The image index within the icon file.
'''
''' ----------------------------------------------------------------------------------------------------
Private iconIndex_ As Integer
@@ -611,20 +619,21 @@ Namespace DevCase.Core.IO
'''
''' ( Backing Field of property. )
'''
- ''' The window state for the target file or directory.
+ ''' The window state of the target file or directory.
'''
''' ----------------------------------------------------------------------------------------------------
Private windowState_ As ShortcutWindowState
''' ----------------------------------------------------------------------------------------------------
'''
- ''' Gets or sets the full path to the target file or directory.
+ ''' Gets or sets the full path of the target file or directory.
'''
''' ----------------------------------------------------------------------------------------------------
-
+
+
Public Property Target As String
Get
Return Me.target_
@@ -640,17 +649,17 @@ Namespace DevCase.Core.IO
'''
''' ( Backing Field of property. )
'''
- ''' The full path to the target file or directory.
+ ''' The full path of the target file or directory.
'''
''' ----------------------------------------------------------------------------------------------------
Private target_ As String
''' ----------------------------------------------------------------------------------------------------
'''
- ''' Gets or sets the command-line arguments for a target executable file.
+ ''' Gets or sets the command-line arguments of the target.
'''
''' ----------------------------------------------------------------------------------------------------
-
+
@@ -669,11 +678,30 @@ Namespace DevCase.Core.IO
'''
''' ( Backing Field of property. )
'''
- ''' The command-line arguments for a target executable file.
+ ''' The command-line arguments of the target.
'''
''' ----------------------------------------------------------------------------------------------------
Private targetArguments_ As String
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Gets the display name of the target file or directory.
+ '''
+ ''' Returns a empty string if the target does not exist.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+
+
+
+
+ Public ReadOnly Property TargetDisplayName As String
+ Get
+ Dim shellItem As IShellItem = Nothing
+ NativeMethods.SHCreateItemFromParsingName(Me.target_, IntPtr.Zero, GetType(IShellItem).GUID, shellItem)
+ Return shellItem?.GetDisplayName(ShellItemGetDisplayName.NormalDisplay).ToString()
+ End Get
+ End Property
+
''' ----------------------------------------------------------------------------------------------------
'''
''' Gets or sets the working directory of the target file or directory.
@@ -683,6 +711,7 @@ Namespace DevCase.Core.IO
+
Public Property WorkingDirectory As String
Get
Return Me.workingDirectory_
@@ -721,7 +750,7 @@ Namespace DevCase.Core.IO
'''
''' ----------------------------------------------------------------------------------------------------
-
+
Public Property ViewMode As Boolean
Get
Return Me.viewMode_
@@ -1112,7 +1141,6 @@ Namespace DevCase.Core.IO
''' ----------------------------------------------------------------------------------------------------
Private Sub ReadLink()
-
Dim arguments As New StringBuilder(260)
Dim description As New StringBuilder(260)
Dim hotkey As UShort
@@ -1138,8 +1166,9 @@ Namespace DevCase.Core.IO
.GetWorkingDirectory(workingDir, workingDir.Capacity)
' SHGetNameFromIDList() can retrieve common file system paths, and CLSIDs/virtual folders.
- If NativeMethods.SHGetNameFromIDList(pidl, ShellItemGetDisplayName.DesktopAbsoluteParsing, target) <> HResult.S_OK Then
+ If (pidl = IntPtr.Zero) OrElse NativeMethods.SHGetNameFromIDList(pidl, ShellItemGetDisplayName.DesktopAbsoluteParsing, target) <> HResult.S_OK Then
target.Clear()
+
' IShellLinkW.GetPath() only can retrieve common file system paths.
.GetPath(target, target.Capacity, Nothing, IShellLinkGetPathFlags.RawPath)
End If
diff --git a/src/DevCase/ShortcutFileInfoIconIndexEditor.vb b/src/DevCase/ShortcutFileInfoIconIndexEditor.vb
new file mode 100644
index 0000000..4510fc1
--- /dev/null
+++ b/src/DevCase/ShortcutFileInfoIconIndexEditor.vb
@@ -0,0 +1,206 @@
+' This source-code is freely distributed as part of "DevCase for .NET Framework".
+'
+' Maybe you would like to consider to buy this powerful set of libraries to support me.
+' You can do loads of things with my apis for a big amount of diverse thematics.
+'
+' Here is a link to the purchase page:
+' https://codecanyon.net/item/elektrokit-class-library-for-net/19260282
+'
+' Thank you.
+
+#Region " Option Statements "
+
+Option Strict On
+Option Explicit On
+Option Infer Off
+
+#End Region
+
+#Region " Imports "
+
+Imports System.ComponentModel
+Imports System.Drawing.Design
+Imports System.IO
+
+Imports DevCase.Core.Imaging.Tools
+Imports DevCase.Core.IO
+
+#End Region
+
+#Region " ShortcutFileInfoIconIndexEditor "
+
+Namespace DevCase.Core.Design
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Provides a user interface for selecting the value of property.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ Friend NotInheritable Class ShortcutFileInfoIconIndexEditor : Inherits IconEditor
+
+#Region " Private Fields "
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' A reference to property.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ Private iconPath As String
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' A reference to property.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ Private target As String
+
+#End Region
+
+#Region " Public Methods "
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Paints a representative value of the given object to the provided canvas.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' What to paint and where to paint it.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ Public Overrides Sub PaintValue(ByVal e As PaintValueEventArgs)
+
+ Dim ico As Icon = Nothing
+ Dim index As Integer = CInt(e.Value)
+
+ Dim isIconPathEmpty As Boolean = String.IsNullOrWhiteSpace(Me.iconPath)
+ Dim iconFileExist As Boolean = File.Exists(Me.iconPath)
+
+ Dim isTargetEmpty As Boolean = String.IsNullOrWhiteSpace(Me.target)
+ Dim targetFileExist As Boolean = File.Exists(Me.target)
+ Dim targetDirExist As Boolean = System.IO.Directory.Exists(Me.target)
+
+ ' Try extract icon from icon file path.
+ If Not isIconPathEmpty AndAlso (iconFileExist) Then
+ Try
+ ico = ImageUtil.ExtractIconFromExecutableFile(Me.iconPath, index)
+ Catch
+ End Try
+ End If
+
+ ' Try extract icon from target file path.
+ If (ico Is Nothing) AndAlso Not (isTargetEmpty) AndAlso (targetFileExist) Then
+ Try
+ ico = ImageUtil.ExtractIconFromExecutableFile(Me.target, index)
+ Catch
+ End Try
+ End If
+
+ ' Try extract icon from target file extension.
+ If (ico Is Nothing) AndAlso Not (isTargetEmpty) AndAlso (targetFileExist) Then
+ Try
+ Dim ext As String = Path.GetExtension(Me.target)
+ ico = ImageUtil.ExtractIconFromFileExtension(ext)
+ Catch
+ End Try
+ End If
+
+ ' Try extract icon from target directory path.
+ If (ico Is Nothing) AndAlso Not (isTargetEmpty) AndAlso (targetDirExist) Then
+ Try
+ ico = ImageUtil.ExtractIconFromDirectory(Me.target)
+ Catch
+ End Try
+ End If
+
+ ' Set default (null) file icon.
+ If (ico Is Nothing) Then
+ Try
+ ico = ImageUtil.ExtractIconFromExecutableFile("Shell32.dll", 0)
+ Catch
+ End Try
+ End If
+
+ ' Draw the icon.
+ If (ico IsNot Nothing) Then
+ e.Graphics.DrawIcon(ico, e.Bounds)
+ End If
+
+ MyBase.PaintValue(e)
+ End Sub
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Edits the given object value using the editor style provided by the
+ ''' method.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' A type descriptor context that can be used to provide additional context information.
+ '''
+ '''
+ '''
+ ''' A service provider object through which editing services may be obtained.
+ '''
+ '''
+ '''
+ ''' An instance of the value being edited.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' The new value of the object.
+ '''
+ ''' If the value of the object has not changed, this should return the same object it was passed.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ Public Overrides Function EditValue(ByVal context As ITypeDescriptorContext, ByVal provider As IServiceProvider, ByVal value As Object) As Object
+ Me.UpdateFields(context)
+ Return MyBase.EditValue(context, provider, value)
+ End Function
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Retrieves the editing style of the method.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' A type descriptor context that can be used to provide additional context information.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' One of the values indicating the provided editing style.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ Public Overrides Function GetEditStyle(ByVal context As ITypeDescriptorContext) As UITypeEditorEditStyle
+ Me.UpdateFields(context)
+ Return UITypeEditorEditStyle.None
+ End Function
+
+#End Region
+
+#Region " Private Methods "
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Updates the and
+ ''' values.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' A type descriptor context that can be used to provide additional context information.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ Private Sub UpdateFields(ByVal context As ITypeDescriptorContext)
+ Dim lnk As ShortcutFileInfo = DirectCast(context.Instance, ShortcutFileInfo)
+ Me.iconPath = lnk.Icon
+ Me.target = lnk.Target
+ End Sub
+
+#End Region
+
+ End Class
+
+End Namespace
+
+#End Region
diff --git a/src/DevCase/SizeUnits.vb b/src/DevCase/SizeUnits.vb
new file mode 100644
index 0000000..6d3ed51
--- /dev/null
+++ b/src/DevCase/SizeUnits.vb
@@ -0,0 +1,83 @@
+' This source-code is freely distributed as part of "DevCase for .NET Framework".
+'
+' Maybe you would like to consider to buy this powerful set of libraries to support me.
+' You can do loads of things with my apis for a big amount of diverse thematics.
+'
+' Here is a link to the purchase page:
+' https://codecanyon.net/item/elektrokit-class-library-for-net/19260282
+'
+' Thank you.
+
+#Region " Option Statements "
+
+Option Strict On
+Option Explicit On
+Option Infer Off
+
+#End Region
+
+#Region " Size Units "
+
+Namespace DevCase.Core.IO
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Specifies a size unit.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ Friend Enum SizeUnits As Long
+
+ '''
+ ''' Represents 1 Byte.
+ '''
+ ''' (8 Bits)
+ '''
+ [Byte] = CLng(2 ^ 0)
+
+ '''
+ ''' Represents 1 Kilobyte.
+ '''
+ ''' (1.024 Bytes)
+ '''
+ Kilobyte = CLng(2 ^ 10)
+
+ '''
+ ''' Represents 1 MegaByte.
+ '''
+ ''' (1.048.576 Bytes)
+ '''
+ Megabyte = CLng(2 ^ 20)
+
+ '''
+ ''' Represents 1 Gigabyte.
+ '''
+ ''' (1.073.741.824 Bytes)
+ '''
+ Gigabyte = CLng(2 ^ 30)
+
+ '''
+ ''' Represents 1 Terabyte.
+ '''
+ ''' (1.099.511.627.776 Bytes)
+ '''
+ Terabyte = CLng(2 ^ 40)
+
+ '''
+ ''' Represents 1 Petabyte.
+ '''
+ ''' (1.125.899.906.842.624 Bytes)
+ '''
+ Petabyte = CLng(2 ^ 50)
+
+ '''
+ ''' Represents 1 Exabyte.
+ '''
+ ''' (1.152.921.504.606.846.976 Bytes)
+ '''
+ Exabyte = CLng(2 ^ 60)
+
+ End Enum
+
+End Namespace
+
+#End Region
diff --git a/src/DevCase/Win32/IShellItem.vb b/src/DevCase/Win32/IShellItem.vb
new file mode 100644
index 0000000..6100dc2
--- /dev/null
+++ b/src/DevCase/Win32/IShellItem.vb
@@ -0,0 +1,93 @@
+' This source-code is freely distributed as part of "DevCase for .NET Framework".
+'
+' Maybe you would like to consider to buy this powerful set of libraries to support me.
+' You can do loads of things with my apis for a big amount of diverse thematics.
+'
+' Here is a link to the purchase page:
+' https://codecanyon.net/item/elektrokit-class-library-for-net/19260282
+'
+' Thank you.
+
+#Region " Option Statements "
+
+Option Strict On
+Option Explicit On
+Option Infer Off
+
+#End Region
+
+#Region " Imports "
+
+Imports System.ComponentModel
+Imports System.Runtime.CompilerServices
+Imports System.Runtime.InteropServices
+Imports System.Security
+Imports System.Text
+
+Imports DevCase.Interop.Unmanaged.Win32.Enums
+
+#End Region
+
+#Region " IShellItem "
+
+Namespace DevCase.Interop.Unmanaged.Win32.Interfaces
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Exposes a method to return either icons or thumbnails for Shell items.
+ '''
+ ''' If no thumbnail or icon is available for the requested item, a per-class icon may be provided from the Shell
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ '''
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+
+
+
+
+ Public Interface IShellItem
+
+
+ Function NotImplemented_BindToHandler() As Object
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Gets the parent of an object.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' The address of a pointer to the parent of an interface.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ Function GetParent() As IShellItem
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Gets the display name of the object.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' One of the values that indicates how the name should look.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' A value that, when this function returns successfully,
+ ''' receives the address of a pointer to the retrieved display name.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+
+ Function GetDisplayName(ByVal sigdn As ShellItemGetDisplayName) As StringBuilder
+
+
+ Function NotImplemented_GetAttributes() As UInteger
+
+
+ Function NotImplemented_Compare() As Integer
+
+ End Interface
+
+End Namespace
+
+#End Region
diff --git a/src/DevCase/Win32/NativeMethods.vb b/src/DevCase/Win32/NativeMethods.vb
index 1bfdfb4..9f30b2a 100644
--- a/src/DevCase/Win32/NativeMethods.vb
+++ b/src/DevCase/Win32/NativeMethods.vb
@@ -18,12 +18,13 @@ Option Infer Off
#Region " Imports "
-Imports System.Diagnostics.CodeAnalysis
Imports System.IO
Imports System.Runtime.InteropServices
Imports System.Security
Imports System.Text
+
Imports DevCase.Interop.Unmanaged.Win32.Enums
+Imports DevCase.Interop.Unmanaged.Win32.Interfaces
Imports DevCase.Interop.Unmanaged.Win32.Structures
#End Region
@@ -143,11 +144,11 @@ Namespace DevCase.Interop.Unmanaged.Win32
''' A PIDL that identifies the item.
'''
'''
- '''
+ '''
''' A value from the enumeration that specifies the type of display name to retrieve.
'''
'''
- '''
+ '''
''' A value that, when this function returns successfully, receives the retrieved display name.
'''
''' ----------------------------------------------------------------------------------------------------
@@ -160,7 +161,116 @@ Namespace DevCase.Interop.Unmanaged.Win32
Public Shared Function SHGetNameFromIDList(ByVal pidl As IntPtr,
ByVal sigdn As ShellItemGetDisplayName,
- ByRef name As StringBuilder
+ ByRef refName As StringBuilder
+ ) As HResult
+ End Function
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Creates and initializes a Shell item object from a parsing name.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ '''
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' A display name.
+ '''
+ '''
+ '''
+ ''' Optional. A pointer to a bind context used to pass parameters as inputs and outputs to the parsing function.
+ '''
+ ''' These passed parameters are often specific to the data source and are documented by the data source owners.
+ '''
+ ''' For example, the file system data source accepts the name being parsed (as a structure),
+ ''' using the STR_FILE_SYS_BIND_DATA bind context parameter.
+ '''
+ '''
+ '''
+ ''' A reference to the IID of the interface to retrieve through ppv, typically IID_IShellItem or IID_IShellItem2.
+ '''
+ '''
+ '''
+ ''' When this method returns successfully, contains the interface pointer requested in .
+ ''' This is typically or IShellItem2.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' If this function succeeds, it returns .
+ ''' Otherwise, it returns an error code.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+
+ Public Shared Function SHCreateItemFromParsingName(ByVal path As String,
+ ByVal pbc As IntPtr,
+ ByRef refIID As Guid,
+ ByRef refShellItem As IShellItem
+ ) As HResult
+ End Function
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Provides a default handler to extract an icon from a file.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ '''
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' A pointer to a null-terminated buffer that contains the path and name of the file from which the icon is extracted.
+ '''
+ '''
+ '''
+ ''' The location of the icon within the file named in pszIconFile.
+ '''
+ ''' If this is a positive number, it refers to the zero-based position of the icon in the file.
+ '''
+ ''' For instance, 0 refers to the 1st icon in the resource file and 2 refers to the 3rd.
+ ''' If this is a negative number, it refers to the icon's resource ID.
+ '''
+ '''
+ '''
+ ''' A flag that controls the icon extraction.
+ '''
+ '''
+ '''
+ ''' A pointer to an HICON that, when this function returns successfully,
+ ''' receives the handle of the large version of the icon specified in the LOWORD of nIconSize.
+ '''
+ ''' This value can be .
+ '''
+ '''
+ '''
+ ''' A pointer to an HICON that, when this function returns successfully,
+ ''' receives the handle of the small version of the icon specified in the HIWORD of param.
+ '''
+ ''' This value can be .
+ '''
+ '''
+ '''
+ ''' A value that contains the large icon size in its LOWORD and the small icon size in its HIWORD.
+ '''
+ ''' Size is measured in pixels.
+ '''
+ ''' Pass 0 to specify default large and small sizes.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' This function can return one of these values:
+ '''
+ ''' , or .
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+
+
+ Public Shared Function SHDefExtractIcon(ByVal iconFile As String,
+ ByVal iconIndex As Integer,
+ ByVal flags As UInteger,
+ ByRef refHiconLarge As IntPtr,
+ ByRef refHiconSmall As IntPtr,
+ ByVal iconSize As UInteger
) As HResult
End Function
diff --git a/src/Easy Link File Viewer.vbproj b/src/Easy Link File Viewer.vbproj
index 673f63c..e29fe94 100644
--- a/src/Easy Link File Viewer.vbproj
+++ b/src/Easy Link File Viewer.vbproj
@@ -58,7 +58,9 @@
+
+
@@ -78,8 +80,19 @@
+
+
+
+
+
+
+ Component
+
+
+
+
AboutBox1.vb
@@ -155,6 +168,10 @@
+
+
+
+
diff --git a/src/My Project/AssemblyInfo.vb b/src/My Project/AssemblyInfo.vb
index 38485d4..debc8d0 100644
--- a/src/My Project/AssemblyInfo.vb
+++ b/src/My Project/AssemblyInfo.vb
@@ -32,6 +32,6 @@ Imports System.Runtime.InteropServices
' by using the '*' as shown below:
'
-
-
+
+
diff --git a/src/My Project/Resources.Designer.vb b/src/My Project/Resources.Designer.vb
index 1dcacc8..5d5c30c 100644
--- a/src/My Project/Resources.Designer.vb
+++ b/src/My Project/Resources.Designer.vb
@@ -120,6 +120,26 @@ Namespace My.Resources
End Get
End Property
+ '''
+ ''' Looks up a localized resource of type System.Drawing.Bitmap.
+ '''
+ Friend ReadOnly Property FolderOpen_16x() As System.Drawing.Bitmap
+ Get
+ Dim obj As Object = ResourceManager.GetObject("FolderOpen_16x", resourceCulture)
+ Return CType(obj,System.Drawing.Bitmap)
+ End Get
+ End Property
+
+ '''
+ ''' Looks up a localized resource of type System.Drawing.Bitmap.
+ '''
+ Friend ReadOnly Property FontSize_16x() As System.Drawing.Bitmap
+ Get
+ Dim obj As Object = ResourceManager.GetObject("FontSize_16x", resourceCulture)
+ Return CType(obj,System.Drawing.Bitmap)
+ End Get
+ End Property
+
'''
''' Looks up a localized resource of type System.Drawing.Bitmap.
'''
@@ -140,6 +160,26 @@ Namespace My.Resources
End Get
End Property
+ '''
+ ''' Looks up a localized resource of type System.Drawing.Bitmap.
+ '''
+ Friend ReadOnly Property NewFile_16x() As System.Drawing.Bitmap
+ Get
+ Dim obj As Object = ResourceManager.GetObject("NewFile_16x", resourceCulture)
+ Return CType(obj,System.Drawing.Bitmap)
+ End Get
+ End Property
+
+ '''
+ ''' Looks up a localized resource of type System.Drawing.Bitmap.
+ '''
+ Friend ReadOnly Property Open_16x() As System.Drawing.Bitmap
+ Get
+ Dim obj As Object = ResourceManager.GetObject("Open_16x", resourceCulture)
+ Return CType(obj,System.Drawing.Bitmap)
+ End Get
+ End Property
+
'''
''' Looks up a localized resource of type System.Drawing.Bitmap.
'''
diff --git a/src/My Project/Resources.resx b/src/My Project/Resources.resx
index 842faa3..1ea8537 100644
--- a/src/My Project/Resources.resx
+++ b/src/My Project/Resources.resx
@@ -154,4 +154,16 @@
..\Resources\Settings_16x.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+ ..\Resources\FolderOpen_16x.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\Open_16x.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\FontSize_16x.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\NewFile_16x.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
\ No newline at end of file
diff --git a/src/My Project/Settings.Designer.vb b/src/My Project/Settings.Designer.vb
index 0aa669d..a262b63 100644
--- a/src/My Project/Settings.Designer.vb
+++ b/src/My Project/Settings.Designer.vb
@@ -65,6 +65,18 @@ Namespace My
Me("VisualThemeIndex") = value
End Set
End Property
+
+ _
+ Public Property FontSize() As Single
+ Get
+ Return CType(Me("FontSize"),Single)
+ End Get
+ Set
+ Me("FontSize") = value
+ End Set
+ End Property
End Class
End Namespace
diff --git a/src/My Project/Settings.settings b/src/My Project/Settings.settings
index c73fd52..82054f0 100644
--- a/src/My Project/Settings.settings
+++ b/src/My Project/Settings.settings
@@ -5,5 +5,8 @@
0
+
+ 10
+
\ No newline at end of file
diff --git a/src/Resources/FolderOpen_16x.png b/src/Resources/FolderOpen_16x.png
new file mode 100644
index 0000000..7e788e4
Binary files /dev/null and b/src/Resources/FolderOpen_16x.png differ
diff --git a/src/Resources/FontSize_16x.png b/src/Resources/FontSize_16x.png
new file mode 100644
index 0000000..89e1712
Binary files /dev/null and b/src/Resources/FontSize_16x.png differ
diff --git a/src/Resources/NewFile_16x.png b/src/Resources/NewFile_16x.png
new file mode 100644
index 0000000..12354ce
Binary files /dev/null and b/src/Resources/NewFile_16x.png differ
diff --git a/src/Resources/Open_16x.png b/src/Resources/Open_16x.png
new file mode 100644
index 0000000..88cfc57
Binary files /dev/null and b/src/Resources/Open_16x.png differ
diff --git a/src/UI/Form1.Designer.vb b/src/UI/Form1.Designer.vb
index f4db833..3ff4aa5 100644
--- a/src/UI/Form1.Designer.vb
+++ b/src/UI/Form1.Designer.vb
@@ -22,65 +22,147 @@ Partial Friend Class Form1
'Do not modify it using the code editor.
Private Sub InitializeComponent()
+ Me.components = New System.ComponentModel.Container()
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(Form1))
Me.MenuStrip1 = New System.Windows.Forms.MenuStrip()
+ Me.PropertyGrid1 = New System.Windows.Forms.PropertyGrid()
+ Me.ContextMenuStrip1 = New System.Windows.Forms.ContextMenuStrip(Me.components)
+ Me.StatusStrip1 = New System.Windows.Forms.StatusStrip()
+ Me.ToolStripStatusLabelIcon = New System.Windows.Forms.ToolStripStatusLabel()
+ Me.ToolStripStatusLabelFileName = New System.Windows.Forms.ToolStripStatusLabel()
Me.FileToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
- Me.OpenToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
+ Me.NewToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
+ Me.ToolStripSeparator3 = New System.Windows.Forms.ToolStripSeparator()
Me.RecentToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
+ Me.ToolStripSeparator1 = New System.Windows.Forms.ToolStripSeparator()
+ Me.OpenToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.SaveToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.SaveAsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.CloseToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
+ Me.ToolStripSeparator2 = New System.Windows.Forms.ToolStripSeparator()
Me.ExitToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.SettingsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
+ Me.FontSizeToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
+ Me.ToolStripComboBoxFontSize = New System.Windows.Forms.ToolStripComboBox()
Me.VisualThemeToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.DefaultToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.DarkToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.AboutToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
- Me.PropertyGrid1 = New System.Windows.Forms.PropertyGrid()
- Me.StatusStrip1 = New System.Windows.Forms.StatusStrip()
- Me.ToolStripStatusLabel1 = New System.Windows.Forms.ToolStripStatusLabel()
+ Me.OpenShortcutMenuItem = New System.Windows.Forms.ToolStripMenuItem()
+ Me.OpenTargetMenuItem = New System.Windows.Forms.ToolStripMenuItem()
+ Me.OpenTargetWithArgsMenuItem = New System.Windows.Forms.ToolStripMenuItem()
+ Me.ViewShortcutMenuItem = New System.Windows.Forms.ToolStripMenuItem()
+ Me.ViewTargetMenuItem = New System.Windows.Forms.ToolStripMenuItem()
+ Me.ViewWorkingDirectoryMenuItem = New System.Windows.Forms.ToolStripMenuItem()
+ Me.ViewIconMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.MenuStrip1.SuspendLayout()
+ Me.ContextMenuStrip1.SuspendLayout()
Me.StatusStrip1.SuspendLayout()
Me.SuspendLayout()
'
'MenuStrip1
'
+ Me.MenuStrip1.Font = New System.Drawing.Font("Segoe UI", 10.0!)
Me.MenuStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.FileToolStripMenuItem, Me.SettingsToolStripMenuItem, Me.AboutToolStripMenuItem})
Me.MenuStrip1.Location = New System.Drawing.Point(0, 0)
Me.MenuStrip1.Name = "MenuStrip1"
- Me.MenuStrip1.Size = New System.Drawing.Size(684, 24)
+ Me.MenuStrip1.Size = New System.Drawing.Size(684, 27)
Me.MenuStrip1.TabIndex = 0
Me.MenuStrip1.Text = "MenuStrip1"
'
+ 'PropertyGrid1
+ '
+ Me.PropertyGrid1.AllowDrop = True
+ Me.PropertyGrid1.Dock = System.Windows.Forms.DockStyle.Fill
+ Me.PropertyGrid1.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!)
+ Me.PropertyGrid1.Location = New System.Drawing.Point(0, 27)
+ Me.PropertyGrid1.Name = "PropertyGrid1"
+ Me.PropertyGrid1.Size = New System.Drawing.Size(684, 360)
+ Me.PropertyGrid1.TabIndex = 1
+ '
+ 'ContextMenuStrip1
+ '
+ Me.ContextMenuStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.OpenShortcutMenuItem, Me.OpenTargetMenuItem, Me.OpenTargetWithArgsMenuItem, Me.ViewShortcutMenuItem, Me.ViewTargetMenuItem, Me.ViewWorkingDirectoryMenuItem, Me.ViewIconMenuItem})
+ Me.ContextMenuStrip1.Name = "ContextMenuStrip1"
+ Me.ContextMenuStrip1.Size = New System.Drawing.Size(257, 158)
+ '
+ 'StatusStrip1
+ '
+ Me.StatusStrip1.BackColor = System.Drawing.SystemColors.Control
+ Me.StatusStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ToolStripStatusLabelIcon, Me.ToolStripStatusLabelFileName})
+ Me.StatusStrip1.Location = New System.Drawing.Point(0, 387)
+ Me.StatusStrip1.Name = "StatusStrip1"
+ Me.StatusStrip1.Size = New System.Drawing.Size(684, 24)
+ Me.StatusStrip1.TabIndex = 2
+ Me.StatusStrip1.Text = "StatusStrip1"
+ '
+ 'ToolStripStatusLabelIcon
+ '
+ Me.ToolStripStatusLabelIcon.Font = New System.Drawing.Font("Segoe UI", 10.0!)
+ Me.ToolStripStatusLabelIcon.ImageAlign = System.Drawing.ContentAlignment.MiddleRight
+ Me.ToolStripStatusLabelIcon.Name = "ToolStripStatusLabelIcon"
+ Me.ToolStripStatusLabelIcon.Size = New System.Drawing.Size(42, 19)
+ Me.ToolStripStatusLabelIcon.Text = "{icon}"
+ Me.ToolStripStatusLabelIcon.TextImageRelation = System.Windows.Forms.TextImageRelation.Overlay
+ '
+ 'ToolStripStatusLabelFileName
+ '
+ Me.ToolStripStatusLabelFileName.AutoToolTip = True
+ Me.ToolStripStatusLabelFileName.Font = New System.Drawing.Font("Segoe UI", 10.0!)
+ Me.ToolStripStatusLabelFileName.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
+ Me.ToolStripStatusLabelFileName.LinkBehavior = System.Windows.Forms.LinkBehavior.NeverUnderline
+ Me.ToolStripStatusLabelFileName.Name = "ToolStripStatusLabelFileName"
+ Me.ToolStripStatusLabelFileName.Size = New System.Drawing.Size(627, 19)
+ Me.ToolStripStatusLabelFileName.Spring = True
+ Me.ToolStripStatusLabelFileName.Text = "{fullpath} "
+ Me.ToolStripStatusLabelFileName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
+ '
'FileToolStripMenuItem
'
- Me.FileToolStripMenuItem.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.OpenToolStripMenuItem, Me.RecentToolStripMenuItem, Me.SaveToolStripMenuItem, Me.SaveAsToolStripMenuItem, Me.CloseToolStripMenuItem, Me.ExitToolStripMenuItem})
+ Me.FileToolStripMenuItem.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.NewToolStripMenuItem, Me.ToolStripSeparator3, Me.RecentToolStripMenuItem, Me.ToolStripSeparator1, Me.OpenToolStripMenuItem, Me.SaveToolStripMenuItem, Me.SaveAsToolStripMenuItem, Me.CloseToolStripMenuItem, Me.ToolStripSeparator2, Me.ExitToolStripMenuItem})
Me.FileToolStripMenuItem.Image = Global.My.Resources.Resources.FSFile_16x
Me.FileToolStripMenuItem.Name = "FileToolStripMenuItem"
- Me.FileToolStripMenuItem.Size = New System.Drawing.Size(53, 20)
+ Me.FileToolStripMenuItem.Size = New System.Drawing.Size(57, 23)
Me.FileToolStripMenuItem.Text = "File"
'
- 'OpenToolStripMenuItem
+ 'NewToolStripMenuItem
'
- Me.OpenToolStripMenuItem.Image = Global.My.Resources.Resources.OpenFile_16x
- Me.OpenToolStripMenuItem.Name = "OpenToolStripMenuItem"
- Me.OpenToolStripMenuItem.Size = New System.Drawing.Size(123, 22)
- Me.OpenToolStripMenuItem.Text = "Open"
+ Me.NewToolStripMenuItem.Image = Global.My.Resources.Resources.NewFile_16x
+ Me.NewToolStripMenuItem.Name = "NewToolStripMenuItem"
+ Me.NewToolStripMenuItem.Size = New System.Drawing.Size(180, 24)
+ Me.NewToolStripMenuItem.Text = "New"
+ '
+ 'ToolStripSeparator3
+ '
+ Me.ToolStripSeparator3.Name = "ToolStripSeparator3"
+ Me.ToolStripSeparator3.Size = New System.Drawing.Size(177, 6)
'
'RecentToolStripMenuItem
'
Me.RecentToolStripMenuItem.Enabled = False
Me.RecentToolStripMenuItem.Image = Global.My.Resources.Resources.FileGroup_16x
Me.RecentToolStripMenuItem.Name = "RecentToolStripMenuItem"
- Me.RecentToolStripMenuItem.Size = New System.Drawing.Size(123, 22)
+ Me.RecentToolStripMenuItem.Size = New System.Drawing.Size(180, 24)
Me.RecentToolStripMenuItem.Text = "Recent..."
'
+ 'ToolStripSeparator1
+ '
+ Me.ToolStripSeparator1.Name = "ToolStripSeparator1"
+ Me.ToolStripSeparator1.Size = New System.Drawing.Size(177, 6)
+ '
+ 'OpenToolStripMenuItem
+ '
+ Me.OpenToolStripMenuItem.Image = Global.My.Resources.Resources.OpenFile_16x
+ Me.OpenToolStripMenuItem.Name = "OpenToolStripMenuItem"
+ Me.OpenToolStripMenuItem.Size = New System.Drawing.Size(180, 24)
+ Me.OpenToolStripMenuItem.Text = "Open"
+ '
'SaveToolStripMenuItem
'
Me.SaveToolStripMenuItem.Enabled = False
Me.SaveToolStripMenuItem.Image = Global.My.Resources.Resources.Save_16x
Me.SaveToolStripMenuItem.Name = "SaveToolStripMenuItem"
- Me.SaveToolStripMenuItem.Size = New System.Drawing.Size(123, 22)
+ Me.SaveToolStripMenuItem.Size = New System.Drawing.Size(180, 24)
Me.SaveToolStripMenuItem.Text = "Save"
'
'SaveAsToolStripMenuItem
@@ -88,7 +170,7 @@ Partial Friend Class Form1
Me.SaveAsToolStripMenuItem.Enabled = False
Me.SaveAsToolStripMenuItem.Image = Global.My.Resources.Resources.Save_16x
Me.SaveAsToolStripMenuItem.Name = "SaveAsToolStripMenuItem"
- Me.SaveAsToolStripMenuItem.Size = New System.Drawing.Size(123, 22)
+ Me.SaveAsToolStripMenuItem.Size = New System.Drawing.Size(180, 24)
Me.SaveAsToolStripMenuItem.Text = "Save As..."
'
'CloseToolStripMenuItem
@@ -96,86 +178,129 @@ Partial Friend Class Form1
Me.CloseToolStripMenuItem.Enabled = False
Me.CloseToolStripMenuItem.Image = Global.My.Resources.Resources.FileExclude_16x
Me.CloseToolStripMenuItem.Name = "CloseToolStripMenuItem"
- Me.CloseToolStripMenuItem.Size = New System.Drawing.Size(123, 22)
+ Me.CloseToolStripMenuItem.Size = New System.Drawing.Size(180, 24)
Me.CloseToolStripMenuItem.Text = "Close"
'
+ 'ToolStripSeparator2
+ '
+ Me.ToolStripSeparator2.Name = "ToolStripSeparator2"
+ Me.ToolStripSeparator2.Size = New System.Drawing.Size(177, 6)
+ '
'ExitToolStripMenuItem
'
Me.ExitToolStripMenuItem.Image = Global.My.Resources.Resources.Close_red_16x
Me.ExitToolStripMenuItem.Name = "ExitToolStripMenuItem"
- Me.ExitToolStripMenuItem.Size = New System.Drawing.Size(123, 22)
+ Me.ExitToolStripMenuItem.Size = New System.Drawing.Size(180, 24)
Me.ExitToolStripMenuItem.Text = "Exit"
'
'SettingsToolStripMenuItem
'
- Me.SettingsToolStripMenuItem.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.VisualThemeToolStripMenuItem})
+ Me.SettingsToolStripMenuItem.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.FontSizeToolStripMenuItem, Me.VisualThemeToolStripMenuItem})
Me.SettingsToolStripMenuItem.Image = Global.My.Resources.Resources.Settings_16x
Me.SettingsToolStripMenuItem.Name = "SettingsToolStripMenuItem"
- Me.SettingsToolStripMenuItem.Size = New System.Drawing.Size(77, 20)
+ Me.SettingsToolStripMenuItem.Size = New System.Drawing.Size(86, 23)
Me.SettingsToolStripMenuItem.Text = "Settings"
'
+ 'FontSizeToolStripMenuItem
+ '
+ Me.FontSizeToolStripMenuItem.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ToolStripComboBoxFontSize})
+ Me.FontSizeToolStripMenuItem.Image = Global.My.Resources.Resources.FontSize_16x
+ Me.FontSizeToolStripMenuItem.Name = "FontSizeToolStripMenuItem"
+ Me.FontSizeToolStripMenuItem.Size = New System.Drawing.Size(159, 24)
+ Me.FontSizeToolStripMenuItem.Text = "Font Size"
+ '
+ 'ToolStripComboBoxFontSize
+ '
+ Me.ToolStripComboBoxFontSize.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
+ Me.ToolStripComboBoxFontSize.Items.AddRange(New Object() {"8", "9", "10", "11", "12"})
+ Me.ToolStripComboBoxFontSize.Name = "ToolStripComboBoxFontSize"
+ Me.ToolStripComboBoxFontSize.Size = New System.Drawing.Size(121, 23)
+ '
'VisualThemeToolStripMenuItem
'
Me.VisualThemeToolStripMenuItem.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.DefaultToolStripMenuItem, Me.DarkToolStripMenuItem})
Me.VisualThemeToolStripMenuItem.Image = Global.My.Resources.Resources.ColorPalette_16x
Me.VisualThemeToolStripMenuItem.Name = "VisualThemeToolStripMenuItem"
- Me.VisualThemeToolStripMenuItem.Size = New System.Drawing.Size(145, 22)
+ Me.VisualThemeToolStripMenuItem.Size = New System.Drawing.Size(159, 24)
Me.VisualThemeToolStripMenuItem.Text = "Visual Theme"
'
'DefaultToolStripMenuItem
'
Me.DefaultToolStripMenuItem.Image = Global.My.Resources.Resources.ColorWheel_16x
Me.DefaultToolStripMenuItem.Name = "DefaultToolStripMenuItem"
- Me.DefaultToolStripMenuItem.Size = New System.Drawing.Size(112, 22)
+ Me.DefaultToolStripMenuItem.Size = New System.Drawing.Size(122, 24)
Me.DefaultToolStripMenuItem.Text = "Default"
'
'DarkToolStripMenuItem
'
Me.DarkToolStripMenuItem.Image = Global.My.Resources.Resources.DarkTheme_16x
Me.DarkToolStripMenuItem.Name = "DarkToolStripMenuItem"
- Me.DarkToolStripMenuItem.Size = New System.Drawing.Size(112, 22)
+ Me.DarkToolStripMenuItem.Size = New System.Drawing.Size(122, 24)
Me.DarkToolStripMenuItem.Text = "Dark"
'
'AboutToolStripMenuItem
'
Me.AboutToolStripMenuItem.Image = Global.My.Resources.Resources.Question_16x
Me.AboutToolStripMenuItem.Name = "AboutToolStripMenuItem"
- Me.AboutToolStripMenuItem.Size = New System.Drawing.Size(77, 20)
+ Me.AboutToolStripMenuItem.Size = New System.Drawing.Size(84, 23)
Me.AboutToolStripMenuItem.Text = "About..."
'
- 'PropertyGrid1
+ 'OpenShortcutMenuItem
'
- Me.PropertyGrid1.AllowDrop = True
- Me.PropertyGrid1.Dock = System.Windows.Forms.DockStyle.Fill
- Me.PropertyGrid1.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
- Me.PropertyGrid1.Location = New System.Drawing.Point(0, 24)
- Me.PropertyGrid1.Name = "PropertyGrid1"
- Me.PropertyGrid1.Size = New System.Drawing.Size(684, 337)
- Me.PropertyGrid1.TabIndex = 1
+ Me.OpenShortcutMenuItem.Image = Global.My.Resources.Resources.Open_16x
+ Me.OpenShortcutMenuItem.Name = "OpenShortcutMenuItem"
+ Me.OpenShortcutMenuItem.Size = New System.Drawing.Size(256, 22)
+ Me.OpenShortcutMenuItem.Text = "Open Shortcut"
'
- 'StatusStrip1
+ 'OpenTargetMenuItem
'
- Me.StatusStrip1.BackColor = System.Drawing.SystemColors.Control
- Me.StatusStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ToolStripStatusLabel1})
- Me.StatusStrip1.Location = New System.Drawing.Point(0, 339)
- Me.StatusStrip1.Name = "StatusStrip1"
- Me.StatusStrip1.Size = New System.Drawing.Size(684, 22)
- Me.StatusStrip1.TabIndex = 2
- Me.StatusStrip1.Text = "StatusStrip1"
+ Me.OpenTargetMenuItem.Image = Global.My.Resources.Resources.Open_16x
+ Me.OpenTargetMenuItem.Name = "OpenTargetMenuItem"
+ Me.OpenTargetMenuItem.Size = New System.Drawing.Size(256, 22)
+ Me.OpenTargetMenuItem.Text = "Open Target"
+ '
+ 'OpenTargetWithArgsMenuItem
+ '
+ Me.OpenTargetWithArgsMenuItem.Image = Global.My.Resources.Resources.Open_16x
+ Me.OpenTargetWithArgsMenuItem.Name = "OpenTargetWithArgsMenuItem"
+ Me.OpenTargetWithArgsMenuItem.Size = New System.Drawing.Size(256, 22)
+ Me.OpenTargetWithArgsMenuItem.Text = "Open Target with Arguments"
'
- 'ToolStripStatusLabel1
+ 'ViewShortcutMenuItem
'
- Me.ToolStripStatusLabel1.Name = "ToolStripStatusLabel1"
- Me.ToolStripStatusLabel1.Size = New System.Drawing.Size(37, 17)
- Me.ToolStripStatusLabel1.Text = " "
+ Me.ViewShortcutMenuItem.Image = Global.My.Resources.Resources.FolderOpen_16x
+ Me.ViewShortcutMenuItem.Name = "ViewShortcutMenuItem"
+ Me.ViewShortcutMenuItem.Size = New System.Drawing.Size(256, 22)
+ Me.ViewShortcutMenuItem.Text = "View Shortcut in Explorer"
+ '
+ 'ViewTargetMenuItem
+ '
+ Me.ViewTargetMenuItem.Image = Global.My.Resources.Resources.FolderOpen_16x
+ Me.ViewTargetMenuItem.Name = "ViewTargetMenuItem"
+ Me.ViewTargetMenuItem.Size = New System.Drawing.Size(256, 22)
+ Me.ViewTargetMenuItem.Text = "View Target in Explorer"
+ '
+ 'ViewWorkingDirectoryMenuItem
+ '
+ Me.ViewWorkingDirectoryMenuItem.Image = Global.My.Resources.Resources.FolderOpen_16x
+ Me.ViewWorkingDirectoryMenuItem.Name = "ViewWorkingDirectoryMenuItem"
+ Me.ViewWorkingDirectoryMenuItem.Size = New System.Drawing.Size(256, 22)
+ Me.ViewWorkingDirectoryMenuItem.Text = "View Working Directory in Explorer"
+ '
+ 'ViewIconMenuItem
+ '
+ Me.ViewIconMenuItem.Image = Global.My.Resources.Resources.FolderOpen_16x
+ Me.ViewIconMenuItem.Name = "ViewIconMenuItem"
+ Me.ViewIconMenuItem.Size = New System.Drawing.Size(256, 22)
+ Me.ViewIconMenuItem.Text = "View Icon in Explorer"
'
'Form1
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
- Me.ClientSize = New System.Drawing.Size(684, 361)
- Me.Controls.Add(Me.StatusStrip1)
+ Me.ClientSize = New System.Drawing.Size(684, 411)
Me.Controls.Add(Me.PropertyGrid1)
+ Me.Controls.Add(Me.StatusStrip1)
Me.Controls.Add(Me.MenuStrip1)
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.MainMenuStrip = Me.MenuStrip1
@@ -184,6 +309,7 @@ Partial Friend Class Form1
Me.Text = "Easy Link File Viewer"
Me.MenuStrip1.ResumeLayout(False)
Me.MenuStrip1.PerformLayout()
+ Me.ContextMenuStrip1.ResumeLayout(False)
Me.StatusStrip1.ResumeLayout(False)
Me.StatusStrip1.PerformLayout()
Me.ResumeLayout(False)
@@ -205,6 +331,21 @@ Partial Friend Class Form1
Friend WithEvents AboutToolStripMenuItem As ToolStripMenuItem
Friend WithEvents PropertyGrid1 As PropertyGrid
Friend WithEvents StatusStrip1 As StatusStrip
- Friend WithEvents ToolStripStatusLabel1 As ToolStripStatusLabel
+ Friend WithEvents ToolStripStatusLabelFileName As ToolStripStatusLabel
Friend WithEvents RecentToolStripMenuItem As ToolStripMenuItem
+ Friend WithEvents ContextMenuStrip1 As ContextMenuStrip
+ Friend WithEvents OpenShortcutMenuItem As ToolStripMenuItem
+ Friend WithEvents ViewShortcutMenuItem As ToolStripMenuItem
+ Friend WithEvents ViewTargetMenuItem As ToolStripMenuItem
+ Friend WithEvents ViewWorkingDirectoryMenuItem As ToolStripMenuItem
+ Friend WithEvents OpenTargetMenuItem As ToolStripMenuItem
+ Friend WithEvents OpenTargetWithArgsMenuItem As ToolStripMenuItem
+ Friend WithEvents ViewIconMenuItem As ToolStripMenuItem
+ Friend WithEvents ToolStripSeparator1 As ToolStripSeparator
+ Friend WithEvents ToolStripSeparator2 As ToolStripSeparator
+ Friend WithEvents FontSizeToolStripMenuItem As ToolStripMenuItem
+ Friend WithEvents ToolStripComboBoxFontSize As ToolStripComboBox
+ Friend WithEvents ToolStripStatusLabelIcon As ToolStripStatusLabel
+ Friend WithEvents NewToolStripMenuItem As ToolStripMenuItem
+ Friend WithEvents ToolStripSeparator3 As ToolStripSeparator
End Class
diff --git a/src/UI/Form1.resx b/src/UI/Form1.resx
index 6620e73..00edaea 100644
--- a/src/UI/Form1.resx
+++ b/src/UI/Form1.resx
@@ -126,6 +126,9 @@
True
+
+ 261, 17
+
138, 17
diff --git a/src/UI/Form1.vb b/src/UI/Form1.vb
index b41a773..4173be8 100644
--- a/src/UI/Form1.vb
+++ b/src/UI/Form1.vb
@@ -1,6 +1,6 @@
' ***********************************************************************
' Author : ElektroStudios
-' Modified : 27-May-2019
+' Modified : 30-May-2019
' ***********************************************************************
#Region " Option Statements "
@@ -13,10 +13,13 @@ Option Infer Off
#Region " Imports "
+Imports System.ComponentModel
+Imports System.IO
+
Imports DevCase.Core.Extensions
Imports DevCase.Core.IO
+Imports DevCase.Core.IO.Tools
Imports DevCase.Core.Imaging.Tools
-Imports System.IO
#End Region
@@ -29,6 +32,17 @@ Imports System.IO
''' ----------------------------------------------------------------------------------------------------
Friend NotInheritable Class Form1 : Inherits Form
+#Region " Private Fields "
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' The current instance that is loaded in the control.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ Private CurrentShortcut As ShortcutFileInfo
+
+#End Region
+
#Region " Constructors "
''' ----------------------------------------------------------------------------------------------------
@@ -44,6 +58,8 @@ Friend NotInheritable Class Form1 : Inherits Form
#Region " Event Handlers "
+#Region " Form "
+
''' ----------------------------------------------------------------------------------------------------
'''
''' Handles the event of the control.
@@ -58,6 +74,10 @@ Friend NotInheritable Class Form1 : Inherits Form
'''
''' ----------------------------------------------------------------------------------------------------
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
+ Me.ToolStripStatusLabelIcon.Text = ""
+ Me.ToolStripStatusLabelFileName.Text = ""
+ Me.ToolStripComboBoxFontSize.SelectedItem = CStr(My.Settings.FontSize)
+
Me.LoadVisualTheme()
End Sub
@@ -75,12 +95,33 @@ Friend NotInheritable Class Form1 : Inherits Form
'''
''' ----------------------------------------------------------------------------------------------------
Private Sub Form1_Shown(sender As Object, e As EventArgs) Handles MyBase.Shown
- Dim minWidth As Integer = (From item As ToolStripMenuItem In MenuStrip1.Items.Cast(Of ToolStripMenuItem)
+ Dim minWidth As Integer = (From item As ToolStripMenuItem In Me.MenuStrip1.Items.Cast(Of ToolStripMenuItem)
Select item.Width + item.Padding.Horizontal).Sum()
- Me.MinimumSize = New Size(minWidth, Me.Size.Height)
+ Me.MinimumSize = New Size(minWidth, Me.Height)
+ End Sub
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Handles the event of the control.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' The source of the event.
+ '''
+ '''
+ '''
+ ''' The instance containing the event data.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ Private Sub Form1_Resize(sender As Object, e As EventArgs) Handles MyBase.Resize
+ Me.PropertyGrid1.MoveSplitterTo(180)
End Sub
+#End Region
+
+#Region " PropertyGrid "
+
''' ----------------------------------------------------------------------------------------------------
'''
''' Handles the event of the control.
@@ -130,6 +171,70 @@ Friend NotInheritable Class Form1 : Inherits Form
End Sub
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Handles the event of the control.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' The source of the event.
+ '''
+ '''
+ '''
+ ''' The instance containing the event data.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ Private Sub PropertyGrid1_PropertyValueChanged(sender As Object, e As PropertyValueChangedEventArgs) Handles PropertyGrid1.PropertyValueChanged
+ ' Force refresh of ShortcutFileInfo properties.
+ Me.PropertyGrid1.Refresh()
+ End Sub
+
+#End Region
+
+#Region " Menu Strip "
+
+#Region " File Menu "
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Handles the event of the control.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' The source of the event.
+ '''
+ '''
+ '''
+ ''' The instance containing the event data.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ Private Sub NewToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles NewToolStripMenuItem.Click
+
+ Using dlg As New SaveFileDialog()
+ dlg.FileName = "New Shortcut.lnk"
+ dlg.DefaultExt = "lnk"
+ dlg.DereferenceLinks = False
+ dlg.Filter = "Shortcut files (*.lnk)|*.lnk"
+ dlg.FilterIndex = 1
+ dlg.RestoreDirectory = True
+ dlg.SupportMultiDottedExtensions = True
+ dlg.Title = "Select a destination to save the shortcut file..."
+
+ If dlg.ShowDialog() = DialogResult.OK Then
+ Try
+ File.Delete(dlg.FileName)
+ Catch ex As Exception
+ MessageBox.Show(Me, "Can't overwrite file.", Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Error)
+ End Try
+ Dim newShortcut As New ShortcutFileInfo(dlg.FileName) With {.ViewMode = True}
+ newShortcut.Create()
+
+ Me.LoadShortcutInPropertyGrid(newShortcut.FullName)
+ End If
+ End Using
+
+ End Sub
+
''' ----------------------------------------------------------------------------------------------------
'''
''' Handles the event of the control.
@@ -145,18 +250,18 @@ Friend NotInheritable Class Form1 : Inherits Form
''' ----------------------------------------------------------------------------------------------------
Private Sub OpenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles OpenToolStripMenuItem.Click
- Using ofd As New OpenFileDialog
- ofd.DefaultExt = "lnk"
- ofd.DereferenceLinks = False
- ofd.Filter = "Shortcut files (*.lnk)|*.lnk"
- ofd.FilterIndex = 1
- ofd.Multiselect = False
- ofd.RestoreDirectory = True
- ofd.SupportMultiDottedExtensions = True
- ofd.Title = "Select a shortcut file to open..."
-
- If ofd.ShowDialog = DialogResult.OK Then
- Me.LoadShortcutInPropertyGrid(ofd.FileName)
+ Using dlg As New OpenFileDialog()
+ dlg.DefaultExt = "lnk"
+ dlg.DereferenceLinks = False
+ dlg.Filter = "Shortcut files (*.lnk)|*.lnk"
+ dlg.FilterIndex = 1
+ dlg.Multiselect = False
+ dlg.RestoreDirectory = True
+ dlg.SupportMultiDottedExtensions = True
+ dlg.Title = "Select a shortcut file to open..."
+
+ If dlg.ShowDialog = DialogResult.OK Then
+ Me.LoadShortcutInPropertyGrid(dlg.FileName)
End If
End Using
@@ -177,10 +282,8 @@ Friend NotInheritable Class Form1 : Inherits Form
'''
''' ----------------------------------------------------------------------------------------------------
Private Sub SaveToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles SaveToolStripMenuItem.Click
-
- Dim shortcut As ShortcutFileInfo = DirectCast(Me.PropertyGrid1.SelectedObject, ShortcutFileInfo)
- shortcut.Create()
-
+ Me.CurrentShortcut.Create()
+ Me.PropertyGrid1.Refresh()
End Sub
''' ----------------------------------------------------------------------------------------------------
@@ -198,37 +301,35 @@ Friend NotInheritable Class Form1 : Inherits Form
''' ----------------------------------------------------------------------------------------------------
Private Sub SaveAsToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles SaveAsToolStripMenuItem.Click
- Dim shortcut As ShortcutFileInfo = DirectCast(Me.PropertyGrid1.SelectedObject, ShortcutFileInfo)
-
- Using ofd As New SaveFileDialog
- ofd.FileName = shortcut.FullName
- ofd.DefaultExt = "lnk"
- ofd.DereferenceLinks = False
- ofd.Filter = "Shortcut files (*.lnk)|*.lnk"
- ofd.FilterIndex = 1
- ofd.RestoreDirectory = True
- ofd.SupportMultiDottedExtensions = True
- ofd.Title = "Select a destination to save the shortcut file..."
+ Using dlg As New SaveFileDialog()
+ dlg.FileName = Me.CurrentShortcut.FullName
+ dlg.DefaultExt = "lnk"
+ dlg.DereferenceLinks = False
+ dlg.Filter = "Shortcut files (*.lnk)|*.lnk"
+ dlg.FilterIndex = 1
+ dlg.RestoreDirectory = True
+ dlg.SupportMultiDottedExtensions = True
+ dlg.Title = "Select a destination to save the shortcut file..."
- If ofd.ShowDialog() = DialogResult.OK Then
+ If dlg.ShowDialog() = DialogResult.OK Then
- Dim dstShortcut As New ShortcutFileInfo(ofd.FileName) With {.ViewMode = True}
+ Dim dstShortcut As New ShortcutFileInfo(dlg.FileName) With {.ViewMode = True}
With dstShortcut
- .Description = shortcut.Description
- .Hotkey = shortcut.Hotkey
- .Icon = shortcut.Icon
- .IconIndex = shortcut.IconIndex
- .Target = shortcut.Target
- .TargetArguments = shortcut.TargetArguments
- .WindowState = shortcut.WindowState
- .WorkingDirectory = shortcut.WorkingDirectory
+ .Description = Me.CurrentShortcut.Description
+ .Hotkey = Me.CurrentShortcut.Hotkey
+ .Icon = Me.CurrentShortcut.Icon
+ .IconIndex = Me.CurrentShortcut.IconIndex
+ .Target = Me.CurrentShortcut.Target
+ .TargetArguments = Me.CurrentShortcut.TargetArguments
+ .WindowState = Me.CurrentShortcut.WindowState
+ .WorkingDirectory = Me.CurrentShortcut.WorkingDirectory
.Create()
- .Attributes = shortcut.Attributes
- .CreationTime = shortcut.CreationTime
- .LastAccessTime = shortcut.LastAccessTime
- .LastWriteTime = shortcut.LastWriteTime
+ .Attributes = Me.CurrentShortcut.Attributes
+ .CreationTime = Me.CurrentShortcut.CreationTime
+ .LastAccessTime = Me.CurrentShortcut.LastAccessTime
+ .LastWriteTime = Me.CurrentShortcut.LastWriteTime
End With
End If
@@ -251,11 +352,14 @@ Friend NotInheritable Class Form1 : Inherits Form
''' ----------------------------------------------------------------------------------------------------
Private Sub CloseToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles CloseToolStripMenuItem.Click
Me.PropertyGrid1.SelectedObject = Nothing
- Me.ToolStripStatusLabel1.Text = ""
+ Me.ToolStripStatusLabelFileName.Image = Nothing
+ Me.ToolStripStatusLabelFileName.Text = ""
Me.SaveToolStripMenuItem.Enabled = False
Me.SaveAsToolStripMenuItem.Enabled = False
Me.CloseToolStripMenuItem.Enabled = False
+
+ Me.PropertyGrid1.ContextMenuStrip = Nothing
End Sub
''' ----------------------------------------------------------------------------------------------------
@@ -275,6 +379,31 @@ Friend NotInheritable Class Form1 : Inherits Form
Me.Close()
End Sub
+#End Region
+
+#Region " Settings Menu "
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Handles the event of the control.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' The source of the event.
+ '''
+ '''
+ '''
+ ''' The instance containing the event data.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ Private Sub ToolStripComboBoxFontSize_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ToolStripComboBoxFontSize.SelectedIndexChanged
+
+ Dim sz As Single = CSng(DirectCast(sender, ToolStripComboBox).SelectedItem)
+ My.Settings.FontSize = sz
+ Me.LoadFontSize()
+
+ End Sub
+
''' ----------------------------------------------------------------------------------------------------
'''
''' Handles the event of the control.
@@ -311,6 +440,10 @@ Friend NotInheritable Class Form1 : Inherits Form
Me.LoadVisualTheme()
End Sub
+#End Region
+
+#Region " About Menu "
+
''' ----------------------------------------------------------------------------------------------------
'''
''' Handles the event of the control.
@@ -330,8 +463,250 @@ Friend NotInheritable Class Form1 : Inherits Form
#End Region
+#End Region
+
+#Region " PropertyGrid Context Menu "
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Handles the event of the menu.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' The source of the event.
+ '''
+ '''
+ '''
+ ''' The instance containing the event data.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ Private Sub ContextMenuStrip1_Opening(sender As Object, e As CancelEventArgs) Handles ContextMenuStrip1.Opening
+
+ Me.OpenShortcutMenuItem.Enabled = Me.CurrentShortcut.Exists
+ Me.ViewShortcutMenuItem.Enabled = Me.OpenShortcutMenuItem.Enabled
+
+ Me.OpenTargetMenuItem.Enabled = File.Exists(Me.CurrentShortcut.Target) OrElse Directory.Exists(Me.CurrentShortcut.Target)
+ Me.OpenTargetWithArgsMenuItem.Enabled = File.Exists(Me.CurrentShortcut.Target) AndAlso Not String.IsNullOrWhiteSpace(Me.CurrentShortcut.TargetArguments)
+ Me.ViewTargetMenuItem.Enabled = Me.OpenTargetMenuItem.Enabled
+
+ Me.ViewWorkingDirectoryMenuItem.Enabled = Directory.Exists(Me.CurrentShortcut.WorkingDirectory)
+ Me.ViewIconMenuItem.Enabled = File.Exists(Me.CurrentShortcut.Icon)
+
+ End Sub
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Handles the event of the menu item.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' The source of the event.
+ '''
+ '''
+ '''
+ ''' The instance containing the event data.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ Private Sub OpenShortcutMenuItem_Click(sender As Object, e As EventArgs) Handles OpenShortcutMenuItem.Click
+
+ Try
+ Process.Start(Me.CurrentShortcut.FullName)
+
+ Catch ex As Exception
+ MessageBox.Show(Me, ex.Message, Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Error)
+
+ End Try
+
+ End Sub
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Handles the event of the menu item.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' The source of the event.
+ '''
+ '''
+ '''
+ ''' The instance containing the event data.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ Private Sub OpenTargetMenuItem1_Click(sender As Object, e As EventArgs) Handles OpenTargetMenuItem.Click
+
+ Dim target As String = Me.CurrentShortcut.Target
+
+ If File.Exists(target) Then
+ Try
+ Process.Start(target)
+ Exit Sub
+
+ Catch ex As Exception
+ MessageBox.Show(Me, ex.Message, Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Error)
+
+ End Try
+ End If
+
+ If Directory.Exists(target) Then
+ Try
+ FileUtil.InternalOpenInExplorer(target)
+ Exit Sub
+
+ Catch ex As Exception
+ MessageBox.Show(Me, ex.Message, Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Error)
+
+ End Try
+ End If
+
+ MessageBox.Show(Me, "Can't find the shortcut target.", Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Error)
+
+ End Sub
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Handles the event of the menu item.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' The source of the event.
+ '''
+ '''
+ '''
+ ''' The instance containing the event data.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ Private Sub OpenTargetWithArgsMenuItem_Click(sender As Object, e As EventArgs) Handles OpenTargetWithArgsMenuItem.Click
+
+ Try
+ Process.Start(Me.CurrentShortcut.Target, Me.CurrentShortcut.TargetArguments)
+ Exit Sub
+
+ Catch ex As Exception
+ MessageBox.Show(Me, ex.Message, Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Error)
+
+ End Try
+
+ End Sub
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Handles the event of the menu item.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' The source of the event.
+ '''
+ '''
+ '''
+ ''' The instance containing the event data.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ Private Sub ViewShortcutMenuItem_Click(sender As Object, e As EventArgs) Handles ViewShortcutMenuItem.Click
+
+ Try
+ FileUtil.InternalOpenInExplorer(Me.CurrentShortcut.FullName)
+
+ Catch ex As Exception
+ MessageBox.Show(Me, ex.Message, Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Error)
+
+ End Try
+
+ End Sub
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Handles the event of the menu item.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' The source of the event.
+ '''
+ '''
+ '''
+ ''' The instance containing the event data.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ Private Sub ViewTargetMenuItem_Click(sender As Object, e As EventArgs) Handles ViewTargetMenuItem.Click
+
+ Try
+ FileUtil.InternalOpenInExplorer(Me.CurrentShortcut.Target)
+
+ Catch ex As Exception
+ MessageBox.Show(Me, ex.Message, Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Error)
+
+ End Try
+
+ End Sub
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Handles the event of the menu item.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' The source of the event.
+ '''
+ '''
+ '''
+ ''' The instance containing the event data.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ Private Sub ViewWorkingDirectoryMenuItem_Click(sender As Object, e As EventArgs) Handles ViewWorkingDirectoryMenuItem.Click
+
+ Try
+ FileUtil.InternalOpenInExplorer(Me.CurrentShortcut.WorkingDirectory)
+
+ Catch ex As Exception
+ MessageBox.Show(Me, ex.Message, Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Error)
+
+ End Try
+
+ End Sub
+
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Handles the event of the menu item.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' The source of the event.
+ '''
+ '''
+ '''
+ ''' The instance containing the event data.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ Private Sub ViewIconMenuItem_Click(sender As Object, e As EventArgs) Handles ViewIconMenuItem.Click
+
+ Try
+ FileUtil.InternalOpenInExplorer(Me.CurrentShortcut.Icon)
+
+ Catch ex As Exception
+ MessageBox.Show(Me, ex.Message, Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Error)
+
+ End Try
+
+ End Sub
+
+#End Region
+
+#End Region
+
#Region " Private Methods "
+ ''' ----------------------------------------------------------------------------------------------------
+ '''
+ ''' Loads the saved font size for the user-interface.
+ '''
+ ''' ----------------------------------------------------------------------------------------------------
+ Private Sub LoadFontSize()
+ Me.MenuStrip1.Font = New Font(Me.MenuStrip1.Font.FontFamily, My.Settings.FontSize, Me.MenuStrip1.Font.Style)
+ Me.StatusStrip1.Font = New Font(Me.StatusStrip1.Font.FontFamily, My.Settings.FontSize, Me.StatusStrip1.Font.Style)
+ Me.ToolStripStatusLabelIcon.Font = New Font(Me.ToolStripStatusLabelIcon.Font.FontFamily, My.Settings.FontSize, Me.ToolStripStatusLabelIcon.Font.Style)
+ Me.ToolStripStatusLabelFileName.Font = New Font(Me.ToolStripStatusLabelFileName.Font.FontFamily, My.Settings.FontSize, Me.ToolStripStatusLabelFileName.Font.Style)
+ Me.PropertyGrid1.Font = New Font(Me.PropertyGrid1.Font.FontFamily, My.Settings.FontSize, Me.PropertyGrid1.Font.Style)
+ End Sub
+
''' ----------------------------------------------------------------------------------------------------
'''
''' Loads the saved visual theme for the user-interface.
@@ -420,22 +795,25 @@ Friend NotInheritable Class Form1 : Inherits Form
''' ----------------------------------------------------------------------------------------------------
Private Sub LoadShortcutInPropertyGrid(ByVal filePath As String)
- Dim shortcut As New ShortcutFileInfo(filePath) With {.ViewMode = True}
- If Not shortcut.Exists Then
- MessageBox.Show(Me, $"The lnk file does not exist: {shortcut.FullName}", Me.Name, MessageBoxButtons.OK, MessageBoxIcon.Error)
+ Me.CurrentShortcut = New ShortcutFileInfo(filePath) With {.ViewMode = True}
+ If Not Me.CurrentShortcut.Exists Then
+ MessageBox.Show(Me, $"The lnk file does not exist: {Me.CurrentShortcut.FullName}", Me.Name, MessageBoxButtons.OK, MessageBoxIcon.Error)
Exit Sub
End If
- Me.PropertyGrid1.MoveSplitterTo(160)
- Me.PropertyGrid1.SelectedObject = shortcut
- Me.ToolStripStatusLabel1.Text = filePath
+ Me.PropertyGrid1.MoveSplitterTo(180)
+ Me.PropertyGrid1.SelectedObject = Me.CurrentShortcut
+ Me.ToolStripStatusLabelFileName.Text = filePath
Me.RecentToolStripMenuItem.Enabled = True
Me.SaveToolStripMenuItem.Enabled = True
Me.SaveAsToolStripMenuItem.Enabled = True
Me.CloseToolStripMenuItem.Enabled = True
- Me.UpdateMruItems(shortcut)
+ Me.UpdateMruItems(Me.CurrentShortcut)
+ Me.ToolStripStatusLabelIcon.Image = Me.RecentToolStripMenuItem.DropDown.Items(0).Image
+
+ Me.PropertyGrid1.ContextMenuStrip = Me.ContextMenuStrip1
End Sub