public void OnProviderDisabled(string provider)
            {
                if (provider == LocationManager.PassiveProvider)
                {
                    return;
                }

                lock (ActiveProviders)
                {
                    if (ActiveProviders.Remove(provider) && ActiveProviders.None())
                    {
                        PositionError.RaiseOn(Zebble.Thread.Pool, new Exception(UNAVAILABLE_ERROR));
                    }
                }
            }
Пример #2
0
        private void Validate(T sender, PropertyChangedEventArgs e)
        {
            if (e.PropertyName == "IsValid" || e.PropertyName == "EventContext" || e.PropertyName == "ContactContext" || e.PropertyName == "IsDirty")
            {
                return;
            }

            _validationResults.Clear();

            Validator.TryValidateObject(_target, _validationContext, _validationResults, true);

            var hashSet = new HashSet <string>(_validationResults.SelectMany(x => x.MemberNames));

            sender.IsValid = hashSet.None();

            foreach (var error in hashSet)
            {
                RaiseErrorsChanged(error);
            }
        }
        public BootstrapConventions()
        {
            this.IsConcreteType = t => !t.IsInterface && !t.IsAbstract && !t.IsGenericType;

            this.IsService = t => this.IsConcreteType( t ) && t.Namespace.IsLike( "*.Services" );

            this.SelectServiceContracts = type =>
            {
                var types = new HashSet<Type>( type.GetInterfaces() );
                if ( types.None() || type.IsAttributeDefined<ContractAttribute>() )
                {
                    types.Add( type );
                }

                return types;
            };

            this.IsMessageHandler = t =>
            {
                return t.Namespace != null && t.Namespace.IsLike( "*.Messaging.Handlers" ) && ( t.Is<IMessageHandler>() || t.Is<IHandleMessage>() );
            };

            this.SelectMessageHandlerContracts = type => type.GetInterfaces().Take( 1 );

            this.IsViewModel = t => this.IsConcreteType( t ) && t.FullName.IsLike( "*.Presentation.*ViewModel" );

            this.IsShellViewModel = ( services, implementation ) =>
            {
                return services.Any( t => t.Name.IsLike( "Main*" ) || t.Name.IsLike( "Shell*" ) );
            };

            this.SelectViewModelContracts = type => new[] { type };

            this.IsView = t => this.IsConcreteType( t ) && t.FullName.IsLike( "*.Presentation.*View" );

            this.IsShellView = ( services, implementation ) =>
            {
                return services.Any( t => t.Name.IsLike( "Main*" ) || t.Name.IsLike( "Shell*" ) );
            };

            this.SelectViewContracts = type => new[] { type };

            this.GetInterestedRegionNameIfAny = type =>
            {
                if ( this.IsView( type ) )
                {
                    if ( type.IsAttributeDefined<InjectViewInRegionAttribute>() )
                    {
                        return type.GetAttribute<InjectViewInRegionAttribute>().Named;
                    }

                    if ( type.Namespace.IsLike( "*.Presentation.Partial.*" ) )
                    {
                        var regionName = type.Namespace.Split( '.' ).Last();
                        return regionName;
                    }
                }

                return null;
            };

            this.IsExcluded = t =>
            {
                return t.IsAttributeDefined<DisableAutomaticRegistrationAttribute>();
            };
        }
