AppRegistration
Registrations for applications.
Title |
Registrations for applications. |
Author(s) |
LiXizhi |
Date |
2007/12/28 |
File |
script/kids/3DMapSystemApp/AppRegistration.lua |
Description
Sample Code
NPL.load("(gl)script/kids/3DMapSystemApp/AppRegistration.lua");
Member Functions
Map3DSystem.App.Registration.ConnectToAppDB
requires
NPL.load("(gl)script/kids/3DMapSystemApp/AppKeys.lua");
NPL.load("(gl)script/sqlite/sqlite3.lua");
app client database
if(not
Map3DSystem.App.Registration) then
Map3DSystem.App.Registration={}; end
default app database path
Map3DSystem.App.Registration._AppDBFilePath = "Database/apps.db";
UNTESTED: connect to the client's application database. It is a database stored at Database/apps.db
it is safe to call this function as many times as you like, since it will maintain the database connection.
it will return the application database object.
syntax
function Map3DSystem.App.Registration.ConnectToAppDB()
Map3DSystem.App.Registration.CheckApp
UNTESTED: check if an application is downloaded and installed on the client's computer's db.
- param app :_key: id of the application
- return bInstalled :, version: boolean of whether the application is installed, if it is true, the version contains the application version installed; otherwise it is nil.
syntax
function Map3DSystem.App.Registration.CheckApp(app_key)
parameters
app |
_key: id of the application |
key |
|
Map3DSystem.App.Registration.GetApp
get application data from the database. this is faster than parsing IP.xml each time.
- return __ : app table or nil
syntax
function Map3DSystem.App.Registration.GetApp(app_key)
parameters
app |
|
key |
|
return |
app table or nil |
Map3DSystem.App.Registration.AddRemoveAppOnStartup
NOT tested: add or remove a given app at startup time.
Note: it will only remove if app is uninstallable.
- param app :_key: app key
- param UserAdded : boolean whether to load the app at startup time.
- return true : if succeed.
syntax
function Map3DSystem.App.Registration.AddRemoveAppOnStartup(app_key, UserAdded)
parameters
app |
_key: app key |
key |
|
UserAdded |
|
return |
if succeed. |
Map3DSystem.App.Registration.IsAppUninstallable
return true if app must not be uninstalled.
syntax
function Map3DSystem.App.Registration.IsAppUninstallable(app_key)
parameters
Map3DSystem.App.Registration.UninstallApp
uninstall an application permanently from the application registration database.
Note: it will only uninstall if app is uninstallable.
- return true : if successfully uninstalled.
syntax
function Map3DSystem.App.Registration.UninstallApp(app_key)
parameters
app |
|
key |
|
return |
if successfully uninstalled. |
Map3DSystem.App.Registration.InstallApp
get application data from the database. this is faster than parsing IP.xml each time.
- param app : it should be a table containing {app_key="any GUID"}
- param IP :_file: file path of the IP.xml in the file.
- param bSkipInsertDB : default to nil. if true, we will not insert it to DB
- return __ : app table or nil
syntax
function Map3DSystem.App.Registration.InstallApp(app, IP_file, bSkipInsertDB)
parameters
app |
it should be a table containing {app_key="any GUID"} |
IP |
|
file |
|
bSkipInsertDB |
default to nil. if true, we will not insert it to DB |