static void setup_app (Deployment *deployment, const char *base_dir, MoonAppRecord *app) { Surface *surface; char *path, *uri; Uri *origin, *url; /* use the App's origin URI as the surface's SourceLocation so that it * can do proper web download checks */ surface = deployment->GetSurface (); origin = Uri::Create (app->origin); surface->SetSourceLocation (origin); delete origin; /* get the install path/uri for the Xap */ path = g_build_filename (base_dir, app->uid, "Application.xap", NULL); uri = g_strdup_printf ("file://%s", path); url = Uri::Create (uri); deployment->SetXapFilename (path); deployment->SetXapLocation (url); g_free (path); g_free (uri); delete url; }
int main (int argc, char **argv) { MonoDomain *domain; Deployment *deployment; MoonWindow *window; MoonWindowingSystem *winsys; Surface *surface; char *data_dir; // setenv ("MONO_PATH", "/opt/mono/lib/mono/2.0:/opt/moonlight-osx/lib/mono/moonlight/", 1); setenv ("MONO_PATH", "/Users/plasma/Work/darwoon/moon/class/lib/2.1", 1); //setenv ("MOONLIGHT_DEBUG", "mediaplayer", 1); setenv ("MOONLIGHT_OVERRIDES", "curlbridge=yes", 1); setenv ("MOONLIGHT_DISABLE_INCOMPLETE_MESSAGE", "1", 1); setenv ("XAP_URI", "file://Users/plasma/tmp/xap", 1); mono_config_parse_memory(mono_config); mono_debug_init (MONO_DEBUG_FORMAT_MONO); mono_set_signal_chaining (true); domain = mono_jit_init_version ("Moonlight for OSX Root Domain", "v2.0.50727"); mono_jit_set_trace_options ("E:all"); Runtime::InitDesktop (); winsys = Runtime::GetWindowingSystem (); winsys->SetPlatformWindowingSystemData (NULL); deployment = Deployment::GetCurrent (); window = winsys->CreateWindow (MoonWindowType_Desktop, 640, 480); surface = new Surface (window); deployment->SetSurface (surface); window->SetSurface (surface); surface->SetSourceLocation (Uri::Create ("file:///Users/toshok/tmp/xap")); deployment->SetXapFilename (argv[1]); deployment->SetXapLocation (Uri::Create ("file:///Users/toshok/src/moonlight-android/moonlight-activity/DemoApp.xap")); window->SetTitle (argv[1]); surface->AddXamlHandler (Surface::ErrorEvent, error_handler, NULL); surface->unref (); if (!deployment->InitializeManagedDeployment (NULL, NULL, NULL)) { surface->unref (); g_debug ("Could not initialize managed deployment"); return 0; } g_warning ("pid: %i\n", getpid ()); winsys->RunMainLoop (window); // Shutdown ungracefully for now return 1; }