aboutsummaryrefslogtreecommitdiff
path: root/src/AddIn/Sku.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/AddIn/Sku.cs')
-rw-r--r--src/AddIn/Sku.cs67
1 files changed, 0 insertions, 67 deletions
diff --git a/src/AddIn/Sku.cs b/src/AddIn/Sku.cs
deleted file mode 100644
index aaf5937..0000000
--- a/src/AddIn/Sku.cs
+++ /dev/null
@@ -1,67 +0,0 @@
-using System.Text.RegularExpressions;
-
-namespace RhSolutions
-{
- internal class Sku
- {
- public string Article { get; private set; }
- public string Variant { get; private set; }
-
- public Sku(string article, string variant)
- {
- Article = article;
- Variant = variant;
- }
-
- public static bool TryParse(string line, out Sku rehauSku)
- {
- Match match;
- match = Regex.Match(line, @"\b[1]\d{6}[1]\d{3}\b");
- if (match.Success)
- {
- string sku = match.Value.Substring(1, 6);
- string variant = match.Value.Substring(8, 3);
- rehauSku = new Sku(sku, variant);
- return true;
- }
-
- match = Regex.Match(line, @"\b\d{6}\D\d{3}\b");
- if (match.Success)
- {
- string sku = match.Value.Substring(0, 6);
- string variant = match.Value.Substring(7, 3);
- rehauSku = new Sku(sku, variant);
- return true;
- }
-
- match = Regex.Match(line, @"\b\d{9}\b");
- if (match.Success)
- {
- string sku = match.Value.Substring(0, 6);
- string variant = match.Value.Substring(6, 3);
- rehauSku = new Sku(sku, variant);
- return true;
- }
-
- match = Regex.Match(line, @"\b\d{6}\b");
- if (match.Success)
- {
- string sku = match.Value.Substring(0, 6);
- string variant = "001";
- rehauSku = new Sku(sku, variant);
- return true;
- }
-
- else
- {
- rehauSku = null;
- return false;
- }
- }
-
- public override string ToString()
- {
- return $"1{Article}1{Variant}";
- }
- }
-} \ No newline at end of file