-
Notifications
You must be signed in to change notification settings - Fork 237
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #152 from barnhill/SkiaSharp-drawing-lib
Skia sharp drawing lib
- Loading branch information
Showing
58 changed files
with
1,716 additions
and
1,570 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Oops, something went wrong.