Пример #4
0
        public ItemPrefab(XElement element, string filePath)
        {
            configFile    = filePath;
            ConfigElement = element;

            identifier = element.GetAttributeString("identifier", "");

            name = TextManager.Get("EntityName." + identifier, true) ?? element.GetAttributeString("name", "");
            if (name == "")
            {
                DebugConsole.ThrowError("Unnamed item in " + filePath + "!");
            }

            DebugConsole.Log("    " + name);

            Aliases = element.GetAttributeStringArray("aliases", new string[0], convertToLowerInvariant: true);

            if (!Enum.TryParse(element.GetAttributeString("category", "Misc"), true, out MapEntityCategory category))
            {
                category = MapEntityCategory.Misc;
            }
            Category = category;

            Triggers           = new List <Rectangle>();
            DeconstructItems   = new List <DeconstructItem>();
            FabricationRecipes = new List <FabricationRecipe>();
            DeconstructTime    = 1.0f;

            Tags = new HashSet <string>(element.GetAttributeStringArray("tags", new string[0], convertToLowerInvariant: true));
            if (Tags.None())
            {
                Tags = new HashSet <string>(element.GetAttributeStringArray("Tags", new string[0], convertToLowerInvariant: true));
            }

            if (element.Attribute("cargocontainername") != null)
            {
                DebugConsole.ThrowError("Error in item prefab \"" + name + "\" - cargo container should be configured using the item's identifier, not the name.");
            }

            SerializableProperty.DeserializeProperties(this, element);

            string translatedDescription = TextManager.Get("EntityDescription." + identifier, true);

            if (!string.IsNullOrEmpty(translatedDescription))
            {
                Description = translatedDescription;
            }

            foreach (XElement subElement in element.Elements())
            {
                switch (subElement.Name.ToString().ToLowerInvariant())
                {
                case "sprite":
                    string spriteFolder = "";
                    if (!subElement.GetAttributeString("texture", "").Contains("/"))
                    {
                        spriteFolder = Path.GetDirectoryName(filePath);
                    }

                    canSpriteFlipX = subElement.GetAttributeBool("canflipx", true);
                    canSpriteFlipY = subElement.GetAttributeBool("canflipy", true);

                    sprite = new Sprite(subElement, spriteFolder, lazyLoad: true);
                    if (subElement.Attribute("sourcerect") == null)
                    {
                        DebugConsole.ThrowError("Warning - sprite sourcerect not configured for item \"" + Name + "\"!");
                    }
                    size = sprite.size;

                    if (subElement.Attribute("name") == null && !string.IsNullOrWhiteSpace(Name))
                    {
                        sprite.Name = Name;
                    }
                    sprite.EntityID = identifier;
                    break;

                case "price":
                    string locationType = subElement.GetAttributeString("locationtype", "");
                    if (prices == null)
                    {
                        prices = new Dictionary <string, PriceInfo>();
                    }
                    prices[locationType.ToLowerInvariant()] = new PriceInfo(subElement);
                    break;

#if CLIENT
                case "inventoryicon":
                    string iconFolder = "";
                    if (!subElement.GetAttributeString("texture", "").Contains("/"))
                    {
                        iconFolder = Path.GetDirectoryName(filePath);
                    }
                    InventoryIcon = new Sprite(subElement, iconFolder, lazyLoad: true);
                    break;

                case "brokensprite":
                    string brokenSpriteFolder = "";
                    if (!subElement.GetAttributeString("texture", "").Contains("/"))
                    {
                        brokenSpriteFolder = Path.GetDirectoryName(filePath);
                    }

                    var brokenSprite = new BrokenItemSprite(
                        new Sprite(subElement, brokenSpriteFolder, lazyLoad: true),
                        subElement.GetAttributeFloat("maxcondition", 0.0f),
                        subElement.GetAttributeBool("fadein", false));

                    int spriteIndex = 0;
                    for (int i = 0; i < BrokenSprites.Count && BrokenSprites[i].MaxCondition < brokenSprite.MaxCondition; i++)
                    {
                        spriteIndex = i;
                    }
                    BrokenSprites.Insert(spriteIndex, brokenSprite);
                    break;

                case "decorativesprite":
                    string decorativeSpriteFolder = "";
                    if (!subElement.GetAttributeString("texture", "").Contains("/"))
                    {
                        decorativeSpriteFolder = Path.GetDirectoryName(filePath);
                    }

                    int groupID = 0;
                    DecorativeSprite decorativeSprite = null;
                    if (subElement.Attribute("texture") == null)
                    {
                        groupID = subElement.GetAttributeInt("randomgroupid", 0);
                    }
                    else
                    {
                        decorativeSprite = new DecorativeSprite(subElement, decorativeSpriteFolder, lazyLoad: true);
                        DecorativeSprites.Add(decorativeSprite);
                        groupID = decorativeSprite.RandomGroupID;
                    }
                    if (!DecorativeSpriteGroups.ContainsKey(groupID))
                    {
                        DecorativeSpriteGroups.Add(groupID, new List <DecorativeSprite>());
                    }
                    DecorativeSpriteGroups[groupID].Add(decorativeSprite);

                    break;

                case "containedsprite":
                    string containedSpriteFolder = "";
                    if (!subElement.GetAttributeString("texture", "").Contains("/"))
                    {
                        containedSpriteFolder = Path.GetDirectoryName(filePath);
                    }
                    var containedSprite = new ContainedItemSprite(subElement, containedSpriteFolder, lazyLoad: true);
                    if (containedSprite.Sprite != null)
                    {
                        ContainedSprites.Add(containedSprite);
                    }
                    break;
#endif
                case "deconstruct":
                    DeconstructTime = subElement.GetAttributeFloat("time", 1.0f);

                    foreach (XElement deconstructItem in subElement.Elements())
                    {
                        if (deconstructItem.Attribute("name") != null)
                        {
                            DebugConsole.ThrowError("Error in item config \"" + Name + "\" - use item identifiers instead of names to configure the deconstruct items.");
                            continue;
                        }

                        DeconstructItems.Add(new DeconstructItem(deconstructItem));
                    }

                    break;

                case "fabricate":
                case "fabricable":
                case "fabricableitem":
                    fabricationRecipeElements.Add(subElement);
                    break;

                case "trigger":
                    Rectangle trigger = new Rectangle(0, 0, 10, 10)
                    {
                        X      = subElement.GetAttributeInt("x", 0),
                        Y      = subElement.GetAttributeInt("y", 0),
                        Width  = subElement.GetAttributeInt("width", 0),
                        Height = subElement.GetAttributeInt("height", 0)
                    };

                    Triggers.Add(trigger);

                    break;

                case "levelresource":
                    foreach (XElement levelCommonnessElement in subElement.Elements())
                    {
                        string levelName = levelCommonnessElement.GetAttributeString("levelname", "").ToLowerInvariant();
                        if (!LevelCommonness.ContainsKey(levelName))
                        {
                            LevelCommonness.Add(levelName, levelCommonnessElement.GetAttributeFloat("commonness", 0.0f));
                        }
                    }
                    break;

                case "suitabletreatment":
                    if (subElement.Attribute("name") != null)
                    {
                        DebugConsole.ThrowError("Error in item prefab \"" + Name + "\" - suitable treatments should be defined using item identifiers, not item names.");
                    }

                    string treatmentIdentifier = subElement.GetAttributeString("identifier", "").ToLowerInvariant();

                    List <AfflictionPrefab> matchingAfflictions = AfflictionPrefab.List.FindAll(a => a.Identifier == treatmentIdentifier || a.AfflictionType == treatmentIdentifier);
                    if (matchingAfflictions.Count == 0)
                    {
                        DebugConsole.ThrowError("Error in item prefab \"" + Name + "\" - couldn't define as a treatment, no treatments with the identifier or type \"" + treatmentIdentifier + "\" were found.");
                        continue;
                    }

                    float suitability = subElement.GetAttributeFloat("suitability", 0.0f);
                    foreach (AfflictionPrefab matchingAffliction in matchingAfflictions)
                    {
                        if (matchingAffliction.TreatmentSuitability.ContainsKey(identifier))
                        {
                            matchingAffliction.TreatmentSuitability[identifier] =
                                Math.Max(matchingAffliction.TreatmentSuitability[identifier], suitability);
                        }
                        else
                        {
                            matchingAffliction.TreatmentSuitability.Add(identifier, suitability);
                        }
                    }
                    break;
                }
            }

            if (sprite == null)
            {
                DebugConsole.ThrowError("Item \"" + Name + "\" has no sprite!");
#if SERVER
                sprite            = new Sprite("", Vector2.Zero);
                sprite.SourceRect = new Rectangle(0, 0, 32, 32);
#else
                sprite = new Sprite(TextureLoader.PlaceHolderTexture, null, null)
                {
                    Origin = TextureLoader.PlaceHolderTexture.Bounds.Size.ToVector2() / 2
                };
#endif
                size            = sprite.size;
                sprite.EntityID = identifier;
            }

            if (!category.HasFlag(MapEntityCategory.Legacy) && string.IsNullOrEmpty(identifier))
            {
                DebugConsole.ThrowError(
                    "Item prefab \"" + name + "\" has no identifier. All item prefabs have a unique identifier string that's used to differentiate between items during saving and loading.");
            }
            if (!string.IsNullOrEmpty(identifier))
            {
                MapEntityPrefab existingPrefab = List.Find(e => e.Identifier == identifier);
                if (existingPrefab != null)
                {
                    DebugConsole.ThrowError(
                        "Map entity prefabs \"" + name + "\" and \"" + existingPrefab.Name + "\" have the same identifier!");
                }
            }

            AllowedLinks = element.GetAttributeStringArray("allowedlinks", new string[0], convertToLowerInvariant: true).ToList();

            List.Add(this);
        }
Пример #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BootstrapConventions" /> class.
        /// </summary>
        public BootstrapConventions()
        {
            this.DefaultIsConcreteType = t => !t.IsInterface && !t.IsAbstract && !t.IsGenericType;
            this.IsConcreteType        = t => this.DefaultIsConcreteType(t);

            this.DefaultIsService = t => this.IsConcreteType(t) && t.Namespace.IsLike("*.Services");
            this.IsService        = t => this.DefaultIsService(t);

            this.DefaultSelectServiceContracts = type =>
            {
                var types = new HashSet <Type>(type.GetInterfaces());
                if (types.None() || type.IsAttributeDefined <ContractAttribute>())
                {
                    types.Add(type);
                }

                return(types);
            };
            this.SelectServiceContracts = type => this.DefaultSelectServiceContracts(type);

            this.DefaultIsMessageHandler = t =>
            {
#pragma warning disable 618
                return(t.Namespace != null && t.Namespace.IsLike("*.Messaging.Handlers") && (t.Is <IMessageHandler>() || t.Is <IHandleMessage>()));

#pragma warning restore 618
            };
            this.IsMessageHandler = t => this.DefaultIsMessageHandler(t);

            this.DefaultSelectMessageHandlerContracts = type => type.GetInterfaces().Take(1);
            this.SelectMessageHandlerContracts        = type => this.DefaultSelectMessageHandlerContracts(type);

            this.DefaultIsViewModel = t => this.IsConcreteType(t) && t.FullName.IsLike("*.Presentation.*ViewModel");
            this.IsViewModel        = t => this.DefaultIsViewModel(t);

            this.DefaultIsShellViewModel = (services, implementation) =>
            {
                return(services.Any(t => t.Name.IsLike("Main*") || t.Name.IsLike("Shell*")));
            };
            this.IsShellViewModel = (services, implementation) => this.DefaultIsShellViewModel(services, implementation);

            this.DefaultSelectViewModelContracts = type => new[] { type };
            this.SelectViewModelContracts        = type => this.DefaultSelectViewModelContracts(type);

            this.DefaultIsView = t => this.IsConcreteType(t) && t.FullName.IsLike("*.Presentation.*View");
            this.IsView        = t => this.DefaultIsView(t);

            this.DefaultIsShellView = (services, implementation) =>
            {
                return(services.Any(t => t.Name.IsLike("Main*") || t.Name.IsLike("Shell*")));
            };
            this.IsShellView = (services, implementation) => this.DefaultIsShellView(services, implementation);

            this.DefaultSelectViewContracts = type => new[] { type };
            this.SelectViewContracts        = type => this.DefaultSelectViewContracts(type);
#if !WINDOWS_PHONE_8
            this.DefaultGetInterestedRegionNameIfAny = type =>
            {
                if (this.IsView(type))
                {
                    if (type.IsAttributeDefined <InjectViewInRegionAttribute>())
                    {
                        return(type.GetAttribute <InjectViewInRegionAttribute>().Named);
                    }

                    if (type.Namespace.IsLike("*.Presentation.Partial.*"))
                    {
                        var regionName = type.Namespace.Split('.').Last();
                        return(regionName);
                    }
                }

                return(null);
            };
            this.GetInterestedRegionNameIfAny = type => this.DefaultGetInterestedRegionNameIfAny(type);
#endif

            this.DefaultIsExcluded = t =>
            {
                return(t.IsAttributeDefined <DisableAutomaticRegistrationAttribute>());
            };
            this.IsExcluded = t => this.DefaultIsExcluded(t);

#if !SILVERLIGHT
            this.DefaultAssemblyFileScanPatterns = entryAssembly =>
            {
                var name = entryAssembly.GetName().Name;

                var dllPattern = String.Format("{0}*.dll", name);
                var radical    = "Radical.*.dll";

                return(new[] { dllPattern, radical });
            };
            this.AssemblyFileScanPatterns = entryAssembly => this.DefaultAssemblyFileScanPatterns(entryAssembly);

            this.DefaultIncludeAssemblyInContainerScan = assembly => true;
            this.IncludeAssemblyInContainerScan        = assembly => this.DefaultIncludeAssemblyInContainerScan(assembly);

            this.DefaultIgnorePropertyInjection = pi =>
            {
                var isDefined = pi.IsAttributeDefined <IgnorePropertyInjectionAttribue>();
                return(isDefined);
            };
            this.IgnorePropertyInjection = pi => this.DefaultIgnorePropertyInjection(pi);

            this.DefaultIgnoreViewPropertyInjection = pi =>
            {
                return(true);
            };
            this.IgnoreViewPropertyInjection = pi => this.DefaultIgnoreViewPropertyInjection(pi);

            this.DefaultIgnoreViewModelPropertyInjection = pi =>
            {
                return(true);
            };
            this.IgnoreViewModelPropertyInjection = pi => this.DefaultIgnoreViewModelPropertyInjection(pi);
#endif
        }
Пример #6
0
        protected override void StartMissionSpecific(Level level)
        {
            existingTargets.Clear();
            spawnedTargets.Clear();
            allTargets.Clear();
            if (IsClient)
            {
                return;
            }
            TargetRuin = Level.Loaded?.Ruins?.GetRandom(randSync: Rand.RandSync.Server);
            if (TargetRuin == null)
            {
                DebugConsole.ThrowError($"Failed to initialize an Alien Ruin mission (\"{Prefab.Identifier}\"): level contains no alien ruins");
                return;
            }
            if (targetItemIdentifiers.Length < 1 && targetEnemyIdentifiers.Length < 1)
            {
                DebugConsole.ThrowError($"Failed to initialize an Alien Ruin mission (\"{Prefab.Identifier}\"): no target identifiers set in the mission definition");
                return;
            }
            foreach (var item in Item.ItemList)
            {
                if (!targetItemIdentifiers.Contains(item.Prefab.Identifier))
                {
                    continue;
                }
                if (item.Submarine != TargetRuin.Submarine)
                {
                    continue;
                }
                existingTargets.Add(item);
                allTargets.Add(item);
            }
            int existingEnemyCount = 0;

            foreach (var character in Character.CharacterList)
            {
                if (string.IsNullOrEmpty(character.SpeciesName))
                {
                    continue;
                }
                if (!targetEnemyIdentifiers.Contains(character.SpeciesName.ToLowerInvariant()))
                {
                    continue;
                }
                if (character.Submarine != TargetRuin.Submarine)
                {
                    continue;
                }
                existingTargets.Add(character);
                allTargets.Add(character);
                existingEnemyCount++;
            }
            if (existingEnemyCount < minEnemyCount)
            {
                var enemyPrefabs = new HashSet <CharacterPrefab>();
                foreach (string identifier in targetEnemyIdentifiers)
                {
                    var prefab = CharacterPrefab.FindBySpeciesName(identifier);
                    if (prefab != null)
                    {
                        enemyPrefabs.Add(prefab);
                    }
                    else
                    {
                        DebugConsole.ThrowError($"Error in an Alien Ruin mission (\"{Prefab.Identifier}\"): could not find a character prefab with the species \"{identifier}\"");
                    }
                }
                if (enemyPrefabs.None())
                {
                    DebugConsole.ThrowError($"Error in an Alien Ruin mission (\"{Prefab.Identifier}\"): no enemy species defined that could be used to spawn more ({minEnemyCount - existingEnemyCount}) enemies");
                    return;
                }
                for (int i = 0; i < (minEnemyCount - existingEnemyCount); i++)
                {
                    var prefab   = enemyPrefabs.GetRandom();
                    var spawnPos = TargetRuin.Submarine.GetWaypoints(false).GetRandom(w => w.CurrentHull != null)?.WorldPosition;
                    if (!spawnPos.HasValue)
                    {
                        DebugConsole.ThrowError($"Error in an Alien Ruin mission (\"{Prefab.Identifier}\"): no valid spawn positions could be found for the additional ({minEnemyCount - existingEnemyCount}) enemies to be spawned");
                        return;
                    }
                    var newEnemy = Character.Create(prefab.Identifier, spawnPos.Value, ToolBox.RandomSeed(8), createNetworkEvent: false);
                    spawnedTargets.Add(newEnemy);
                    allTargets.Add(newEnemy);
                }
            }
#if DEBUG
            DebugConsole.NewMessage("********** CLEAR RUIN MISSION INFO **********");
            DebugConsole.NewMessage($"Existing item targets: {existingTargets.Count - existingEnemyCount}");
            DebugConsole.NewMessage($"Existing enemy targets: {existingEnemyCount}");
            DebugConsole.NewMessage($"Spawned enemy targets: {spawnedTargets.Count}");
#endif
        }
		/// <summary>
		/// Initializes a new instance of the <see cref="BootstrapConventions" /> class.
		/// </summary>
		public BootstrapConventions()
		{
			this.DefaultIsConcreteType = t => !t.IsInterface && !t.IsAbstract && !t.IsGenericType;
			this.IsConcreteType = t => this.DefaultIsConcreteType( t );

			this.DefaultIsService = t => this.IsConcreteType( t ) && t.Namespace.IsLike( "*.Services" );
			this.IsService = t => this.DefaultIsService( t );

			this.DefaultSelectServiceContracts = type =>
			{
				var types = new HashSet<Type>( type.GetInterfaces() );
				if( types.None() || type.IsAttributeDefined<ContractAttribute>() )
				{
					types.Add( type );
				}

				return types;
			};
			this.SelectServiceContracts = type => this.DefaultSelectServiceContracts( type );

			this.DefaultIsMessageHandler = t =>
			{
#pragma warning disable 618
				return t.Namespace != null && t.Namespace.IsLike( "*.Messaging.Handlers" ) && ( t.Is<IMessageHandler>() || t.Is<IHandleMessage>() );
#pragma warning restore 618
			};
			this.IsMessageHandler = t => this.DefaultIsMessageHandler( t );

			this.DefaultSelectMessageHandlerContracts = type => type.GetInterfaces().Take( 1 );
			this.SelectMessageHandlerContracts = type => this.DefaultSelectMessageHandlerContracts( type );

			this.DefaultIsViewModel = t => this.IsConcreteType( t ) && t.FullName.IsLike( "*.Presentation.*ViewModel" );
			this.IsViewModel = t => this.DefaultIsViewModel( t );

			this.DefaultIsShellViewModel = ( services, implementation ) =>
			{
				return services.Any( t => t.Name.IsLike( "Main*" ) || t.Name.IsLike( "Shell*" ) );
			};
			this.IsShellViewModel = ( services, implementation ) => this.DefaultIsShellViewModel( services, implementation );

			this.DefaultSelectViewModelContracts = type => new[] { type };
			this.SelectViewModelContracts = type => this.DefaultSelectViewModelContracts( type );

			this.DefaultIsView = t => this.IsConcreteType( t ) && t.FullName.IsLike( "*.Presentation.*View" );
			this.IsView = t => this.DefaultIsView( t );

			this.DefaultIsShellView = ( services, implementation ) =>
			{
				return services.Any( t => t.Name.IsLike( "Main*" ) || t.Name.IsLike( "Shell*" ) );
			};
			this.IsShellView = ( services, implementation ) => this.DefaultIsShellView( services, implementation );

			this.DefaultSelectViewContracts = type => new[] { type };
			this.SelectViewContracts = type => this.DefaultSelectViewContracts( type );
#if !WINDOWS_PHONE_8

			this.DefaultGetInterestedRegionNameIfAny = type =>
			{
				if( this.IsView( type ) )
				{

					if( type.IsAttributeDefined<InjectViewInRegionAttribute>() )
					{
						return type.GetAttribute<InjectViewInRegionAttribute>().Named;
					}

					if( type.Namespace.IsLike( "*.Presentation.Partial.*" ) )
					{
						var regionName = type.Namespace.Split( '.' ).Last();
						return regionName;
					}
				}

				return null;
			};
			this.GetInterestedRegionNameIfAny = type => this.DefaultGetInterestedRegionNameIfAny( type );
#endif

			this.DefaultIsExcluded = t =>
			{
				return t.IsAttributeDefined<DisableAutomaticRegistrationAttribute>();
			};
			this.IsExcluded = t => this.DefaultIsExcluded( t );

#if !SILVERLIGHT

			this.DefaultAssemblyFileScanPatterns = entryAssembly =>
			{
				var name = entryAssembly.GetName().Name;

				var dllPattern = String.Format( "{0}*.dll", name );
				var radical = "Radical.*.dll";

				return new[] { dllPattern, radical };
			};
			this.AssemblyFileScanPatterns = entryAssembly => this.DefaultAssemblyFileScanPatterns( entryAssembly );

			this.DefaultIncludeAssemblyInContainerScan = assembly => true;
			this.IncludeAssemblyInContainerScan = assembly => this.DefaultIncludeAssemblyInContainerScan(assembly);

			this.DefaultIgnorePropertyInjection = pi =>
			{
				var isDefined = pi.IsAttributeDefined<IgnorePropertyInjectionAttribue>();
				return isDefined;
			};
			this.IgnorePropertyInjection = pi => this.DefaultIgnorePropertyInjection( pi );

			this.DefaultIgnoreViewPropertyInjection = pi =>
			{
				return true;
			};
			this.IgnoreViewPropertyInjection = pi => this.DefaultIgnoreViewPropertyInjection( pi );

			this.DefaultIgnoreViewModelPropertyInjection = pi =>
			{
				return true;
			};
			this.IgnoreViewModelPropertyInjection = pi => this.DefaultIgnoreViewModelPropertyInjection( pi );
#endif
		}
        public BootstrapConventions()
        {
            this.IsConcreteType = t => !t.IsInterface && !t.IsAbstract && !t.IsGenericType;

            this.IsService = t => this.IsConcreteType(t) && t.Namespace.IsLike("*.Services");

            this.SelectServiceContracts = type =>
            {
                var types = new HashSet <Type>(type.GetInterfaces());
                if (types.None() || type.IsAttributeDefined <ContractAttribute>())
                {
                    types.Add(type);
                }

                return(types);
            };

            this.IsMessageHandler = t =>
            {
                return(t.Namespace != null && t.Namespace.IsLike("*.Messaging.Handlers") && (t.Is <IMessageHandler>() || t.Is <IHandleMessage>()));
            };

            this.SelectMessageHandlerContracts = type => type.GetInterfaces().Take(1);

            this.IsViewModel = t => this.IsConcreteType(t) && t.FullName.IsLike("*.Presentation.*ViewModel");

            this.IsShellViewModel = (services, implementation) =>
            {
                return(services.Any(t => t.Name.IsLike("Main*") || t.Name.IsLike("Shell*")));
            };

            this.SelectViewModelContracts = type => new[] { type };

            this.IsView = t => this.IsConcreteType(t) && t.FullName.IsLike("*.Presentation.*View");

            this.IsShellView = (services, implementation) =>
            {
                return(services.Any(t => t.Name.IsLike("Main*") || t.Name.IsLike("Shell*")));
            };

            this.SelectViewContracts = type => new[] { type };

            this.GetInterestedRegionNameIfAny = type =>
            {
                if (this.IsView(type))
                {
                    if (type.IsAttributeDefined <InjectViewInRegionAttribute>())
                    {
                        return(type.GetAttribute <InjectViewInRegionAttribute>().Named);
                    }

                    if (type.Namespace.IsLike("*.Presentation.Partial.*"))
                    {
                        var regionName = type.Namespace.Split('.').Last();
                        return(regionName);
                    }
                }

                return(null);
            };

            this.IsExcluded = t =>
            {
                return(t.IsAttributeDefined <DisableAutomaticRegistrationAttribute>());
            };
        }