Skip to content

Commit 77623dd

Browse files
committed
Refactor QRCodeGenerator into separate files
1 parent e36d34d commit 77623dd

13 files changed

+712
-638
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using System.Collections.Generic;
2+
3+
namespace QRCoder
4+
{
5+
public partial class QRCodeGenerator
6+
{
7+
private struct AlignmentPattern
8+
{
9+
public int Version;
10+
public List<Point> PatternPositions;
11+
}
12+
}
13+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
namespace QRCoder
2+
{
3+
public partial class QRCodeGenerator
4+
{
5+
private struct CodewordBlock
6+
{
7+
public CodewordBlock(byte[] codeWords, byte[] eccWords)
8+
{
9+
this.CodeWords = codeWords;
10+
this.ECCWords = eccWords;
11+
}
12+
13+
public byte[] CodeWords { get; }
14+
public byte[] ECCWords { get; }
15+
}
16+
}
17+
}

QRCoder/QRCodeGenerator.ECCInfo.cs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
namespace QRCoder
2+
{
3+
public partial class QRCodeGenerator
4+
{
5+
private struct ECCInfo
6+
{
7+
public ECCInfo(int version, ECCLevel errorCorrectionLevel, int totalDataCodewords, int eccPerBlock, int blocksInGroup1,
8+
int codewordsInGroup1, int blocksInGroup2, int codewordsInGroup2)
9+
{
10+
this.Version = version;
11+
this.ErrorCorrectionLevel = errorCorrectionLevel;
12+
this.TotalDataCodewords = totalDataCodewords;
13+
this.ECCPerBlock = eccPerBlock;
14+
this.BlocksInGroup1 = blocksInGroup1;
15+
this.CodewordsInGroup1 = codewordsInGroup1;
16+
this.BlocksInGroup2 = blocksInGroup2;
17+
this.CodewordsInGroup2 = codewordsInGroup2;
18+
}
19+
public int Version { get; }
20+
public ECCLevel ErrorCorrectionLevel { get; }
21+
public int TotalDataCodewords { get; }
22+
public int ECCPerBlock { get; }
23+
public int BlocksInGroup1 { get; }
24+
public int CodewordsInGroup1 { get; }
25+
public int BlocksInGroup2 { get; }
26+
public int CodewordsInGroup2 { get; }
27+
}
28+
}
29+
}

QRCoder/QRCodeGenerator.ECCLevel.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
namespace QRCoder
2+
{
3+
public partial class QRCodeGenerator
4+
{
5+
/// <summary>
6+
/// Error correction level. These define the tolerance levels for how much of the code can be lost before the code cannot be recovered.
7+
/// </summary>
8+
public enum ECCLevel
9+
{
10+
/// <summary>
11+
/// 7% may be lost before recovery is not possible
12+
/// </summary>
13+
L,
14+
/// <summary>
15+
/// 15% may be lost before recovery is not possible
16+
/// </summary>
17+
M,
18+
/// <summary>
19+
/// 25% may be lost before recovery is not possible
20+
/// </summary>
21+
Q,
22+
/// <summary>
23+
/// 30% may be lost before recovery is not possible
24+
/// </summary>
25+
H
26+
}
27+
}
28+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
namespace QRCoder
2+
{
3+
public partial class QRCodeGenerator
4+
{
5+
private enum EncodingMode
6+
{
7+
Numeric = 1,
8+
Alphanumeric = 2,
9+
Byte = 4,
10+
Kanji = 8,
11+
ECI = 7
12+
}
13+
}
14+
}

0 commit comments

Comments
 (0)