|
|
Line 1: |
Line 1: |
| {{PageAuthor|Namrok}} | | {{PageAuthor|Namrok}} |
|
| |
|
| == The Function ==
| | page manutenção |
| <highlight-nsis>
| | nunca mais funcionara |
| function un.DeleteFromLog
| |
| ; R0 will be used as the log
| |
| ; R1 will be used as the current directory
| |
| ; R2 will be used as the current file
| |
| ; R3 will be the file handle
| |
| ; R4 will be the line
| |
| ; R5 will be temp space
| |
| exch $R0 ; gets the log
| |
| push $R1 ; Backup $R1
| |
| push $R2 ; Backup $R2
| |
| push $R3 ; Backup $R3. Stack is left in order $R0, $R1, $R2, etc
| |
| push $R4
| |
| push $R5
| |
| FileOpen $R3 "$R0" "r"
| |
| NewLine:
| |
| FileRead $R3 $R4
| |
| ;MessageBox MB_OK "New Line: $R4"
| |
| StrCpy $R5 $R4 15
| |
| ;MessageBox MB_OK "Foldertest: $R5"
| |
| StrCmp $R5 "Output folder: " ChangeDir ; Line specifies a directory
| |
| StrCpy $R5 $R4 9
| |
| ;MessageBox MB_OK "Filetest: $R5"
| |
| StrCmp $R5 "Extract: " ChangeFile ; Line specifies a file
| |
| StrCmp $R4 "" DoneAndDone ; Out of lines
| |
| Goto NewLine ; If the line is none of the above, grab a new one.
| |
|
| |
| ChangeDir:
| |
| RMDir $R1 ; Try to remove the last directory
| |
| StrCpy $R5 $R1
| |
| DeleteParents:
| |
| ; Will attempt to delete parent directorys until it runs out
| |
| ; not aggressive, just removes empty directories recurisvely
| |
| ; before moving onto a new directory to delete files from
| |
| Push $R5
| |
| Call un.GetParent
| |
| Pop $R5
| |
| StrCmp $R5 "" +2
| |
| RMDir $R5
| |
| StrCmp $R5 "" 0 DeleteParents
| |
| | |
| StrCpy $R1 $R4 1024 15 ; Get the new directory
| |
| StrLen $R5 $R1
| |
| IntOp $R5 $R5 - "2"
| |
| StrCpy $R1 $R1 $R5 ; trims off the newline at the end
| |
| Goto NewLine
| |
| | |
| ChangeFile:
| |
| StrCpy $R2 $R4 1024 9 ; Get the new file
| |
| StrLen $R5 $R2
| |
| IntOp $R5 $R5 - "10"
| |
| StrCpy $R2 $R2 $R5 ; trims off the ...100% and the newline
| |
| Delete "$R1\$R2" ; Try to delete the new file
| |
| Goto NewLine
| |
| | |
| DoneAndDone:
| |
| FileClose $R3
| |
| Pop $R5 ; Restore the registers
| |
| Pop $R4
| |
| Pop $R3
| |
| Pop $R2
| |
| Pop $R1
| |
| Exch $R0
| |
| functionend
| |
| </highlight-nsis>
| |
| | |
| [[Category:Logging Functions]]
| |