Skip to content

Commit

Permalink
Added .scr files to dangerous extensions, fixed getting file path oft…
Browse files Browse the repository at this point in the history
…er renaming

Full file path in Copy button right click, ask before reading new file
Set window Cancel button to btnClose, bumped version
  • Loading branch information
Walkman100 committed Jul 3, 2015
1 parent 909809f commit c14961d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
4 changes: 2 additions & 2 deletions My Project/AssemblyInfo.vb
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>

<Assembly: AssemblyVersion("1.0.0.0")>
<Assembly: AssemblyFileVersion("1.0.0.0")>
<Assembly: AssemblyVersion("1.1.0.0")>
<Assembly: AssemblyFileVersion("1.1.0.0")>
2 changes: 2 additions & 0 deletions PropertiesDotNet.Designer.vb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 8 additions & 7 deletions PropertiesDotNet.vb
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ Public Class PropertiesDotNet
End Sub
Sub btnOpenWith_Click() Handles btnOpenWith.Click
Dim isDangerousExtension As New Boolean
Dim dangerousExtensions() As String = {".exe", ".bat", ".cmd", ".lnk", ".com"}
Dim dangerousExtensions() As String = {".exe", ".bat", ".cmd", ".lnk", ".com", ".scr"}
For i = 1 To dangerousExtensions.Length
If lblExtension.Text = dangerousExtensions(i-1) Then
isDangerousExtension = True
Expand Down Expand Up @@ -261,7 +261,7 @@ Public Class PropertiesDotNet
If newName <> "" Then
Try
FileProperties.MoveTo(FileProperties.DirectoryName & "\" & newName)
lblLocation.Text = FileProperties.DirectoryName & "\" & newName
lblLocation.Text = FileProperties.FullName
Catch ex As exception
If ex.GetType.ToString = "System.UnauthorizedAccessException" Then
If MsgBox(ex.message & vbnewline & vbnewline & "Try launching a system tool as admin?", _
Expand Down Expand Up @@ -317,19 +317,20 @@ Public Class PropertiesDotNet
Sub btnCopy_MouseUp(sender As Object, e As MouseEventArgs) Handles btnCopy.MouseUp
If e.Button = Windows.Forms.MouseButtons.Right Then
Dim FileProperties As New FileInfo(lblLocation.Text)
Dim newName = InputBox("Copy to:", "Copy file", FileProperties.Name)
Dim newName = InputBox("Copy to:", "Copy file", FileProperties.FullName)
If newName <> "" Then
Try
FileProperties.CopyTo(newName)
lblLocation.Text = newName
If MsgBox("Read new file?", MsgBoxStyle.YesNo + MsgBoxStyle.Question) = MsgBoxResult.Yes Then _
lblLocation.Text = newName
Catch ex As exception
If ex.GetType.ToString = "System.UnauthorizedAccessException" Then
If MsgBox(ex.message & vbnewline & vbnewline & "Try launching a system tool as admin?", _
MsgBoxStyle.YesNo + MsgBoxStyle.Exclamation, "Access denied!") = MsgBoxResult.Yes Then
MsgBoxStyle.YesNo + MsgBoxStyle.Exclamation, "Access denied!") = MsgBoxResult.Yes Then
CreateObject("Shell.Application").ShellExecute("xcopy", """" & lblFullPath.Text & _
""" """ & newName & """", "", "runas")
""" """ & newName & """", "", "runas")
If MsgBox("Read new file?", MsgBoxStyle.YesNo + MsgBoxStyle.Question) = MsgBoxResult.Yes Then _
lblLocation.Text = newName
lblLocation.Text = newName
Else
ErrorParser(ex)
End If
Expand Down

0 comments on commit c14961d

Please sign in to comment.