forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Resource compiler

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 3 Source Code
View previous topic :: View next topic  
Author Message
Dr. Dread
Professional Member
Professional Member


Joined: 03 Aug 2001
Posts: 1065
Location: Copenhagen, Denmark

PostPosted: Fri Mar 01, 2002 12:52 am    Post subject: Resource compiler Reply with quote

This proggie uses VDSINOUT.DLL
(http://www.vdsworld.com/index.php?page=download&fileid=10) to create a single
resource file for all the files associated with your VDS program (not
VDSINOUT.DLL, though).
In contrast with the VDS resource compiler, it will take ANY type of file,
such as text files or binary files. I have tested with dll, exe, hlp, wav, txt,
bmp etc. and so far no problems detected.

The resource compiler creates a single resource file from a list of input
files. It also makes a map file with file offsets - written in a format that
can be pasted right into a VDS file to extract the files from the resource file.

Code:

  title Resource compiler

  dialog CREATE,Dr. Dread's Resource compiler,-1,0,394,318,SAVEPOS,DRAGDROP
  dialog ADD,TEXT,T1,7,10,,,Output file name:
  dialog ADD,EDIT,Outfile,5,100,150,
  dialog ADD,TEXT,T2,36,10,,,Files:
  dialog ADD,TEXT,T3,36,270,,,(drag&&drop files here)
  dialog ADD,LIST,LB,55,10,366,160
  dialog ADD,BUTTON,Reprieve,228,10,100,,Remove from list
  dialog ADD,BUTTON,Compile,228,150,100,,Compile now
  dialog ADD,BUTTON,Quit,228,300,,,Close
  dialog ADD,STATUS,SP
  dialog ADD,TEXT,T4,270,10,,,Status:
  dialog ADD,PROGRESS,PROGRESS1,268,50,267,18,0
  dialog ADD,TEXT,T5,270,320,,,100%
  option DECIMALSEP,.
  %h = @sendmsg(@winexists(~LB),1045,1000,0)
  dialog SHOW
:evloop
  dialog set,SP,@count(LB) files selected
  wait event
  goto @event()
:dragdrop
  list DROPFILES,LB
  goto evloop
:ReprieveBUTTON
  dialog CLEARSEL,LB
  goto evloop
:CompileBUTTON
  %%resfile = @dlgtext(Outfile)
  list create,9
  %a = @count(LB)
  %b = @div(100,%A)
  %i = 0
  list seek,LB,0
  rem Create resource file from list of files
  repeat
    %f = @item(LB)
    if @not(@null(%F))
      %%app = @IO(APPND,%%resfile,%F)
      gosub logger
      list delete,LB
      %i = @fadd(%I,%B)
      dialog set,progress1,%I
    end
  until @null(%F)
  dialog clear,LB
  dialog set,progress1,100
  dialog cursor
  list savefile,9,mapfile.txt
  list close,9
  shell OPEN,mapfile.txt
  goto evloop

:QuitButton
:CLOSE
  exit

  rem SUBS
:logger
  rem Create map file in a format appropriate for extraction by VDSINOUT
  wait 0.1
  %%size = @file(%%resfile,Z)
  %%start = @succ(@fsub(%%size,%%app))
  %%file = @NAME(%F).@EXT(%F)
  list add,9,"%%xtract = @IO(XTRCT,"%%resfile","%%start","%%size","%%file)
  rem *** inconsistent @ character, opening bracket and closing bracket count on previous line ***
  exit


One more comment. The compiled resource file can be used directly from
VDS as concerns TXT, BMP, and ICO files.
For instance:
Code:
DIALOG SET,BITMAP1,resfile.dsr|123

However the byte offset should be set one lower as compared to using
VDSINOUT for extraction. And VDSINOUT still has to be used to extract
any other type of files

If you want to disguise your resources from nosy users, create a new
directory somewhere, extract the files there, and delete them again when
the program is closed.

Keep on trucking!

Dread
Wink

_________________
~~ Alcohol and calculus don't mix... Don't drink and derive! ~~

String.DLL * advanced string processing
Back to top
View user's profile Send private message
marty
Professional Member
Professional Member


Joined: 10 May 2001
Posts: 789

PostPosted: Fri Aug 30, 2002 4:46 pm    Post subject: Reply with quote

Well just tried this little source code and it works well, except for one thing I would like to know...

I selected 5 files to be compiled in a resource file of an original total size of 1.27 megs, after the compilation the newly created resource file is 6.2 megs...

I used the code in VDS 4.5

Anybody have an idea why?

I would really like using the little code in one of my vds projects...

Thanks
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
marty
Professional Member
Professional Member


Joined: 10 May 2001
Posts: 789

PostPosted: Fri Aug 30, 2002 4:50 pm    Post subject: Reply with quote

Forget it... I found my problem, I didnt delete the original resource file I did, so it kept adding the sames file to it..

Normal it grows in size that way... Wink


Ciao
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 3 Source Code All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group