Small company logo:
   History
 
Advertising banner:
 
 ServerFile.AddResource
Home • Help • Customization Tools • FCAS • Language Reference • ServerFile.AddResource
 
Purpose
Adds the specified resource to an open .fc or .rez file.
Syntax
ServerFile.AddResource (ResourceType, ResourceID, ResourceName, ResourceAsBinary [, Commit as Integer = TRUE | FALSE] )


ResourceType
A string representing the resource type.
ResourceID
An integer representing the resource ID.
ResourceName
A string representing the resource name.
ResourceAsBinary
The binary data.
This might be a variable of type Binary, a server file or file data attribute, or the result of a GetResource from a different resource file.
Commit as Integer
TRUE is the default, and means the resource is committed to the server file immediately.
FALSE means committing will be delayed until the ServerFile.CommitResource command is issued. This is for performance purposes.

Example
Dim sf as ServerFile
Dim sf2 as ServerFile
Dim f as File
' Open the resource file from the server
sf.OpenFile("FCAS Config|JPEG1000.rez")
' Write a resource to local disk
f.OpenFile(fcpofolder & "\Test.JPG",fcWrite)
f.Write(sf.GetResource("JPEG",1000))
f.CloseFile
' Add a resource to another file
sf2.CreateFile("FCAS Config|newrez.rez",fcFile)
sf2.AddResource("JPEG",1000,"Name",sf.GetResource("JPEG",1000),FALSE)
sf2.AddResource("JPEG",1001,"Name",sf.GetResource("JPEG",1000),FALSE)
sf2.Commit
f.OpenFile(fcpofolder & "\Test2.JPG",fcWrite)
f.Write(sf2.GetResource("JPEG",1000))
f.CloseFile
f.OpenFile(fcpofolder & "\Test3.JPG",fcWrite)
f.Write(sf2.GetResource("JPEG",1001))
f.CloseFile
' Delete a resource from a server file
sf2.DelResource("JPEG",1000)