Exemple #1
0
 internal Bundle(BundleData bundleData, Framework framework)
 {
     this.id = bundleData.Id;
     this.storage = new DirectoryInfo(bundleData.Location);
     this.framework = framework;
     this.bundleData = bundleData;
     this.location = bundleData.Location;
     this.symbolicName = Path.GetFileNameWithoutExtension(bundleData.Location);
     this.state = BundleState.Installed;
     SetDynamicInfo();
 }
 /// <summary>
 /// Get Xml For BundleData
 /// </summary>
 /// <returns></returns>
 public static BundleData GetXmlForBundleData(string dirName)
 {
     BundleData result = new BundleData();
     //获取配置信息
     ComponentMetadata metadata = SearchXml(dirName);
     //将配置信息加入组件信息中
     if (null != metadata)
     {
         result.Name = metadata.Name;
         result.SymbolicName = metadata.Name;
         result.Path = metadata.Path;
         result.Runtime = GetRuntimeDataForRuntimeData(metadata);
     }
     return result;
 }
        public IBundle InstallBundle(string location, BundleData bd)
        {
            if (!ValidExtention(location))
            {
                location = location + BundleExtention;
            }

            string fullLocation = string.Empty;

            bool isPathRooted = Path.IsPathRooted(location);

            if (isPathRooted)
            {
                fullLocation = location;
            }

            if (!File.Exists(fullLocation))
            {
                throw new BundleException(String.Format("Bundle {0} not found.", location),
                    new FileNotFoundException(String.Format("file:{0} not found.", fullLocation)));
            }

            // Create the bundle object
            BundleData bundleData = bd;
            bundleData.Id = bundleRepository.Count;
            bundleData.Location = fullLocation;

            Bundle bundle = new Bundle(bundleData, this);

            CheckInstallBundle(bundle);

            InstallBundleInternal(bundle);
            return bundle;
        }