Exemplo n.º 1
0
        /// <summary>
        /// 读取插件数据
        /// </summary>
        /// <returns></returns>
        private IBundleData[] ReadBundleDatas()
        {
            // 获取所有插件清单的路径
            string[] addInsLocations = locationManager.GetAddinsLocations();
            if (addInsLocations == null || addInsLocations.Length == 0)
            {
                return(null);
            }
            // 开始加载插件清单
            IList <BaseData> bundleDatas = new List <BaseData>();

            foreach (var location in addInsLocations)
            {
                var xManifest = XBundle.Load(location) as XBundle;
                if (xManifest == null)
                {
                    continue;
                }
                string   bundleLocation = Path.GetDirectoryName(Path.GetDirectoryName(location));
                BaseData bundleData     = new BaseData(GetNextBundleId(), xManifest, bundleLocation);
                bundleDatas.Add(bundleData);
            }

            return(bundleDatas.ToArray());
        }
Exemplo n.º 2
0
        /// <summary>
        /// 加载系统插件清单
        /// </summary>
        /// <returns></returns>
        private static XBundle LoadSystemBundleManifest()
        {
            try
            {
                Type   type = typeof(SystemBundleData);
                string xml  = BundleUtil.LoadResourceString(ConfigConstant.SYSTEM_MANIFEST, type.Assembly);

                if (string.IsNullOrEmpty(xml))
                {
                    return(null);
                }
                var xManifest = XBundle.Parse(xml) as XBundle;

                return(xManifest);
            }
            catch (Exception e)
            {
                Log.Debug(e);
            }
            return(null);
        }
Exemplo n.º 3
0
 public BaseData(long id, XBundle manifest, string location)
 {
     this.id       = id;
     this.manifest = manifest;
     this.location = location;
 }