internal bool InitializeDeployment (IntPtr plugin, string xapPath, string culture, string uiCulture)
{
TerminateAndSetCulture (culture, uiCulture);
if (plugin == IntPtr.Zero) {
string location = NativeMethods.surface_get_source_location (Surface.Native);
if (location != null) {
// full uri including xap
Uri source_uri = new Uri (location, UriKind.RelativeOrAbsolute);
// IsolatedStorage (inside mscorlib.dll) needs some information about the XAP file
// to initialize it's application and site directory storage. WebClient is another user of this
AppDomain.CurrentDomain.SetData ("xap_uri", PluginHost.GetApplicationIdentity (source_uri));
}
}
else {
PluginHost.SetPluginHandle (plugin);
}
if (!Directory.Exists (xapPath))
ExtractXap (xapPath);
else
XapDir = xapPath;
// this is currently disabled for the 3.0 desktop profile. we'll
// need it to be done by unmanaged code there, on every deployment
// switch.
#if NET_2_1
AppDomain.CurrentDomain.SetupInformationNoCopy.ApplicationBase = XapDir;
#endif
NativeMethods.deployment_set_initialization (native, true);
try {
ReadManifest ();
NativeMethods.deployment_set_is_loaded_from_xap (native, true);
return LoadAssemblies ();
}
finally {
NativeMethods.deployment_set_initialization (native, false);
}
}