Dras.biz Just another WordPress site

June 27, 2012

VFSSaveContext Class

Filed under: SaveIt,SaveIT API Reference — mark @ 16:04

Namespace: SaveIt.SingleFileVFS
C#:

using SaveIt.SingleFileVFS;

JS:

import SaveIt.SingleFileVFS;

VFSSaveContext(string fileName, ResourceEntry[] resourceEntries = null)
Parameters:

    fileName – the filename to the file to which this context should write
    resourceEntries [optional] – array of precreated resources to use instead to create it on demand

Creates a new VFSSaveContext instance. The main difference to the non VFS Context is that you will not have to use the Flush()
command to store your data to disc. Instead the VFSSaveContext will save the data immediately as you call a Save method or the Delete command.

C#:

1
VFSSaveContext context = new VFSSaveContext("SaveItData");
1
VFSSaveContext context = new VFSSaveContext("SaveItData", myResourceEntries);

JS:

1
var context : VFSSaveContext = VFSSaveContext("SaveItData");
1
var context : VFSSaveContext = VFSSaveContext("SaveItData", myResourceEntries);

void Flush()
Parameters:

    none

Defragments the file and rewrites its content to disc. Its not needed to be called.
Use this method when you feel that the created file needs to much disc space.

C#:

1
2
3
context.Save(gameObject.name, "name");
context.Save(42, "magicNumber");
context.Flush();

JS:

1
2
3
context.Save(gameObject.name, "name");
context.Save(42, "magicNumber");
context.Flush();

void Delete(string name)
Parameters:

    name – an entry name which should be deleted

Deletes the entry with the given name from the context, reduces the ammount of memory needed for the whole file.

C#:

1
2
3
context.Save(gameObject.name, "name");
context.Save(42, "magicNumber");
context.Delete("name");

JS:

1
2
3
context.Save(gameObject.name, "name");
context.Save(42, "magicNumber");
context.Delete("name");

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress