Iniread iniwirite

  • Hey ich hab ein kleines problem und zwas geht es darum das ich ein kleines Programm amchen möchte in dem man Sein PW und sein Acc angeben kann...
    PS: das is kein hack ich vergess nur oft passwörter!

    Spoiler anzeigen
    [autoit]

    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <GUIListBox.au3>
    #include <WindowsConstants.au3>

    [/autoit] [autoit][/autoit] [autoit]

    $sIniSection = IniReadSectionNames( "Data.txt")

    [/autoit] [autoit][/autoit] [autoit]

    #Region ### START Koda GUI section ### Form=
    $Form2 = GUICreate("Choices Dialog", 345, 254, 302, 218)
    GUISetIcon("D:\007.ico")
    $ListBox1 = GUICtrlCreateList("", 8, 8, 137, 201)
    GUICtrlSetData(-1, "")
    $Button2 = GUICtrlCreateButton("+", 156, 72, 31, 25)
    $Button3 = GUICtrlCreateButton("-", 157, 105, 31, 25, $WS_GROUP)
    GUICtrlSetState(-1, $GUI_DISABLE)
    $ListBox2 = GUICtrlCreateList("", 200, 8, 137, 201)
    GUICtrlSetData(-1 , "")
    $Button5 = GUICtrlCreateButton("&OK", 104, 225, 75, 25, $WS_GROUP)
    $Button6 = GUICtrlCreateButton("&Cancel", 184, 225, 75, 25, $WS_GROUP)
    $Button7 = GUICtrlCreateButton("&Help", 264, 225, 75, 25, $WS_GROUP)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Button2
    $sName = InputBox( "Add File", "Geben sie jetzt den Acc namen an!")
    $sPasswort = InputBox( "Add File", "Geben sie jetzt das Passwort an!")
    _GUICtrlListBox_AddString($ListBox1, $sName)
    _GUICtrlListBox_AddString($ListBox2, $sPasswort)
    IniWriteSection( "Data.txt", $sName, $sPasswort)
    Case $Button5
    Exit
    Case $Button6
    Exit
    EndSwitch
    WEnd

    [/autoit]


    Und zwas soll der am Anfangen immer alle Namen auslesen und in die linke Listbox schreiben und die PAsswörter in die Rechte!
    Dann soll man mit + eine neun Eintrag falls man einen neuen acc hat..
    und mit - soll man sie löschen können..

    MFG CF gaming

  • Geht bestimmt besser, aber naja:

    Spoiler anzeigen
    [autoit]

    #include <File.au3>
    #include <GUIListView.au3>
    Dim $datas
    $file="data.dat"
    _FileReadToArray($file, $datas)
    $hFile=FileOpen($file)
    $oGUI = GUICreate("Passwort Manager", 374, 418, 192, 124)
    $hList = GUICtrlCreateListView("Benutzername|Passwort", 9, 32, 245, 370)
    $LVContext=GUICtrlCreateContextMenu($hList)
    $deletespecific=GUICtrlCreateMenuItem("Löschen", $LVContext)
    $deleteall=GUICtrlCreateMenuItem("Alle Löschen", $LVContext)
    _GUICtrlListView_SetColumnWidth($hList, 0, 120)
    _GUICtrlListView_SetColumnWidth($hList, 1, 120)
    GUICtrlCreateLabel("Passwort Manager", 16, 8, 99, 17)
    $adddata = GUICtrlCreateButton("Hinzufügen", 272, 32, 75, 25)
    $editdata = GUICtrlCreateButton("Bearbeiten", 272, 72, 75, 25)
    $deletedata = GUICtrlCreateButton("Löschen", 272, 112, 75, 25)
    GUISetState(@SW_SHOW)
    For $i=1 to _FileCountLines($file) Step 2
    GUICtrlCreateListViewItem(FileReadLine($hFile, $i)&"|"&FileReadLine($hFile, $i+1), $hList)
    Next
    While True
    Switch GUIGetMsg()
    Case -3
    Exit
    Case $adddata
    adddataGUI()
    $temp=FileOpen($file)
    For $i=1 to _FileCountLines($file)
    If FileReadLine($TEMP, $i)="" Then _FileWriteToLine($file, $i, "", 1)
    Next
    FileClose($temp)
    If IsArray($datas) Then
    For $i=0 to $datas[0]
    _ArrayDelete($datas, $i)
    Next
    EndIf
    _FileReadToArray($file, $datas)
    FileClose($hFile)
    $hFile=FileOpen($file)
    _GUICtrlListView_DeleteAllItems($hList)
    For $i=1 to _FileCountLines($file) Step 2
    GUICtrlCreateListViewItem(FileReadLine($hFile, $i)&"|"&FileReadLine($hFile, $i+1), $hList)
    Next
    Case $deletedata
    $data=_GUICtrlListView_GetSelectedIndices($hList)*2+1
    _FileWriteToLine($file, $data, "", 1)
    _FileWriteToLine($file, $data, "", 1)
    $temp=FileOpen($file)
    For $i=1 to _FileCountLines($file)
    If FileReadLine($TEMP, $i)="" Then _FileWriteToLine($file, $i, "", 1)
    Next
    FileClose($temp)
    If IsArray($datas) Then
    For $i=0 to $datas[0]
    _ArrayDelete($datas, $i)
    Next
    EndIf
    _FileReadToArray($file, $datas)
    FileClose($hFile)
    $hFile=FileOpen($file)
    _GUICtrlListView_DeleteAllItems($hList)
    For $i=1 to _FileCountLines($file) Step 2
    GUICtrlCreateListViewItem(FileReadLine($hFile, $i)&"|"&FileReadLine($hFile, $i+1), $hList)
    Next
    Case $editdata
    $data=_GUICtrlListView_GetSelectedIndices($hList)*2+1
    $edGUI = GUICreate("Daten ändern", 322, 150, 192, 124)
    GUICtrlCreateLabel("Username", 16, 16, 44, 17)
    $username = GUICtrlCreateInput(FileReadLine($hFile, $data), 72, 14, 185, 21)
    GUICtrlCreateLabel("Passwort", 16, 56, 44, 17)
    $passwort = GUICtrlCreateInput(FileReadLine($hFile, $data+1), 72, 54, 185, 21)
    $savechanges = GUICtrlCreateButton("Änderungen speichern", 72, 88, 139, 25)
    GUISetState()
    While True
    Switch GUIGetMsg()
    Case -3
    GUIDelete($edGUI)
    ExitLoop
    Case $savechanges
    _FileWriteToLine($file, $data, GUICtrlRead($username), 1)
    _FileWriteToLine($file, $data+1, GUICtrlRead($passwort), 1)
    GUIDelete($edGUI)
    ExitLoop
    EndSwitch
    WEnd
    $temp=FileOpen($file)
    For $i=1 to _FileCountLines($file)
    If FileReadLine($TEMP, $i)="" Then _FileWriteToLine($file, $i, "", 1)
    Next
    FileClose($temp)
    If IsArray($datas) Then
    For $i=0 to $datas[0]
    _ArrayDelete($datas, $i)
    Next
    EndIf
    _FileReadToArray($file, $datas)
    FileClose($hFile)
    $hFile=FileOpen($file)
    _GUICtrlListView_DeleteAllItems($hList)
    For $i=1 to _FileCountLines($file) Step 2
    GUICtrlCreateListViewItem(FileReadLine($hFile, $i)&"|"&FileReadLine($hFile, $i+1), $hList)
    Next
    Case $deletespecific
    ControlClick("Optionen", "", $deletedata)
    Case $deleteall
    FileClose($hFile)
    FileDelete($file)
    $hFile=FileOpen($file)
    _GUICtrlListView_DeleteAllItems($hList)
    EndSwitch
    WEnd
    Func adddataGUI()
    $adGUI = GUICreate("Daten hinzufügen", 388, 138, 192, 124)
    GUICtrlCreateLabel("Username", 16, 16, 44, 17)
    $username = GUICtrlCreateInput("", 80, 14, 257, 21)
    GUICtrlCreateLabel("Passwort", 16, 48, 44, 17)
    $passwort = GUICtrlCreateInput("", 80, 46, 257, 21)
    $save = GUICtrlCreateButton("Speichern", 136, 80, 75, 25)
    GUISetState(@SW_SHOW)
    While True
    Switch GUIGetMsg()
    Case -3
    GUIDelete($adGUI)
    Return
    Case $save
    FileWrite($file, @CRLF&GUICtrlRead($username)&@CRLF)
    FileWrite($file, GUICtrlRead($passwort))
    GUIDelete($adGUI)
    Return
    EndSwitch
    WEnd
    EndFunc

    [/autoit]


    Ich würde die Datei aber verschlüsseln...