Skip to content

Commit

Permalink
Upgraded C# Langugage Version for all projects to Latest Minor
Browse files Browse the repository at this point in the history
  • Loading branch information
pgeerkens committed Apr 6, 2019
1 parent 2008507 commit 3511bdb
Show file tree
Hide file tree
Showing 13 changed files with 36 additions and 80 deletions.
4 changes: 2 additions & 2 deletions HexGridExampleCommon/EmptyGridHex.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ namespace PGNapoleonics.HexgridExampleCommon {
/// <summary>TODO</summary>
public sealed class EmptyGridHex : Hex {
/// <summary>TODO</summary>
public EmptyGridHex(HexCoords coords) : base(coords,0) => TerrainType = default(char);
public EmptyGridHex(HexCoords coords) : base(coords,0) => TerrainType = default;

/// <inheritdoc/>
public override char TerrainType { get; }
Expand All @@ -41,6 +41,6 @@ public sealed class EmptyGridHex : Hex {
public override int HeightTerrain => 0;

/// <inheritdoc/>
public override short? TryStepCost(Hexside hexsideExit) => default(short?);
public override short? TryStepCost(Hexside hexsideExit) => default;
}
}
3 changes: 3 additions & 0 deletions HexGridExampleCommon/HexgridExampleCommon.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRulesLessCA1303.ruleset</CodeAnalysisRuleSet>
<NoWarn>1587,1607</NoWarn>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
Expand All @@ -39,6 +40,7 @@
<DocumentationFile>bin\Release\HexgridExampleCommon.xml</DocumentationFile>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<NoWarn>1587,1607</NoWarn>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>false</SignAssembly>
Expand All @@ -56,6 +58,7 @@
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<NoWarn>1587,1607</NoWarn>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
Expand Down
2 changes: 1 addition & 1 deletion HexUtilities/Hex.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ protected Hex(HexCoords coords, int elevationLevel) {
public abstract short? TryStepCost(Hexside hexsideExit);

/// <summary>Default implementation, assuming no blocking hexside terrain.</summary>
public virtual int HeightHexside(Hexside hexside) => HeightTerrain;
public virtual int HeightHexside(Hexside hexside) => HeightTerrain;

#region Value Equality with IEquatable<T>
/// <inheritdoc/>
Expand Down
24 changes: 12 additions & 12 deletions HexUtilities/HexCoords.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,20 +84,20 @@ public struct HexCoords : IEquatable<HexCoords>, IFormattable {

#region Public static members
/// <summary>Create a new instance located at the specified i and j offsets as interpreted in the Canon(ical) frame.</summary>
public static HexCoords NewCanonCoords (int x, int y) {
return NewCanonCoords(IntVector2D.New(x,y));
}
public static HexCoords NewCanonCoords (int x, int y)
=> NewCanonCoords(IntVector2D.New(x,y));

/// <summary>Create a new instance located at the specified i and j offsets as interpreted in the ectangular (User) frame.</summary>
public static HexCoords NewUserCoords (int x, int y) {
return NewUserCoords(IntVector2D.New(x,y));
}
public static HexCoords NewUserCoords (int x, int y)
=> NewUserCoords(IntVector2D.New(x,y));

/// <summary>Create a new instance located at the specified vector offset as interpreted in the Canon(ical) frame.</summary>
public static HexCoords NewCanonCoords (IntVector2D vector){
return new HexCoords(vector, vector * _matrixCanonToUser);
}
public static HexCoords NewCanonCoords (IntVector2D vector)
=> new HexCoords(vector, vector * _matrixCanonToUser);

/// <summary>Create a new instance located at the specified vector offset as interpreted in the Rectangular (User) frame.</summary>
public static HexCoords NewUserCoords (IntVector2D vector) =>
new HexCoords(vector * _matrixUserToCanon, vector);
public static HexCoords NewUserCoords (IntVector2D vector)
=> new HexCoords(vector * _matrixUserToCanon, vector);

/// <summary>Origin of the Canon(ical) coordinate frame.</summary>
public static HexCoords EmptyCanon { get; } = NewCanonCoords(0,0);
Expand Down Expand Up @@ -127,7 +127,7 @@ private HexCoords(IntVector2D canon, IntVector2D user) :this() {
public IntVector2D User { get; }

/// <summary>Modified <i>Manhattan</i> distance of supplied coordinate from the origin.</summary>
public int RangeFromOrigin { get { return EmptyCanon.Range(this);} }
public int RangeFromOrigin => EmptyCanon.Range(this);
#endregion

#region Methods
Expand Down
3 changes: 3 additions & 0 deletions HexUtilities/HexUtilities.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
<CodeContractsReferenceAssembly>Build</CodeContractsReferenceAssembly>
<CodeContractsAnalysisWarningLevel>2</CodeContractsAnalysisWarningLevel>
<PlatformTarget>AnyCPU</PlatformTarget>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
Expand Down Expand Up @@ -137,6 +138,7 @@
<CodeContractsRuntimeCheckingLevel>Full</CodeContractsRuntimeCheckingLevel>
<CodeContractsReferenceAssembly>Build</CodeContractsReferenceAssembly>
<CodeContractsAnalysisWarningLevel>2</CodeContractsAnalysisWarningLevel>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>false</SignAssembly>
Expand Down Expand Up @@ -201,6 +203,7 @@
<CodeContractsRuntimeCheckingLevel>Pre and Post</CodeContractsRuntimeCheckingLevel>
<CodeContractsReferenceAssembly>Build</CodeContractsReferenceAssembly>
<CodeContractsAnalysisWarningLevel>2</CodeContractsAnalysisWarningLevel>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
Expand Down
3 changes: 2 additions & 1 deletion HexUtilities/IHex.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ public interface IHex {

/// <summary>Height ASL in <i>game units</i> of any blocking terrian in this hex.</summary>
int HeightTerrain { get; }
/// <inheritdoc/>

/// <summary>Char code for the tYpe of the terrain in this hex.</summary>
char TerrainType { get; }

/// <summary>Returns the cost (> 0) to extend the path across <paramref name="hexsideExit"/>; or null.</summary>
Expand Down
3 changes: 3 additions & 0 deletions HexgridExampleWinforms/HexgridExampleWinforms.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
<CodeAnalysisRuleSet>AllRulesLessCA1303.ruleset</CodeAnalysisRuleSet>
<NoWarn>1587,1607</NoWarn>
<Prefer32Bit>false</Prefer32Bit>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
Expand All @@ -56,6 +57,7 @@
<NoWarn>1587,1607</NoWarn>
<DocumentationFile>bin\Release\PGNapoleonics.HexgridExampleWinforms.xml</DocumentationFile>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<PropertyGroup>
<StartupObject>PGNapoleonics.HexgridExampleWinforms.Program</StartupObject>
Expand All @@ -79,6 +81,7 @@
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
Expand Down
3 changes: 3 additions & 0 deletions HexgridExampleWinforms2/HexgridExampleWinforms2.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
Expand All @@ -33,6 +34,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Checked|AnyCPU'">
<OutputPath>bin\Checked\</OutputPath>
Expand All @@ -42,6 +44,7 @@
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
Expand Down
3 changes: 3 additions & 0 deletions HexgridExampleWpf/HexgridExampleWpf.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
Expand All @@ -42,6 +43,7 @@
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
<CodeAnalysisRuleSet>ExtendedDesignGuidelineRules.ruleset</CodeAnalysisRuleSet>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>false</SignAssembly>
Expand All @@ -58,6 +60,7 @@
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>ExtendedDesignGuidelineRules.ruleset</CodeAnalysisRuleSet>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<PropertyGroup>
<StartupObject>HexgridExampleWpf.App</StartupObject>
Expand Down
3 changes: 3 additions & 0 deletions HexgridPanel/HexgridPanel.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
<CodeContractsRuntimeCheckingLevel>Full</CodeContractsRuntimeCheckingLevel>
<CodeContractsReferenceAssembly>Build</CodeContractsReferenceAssembly>
<CodeContractsAnalysisWarningLevel>1</CodeContractsAnalysisWarningLevel>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
Expand All @@ -91,6 +92,7 @@
<Prefer32Bit>false</Prefer32Bit>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<BaseAddress>258277376</BaseAddress>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>false</SignAssembly>
Expand All @@ -114,6 +116,7 @@
<HighEntropyVA>False</HighEntropyVA>
<DynamicBase>False</DynamicBase>
<BaseAddress>258277376</BaseAddress>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup>
<Reference Include="Accessibility" />
Expand Down
63 changes: 0 additions & 63 deletions HexgridPanel/MapDisplayPainter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,69 +39,6 @@ public class MapDisplayPainter<THex>: AbstractModelDisplayPainter<THex> where TH
/// <param name="model">The map to be painted, as a <see cref="IMapDisplayWinForms{THex}"/>.</param>
public MapDisplayPainter(IMapDisplayWinForms<THex> model) : base(model) { }

///// <inheritdoc/>
//public override void PaintMap(Graphics graphics, bool showHexgrid)
//=> graphics.Contain( g => {
// var boardHexes = Model.BoardHexes;
// graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
// PaintForEachHex(graphics, coords => {
// boardHexes[coords].IfHasValueDo(h => {
// if(h is THex hex) Paint(hex,graphics, Model.HexgridPath, GetHexBrush(hex));
// });
// if (showHexgrid) graphics.DrawPath(Pens.Black, Model.HexgridPath);
// } );
// } );

///// <inheritdoc/>
//public override void PaintLabels(Graphics graphics, Func<HexCoords,string> hexText)
//=> graphics.Contain( g => {
// PaintForEachHex(graphics, coords => {
// var font = SystemFonts.MenuFont;
// var textOffset = new Point((Model.GridSize.Scale(0.50F)
// - new SizeF(font.Size,font.Size).Scale(0.8F)).ToSize());
// graphics.DrawString(hexText(coords), font, TextBrush, textOffset);
// } );
// } );

///// <inheritdoc/>
//public override void PaintHighlight(Graphics graphics) {
// graphics.Contain(g => {
// g.Transform = Model.TranslateToHex(Model.StartHex);
// g.DrawPath(Pens.Red, Model.HexgridPath);
// } );

// if (Model.Path != null) {
// graphics.Contain(g => { PaintPath(g); });
// }

// if (Model.ShowRangeLine) {
// graphics.Contain(g => {
// var target = Model.CentreOfHex(Model.HotspotHex);
// graphics.DrawLine(Pens.Red, Model.CentreOfHex(Model.StartHex), target);
// graphics.DrawLine(Pens.Red, target.X-8,target.Y-8, target.X+8,target.Y+8);
// graphics.DrawLine(Pens.Red, target.X-8,target.Y+8, target.X+8,target.Y-8);
// } );
// }
//}

///// <inheritdoc/>
//public override void PaintShading(Graphics graphics, IShadingMask isShaded)
//=> graphics.Contain(g => {
// graphics.CompositingMode = CompositingMode.SourceOver;
// using (var shadeBrush = new SolidBrush(Color.FromArgb(Model.ShadeBrushAlpha,ShadeColor))) {
// PaintForEachHex(graphics,coords => {
// if (isShaded[coords]) { graphics.FillPath(shadeBrush,Model.HexgridPath); }
// });
// }
// } );

///// <inheritdoc/>
//public override void PaintUnits(Graphics graphics) {
// if (graphics == null) throw new ArgumentNullException("graphics");

// /* NO-OP - Not implemented in examples. */
//}

/// <summary>Returns a <see cref="Brush"/> suitable for painting the specified <see cref="THex"/>.</summary>
/// <param name="hex">The <see cref="THex"/> being queried.</param>
/// <remarks>
Expand Down
2 changes: 1 addition & 1 deletion HexgridPanel/MapPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ private string LandmarkText(HexCoords coords)
=> DataContext.Model.Landmarks.DistanceFrom(coords,DataContext.Model.LandmarkToShow-1);

/// <summary>TODO</summary>
void ResizeBuffer() { _cacheStatus = _NEEDS_PAINTING; }
void ResizeBuffer() => _cacheStatus = _NEEDS_PAINTING;
#endregion

#region Painting
Expand Down
Binary file modified docs.zip
Binary file not shown.

0 comments on commit 3511bdb

Please sign in to comment.