/// <summary> /// ����һ��application /// </summary> /// <param name="app">Ӧ�õ���Ϣ</param> /// <returns>application����</returns> protected XApplication BuildApplication(PreInstalPackageItem app) { XAppInfo info = GetInfoFromXml(app); if (null == info) { XToastPrompt.GetInstance().Toast(xFaceLibResources.Read_App_Config_Error); XLog.WriteError("PreInstal " + app.PackageName + " app.xml error."); return null; } String appDirNameInAsset = XConstant.PRE_INSTALL_SOURCE_ROOT + app.PackageId; return BuildApplication(info, appDirNameInAsset); }
private XAppInfo GetInfoFromXml(PreInstalPackageItem AppInfo) { // ����app��app.xml // app ��assetĿ¼�� String appDirNameInAsset = XConstant.PRE_INSTALL_SOURCE_ROOT + AppInfo.PackageId; string configFile = appDirNameInAsset + "\\" + XConstant.APP_CONFIG_FILE_NAME; // ����app��app.xml Stream appxmlst = null; try { appxmlst = Application.GetResourceStream(new Uri(configFile, UriKind.Relative)).Stream; } catch (Exception ex) { if (ex is ArgumentException || ex is IOException || ex is ArgumentNullException || ex is NullReferenceException) { XLog.WriteError(string.Format("GetResourceStream {0} occur Exception {1}", configFile, ex.Message)); return null; } throw ex; } if (null == appxmlst) { return null; } XAppConfigParser appConfigParser = XAppConfigParserFactory.CreateAppConfigParser(appxmlst); if (null == appConfigParser) { return null; } XAppInfo info = appConfigParser.parseConfig(); return info; }
/// <summary> /// check defaultId ���Ĭ��appid���Ѿ���װ��Ĭ��appid����ͬ ��checkʧ�ܷ���check�ɹ� /// </summary> /// <param name="startAppInfo">Ӧ�õ���Ϣ</param> /// <returns></returns> private XAppInfo CheckDefaultAppId(PreInstalPackageItem startAppInfo) { // ����app��app.xml XAppInfo info = GetInfoFromXml(startAppInfo); if (null == info) { XToastPrompt.GetInstance().Toast(xFaceLibResources.Read_App_Config_Error); return null; } String id = info.AppId; String defaultId = ams.GetDefaultAppId(); if (null != defaultId && null != id && !id.Equals(defaultId)) { XToastPrompt.GetInstance().Toast(xFaceLibResources.Update_DefaultApp_Id_NoMatch_Error); XLog.WriteError("update failure.startapp id is different."); return null; } return info; }