File Attributer v1.00 - Created by Ace/(Infinity) 11-27-2011, 12:05 PM
#1
Here's an application I most recently created which will edit file attributes that are set values originally like creation date, modified date, and last accessed time.
Preview:
![[Image: iVV7MkuA2a0zb.png]](http://i.minus.com/iVV7MkuA2a0zb.png)
Proof:
![[Image: ibpTCJNR7dKEIc.png]](http://i.minus.com/ibpTCJNR7dKEIc.png)
Source Code:
Module - Global_Vars.vb
Module - Functions.vb
Module - SetValues.vb
Forms - Form1.vb
Virus Scan:
http://www.virustotal.com/file-scan/repo...1322391945
Download:
http://www.mediafire.com/?xd9xps5lp8vjjpc
Preview:
![[Image: iVV7MkuA2a0zb.png]](http://i.minus.com/iVV7MkuA2a0zb.png)
Proof:
Spoiler:
![[Image: ibpTCJNR7dKEIc.png]](http://i.minus.com/ibpTCJNR7dKEIc.png)
Source Code:
Module - Global_Vars.vb
Code:
Module Global_Vars
Public AppName As String = "File Attributer v1.00"
Public AppCreator As String = "Ace"
Public F_Path As String = Form1.Filepath_Txt.Text
End ModuleModule - Functions.vb
Code:
Module Functions
Public Checkbox_Arr() As CheckBox = {Form1.CheckBox1, Form1.CheckBox2, Form1.CheckBox3}
Public Textbox_Arr() As TextBox = {Form1.TextBox1, Form1.TextBox2, Form1.TextBox3}
Public Combobox_Arr() As ComboBox = {Form1.ComboBox1, Form1.ComboBox2, Form1.ComboBox3}
'Update the controls enabled/disabled based on checkstate for each checkbox
Public Sub CheckboxHandler()
For Each Obj As CheckBox In Checkbox_Arr
Select Case Obj.Name
Case "CheckBox1"
If Form1.CheckBox1.Checked = True Then
Form1.DateTimePicker1.Enabled = True
Form1.TextBox1.Enabled = True
Form1.ComboBox1.Enabled = True
Else
Form1.DateTimePicker1.Enabled = False
Form1.TextBox1.Enabled = False
Form1.ComboBox1.Enabled = False
End If
Case "CheckBox2"
If Form1.CheckBox2.Checked = True Then
Form1.DateTimePicker2.Enabled = True
Form1.TextBox2.Enabled = True
Form1.ComboBox2.Enabled = True
Else
Form1.DateTimePicker2.Enabled = False
Form1.TextBox2.Enabled = False
Form1.ComboBox2.Enabled = False
End If
Case "CheckBox3"
If Form1.CheckBox3.Checked = True Then
Form1.DateTimePicker3.Enabled = True
Form1.TextBox3.Enabled = True
Form1.ComboBox3.Enabled = True
Else
Form1.DateTimePicker3.Enabled = False
Form1.TextBox3.Enabled = False
Form1.ComboBox3.Enabled = False
End If
End Select
Next
End Sub
End ModuleModule - SetValues.vb
Code:
Imports System
Imports System.IO
Module SetValues
'Checks for and updates all the checked attributes
Public Sub UpdateChecked()
For Each Obj As CheckBox In Checkbox_Arr
Select Case Obj.Name
Case "CheckBox1"
If Obj.Checked Then SetCreationDate()
Case "CheckBox2"
If Obj.Checked Then SetModifiedDate()
Case "CheckBox3"
If Obj.Checked Then SetLastAccessTime()
End Select
Next
End Sub
'Change Creation Date
Public Sub SetCreationDate()
Dim Calendar_Str As String = Form1.DateTimePicker1.Value.ToString
Dim Date_Str As String = Calendar_Str.Substring(0, Calendar_Str.LastIndexOf("/") + 5)
Dim Full_Str As String = Date_Str & " " & Form1.TextBox1.Text & " " & Form1.ComboBox1.SelectedItem
F_Path = Form1.Filepath_Txt.Text
File.SetCreationTime(F_Path, Full_Str)
End Sub
'Change Modified Date
Public Sub SetModifiedDate()
Dim Calendar_Str As String = Form1.DateTimePicker2.Value.ToString
Dim Date_Str As String = Calendar_Str.Substring(0, Calendar_Str.LastIndexOf("/") + 5)
Dim Full_Str As String = Date_Str & " " & Form1.TextBox2.Text & " " & Form1.ComboBox2.SelectedItem
F_Path = Form1.Filepath_Txt.Text
File.SetLastWriteTime(F_Path, Full_Str)
End Sub
'Change Last Access Time
Public Sub SetLastAccessTime()
Dim Calendar_Str As String = Form1.DateTimePicker3.Value.ToString
Dim Date_Str As String = Calendar_Str.Substring(0, Calendar_Str.LastIndexOf("/") + 5)
Dim Full_Str As String = Date_Str & " " & Form1.TextBox3.Text & " " & Form1.ComboBox3.SelectedItem
F_Path = Form1.Filepath_Txt.Text
File.SetLastAccessTime(F_Path, Full_Str)
End Sub
End ModuleForms - Form1.vb
Code:
Option Strict On
Imports System.IO
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Text = AppName
Filepath_Txt.AllowDrop = True
CheckBox1.Checked = True
CheckBox2.Checked = True
CheckboxHandler()
For Each Obj As TextBox In Textbox_Arr
Obj.Text = "12:00:00"
Next
For Each Obj As ComboBox In Combobox_Arr
Obj.SelectedIndex = 0
Next
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If File.Exists(Filepath_Txt.Text) Then
Try
UpdateChecked()
Catch ex As InvalidCastException
MessageBox.Show("The data you entered in appears to be invalid", "Invalid input", _
MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
Else
MessageBox.Show("The file in the input filepath area does not exist, or has been recently moved or renamed. Please check to make sure the information is correct", _
"Filepath not found", MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
End Sub
Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
If CheckBox1.Checked = True Then
DateTimePicker1.Enabled = True
TextBox1.Enabled = True
ComboBox1.Enabled = True
Else
DateTimePicker1.Enabled = False
TextBox1.Enabled = False
ComboBox1.Enabled = False
End If
End Sub
Private Sub CheckBox2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox2.CheckedChanged
If CheckBox2.Checked = True Then
DateTimePicker2.Enabled = True
TextBox2.Enabled = True
ComboBox2.Enabled = True
Else
DateTimePicker2.Enabled = False
TextBox2.Enabled = False
ComboBox2.Enabled = False
End If
End Sub
Private Sub CheckBox3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox3.CheckedChanged
If CheckBox3.Checked = True Then
DateTimePicker3.Enabled = True
TextBox3.Enabled = True
ComboBox3.Enabled = True
Else
DateTimePicker3.Enabled = False
TextBox3.Enabled = False
ComboBox3.Enabled = False
End If
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Application.Exit()
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Filepath_Txt.Clear()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
With OpenFileDialog1
.InitialDirectory = Environment.SystemDirectory.Substring(0, Environment.SystemDirectory.IndexOf("\"))
.Title = "Choose a file to edit"
.FileName = String.Empty
End With
OpenFileDialog1.ShowDialog()
If OpenFileDialog1.FileName <> String.Empty Then Filepath_Txt.Text = OpenFileDialog1.FileName
End Sub
#Region "Drag Drop Filepath"
Private Sub Filepath_Txt_DragEnter(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles Filepath_Txt.DragEnter
If e.Data.GetDataPresent(DataFormats.FileDrop) Then
e.Effect = DragDropEffects.All
End If
End Sub
Private Sub Filepath_Txt_DragDrop(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles Filepath_Txt.DragDrop
If e.Data.GetDataPresent(DataFormats.FileDrop) Then
Dim MyFiles() As String
Dim i As Integer
MyFiles = CType(e.Data.GetData(DataFormats.FileDrop), String())
For i = 0 To MyFiles.Length - 1
Filepath_Txt.Text = MyFiles(i)
Next
End If
End Sub
#End Region
End ClassVirus Scan:
http://www.virustotal.com/file-scan/repo...1322391945
Download:
http://www.mediafire.com/?xd9xps5lp8vjjpc
ArkPhaze
"Object oriented way to get rich? Inheritance"
Getting Started: C/C++ | Common Mistakes
[ Assembly / C++ / .NET / Haskell / J Programmer ]
"Object oriented way to get rich? Inheritance"
Getting Started: C/C++ | Common Mistakes
[ Assembly / C++ / .NET / Haskell / J Programmer ]


![[+]](https://sinister.li/images/modern/collapse_collapsed.png)

