Skip to content

Commit

Permalink
Merge pull request #152 from barnhill/SkiaSharp-drawing-lib
Browse files Browse the repository at this point in the history
Skia sharp drawing lib
  • Loading branch information
barnhill committed May 28, 2023
2 parents ee346bd + 7b572af commit 150105e
Show file tree
Hide file tree
Showing 58 changed files with 1,716 additions and 1,570 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/dotnet-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@ on:
jobs:
build:

runs-on: ubuntu-latest

runs-on: ${{ matrix.os }}
strategy:
matrix:
dotnet-version: [ '6.0.x', '7.0.x' ]
os: [ubuntu-latest, windows-latest]

steps:
- uses: actions/checkout@v3
- name: Setup .NET Core 5.0.103
uses: actions/setup-dotnet@v3
with:
dotnet-version: 5.0.103
- name: Setup .NET Core 3.1.404
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: 3.1.404
dotnet-version: ${{ matrix.dotnet-version }}
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build BarcodeStandard/BarcodeStandard.csproj --configuration Release --no-restore
- name: Test
run: dotnet test
run: dotnet test --framework net7.0 --no-restore --logger trx --results-directory "TestResults-${{ matrix.dotnet-version }}"
4 changes: 4 additions & 0 deletions Barcode.sln
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ Global
{C588CDB4-B0C9-4EC0-B790-F6F3ED443644}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C588CDB4-B0C9-4EC0-B790-F6F3ED443644}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C588CDB4-B0C9-4EC0-B790-F6F3ED443644}.Release|Any CPU.Build.0 = Release|Any CPU
{A8CE6356-01AA-4215-99E7-D861325592B4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A8CE6356-01AA-4215-99E7-D861325592B4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A8CE6356-01AA-4215-99E7-D861325592B4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A8CE6356-01AA-4215-99E7-D861325592B4}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
45 changes: 22 additions & 23 deletions BarcodeStandard/BarcodeCommon.cs
Original file line number Diff line number Diff line change
@@ -1,39 +1,38 @@
using System;
using System.Collections.Generic;
using System.Linq;

namespace BarcodeLib
namespace BarcodeStandard
{
abstract class BarcodeCommon
internal abstract class BarcodeCommon
{
protected string Raw_Data = "";
protected List<string> _Errors = new List<string>();
public string RawData { get; protected set; } = "";
public List<string> Errors { get; } = new List<string>();

public string RawData
protected void Error(string errorMessage)
{
get { return this.Raw_Data; }
}

public List<string> Errors
{
get { return this._Errors; }
}

public void Error(string errorMessage)
{
this._Errors.Add(errorMessage);
Errors.Add(errorMessage);
throw new Exception(errorMessage);
}

internal static bool CheckNumericOnly(string data)
{
for (var i = 0; i < data.Length; i++)
{
if (!char.IsDigit(data[i]))
{
return false;
}
}
if (data.Any(c => !char.IsDigit(c))) return false;
return data.Length > 0;
}

internal static int GetAlignmentShiftAdjustment(Barcode barcode)
{
switch (barcode.Alignment)
{
case AlignmentPositions.Left:
return 0;
case AlignmentPositions.Right:
return (barcode.Width % barcode.EncodedValue.Length);
case AlignmentPositions.Center:
default:
return (barcode.Width % barcode.EncodedValue.Length) / 2;
}//switch
}
}//BarcodeVariables abstract class
}//namespace
Loading

0 comments on commit 150105e

Please sign in to comment.