Icon Reader Problem: Readbyte immer 0
Übersicht

![]() |
Xaymarehemals "Cgamer"Betreff: Icon Reader Problem: Readbyte immer 0 |
![]() Antworten mit Zitat ![]() |
---|---|---|
Hi,
Ich arbeite derzeit an einem Icon Loader, bzw einem icon extractor. Leider hat es problem bei einem selbsterstellen ico. Manchmal liegt die größe (Size = readint()) bei 20-e28162.19201. Ich habe keine ahnung was für eine Zahl das sein soll. Hier der Code(Liest immoment nur header, bzw Icons werden nicht richtig extrahiert): Code: [AUSKLAPPEN] ;Reading Icon Data
Function ReadIcon(File$) If FileType(File$) = 1 St = ReadFile(File$) Unk = ReadShort(St) Typ = ReadShort(St) IgC = ReadShort(St) TypS$ = "CUR" If Typ = 0 TypS$ = "ICO" Print "Reserved: " + Unk Print "Type: " + TypS$ Print "Images: " + IgC For A = 1 To IgC W = ReadByte(St) H = ReadByte(St) C = ReadByte(St) Print "Width: " + W Print "Height: " + H Print "Colors / X HotSpot(Cur): " + C Print "Reserved / Y HotSpot(Cur): " + ReadByte(St) Size = ReadInt(St) Print "Byte Size of Bitmap: " + Size Print "KB Size: " + Float(Size)/1024 Seek = ReadInt(St)/1024 Print "Offset of Bitmap: " + Seek OPos = FilePos(St) SeekFile(St, Opos+Seek) Print Float(W*H*4+2+4+2+2+4+4+2+2+2+2)/1024 + " KB" Print FilePos(St) If Size < W*H*4 Fil = WriteFile(A+" "+W+"x"+H+".png") While Not FilePos(St) = (OPos + Seek + Size) WriteByte Fil, ReadByte(St) Wend Else Fil = WriteFile(A+" "+W+"x"+H+".bmp") ;Header of a Bitmap. Its Small but contains much WriteShort Fil, $4D WriteInt Fil, Size WriteShort Fil, 0 WriteShort Fil, 0 WriteInt Fil, 26 WriteInt Fil, 12 WriteShort Fil, W WriteShort Fil, H WriteShort Fil, 1 WriteShort Fil, 24 While Not FilePos(St) = (OPos + Seek + Size) WriteInt Fil, ReadInt(St) Wend EndIf CloseFile Fil SeekFile(St, OPos) Next EndIf End Function ReadIcon("binary.ico") WaitKey() binary.ico Was mache ich falsch? Ist vlt das icon kaputt? MfG |
||
Warbseite |
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group