IconChanger 2.1

Door filenox op woensdag 14 oktober 2009 13:53 - Reacties (28)
Categorie: Software, Views: 2185

Ik heb vandaag een tool met de naam 'IconChanger' gemaakt
die het mogelijk maakt om het icoon van een willekeurige USB-drive makkelijk aan te passen. :)

IconChanger 2.1

ICONCHANGER DOWNLOADEN
(1 .exe van 26kB)


ICONCHANGER 2.1 DOWNLOADEN (1 .exe van 24kB)


En voor de geďnteresseerde, de (nu, oude) broncode: http://pastebin.org/45550
Tips en commentaar zijn zoals altijd welkom :)

Bedankt voor alle commentaar, ik heb nu een nieuwe versie gemaakt waar ik met de volgende commentaar heb rekening gehouden;
-Functie gebruiken
-Het GO-crashprobleem
-OpenFileDialog
-Naamgeving

Hier is een nieuwe downloadlink; klik

Todo:
-Driveinfo gebruiken
-Er voor zorgen dat het icoon-bestand niet 'icoon' moet heten
-Er voor zorgen dat het programma niet moet worden afgesloten als er niets is ingevuld
-Nieuwe commentaar erin verwerken :)

Edit2: Bedankt weer voor alle commentaar, ik heb nu een nieuwe versie gemaakt waar ik met de volgende commentaar heb rekening gehouden;
-Driveinfo gebruiken
-Er voor zorgen dat het icoon-bestand niet 'icoon' moet heten
-Er voor zorgen dat het programma niet moet worden afgesloten als er niets is ingevuld
-Nieuwe commentaar erin verwerken ;)

Dat is allemaal goed gelukt, en hier is de broncode weer:

Visual Basic .NET:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
Imports System.IO
Public Class frmHoofdformulier
    Public bestandsnaam As String
    Public Function bestandmaken()
        Dim doelstick As String = cboDrives.SelectedItem.ToString
        Dim doc As New FileStream(doelstick & "autorun.inf"FileMode.CreateFileAccess.Write)
        Dim inhoud As New StreamWriter(doc)
        inhoud.BaseStream.Seek(0SeekOrigin.End)
        inhoud.WriteLine("[autorun]")
        inhoud.WriteLine("icon=" & bestandsnaam)
        inhoud.Close()
    End Function
    Private Sub frmHoofdformulier_Load(ByVal sender As System.ObjectByVal e As System.EventArgsHandles MyBase.Load
        cboDrives.Items.Clear()
        For Each drv As DriveInfo In DriveInfo.GetDrives()
            If drv.DriveType = DriveType.Removable Then
                cboDrives.Items.Add(drv.Name)
            End If
        Next

    End Sub
    Public Sub btnGo_Click(ByVal sender As System.ObjectByVal e As System.EventArgsHandles btnGo.Click
        'kijken ofdat de combobox is ingevuld
        If cboDrives.SelectedIndex = -1 Then
            MsgBox("Selecteer eerst de USB-drive"MsgBoxStyle.Critical)
            Return
        End If

        'bestand selecteren
        Dim bestand As String
        Dim openDialog As New OpenFileDialog()
        openDialog.Filter = "Iconen (*.ico)|*.ico"
        If openDialog.ShowDialog() = DialogResult.OK Then
            bestand = openDialog.FileName
        Else
            Return
        End If

        'bestandsnaam declareren
        bestandsnaam = openDialog.SafeFileName

        'usbdrive selecteren
        Dim doelstick As String = cboDrives.SelectedItem.ToString

        'Icon controlen + kopiëren
        Dim doelICON As String = (doelstick & bestandsnaam)
        If System.IO.File.Exists(doelICON) = True Then
            System.IO.File.Delete(doelICON)
            System.IO.File.Copy(bestanddoelICON)
        Else : System.IO.File.Copy(bestanddoelICON)
        End If

        'autorun.inf aanmaken
        If System.IO.File.Exists(doelstick & "autorun.inf") = True Then
            System.IO.File.Delete(doelstick & "autorun.inf")
            bestandmaken()
        Else : bestandmaken()
        End If

        'bestanden verbergen
        Dim autorun As IO.FileInfo = My.Computer.FileSystem.GetFileInfo(doelstick & "autorun.inf")
        autorun.Attributes = autorun.Attributes Or IO.FileAttributes.Hidden

        Dim icon As IO.FileInfo = My.Computer.FileSystem.GetFileInfo(doelstick & bestandsnaam)
        icon.Attributes = icon.Attributes Or IO.FileAttributes.Hidden

        MsgBox("Het icoon is succesvol veranderd!"MsgBoxStyle.Information)

    End Sub
    Private Sub Linkfilenox_LinkClicked(ByVal sender As System.ObjectByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgsHandles LinkLabel1.LinkClicked
        System.Diagnostics.Process.Start("http://filenox.tweakblogs.net")
    End Sub

    Private Sub LinkIconArchive_LinkClicked(ByVal sender As System.ObjectByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgsHandles LinkLabel2.LinkClicked
        System.Diagnostics.Process.Start("http://www.iconarchive.com/")
    End Sub
End Class


Downloadlink; http://s000.tinyupload.co...e_id=97936709277412897064