Skip to content

Commit

Permalink
Fix for (unused) Colour class
Browse files Browse the repository at this point in the history
Made CsvGen x86/x64
  • Loading branch information
Joakim Wennergren committed Jan 15, 2018
1 parent c463a9e commit 6669e4c
Show file tree
Hide file tree
Showing 8 changed files with 71 additions and 59 deletions.
16 changes: 6 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
_ReSharper.CsvQuerySolution
bin
obj
/CsvQuery/CsvQuery.csproj.user
/TestResults

/Local.testsettings
.axoCover
.vs
*.user
*.testsettings

/TraceAndTestImpact.testsettings
/Tests/*.user
/*.suo
/CsvQuerySolution.sln.DotSettings.user
/.vs
/*.psess
/*.vspx
.axoCover

/TestResults
43 changes: 32 additions & 11 deletions CsvGen/CsvGen.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,45 @@
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
Expand Down
9 changes: 0 additions & 9 deletions CsvGen/CsvGen.csproj.user

This file was deleted.

26 changes: 6 additions & 20 deletions CsvQuery/PluginInfrastructure/GatewayDomain.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// NPP plugin platform for .Net v0.93.96 by Kasper B. Graversen etc.
using System;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Text;

Expand All @@ -17,34 +18,19 @@ public class Colour

public Colour(int rgb)
{
Red = rgb ^ 0xFF;
Green = rgb ^ 0x00FF;
Blue = rgb ^ 0x0000FF;
Red = rgb & 0xFF;
Green = (rgb >> 8) & 0xFF;
Blue = (rgb >> 16) & 0xFF;
}

/// <summary>
///
/// </summary>
/// <param name="red">a number 0-255</param>
/// <param name="green">a number 0-255</param>
/// <param name="blue">a number 0-255</param>
public Colour(int red, int green, int blue)
public Colour(byte red, byte green, byte blue)
{
if(red > 255 || red < 0)
throw new ArgumentOutOfRangeException("red", "must be 0-255");
if(green > 255 || green < 0)
throw new ArgumentOutOfRangeException("green", "must be 0-255");
if(blue > 255 || blue < 0)
throw new ArgumentOutOfRangeException("blue", "must be 0-255");
Red = red;
Green = green;
Blue = blue;
}

public int Value
{
get { return Red + (Blue << 8 ) + (Green << 16); }
}
public int Value => Red + (Green << 8) + (Blue << 16);
}

/// <summary>
Expand Down
16 changes: 8 additions & 8 deletions CsvQuerySolution.sln
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ Global
{E526081B-A5A3-457F-A30D-4AB0D2DB5A05}.Release|x64.Build.0 = Release|x64
{E526081B-A5A3-457F-A30D-4AB0D2DB5A05}.Release|x86.ActiveCfg = Release|x86
{E526081B-A5A3-457F-A30D-4AB0D2DB5A05}.Release|x86.Build.0 = Release|x86
{0D77E645-AA2E-4FCA-A3A9-000FF3C696D8}.Debug|x64.ActiveCfg = Debug|Any CPU
{0D77E645-AA2E-4FCA-A3A9-000FF3C696D8}.Debug|x64.Build.0 = Debug|Any CPU
{0D77E645-AA2E-4FCA-A3A9-000FF3C696D8}.Debug|x86.ActiveCfg = Debug|Any CPU
{0D77E645-AA2E-4FCA-A3A9-000FF3C696D8}.Debug|x86.Build.0 = Debug|Any CPU
{0D77E645-AA2E-4FCA-A3A9-000FF3C696D8}.Release|x64.ActiveCfg = Release|Any CPU
{0D77E645-AA2E-4FCA-A3A9-000FF3C696D8}.Release|x64.Build.0 = Release|Any CPU
{0D77E645-AA2E-4FCA-A3A9-000FF3C696D8}.Release|x86.ActiveCfg = Release|Any CPU
{0D77E645-AA2E-4FCA-A3A9-000FF3C696D8}.Release|x86.Build.0 = Release|Any CPU
{0D77E645-AA2E-4FCA-A3A9-000FF3C696D8}.Debug|x64.ActiveCfg = Debug|x64
{0D77E645-AA2E-4FCA-A3A9-000FF3C696D8}.Debug|x64.Build.0 = Debug|x64
{0D77E645-AA2E-4FCA-A3A9-000FF3C696D8}.Debug|x86.ActiveCfg = Debug|x86
{0D77E645-AA2E-4FCA-A3A9-000FF3C696D8}.Debug|x86.Build.0 = Debug|x86
{0D77E645-AA2E-4FCA-A3A9-000FF3C696D8}.Release|x64.ActiveCfg = Release|x64
{0D77E645-AA2E-4FCA-A3A9-000FF3C696D8}.Release|x64.Build.0 = Release|x64
{0D77E645-AA2E-4FCA-A3A9-000FF3C696D8}.Release|x86.ActiveCfg = Release|x86
{0D77E645-AA2E-4FCA-A3A9-000FF3C696D8}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
1 change: 0 additions & 1 deletion Tests/MetaTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ public void IUnderstandDecimalParsing()
{
bool ok;
decimal decimalResult;
double doubleResult;

ok = decimal.TryParse("12,34", NumberStyles.Any, NumberFormatInfo.InvariantInfo, out decimalResult);
Console.WriteLine($"ok={ok}, res={decimalResult}");
Expand Down
18 changes: 18 additions & 0 deletions Tests/PluginInfrastructure/ColourFacts.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using CsvQuery.PluginInfrastructure;

namespace Tests.PluginInfrastructure
{
using Microsoft.VisualStudio.TestTools.UnitTesting;

[TestClass]
public class ColourFacts
{
[TestMethod]
public void Int_Constructor_returns_same_value()
{
var val = 0x123456;
var c = new Colour(val);
Assert.AreEqual(val, c.Value);
}
}
}
1 change: 1 addition & 0 deletions Tests/Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
<Compile Include="DataStorageFacts.cs" />
<Compile Include="FactsRegardingCsvGeneration.cs" />
<Compile Include="MssqlDataStorageFacts.cs" />
<Compile Include="PluginInfrastructure\ColourFacts.cs" />
<Compile Include="SqliteProviderFacts.cs" />
<Compile Include="ExtensionsFacts.cs" />
<Compile Include="Helpers.cs" />
Expand Down

0 comments on commit 6669e4c

Please sign in to comment.