Page 2 of 2
Posted: Fri Mar 06, 2009 12:42 pm
by User_Russian
Code: Select all
#UCM_PROCESSDATA=1
Procedure RAR_CB(msg, UserData, P1, P2)
If msg=#UCM_PROCESSDATA
Debug "Unpacked - "+Str(P2)+" byte"
EndIf
ProcedureReturn 0
;ProcedureReturn 1 ; Break Unpacked
EndProcedure
memText.s {270}
RarFile$=OpenFileRequester("","","WinRar (*.rar)|*.rar|*.*|*.*",0)
If RarFile$<>""
H_RAR=RAR_OpenArchive(RarFile$) ; Открываем архив и получаем его идентификатор
If H_RAR
RAR_SetCallback(H_RAR, @RAR_CB(), 0)
While RAR_ReadHeader(H_RAR, @memText)=0 ; Узнаём какие файлы есть в архиве
File.s=memText
Debug File
RAR_SetPassword(h_RAR,"") ; Пароля нет
res=RAR_ProcessFile(h_RAR,#RAR_EXTRACT,"","d:\testrar\"+File) ; Распаковываем файл в "d:\testrar\"
Wend
RAR_CloseArchive(H_RAR) ; Закрываем архив
EndIf
EndIf
Posted: Sat Mar 07, 2009 2:54 pm
by codeman
Thank you!
Posted: Sat Mar 07, 2009 3:19 pm
by Peyman
thanks, nobody know how convert time in RARHeaderData\FileTime to pb time.
Code: Select all
FileTime
Output parameter - contains date and time in standard MS DOS format
Posted: Sat Mar 07, 2009 4:06 pm
by codeman
Sorry that I ask so much but how I can make the output into a ProgressGadger?
Yours codeman
Posted: Sun Mar 08, 2009 9:10 am
by User_Russian
In function
RAR_ReadHeader is found bug, sorry
New version of the library
http://purik.nextmail.ru/PureBasic/en/U ... 1.2_EN.rar
nobody know how convert time in RARHeaderData\FileTime to pb time.
Code: Select all
Infa.RAR_HeaderData
memText.s {270}
RarFile$=OpenFileRequester("","","WinRar (*.rar)|*.rar|*.*|*.*",0)
If RarFile$<>""
H_RAR=RAR_OpenArchive(RarFile$) ; Открываем архив и получаем его идентификатор
If H_RAR
While RAR_ReadHeader(H_RAR, @memText,@Infa)=0 ; Узнаём какие файлы есть в архиве
File.s=memText
Debug File +" Create time - "+FormatDate("%dd/%mm/%yy %hh:%ii:%ss",Infa\FileTime)
RAR_SetPassword(h_RAR,"") ; Пароля нет
res=RAR_ProcessFile(h_RAR,#RAR_EXTRACT,"","d:\testrar\"+File) ; Распаковываем файл в "d:\testrar\"
Wend
RAR_CloseArchive(H_RAR) ; Закрываем архив
EndIf
EndIf
Posted: Sun Mar 08, 2009 10:42 am
by codeman
Can anybody make an example were you can see the status of unpacking in a ProgressBarGadget?
Yours codeman
Posted: Sun Mar 08, 2009 10:49 am
by Peyman
User_Russian wrote:
nobody know how convert time in RARHeaderData\FileTime to pb time.
Code: Select all
Infa.RAR_HeaderData
memText.s {270}
RarFile$=OpenFileRequester("","","WinRar (*.rar)|*.rar|*.*|*.*",0)
If RarFile$<>""
H_RAR=RAR_OpenArchive(RarFile$) ; Открываем архив и получаем его идентификатор
If H_RAR
While RAR_ReadHeader(H_RAR, @memText,@Infa)=0 ; Узнаём какие файлы есть в архиве
File.s=memText
Debug File +" Create time - "+FormatDate("%dd/%mm/%yy %hh:%ii:%ss",Infa\FileTime)
RAR_SetPassword(h_RAR,"") ; Пароля нет
res=RAR_ProcessFile(h_RAR,#RAR_EXTRACT,"","d:\testrar"+File) ; Распаковываем файл в "d:\testrar"
Wend
RAR_CloseArchive(H_RAR) ; Закрываем архив
EndIf
EndIf
no this is not true because i create a file and compress it on rar then use your code and this is return :
Code: Select all
New Text Document.txt Create time - 19/01/2001 16:53:42
i think RARHeaderData\FileTime differ with pb time, what means when rar say :
Code: Select all
FileTime
Output parameter - contains date and time in standard MS DOS format
Posted: Sun Mar 08, 2009 11:16 am
by User_Russian
no this is not true because i create a file and compress it on rar then use your code and this is return :
Here is structure
Code: Select all
Structure RAR_HeaderData
ArcName.c[260]
FileName.c[260]
Flags.l
PackSize.l
UnpSize.l
HostOS.l
FileCRC.l
FileTime.l ; <----
UnpVer.l
Method.l
FileAttr.l
*CmtBuf.l
CmtBufSize.l
CmtSize.l
CmtState.l
EndStructure
Posted: Sun Mar 08, 2009 11:51 am
by User_Russian
Can anybody make an example were you can see the status of unpacking in a ProgressBarGadget?
Code: Select all
Infa.RAR_HeaderData
OpenWindow(0,100,80,300,50,"",#PB_Window_SystemMenu)
CreateGadgetList(WindowID(0))
ProgressBarGadget(0,10,10,280,20,0,1)
memText.s {270}
RarFile$=OpenFileRequester("","","WinRar (*.rar)|*.rar|*.*|*.*",0)
If RarFile$<>""
SetGadgetAttribute(0,#PB_ProgressBar_Maximum,FileSize(RarFile$))
H_RAR=RAR_OpenArchive(RarFile$) ; Открываем архив и получаем его идентификатор
If H_RAR
While RAR_ReadHeader(H_RAR, @memText,@Infa)=0 ; Узнаём какие файлы есть в архиве
File.s=memText
X=X+Infa\PackSize
SetGadgetState(0,x)
Debug X
Debug File +" "+Str(Infa\UnpSize-Infa\PackSize)
RAR_SetPassword(h_RAR,"") ; Пароля нет
res=RAR_ProcessFile(h_RAR,#RAR_EXTRACT,"","d:\testrar\"+File) ; Распаковываем файл в "d:\testrar\"
Wend
RAR_CloseArchive(H_RAR) ; Закрываем архив
EndIf
EndIf
Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow
Posted: Sun Mar 08, 2009 11:55 am
by codeman
Thank you for this example!
Posted: Sun Mar 08, 2009 4:05 pm
by Peyman
User_Russian wrote:no this is not true because i create a file and compress it on rar then use your code and this is return :
Here is structure
Code: Select all
Structure RAR_HeaderData
ArcName.c[260]
FileName.c[260]
Flags.l
PackSize.l
UnpSize.l
HostOS.l
FileCRC.l
FileTime.l ; <----
UnpVer.l
Method.l
FileAttr.l
*CmtBuf.l
CmtBufSize.l
CmtSize.l
CmtState.l
EndStructure
Yea i know it but your example for FileTime never debug true created time, i create my file in 2009 but your code debug :
Code: Select all
New Text Document.txt Create time - 19/01/2001 16:53:42