MonoDevelop.D.Projects.Dub.DubProject.OnGetCanExecute C# (CSharp) Méthode

OnGetCanExecute() protected méthode

protected OnGetCanExecute ( MonoDevelop.Projects.ExecutionContext context, MonoDevelop.Projects.ConfigurationSelector configuration ) : bool
context MonoDevelop.Projects.ExecutionContext
configuration MonoDevelop.Projects.ConfigurationSelector
Résultat bool
        protected override bool OnGetCanExecute(ExecutionContext context, ConfigurationSelector configuration)
        {
            if (!base.OnGetCanExecute(context, configuration))
                return false;

            string targetPath = null, targetName = null, targetType = null;
            CommonBuildSettings.TryGetTargetFileProperties(this, configuration, ref targetType, ref targetName, ref targetPath);
            var cfg = GetConfiguration(configuration) as DubProjectConfiguration;
            if(cfg != null) cfg.BuildSettings
                .TryGetTargetFileProperties(this, configuration, ref targetType, ref targetName, ref targetPath);

            if (targetType == "autodetect" || string.IsNullOrWhiteSpace(targetType))
            {
                if (string.IsNullOrEmpty(targetName))
                    return true;

                var ext = Path.GetExtension(targetName);
                if (ext != null)
                    switch (ext.ToLowerInvariant())
                    {
                        case ".dylib":
                        case ".so":
                        case ".a":
                            return false;
                        case ".exe":
                        case null:
                        default:
                            return true;
                    }
            }

            return targetType.ToLowerInvariant() == "executable";
        }