Buchempfehlung
MySQL kurz & gut
MySQL kurz & gut
Das preiswerte Taschen- buch stellt MySQL-rele- vante Inhalte systematisch und knapp dar, sodass es sich optimal zum Nach- schlagen beim Pro- grammieren eignet. [Mehr Infos...]
FreeBASIC-Chat
Es sind Benutzer im FreeBASIC-Chat online.
(Stand:  )
FreeBASIC bei Twitter
Twitter FreeBASIC-Nachrichten jetzt auch über Twitter erhalten. Follow us!

fb:porticula NoPaste

Info
Info / Hilfe
Liste
Übersicht / Liste
Neu
Datei hochladen
Suche
Quellcode suchen
Download
Dateidownload

io.bas

Uploader:Mitgliedcsde_rats
Datum/Zeit:26.11.2007 23:27:32

/'
    DOFDA1
    data or file digest algorithm 1
    

    (c) 2007 Marian Beermann
             aka csde_rats
            
    
'/


#Include "dofda1.bi"

Function dofda1_io_getblock(FileNum As UByte, Offset As ULongInt) As dofda1_block Export
    Dim tempblock As dofda1_block

    Get #FileNum, _
        Offset, _
        tempblock.num

    For n As Integer = 0 To BlockLen
        Get #FileNum, _
             (Offset+SizeOf(tempblock.num)+(n*SizeOf(tempblock.dat(n)))), _
             tempblock.dat(n)
    Next

    Return tempblock
End Function

Function dofda1_io_writeblock(FileNum As UByte, Offset As ULongInt, bBlock As dofda1_block) As Boolean Export
    Dim tempblock As dofda1_block
    tempblock = bBlock

    If Lof(FileNum) < SizeOf(dofda1_desc) Then Return FALSE

    Put #FileNum, _
        Offset, _
        tempblock.num

    For n As Integer = 0 To BlockLen
        Put #FileNum, _
             (Offset+SizeOf(tempblock.num)+(n*SizeOf(tempblock.dat(n)))), _
             tempblock.dat(n)
    Next

    Put #FileNum, _
        (Offset+SizeOf(tempblock.num)+(BlockLen*SizeOf(tempblock.dat(BlockLen)))), _
        tempblock.sHash

    Return TRUE
End Function

Function dofda1_io_writecontext(FileNum As UByte, Offset As ULongInt, cContext As dofda1_context) As Boolean Export
    Dim tempblock As dofda1_block

    With cContext
        Put #FileNum, _
             Offset, _
             .desc

        Put #FileNum, _
             (Offset+SizeOf(.desc)), _
             .iBlockNum

        For n As ULongInt = 0 To cContext.iBlockNum
            tempblock = .ubRawBlocks(n)

            If Lof(FileNum) < SizeOf(dofda1_desc) Then Return FALSE

            Put #FileNum, _
                (Offset+SizeOf(.desc)+SizeOf(.iBlockNum)), _
                tempblock.num

            For n As Integer = 0 To BlockLen
                Put #FileNum, _
                     (Offset+SizeOf(.desc)+SizeOf(.iBlockNum)+SizeOf(tempblock.num)+(n*SizeOf(tempblock.dat(n)))), _
                     tempblock.dat(n)
            Next

            Put #FileNum, _
                (Offset+SizeOf(.desc)+SizeOf(.iBlockNum)+SizeOf(tempblock.num)+(BlockLen*SizeOf(tempblock.dat(BlockLen)))), _
                tempblock.sHash
        Next

    End With

    Return TRUE
End Function