Exemple #1
0
        public BclFile(string name, BclFileType type, bool excludeDebugSymbols = false, string?version = null, BclFileTarget target = BclFileTarget.Android)
        {
            name = name.Trim();
            if (String.IsNullOrEmpty(name))
            {
                throw new ArgumentException("must not be null or empty", nameof(name));
            }

            Name = name;
            Type = type;
            ExcludeDebugSymbols = excludeDebugSymbols;
            Version             = version;
            Target = target;

            string sourceDir;

            switch (type)
            {
            case BclFileType.ProfileAssembly:
                sourceDir = bclProfileSourceDirs [target];
                break;

            case BclFileType.FacadeAssembly:
                sourceDir = bclFacadeSourceDirs [target];
                break;

            default:
                throw new InvalidOperationException($"Unsupported BCL file type {Type} for file {Name}");
            }

            SourcePath = Path.GetFullPath(Path.Combine(sourceDir, name));
        }
        List <BclFile> BclToDesigner(BclFileTarget ignoreForTarget)
        {
            return(BclFilesToInstall.Where(bf => ShouldIncludeDesignerBcl(bf)).Select(bf => new BclFile(bf.Name, bf.Type, bf.ExcludeDebugSymbols, version: bf.Version, target: ignoreForTarget)).ToList());

            bool ShouldIncludeDesignerBcl(BclFile bf)
            {
                if (DesignerIgnoreFiles == null || !DesignerIgnoreFiles.TryGetValue(bf.Name, out (BclFileType Type, BclFileTarget Target)bft))
                {
                    return(true);
                }

                if (bf.Type != bft.Type || bft.Target != ignoreForTarget)
                {
                    return(true);
                }

                Log.Instance.DebugLine($"BCL file {bf.Name} will NOT be included in the installed Designer BCL files ({ignoreForTarget})");
                return(false);
            }
        }