Skip to content

Commit

Permalink
Correção do XML
Browse files Browse the repository at this point in the history
  • Loading branch information
afonsoft committed Mar 28, 2024
1 parent 9cc1090 commit 100b048
Show file tree
Hide file tree
Showing 16 changed files with 184 additions and 16 deletions.
4 changes: 2 additions & 2 deletions QRCoder.Core.Tests/Helpers/HelperFunctions.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using System;
using System.Text;
using System.Drawing;
using System.IO;
using System.Security.Cryptography;
using System.Drawing;
using System.Text;

#if WINDOWS
using SW = System.Windows;
Expand Down
5 changes: 4 additions & 1 deletion QRCoder.Core/ASCIIQRCode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@

namespace QRCoder.Core
{
public class AsciiQRCode : AbstractQRCode, IDisposable
/// <summary>
/// AsciiQRCode
/// </summary>
public class AsciiQRCode : AbstractQRCode
{
/// <summary>
/// Constructor without params to be used in COM Objects connections
Expand Down
19 changes: 17 additions & 2 deletions QRCoder.Core/AbstractQRCode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace QRCoder.Core
/// <summary>
/// AbstractQRCode
/// </summary>
public abstract class AbstractQRCode
public abstract class AbstractQRCode : IDisposable
{
/// <summary>
/// QRCodeData
Expand Down Expand Up @@ -43,10 +43,25 @@ public virtual void SetQRCodeData(QRCodeData data)
this.QrCodeData = data;
}

/// <summary>
/// Dispose
/// </summary>
public void Dispose()
{
this.QrCodeData?.Dispose();
Dispose(true);
}

protected virtual void Dispose(bool disposing)
{
// Cleanup
if (disposing)
this.QrCodeData?.Dispose();
this.QrCodeData = null;
}

~AbstractQRCode()
{
Dispose(false);
}
}
}
5 changes: 4 additions & 1 deletion QRCoder.Core/ArtQRCode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
// pull request raised to extend library used.
namespace QRCoder.Core
{
public class ArtQRCode : AbstractQRCode, IDisposable
/// <summary>
/// ArtQRCode
/// </summary>
public class ArtQRCode : AbstractQRCode
{
/// <summary>
/// Constructor without params to be used in COM Objects connections
Expand Down
5 changes: 4 additions & 1 deletion QRCoder.Core/Base64QRCode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@

namespace QRCoder.Core
{
public class Base64QRCode : AbstractQRCode, IDisposable
/// <summary>
/// Base64QRCode
/// </summary>
public class Base64QRCode : AbstractQRCode
{
private QRCode qr;

Expand Down
5 changes: 4 additions & 1 deletion QRCoder.Core/BitmapByteQRCode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@

namespace QRCoder.Core
{
/// <summary>
/// BitmapByteQRCode
/// </summary>
// ReSharper disable once InconsistentNaming
public class BitmapByteQRCode : AbstractQRCode, IDisposable
public class BitmapByteQRCode : AbstractQRCode
{
/// <summary>
/// Constructor without params to be used in COM Objects connections
Expand Down
3 changes: 3 additions & 0 deletions QRCoder.Core/Exceptions/DataTooLongException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

namespace QRCoder.Core.Exceptions
{
/// <summary>
/// DataTooLongException
/// </summary>
public class DataTooLongException : Exception
{
public DataTooLongException(string eccLevel, string encodingMode, int maxSizeByte) : base(
Expand Down
3 changes: 3 additions & 0 deletions QRCoder.Core/Extensions/StringValueAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ public StringValueAttribute(string value)
}
}

/// <summary>
/// CustomExtensions
/// </summary>
public static class CustomExtensions
{
/// <summary>
Expand Down
56 changes: 55 additions & 1 deletion QRCoder.Core/PayloadGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,45 @@

namespace QRCoder.Core
{
/// <summary>
/// PayloadGenerator
/// </summary>
public static class PayloadGenerator
{
/// <summary>
/// Payload
/// </summary>
public abstract class Payload
{
protected Payload()
{
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
}

/// <summary>
/// Version
/// </summary>
public virtual int Version
{ get { return -1; } }

/// <summary>
/// ECCLevel
/// </summary>
public virtual QRCodeGenerator.ECCLevel EccLevel
{ get { return QRCodeGenerator.ECCLevel.M; } }

/// <summary>
/// EciMode
/// </summary>
public virtual QRCodeGenerator.EciMode EciMode
{ get { return QRCodeGenerator.EciMode.Default; } }

public abstract override string ToString();
}

/// <summary>
/// WiFi
/// </summary>
public class WiFi : Payload
{
private readonly string ssid, password, authenticationMode;
Expand Down Expand Up @@ -66,6 +84,9 @@ public enum Authentication
}
}

/// <summary>
/// Mail
/// </summary>
public class Mail : Payload
{
private readonly string mailReceiver, subject, message;
Expand Down Expand Up @@ -120,6 +141,9 @@ public enum MailEncoding
}
}

/// <summary>
/// SMS
/// </summary>
public class SMS : Payload
{
private readonly string number, subject;
Expand Down Expand Up @@ -184,6 +208,9 @@ public enum SMSEncoding
}
}

/// <summary>
/// MMS
/// </summary>
public class MMS : Payload
{
private readonly string number, subject;
Expand Down Expand Up @@ -243,6 +270,9 @@ public enum MMSEncoding
}
}

/// <summary>
/// Geolocation
/// </summary>
public class Geolocation : Payload
{
private readonly string latitude, longitude;
Expand Down Expand Up @@ -283,6 +313,9 @@ public enum GeolocationEncoding
}
}

/// <summary>
/// PhoneNumber
/// </summary>
public class PhoneNumber : Payload
{
private readonly string number;
Expand All @@ -302,6 +335,9 @@ public override string ToString()
}
}

/// <summary>
/// SkypeCall
/// </summary>
public class SkypeCall : Payload
{
private readonly string skypeUsername;
Expand All @@ -321,6 +357,9 @@ public override string ToString()
}
}

/// <summary>
/// Url
/// </summary>
public class Url : Payload
{
private readonly string url;
Expand All @@ -341,14 +380,17 @@ public override string ToString()
}
}

/// <summary>
/// WhatsAppMessage
/// </summary>
public class WhatsAppMessage : Payload
{
private readonly string number, message;

/// <summary>
/// Let's you compose a WhatApp message and send it the receiver number.
/// </summary>
/// <param name="number">Receiver phone number where the <number> is a full phone number in international format.
/// <param name="number">Receiver phone number where the number is a full phone number in international format.
/// Omit any zeroes, brackets, or dashes when adding the phone number in international format.
/// Use: 1XXXXXXXXXX | Don't use: +001-(XXX)XXXXXXX
/// </param>
Expand Down Expand Up @@ -376,6 +418,9 @@ public override string ToString()
}
}

/// <summary>
/// Bookmark
/// </summary>
public class Bookmark : Payload
{
private readonly string url, title;
Expand All @@ -397,6 +442,9 @@ public override string ToString()
}
}

