2016-11-16 08:11:41 +00:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
// From: https://github.com/codebude/QRCoder
|
|
|
|
namespace QRCoder
|
|
|
|
{
|
|
|
|
using System;
|
|
|
|
|
|
|
|
public class QRCodeData : IDisposable
|
|
|
|
{
|
|
|
|
public List<BitArray> ModuleMatrix { get; set; }
|
2018-05-12 15:13:39 +00:00
|
|
|
|
2016-11-16 08:11:41 +00:00
|
|
|
public QRCodeData(int version)
|
|
|
|
{
|
|
|
|
this.Version = version;
|
|
|
|
var size = ModulesPerSideFromVersion(version);
|
|
|
|
this.ModuleMatrix = new List<BitArray>();
|
|
|
|
for (var i = 0; i < size; i++)
|
|
|
|
this.ModuleMatrix.Add(new BitArray(size));
|
|
|
|
}
|
2018-05-12 15:13:39 +00:00
|
|
|
|
2016-11-16 08:11:41 +00:00
|
|
|
public int Version { get; private set; }
|
2018-05-12 15:13:39 +00:00
|
|
|
|
2016-11-16 08:11:41 +00:00
|
|
|
private static int ModulesPerSideFromVersion(int version)
|
|
|
|
{
|
|
|
|
return 21 + (version - 1) * 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void Dispose()
|
|
|
|
{
|
|
|
|
this.ModuleMatrix = null;
|
|
|
|
this.Version = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|