public T GetOrCreate <T>(PlatformType platform) where T : Configuration, new() { ConfigPlatforms configPlatform; switch (platform) { case PlatformType.Windows: configPlatform = ConfigPlatforms.Windows; break; default: throw new ArgumentOutOfRangeException(nameof(platform), platform, null); } var platVersion = Overrides.FirstOrDefault(x => x != null && x.Platforms.HasFlag(configPlatform) && x.Configuration is T); if (platVersion != null) { return((T)platVersion.Configuration); } return(GetOrCreate <T>()); }
public T Get <T>(PlatformType platform) where T : Configuration, new() { ConfigPlatforms configPlatform; switch (platform) { case PlatformType.Windows: configPlatform = ConfigPlatforms.Windows; break; case PlatformType.WindowsPhone: configPlatform = ConfigPlatforms.WindowsPhone; break; case PlatformType.WindowsStore: configPlatform = ConfigPlatforms.WindowsStore; break; case PlatformType.Android: configPlatform = ConfigPlatforms.Android; break; case PlatformType.iOS: configPlatform = ConfigPlatforms.iOS; break; case PlatformType.Windows10: configPlatform = ConfigPlatforms.Windows10; break; case PlatformType.Linux: configPlatform = ConfigPlatforms.Linux; break; case PlatformType.macOS: configPlatform = ConfigPlatforms.macOS; break; default: throw new ArgumentOutOfRangeException(nameof(platform), platform, null); } var platVersion = Overrides.FirstOrDefault(x => x != null && x.Platforms.HasFlag(configPlatform) && x.Configuration is T); if (platVersion != null) { return((T)platVersion.Configuration); } return(Get <T>()); }
/// <summary> /// Returns the <see cref="Bitmap"/> at the specified row and column. /// </summary> public Bitmap GetSprite(int row, int column) { if (row > RowCount || column > ColumnCount) { throw new ArgumentOutOfRangeException("The specified row or column is out of range."); } SheetOverride crop = Overrides.FirstOrDefault(x => x.Row == row && x.Column == column) ?? SheetOverride.Empty; if (RowCount == 1 && ColumnCount == 1) { return(GetImage()); } return(ImageHelper.Crop(Path, (CropWidth * (column - 1)) + crop.OffsetX, (CropHeight * (row - 1)) + crop.OffsetY, crop.Width ?? CropWidth, crop.Height ?? CropHeight)); }
/// <summary> /// Make sure that the visibility of this member is not higher than allowed from types used in the signature of this member that are from another scope. /// </summary> public void LimitVisibility() { // Limit for signature types this.LimitVisibility(ReturnType); foreach (var p in Parameters) { this.LimitVisibility(p.ParameterType); } // Limit for sealed declaring type var baseMethod = Overrides.FirstOrDefault(x => !x.DeclaringType.IsInterface); if (baseMethod == null) { this.LimitIfDeclaringTypeSealed(DeclaringType); } // Limit when overriding "protected internal" from another scope if ((baseMethod != null) && IsFamilyOrAssembly && !baseMethod.HasSameScope(this)) { IsFamily = true; } }
public int GetCharWidth(char c) => GetWhiteSpace(c)?.Width ?? Overrides?.FirstOrDefault(x => x.Chars.Contains(c))?.Width ?? CharWidth;
public Point GetCharOffset(char c) => Overrides?.FirstOrDefault(x => x.Chars.Contains(c))?.GetOffset() ?? Point.Empty;