/// <summary>
/// ContactData
/// </summary>
public class ContactData : Payload
{
private readonly string firstname;
Expand Down Expand Up @@ -624,6 +672,9 @@ public enum AddressOrder
}
}

/// <summary>
/// Bitcoin Like Crypto Currency Address
/// </summary>
public class BitcoinLikeCryptoCurrencyAddress : Payload
{
private readonly BitcoinLikeCryptoCurrencyType currencyType;
Expand Down Expand Up @@ -729,6 +780,9 @@ public LitecoinAddress(string address, double? amount, string label = null, stri
: base(BitcoinLikeCryptoCurrencyType.Litecoin, address, amount, label, message) { }
}

/// <summary>
/// SwissQrCode
/// </summary>
public class SwissQrCode : Payload
{
//Keep in mind, that the ECC level has to be set to "M" when generating a SwissQrCode!
Expand Down
7 changes: 5 additions & 2 deletions QRCoder.Core/PdfByteQRCode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@

namespace QRCoder.Core
{
/// <summary>
/// PdfByteQRCode
/// </summary>
// ReSharper disable once InconsistentNaming
public class PdfByteQRCode : AbstractQRCode, IDisposable
public class PdfByteQRCode : AbstractQRCode
{
private readonly byte[] pdfBinaryComment = new byte[] { 0x25, 0xe2, 0xe3, 0xcf, 0xd3 };

Expand All @@ -26,7 +29,7 @@ public PdfByteQRCode(QRCodeData data) : base(data)
}

/// <summary>
/// Creates a PDF document with a black & white QR code
/// Creates a PDF document with a black white QR code
/// </summary>
/// <param name="pixelsPerModule"></param>
/// <returns></returns>
Expand Down
7 changes: 5 additions & 2 deletions QRCoder.Core/PngByteQRCode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@

namespace QRCoder.Core
{
public sealed class PngByteQRCode : AbstractQRCode, IDisposable
/// <summary>
/// PngByteQRCode
/// </summary>
public sealed class PngByteQRCode : AbstractQRCode
{
/// <summary>
/// Constructor without params to be used in COM Objects connections
Expand All @@ -18,7 +21,7 @@ public PngByteQRCode(QRCodeData data) : base(data)
}

/// <summary>
/// Creates a black & white PNG of the QR code, using 1-bit grayscale.
/// Creates a black white PNG of the QR code, using 1-bit grayscale.
/// </summary>
public byte[] GetGraphic(int pixelsPerModule, bool drawQuietZones = true)
{
Expand Down
5 changes: 4 additions & 1 deletion QRCoder.Core/PostscriptQRCode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@

namespace QRCoder.Core
{
public class PostscriptQRCode : AbstractQRCode, IDisposable
/// <summary>
/// PostscriptQRCode
/// </summary>
public class PostscriptQRCode : AbstractQRCode
{
/// <summary>
/// Constructor without params to be used in COM Objects connections
Expand Down
25 changes: 24 additions & 1 deletion QRCoder.Core/QRCode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@

namespace QRCoder.Core
{
public class QRCode : AbstractQRCode, IDisposable
/// <summary>
/// QRCode
/// </summary>
public class QRCode : AbstractQRCode
{
/// <summary>
/// Constructor without params to be used in COM Objects connections
Expand Down Expand Up @@ -127,8 +130,28 @@ internal GraphicsPath CreateRoundedRectanglePath(RectangleF rect, int cornerRadi
}
}

/// <summary>
/// QRCodeHelper
/// </summary>
public static class QRCodeHelper
{
/// <summary>
/// GetQRCode
/// </summary>
/// <param name="plainText"></param>
/// <param name="pixelsPerModule"></param>
/// <param name="darkColor"></param>
/// <param name="lightColor"></param>
/// <param name="eccLevel"></param>
/// <param name="forceUtf8"></param>
/// <param name="utf8BOM"></param>
/// <param name="eciMode"></param>
/// <param name="requestedVersion"></param>
/// <param name="icon"></param>
/// <param name="iconSizePercent"></param>
/// <param name="iconBorderWidth"></param>
/// <param name="drawQuietZones"></param>
/// <returns></returns>
public static Bitmap GetQRCode(string plainText, int pixelsPerModule, Color darkColor, Color lightColor, ECCLevel eccLevel, bool forceUtf8 = false, bool utf8BOM = false, EciMode eciMode = EciMode.Default, int requestedVersion = -1, Bitmap icon = null, int iconSizePercent = 15, int iconBorderWidth = 0, bool drawQuietZones = true)
{
using (var qrGenerator = new QRCodeGenerator())
Expand Down
Loading

0 comments on commit 100b048

Please sign in to comment.