Plugin Manager [Help]

Status
Niet open voor verdere reacties.

w00tare

Gebruiker
Lid geworden
10 jul 2009
Berichten
216
Hallo mensen,

Ik heb dus zelf een programma gemaakt.
Nou vindt ik het zelf puur irritant om iedere keer mensen opnieuw het bestand te sturen.
Nou heb ik bedacht, plugins? Makkelijk, meestal klein, en alleen echt de data die je nodig hebt gebruiken.

Ik heb dus een nieuw project aan gemaakt en heb het volgende:
Code:
Imports System.IO
Imports System.Net

Public Class Form1
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Check if there is a DLL(s)
        Dim PathT As String = System.Reflection.Assembly.GetExecutingAssembly.Location
        Dim DLL As DirectoryInfo = New DirectoryInfo(System.Reflection.Assembly.GetExecutingAssembly.Location)
        For Each File As FileInfo In DLL.GetFiles()
            ' If there is a DLL
            If Path.GetExtension(File.FullName) = ".dll" Then
                ' Read it
                GetPluginInfo(PathT + File.FullName)
            End If
        Next
    End Sub

    Private Sub GetPluginInfo(ByVal Path As String)
        Dim Reader = File.OpenText(Path) ' Set path to read
        PluginNew(Reader.ReadLine.Contains("[FormName]").ToString, Reader.ReadLine.Contains("[FormX]").ToString, Reader.ReadLine.Contains("[FormY]").ToString) ' Read some options, also call plugin manager
        Reader.Close()
    End Sub

    Private Sub PluginNew(ByVal FormTitle As String, ByVal FormX As String, ByVal FormY As String)
        ' Setup everything
        Dim LabelText As String = "See this!"
        Dim NewForm As New Form
        Dim NewLabel As New Label
        NewForm.Text = FormTitle.Replace("[FormName]", Nothing) ' Must delete the titels to find it into the .dll
        NewForm.Size = New Size(FormX.Replace("[FormX]", Nothing), FormY.Replace("[FormY]", Nothing)) ' ''
        'NewLabel.Text = LabelText
    End Sub
End Class

Als ik de builded versie open, geeft die een error 'De mapnaam is ongeldig'

Mijn .DLL bestaat uit:

Code:
[FormName]=CheckThisOut!
[FormX]=60
[FormY]=30

Iemand die me kan helpen.

Ook kom ik met een label in de NewForm toevoegen niet helemaal uit.

Bedankt!:thumb:
 
De eigenschap full name geeft de volledige bestandslocatie in dit geval wil je alleen de bestandsnaam dus kun je beter de eigenschap name gebruiken.

Een label toevoegen is niet zo moeilijk

Code:
Imports System.windows.forms
Imports system.drawing

Public Class test
	Public Sub form1_load(sender As Object, e As eventargs)
		Dim lblNieuwLabel As New Label()
		lblNieuwLabel.location = New Point(0, 0)
		lblNieuwLabel.text = "tekst"

		Me.controls.add(lblNieuwLabel)
	End Sub
End Class
 
De eigenschap full name geeft de volledige bestandslocatie in dit geval wil je alleen de bestandsnaam dus kun je beter de eigenschap name gebruiken.

Een label toevoegen is niet zo moeilijk

Code:
Imports System.windows.forms
Imports system.drawing

Public Class test
	Public Sub form1_load(sender As Object, e As eventargs)
		Dim lblNieuwLabel As New Label()
		lblNieuwLabel.location = New Point(0, 0)
		lblNieuwLabel.text = "tekst"

		Me.controls.add(lblNieuwLabel)
	End Sub
End Class

Bedankt!
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan