Author Topic: TrIDEngine.dll definitions  (Read 6210 times)

JeffB

  • Newbie
  • *
  • Posts: 1
TrIDEngine.dll definitions
« on: December 17, 2015, 07:58:33 PM »
Is it possible to use a single TrIDDefs.TRD package rather than a folder containing individual xml def files when calling the the TrIDEngine.dll ?

Thank you.

Mark0

  • Administrator
  • Hero Member
  • *****
  • Posts: 2743
    • Mark0's Home Page
Re: TrIDEngine.dll definitions
« Reply #1 on: December 17, 2015, 09:39:19 PM »
The TRD format itself isn't supported, but you surely don't have to load all the individuals XML defs every time.
TrIDEngine provide functions to load single *.trid.xml definitions, one by one, and to get/set the object that represent them all at once.
So it's  possible to package them in any kind of container you may choose.

Here's a very simple example from TrIDEngine's How-to, using serialization.

A possible way to save the definitions:

MyDefBlock = Ctype(PE.GetDefs, System.Collections.ArrayList)
Dim saveFile As FileStream
saveFile = File.OpenWrite(sBasePath & sDefPackageName)
Dim formatter As BinaryFormatter = New BinaryFormatter()
formatter.Serialize(saveFile, MyDefBlock)
saveFile.Close()


Then, for reloading them:

Dim readFile As FileStream
readFile = File.OpenRead(sBasePath & sDefPackageName)
Dim Formatter As BinaryFormatter =  New BinaryFormatter()
MyDefBlock = CType(Formatter.Deserialize(readFile), System.Collections.ArrayList)
readFile.Close()
PE.SetDefs(MyDefBlock)

Hope this helps,
Bye!