Ejemplo n.º 1
0
        public virtual string[] GetReferencedFileNames(ConfigurationSelector configuration)
        {
            string s = GetReferencedFileName(configuration);

            /*		if (referenceType == ReferenceType.Package) {
             *                      List<string> result = new List<string> ();
             *                      result.Add (s);
             *                      AddRequiredPackages (result, Package);
             *                      return result.ToArray ();
             *              }*/

            if (s != null)
            {
                return new string[] { s }
            }
            ;
            return(new string [0]);
        }

        /*
         * void AddRequiredPackages (List<string> result, SystemPackage fromPackage)
         * {
         *      if (fromPackage == null || string.IsNullOrEmpty (fromPackage.Requires))
         *              return;
         *      foreach (string requiredPackageName in fromPackage.Requires.Split (' ')) {
         *              SystemPackage package = AssemblyContext.GetPackage (requiredPackageName);
         *              if (package == null)
         *                      continue;
         *              foreach (SystemAssembly assembly in package.Assemblies) {
         *                      if (assembly == null)
         *                              continue;
         *                      string location = AssemblyContext.GetAssemblyLocation (assembly.FullName, ownerProject != null ? ownerProject.TargetFramework : null);
         *                      result.Add (location);
         *              }
         *              AddRequiredPackages (result, package);
         *      }
         * }*/

        void UpdatePackageReference()
        {
            if (referenceType == ReferenceType.Package && ownerProject != null)
            {
                notFound = false;

                string cref = AssemblyContext.FindInstalledAssembly(reference, package, ownerProject.TargetFramework);
                if (cref == null)
                {
                    cref = reference;
                }
                cref     = AssemblyContext.GetAssemblyNameForVersion(cref, package, ownerProject.TargetFramework);
                notFound = (cref == null);
                if (cref != null && cref != reference)
                {
                    SystemAssembly asm = AssemblyContext.GetAssemblyFromFullName(cref, package, ownerProject.TargetFramework);
                    bool           isFrameworkAssembly = asm != null && asm.Package.IsFrameworkPackage;
                    if (loadedReference == null && !isFrameworkAssembly)
                    {
                        loadedReference = reference;
                    }
                    reference = cref;
                }
                cachedPackage = null;

                SystemPackage pkg = Package;
                if (pkg != null && pkg.IsFrameworkPackage)
                {
                    int i = Include.IndexOf(',');
                    if (i != -1)
                    {
                        Include = Include.Substring(0, i).Trim();
                    }
                }

                OnStatusChanged();
            }
        }

        IAssemblyContext AssemblyContext {
            get {
                if (ownerProject != null)
                {
                    return(ownerProject.AssemblyContext);
                }
                else
                {
                    return(Runtime.SystemAssemblyService.DefaultAssemblyContext);
                }
            }
        }

        TargetRuntime TargetRuntime {
            get {
                if (ownerProject != null)
                {
                    return(ownerProject.TargetRuntime);
                }
                else
                {
                    return(Runtime.SystemAssemblyService.DefaultRuntime);
                }
            }
        }

        TargetFramework TargetFramework {
            get {
                if (ownerProject != null)
                {
                    return(ownerProject.TargetFramework);
                }
                else
                {
                    return(null);
                }
            }
        }