├── Vadavo.NEscPos
├── Control.cs
├── IPrinter.cs
├── Printable
│ ├── IPrintable.cs
│ ├── Bytes.cs
│ ├── Feed.cs
│ ├── Reset.cs
│ ├── Cut.cs
│ ├── Image.cs
│ ├── CodePage.cs
│ ├── Justification.cs
│ ├── Barcode.cs
│ ├── Font.cs
│ └── TextLine.cs
├── Connectors
│ ├── IPrinterConnector.cs
│ ├── SerialPortConnector.cs
│ └── NetworkPrinterConnector.cs
├── Printer.cs
├── Helpers
│ └── PrintableBuilder.cs
└── Vadavo.NEscPos.csproj
├── Vadavo.NEscPos.Test
├── Vadavo.NEscPos.Test.csproj
├── ConsoleHelpers.cs
├── Ticket.cs
└── Program.cs
├── README.md
├── LICENSE
├── ESCPOS.NET.sln
├── .gitattributes
└── .gitignore
/Vadavo.NEscPos/Control.cs:
--------------------------------------------------------------------------------
1 | namespace Vadavo.NEscPos
2 | {
3 | public enum Control
4 | {
5 | Null = 0x00,
6 | LineFeed = 0x0A,
7 | Escape = 0x1B,
8 | GroupSeparator = 0x1D
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Vadavo.NEscPos/IPrinter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Vadavo.NEscPos.Printable;
3 |
4 | namespace Vadavo.NEscPos
5 | {
6 | public interface IPrinter : IDisposable
7 | {
8 | ///
9 | /// Print an object.
10 | ///
11 | ///
12 | void Print(IPrintable printable);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Vadavo.NEscPos.Test/Vadavo.NEscPos.Test.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | netcoreapp2.2
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Vadavo.NEscPos/Printable/IPrintable.cs:
--------------------------------------------------------------------------------
1 | namespace Vadavo.NEscPos.Printable
2 | {
3 | ///
4 | /// The instance of the class that implements this interface,
5 | /// can be printed with an ESC/POS printer.
6 | ///
7 | public interface IPrintable
8 | {
9 | ///
10 | /// Get bytes to send to the printer.
11 | ///
12 | byte[] GetBytes();
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Vadavo.NEscPos/Connectors/IPrinterConnector.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Vadavo.NEscPos.Connectors
4 | {
5 | public interface IPrinterConnector : IDisposable
6 | {
7 | ///
8 | /// Write data to the printer.
9 | ///
10 | /// The data to write.
11 | void Write(byte[] data);
12 |
13 | ///
14 | /// Read data from the printer.
15 | ///
16 | /// The read data.
17 | byte[] Read();
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Vadavo.NEscPos/Printable/Bytes.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Vadavo.NEscPos.Printable
4 | {
5 | public class Bytes : IPrintable
6 | {
7 | private readonly byte[] _bytes;
8 |
9 | public Bytes(byte[] bytes) => _bytes = bytes;
10 | public byte[] GetBytes() => _bytes;
11 | }
12 |
13 | public static class BytesExtensions
14 | {
15 | public static void SendBytes(this IPrinter printer, byte[] bytes)
16 | {
17 | if (printer == null)
18 | throw new ArgumentNullException(nameof(printer));
19 |
20 | printer.Print(new Bytes(bytes));
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Vadavo.NEscPos/Printer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Vadavo.NEscPos.Connectors;
3 | using Vadavo.NEscPos.Printable;
4 |
5 | namespace Vadavo.NEscPos
6 | {
7 | public class Printer : IPrinter
8 | {
9 | private readonly IPrinterConnector _connector;
10 |
11 | public Printer(IPrinterConnector connector)
12 | {
13 | _connector = connector;
14 | this.Reset();
15 | }
16 |
17 | public void Print(IPrintable printable) => _connector.Write(printable.GetBytes());
18 |
19 | public void Dispose()
20 | {
21 | Dispose(true);
22 | GC.SuppressFinalize(this);
23 | }
24 |
25 | protected virtual void Dispose(bool disposing)
26 | {
27 | if (disposing)
28 | this.Reset();
29 |
30 | _connector?.Dispose();
31 | }
32 |
33 | ~Printer() => Dispose(false);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/Vadavo.NEscPos/Printable/Feed.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Vadavo.NEscPos.Helpers;
3 |
4 | namespace Vadavo.NEscPos.Printable
5 | {
6 | public class Feed : IPrintable
7 | {
8 | public byte[] GetBytes() => new[] {(byte) Control.LineFeed};
9 | }
10 |
11 | public static class FeedExtensions
12 | {
13 | ///
14 | /// Feed the printer buffer.
15 | ///
16 | public static void Feed(this IPrinter printer)
17 | {
18 | if (printer == null)
19 | throw new ArgumentNullException(nameof(printer));
20 |
21 | printer.Print(new Feed());
22 | }
23 |
24 | public static PrintableBuilder Feed(this PrintableBuilder builder)
25 | {
26 | if (builder == null)
27 | throw new ArgumentNullException(nameof(builder));
28 |
29 | return builder.Add(new Feed());
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/Vadavo.NEscPos/Helpers/PrintableBuilder.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Linq;
3 | using Vadavo.NEscPos.Printable;
4 |
5 | namespace Vadavo.NEscPos.Helpers
6 | {
7 | public class PrintableBuilder
8 | {
9 | private readonly IList _bytes = new List();
10 |
11 | public PrintableBuilder Add(IPrintable printable)
12 | {
13 | foreach (var @byte in printable.GetBytes())
14 | _bytes.Add(@byte);
15 |
16 | return this;
17 | }
18 |
19 | public PrintableBuilder Add(byte @byte)
20 | {
21 | _bytes.Add(@byte);
22 |
23 | return this;
24 | }
25 |
26 | public PrintableBuilder Add(IEnumerable bytes)
27 | {
28 | foreach (var @byte in bytes)
29 | Add(@byte);
30 |
31 | return this;
32 | }
33 |
34 | public byte[] ToArray() => _bytes.ToArray();
35 | }
36 | }
--------------------------------------------------------------------------------
/Vadavo.NEscPos.Test/ConsoleHelpers.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Vadavo.NEscPos.Test
4 | {
5 | public static class ConsoleHelpers
6 | {
7 | public static void WriteErrorLine(string message)
8 | {
9 | Console.ForegroundColor = ConsoleColor.Red;
10 | Console.WriteLine(message);
11 | Console.ResetColor();
12 | }
13 |
14 | public static string PromptLine(string message)
15 | {
16 | Console.ForegroundColor = ConsoleColor.Green;
17 | Console.Write(message + " ");
18 | Console.ResetColor();
19 |
20 | return Console.ReadLine();
21 | }
22 |
23 | public static ConsoleKeyInfo PromptKey(string message)
24 | {
25 | Console.ForegroundColor = ConsoleColor.Green;
26 | Console.Write(message + " ");
27 | Console.ResetColor();
28 |
29 | return Console.ReadKey();
30 | }
31 | }
32 | }
--------------------------------------------------------------------------------
/Vadavo.NEscPos/Printable/Reset.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Vadavo.NEscPos.Helpers;
3 |
4 | namespace Vadavo.NEscPos.Printable
5 | {
6 | public class Reset : IPrintable
7 | {
8 | public byte[] GetBytes() => new[] {(byte) Control.Escape, (byte) '@'};
9 | }
10 |
11 | public static class ResetExtensions
12 | {
13 | ///
14 | /// Reset the printer.
15 | ///
16 | public static void Reset(this IPrinter printer)
17 | {
18 | if (printer == null)
19 | throw new ArgumentNullException(nameof(printer));
20 |
21 | printer.Print(new Reset());
22 | }
23 |
24 | public static PrintableBuilder Reset(this PrintableBuilder builder)
25 | {
26 | if (builder == null)
27 | throw new ArgumentNullException(nameof(builder));
28 |
29 | return builder.Add(new Reset());
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # NEscPos
2 |
3 | NEscPos is open-source library for using ESC/POS thermal printers in a .NET project. NEscPos is implemented in .NET Stardard.
4 |
5 | ## Connectors
6 |
7 | An connector is the bridge between the physical thermal printer and the `Vadavo.NEscPos.IPrinter` interface that represents the printer.
8 |
9 | The connector tells the `Vadavo.NEscPos.Printer` class how the computer is connected with the thermal printer (network, USB, serial port, file, etc).
10 |
11 | All connectors implements the `Vadavo.NEscPos.Connectors.IPrinterConnector` interface.
12 |
13 | ## Usage
14 |
15 | The usage of NEscPos is very simple, first create a connector, then create the printer attaching the connector into the printer:
16 |
17 | ```
18 | using (var connector = new Vadavo.NEscPos.Connectors.NetworkConnector("10.0.0.50", 9100))
19 | using (var printer = new Vadavo.NEscPos.Printer(connector))
20 | {
21 | printer.Reset();
22 | printer.Print("Hello from .NET");
23 | printer.Cut();
24 | }
25 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018 VADAVO
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/Vadavo.NEscPos/Vadavo.NEscPos.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 | Vadavo.NEscPos
6 | NEscPos
7 | VADAVO SOLUCIONES S.L.
8 | ESC/POS .NET Standard library
9 | 2018 - VADAVO SOLUCIONES S.L.
10 | https://github.com/vadavo/NEscPos
11 | https://github.com/vadavo/NEscPos
12 | Git
13 | ESC/POS, Thermal Printing
14 | 0.0.0.4
15 | 0.0.0.4
16 | true
17 | 0.0.4
18 | MIT
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Vadavo.NEscPos/Connectors/SerialPortConnector.cs:
--------------------------------------------------------------------------------
1 | using System.IO;
2 | using RJCP.IO.Ports;
3 |
4 | namespace Vadavo.NEscPos.Connectors
5 | {
6 | public class SerialPortConnector : IPrinterConnector
7 | {
8 | private readonly SerialPortStream _portStream;
9 | private readonly BinaryWriter _writer;
10 | private readonly BinaryReader _reader;
11 |
12 | public SerialPortConnector(string portName, int baudRate)
13 | {
14 | _portStream = new SerialPortStream(portName, baudRate);
15 | _writer = new BinaryWriter(_portStream);
16 | _reader = new BinaryReader(_portStream);
17 | }
18 |
19 | public void Write(byte[] data)
20 | {
21 | _writer.Write(data);
22 | }
23 |
24 | public byte[] Read()
25 | {
26 | throw new System.NotImplementedException();
27 | }
28 |
29 | public void Dispose()
30 | {
31 | _reader?.Close();
32 | _reader?.Dispose();
33 |
34 | _writer?.Close();
35 | _writer?.Dispose();
36 |
37 | _portStream?.Close();
38 | _portStream?.Dispose();
39 | }
40 | }
41 | }
--------------------------------------------------------------------------------
/Vadavo.NEscPos/Printable/Cut.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Linq;
3 | using Vadavo.NEscPos.Helpers;
4 |
5 | namespace Vadavo.NEscPos.Printable
6 | {
7 | public enum CutType
8 | {
9 | Partial = 65,
10 | Full = 66,
11 | }
12 |
13 | public class Cut : IPrintable
14 | {
15 | private readonly CutType _type;
16 |
17 | public Cut(CutType type = CutType.Partial)
18 | {
19 | _type = type;
20 | }
21 |
22 | public byte[] GetBytes()
23 | {
24 | return new[] {(byte) Control.GroupSeparator, (byte) 'V', (byte) _type}
25 | .Concat(new Feed().GetBytes())
26 | .ToArray();
27 | }
28 | }
29 |
30 | public static class CutExtensions
31 | {
32 | ///
33 | /// Cut the paper.
34 | ///
35 | public static void Cut(this IPrinter printer, CutType type = CutType.Partial)
36 | {
37 | if (printer == null)
38 | throw new ArgumentNullException(nameof(printer));
39 |
40 | printer.Print(new Cut(type));
41 | }
42 |
43 | public static PrintableBuilder Cut(this PrintableBuilder builder, CutType type = CutType.Partial)
44 | {
45 | if (builder == null)
46 | throw new ArgumentNullException(nameof(builder));
47 |
48 | return builder.Add(new Cut(type));
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/Vadavo.NEscPos/Connectors/NetworkPrinterConnector.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Net;
3 | using System.Net.Sockets;
4 |
5 | namespace Vadavo.NEscPos.Connectors
6 | {
7 | public class NetworkPrinterConnector : IPrinterConnector
8 | {
9 | private readonly IPEndPoint _endPoint;
10 | private Socket _socket;
11 |
12 | public NetworkPrinterConnector(IPEndPoint endPoint)
13 | {
14 | _endPoint = endPoint;
15 | _openSocket();
16 | }
17 |
18 | public NetworkPrinterConnector(IPAddress ipAddress, int port)
19 | {
20 | _endPoint = new IPEndPoint(ipAddress, port);
21 | _openSocket();
22 | }
23 |
24 | public NetworkPrinterConnector(string ipAddress, int port)
25 | {
26 | _endPoint = new IPEndPoint(IPAddress.Parse(ipAddress), port);
27 | _openSocket();
28 | }
29 |
30 | private void _openSocket()
31 | {
32 | _socket = new Socket(_endPoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
33 | _socket.Connect(_endPoint);
34 | }
35 |
36 | public void Dispose()
37 | {
38 | _socket?.Dispose();
39 | }
40 |
41 | public byte[] Read()
42 | {
43 | throw new NotImplementedException();
44 | }
45 |
46 | public void Write(byte[] data)
47 | {
48 | _socket.Send(data);
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/ESCPOS.NET.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | VisualStudioVersion = 15.0.27703.2035
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Vadavo.NEscPos", "Vadavo.NEscPos\Vadavo.NEscPos.csproj", "{C079FBC0-30BF-4258-8054-166EC356F20A}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Vadavo.NEscPos.Test", "Vadavo.NEscPos.Test\Vadavo.NEscPos.Test.csproj", "{6E51D78A-2F03-43A9-8F51-05D8F8CA8892}"
9 | EndProject
10 | Global
11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
12 | Debug|Any CPU = Debug|Any CPU
13 | Release|Any CPU = Release|Any CPU
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {C079FBC0-30BF-4258-8054-166EC356F20A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
17 | {C079FBC0-30BF-4258-8054-166EC356F20A}.Debug|Any CPU.Build.0 = Debug|Any CPU
18 | {C079FBC0-30BF-4258-8054-166EC356F20A}.Release|Any CPU.ActiveCfg = Release|Any CPU
19 | {C079FBC0-30BF-4258-8054-166EC356F20A}.Release|Any CPU.Build.0 = Release|Any CPU
20 | {6E51D78A-2F03-43A9-8F51-05D8F8CA8892}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21 | {6E51D78A-2F03-43A9-8F51-05D8F8CA8892}.Debug|Any CPU.Build.0 = Debug|Any CPU
22 | {6E51D78A-2F03-43A9-8F51-05D8F8CA8892}.Release|Any CPU.ActiveCfg = Release|Any CPU
23 | {6E51D78A-2F03-43A9-8F51-05D8F8CA8892}.Release|Any CPU.Build.0 = Release|Any CPU
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | GlobalSection(ExtensibilityGlobals) = postSolution
29 | SolutionGuid = {5B5B330F-EE0B-48E8-B4B9-1FACF331D92E}
30 | EndGlobalSection
31 | EndGlobal
32 |
--------------------------------------------------------------------------------
/Vadavo.NEscPos/Printable/Image.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 | using System.Drawing.Imaging;
4 | using System.IO;
5 | using System.Linq;
6 | using System.Text;
7 |
8 | namespace Vadavo.NEscPos.Printable
9 | {
10 | public class Image : IPrintable
11 | {
12 | private readonly Bitmap _image;
13 |
14 | public Image(Bitmap image)
15 | {
16 | _image = image;
17 | }
18 |
19 | public Image(string path)
20 | {
21 | if (!File.Exists(path))
22 | throw new FileNotFoundException("File not found.", path);
23 |
24 | _image = new Bitmap(path);
25 | }
26 |
27 | public byte[] GetBytes()
28 | {
29 | byte[] imageBytes;
30 |
31 | using (var stream = new MemoryStream())
32 | {
33 | _image.Save(stream, ImageFormat.Bmp);
34 | imageBytes = stream.ToArray();
35 | }
36 |
37 | return _generateHeader()
38 | .Concat(imageBytes)
39 | .ToArray();
40 | }
41 |
42 | private byte[] _generateHeader()
43 | {
44 | var widthBytes = (_image.Width + 7) / 8;
45 | var heightPixels = _image.Height;
46 |
47 | return new[] {(byte) Control.GroupSeparator, (byte) 'v', (byte) 0, Convert.ToByte(3)}
48 | .Concat(_intLowHigh(widthBytes, 2))
49 | .Concat(_intLowHigh(heightPixels, 2))
50 | .ToArray();
51 | }
52 |
53 | private static byte[] _intLowHigh(int input, int length)
54 | {
55 | var output = string.Empty;
56 |
57 | for (var i = 0; i < length; i++)
58 | {
59 | output += (char) input % 256;
60 | input = input / 256;
61 | }
62 |
63 | return Encoding.Default.GetBytes(output);
64 | }
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/Vadavo.NEscPos/Printable/CodePage.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Vadavo.NEscPos.Helpers;
3 |
4 | namespace Vadavo.NEscPos.Printable
5 | {
6 | public enum CodePage
7 | {
8 | Default = 0,
9 | Pc437 = 0,
10 | Katakana = 1,
11 | Pc850 = 2,
12 | Pc860 = 3
13 | }
14 |
15 | public class SetCodePage : IPrintable
16 | {
17 | private readonly byte _codePage;
18 |
19 | public SetCodePage(CodePage codePage)
20 | {
21 | _codePage = (byte) codePage;
22 | }
23 |
24 | public SetCodePage(byte codePage)
25 | {
26 | _codePage = codePage;
27 | }
28 |
29 | public byte[] GetBytes()
30 | {
31 | return new[] {(byte) Control.Escape, (byte) 't', _codePage};
32 | }
33 | }
34 |
35 | public static class CodePageExtensions
36 | {
37 | public static void SetCodePage(this IPrinter printer, CodePage codePage)
38 | {
39 | if (printer == null)
40 | throw new ArgumentNullException(nameof(printer));
41 |
42 | printer.Print(new SetCodePage(codePage));
43 | }
44 |
45 | public static void SetCodePage(this IPrinter printer, byte codePage)
46 | {
47 | if (printer == null)
48 | throw new ArgumentNullException(nameof(printer));
49 |
50 | printer.Print(new SetCodePage(codePage));
51 | }
52 |
53 | public static PrintableBuilder SetCodePage(this PrintableBuilder builder, CodePage codePage)
54 | {
55 | if (builder == null)
56 | throw new ArgumentNullException(nameof(builder));
57 |
58 | return builder.Add(new SetCodePage(codePage));
59 | }
60 |
61 | public static PrintableBuilder SetCodePage(this PrintableBuilder builder, byte codePage)
62 | {
63 | if (builder == null)
64 | throw new ArgumentNullException(nameof(builder));
65 |
66 | return builder.Add(new SetCodePage(codePage));
67 | }
68 | }
69 | }
--------------------------------------------------------------------------------
/Vadavo.NEscPos/Printable/Justification.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Vadavo.NEscPos.Helpers;
3 |
4 | namespace Vadavo.NEscPos.Printable
5 | {
6 | public enum JustificationType
7 | {
8 | Left, Center, Right
9 | }
10 |
11 | public class SetJustification : IPrintable
12 | {
13 | private JustificationType _type;
14 |
15 | public SetJustification(JustificationType type = JustificationType.Left)
16 | {
17 | _type = type;
18 | }
19 |
20 | public byte[] GetBytes() => new[] { (byte) Control.Escape, (byte) 'a', (byte) _type };
21 | }
22 |
23 | public static class JustificationExtensions
24 | {
25 | public static void SetJustification(this IPrinter printer,
26 | JustificationType justificationType = JustificationType.Left)
27 | {
28 | if (printer == null)
29 | throw new ArgumentNullException(nameof(printer));
30 |
31 | printer.Print(new SetJustification(justificationType));
32 | }
33 |
34 | public static void SetLeftJustification(this IPrinter printer) => printer.SetJustification();
35 |
36 | public static void SetCenterJustification(this IPrinter printer) =>
37 | printer.SetJustification(JustificationType.Center);
38 |
39 | public static void SetRightJustification(this IPrinter printer) =>
40 | printer.SetJustification(JustificationType.Right);
41 |
42 | public static PrintableBuilder SetJustification(this PrintableBuilder builder,
43 | JustificationType justificationType = JustificationType.Left)
44 | {
45 | if (builder == null)
46 | throw new ArgumentNullException(nameof(builder));
47 |
48 | return builder.Add(new SetJustification(justificationType));
49 | }
50 |
51 | public static PrintableBuilder SetLeftJustification(this PrintableBuilder builder) =>
52 | builder.SetJustification();
53 |
54 | public static PrintableBuilder SetCenterJustification(this PrintableBuilder builder) =>
55 | builder.SetJustification(JustificationType.Center);
56 |
57 | public static PrintableBuilder SetRightJustification(this PrintableBuilder builder) =>
58 | builder.SetJustification(JustificationType.Right);
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/Vadavo.NEscPos/Printable/Barcode.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Linq;
3 | using Vadavo.NEscPos.Helpers;
4 |
5 | namespace Vadavo.NEscPos.Printable
6 | {
7 | public enum BarcodeType
8 | {
9 | UpcA, UpcE, Ean13, Ean8, Code39, I25, Codebar, Code93, Code128, Code11, Msi
10 | }
11 |
12 | ///
13 | /// A barcode printable implementation.
14 | ///
15 | ///
16 | /// This printable type reset the printer.
17 | ///
18 | public class Barcode : IPrintable
19 | {
20 | private readonly string _content;
21 | private readonly int _height;
22 | private readonly BarcodeType _type;
23 |
24 | public Barcode(string content, int height = 32, BarcodeType type = BarcodeType.Code128)
25 | {
26 | _content = content;
27 | _height = height;
28 | _type = type;
29 | }
30 |
31 | public byte[] GetBytes()
32 | {
33 | return new PrintableBuilder()
34 | .Add(new Reset())
35 | .Add(new[] {(byte) Control.GroupSeparator, (byte) 'h', (byte) _height})
36 | .Add(new[] {(byte) Control.GroupSeparator, (byte) 'k', (byte) _type, (byte) _content.Length})
37 | .Add(_content.ToCharArray().Select(e => (byte) e))
38 | .Add(new[] {(byte) 0, (byte) _content.Length, (byte) 0})
39 | .Add(new Reset())
40 | .ToArray();
41 | }
42 | }
43 |
44 | public static class BarcodeExtensions
45 | {
46 | public static void PrintBarcode(this IPrinter printer, string content, int height = 32,
47 | BarcodeType barcodeType = BarcodeType.Code128)
48 | {
49 | if (printer == null)
50 | throw new ArgumentNullException(nameof(printer));
51 |
52 | printer.Print(new Barcode(content, height, barcodeType));
53 | }
54 |
55 | public static PrintableBuilder AddBarcode(this PrintableBuilder builder, string content = "", int height = 32,
56 | BarcodeType barcodeType = BarcodeType.Code128)
57 | {
58 | if (builder == null)
59 | throw new ArgumentNullException(nameof(builder));
60 |
61 | return builder.Add(new Barcode(content, height, barcodeType));
62 | }
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/Vadavo.NEscPos.Test/Ticket.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Globalization;
3 | using System.Linq;
4 | using Vadavo.NEscPos.Helpers;
5 | using Vadavo.NEscPos.Printable;
6 |
7 | namespace Vadavo.NEscPos.Test
8 | {
9 | public class Ticket : IPrintable
10 | {
11 | public string CompanyName { get; }
12 | public string CompanyDocument { get; }
13 | public IEnumerable Products { get; }
14 |
15 | public Ticket(string companyName, string companyDocument, IEnumerable products)
16 | {
17 | Products = products;
18 | CompanyName = companyName;
19 | CompanyDocument = companyDocument;
20 | }
21 |
22 | public byte[] GetBytes()
23 | {
24 | var builder = new PrintableBuilder();
25 |
26 | builder
27 | .SetCenterJustification()
28 | .AddTextLine(CompanyName)
29 | .SetFontB()
30 | .AddTextLine($"Doc. {CompanyDocument}")
31 | .Feed()
32 | .Feed()
33 | .SetJustification();
34 |
35 | foreach (var product in Products)
36 | {
37 | builder
38 | .SetFont()
39 | .AddTextLine($"{product.Quantity} x {product.Name}")
40 | .SetFontB()
41 | .AddTextLine($"${product.PricePerUnit.ToString(CultureInfo.InvariantCulture)} x " +
42 | $"{product.Quantity} = ${product.TotalAmount.ToString(CultureInfo.InvariantCulture)}")
43 | .Feed();
44 | }
45 |
46 | builder
47 | .SetRightJustification()
48 | .SetDoubleFont()
49 | .AddTextLine($"Total: ${Products.Sum(e => e.TotalAmount).ToString(CultureInfo.InvariantCulture)}")
50 | .Reset()
51 | .Feed()
52 | .AddBarcode(CompanyName);
53 |
54 | return builder.ToArray();
55 | }
56 | }
57 |
58 | public class Product
59 | {
60 | public string Name { get; set; }
61 | public int Quantity { get; set; }
62 | public decimal PricePerUnit { get; set; }
63 | public decimal TotalAmount => PricePerUnit * Quantity;
64 |
65 | public Product(string name, int quantity, decimal pricePerUnit)
66 | {
67 | Name = name;
68 | Quantity = quantity;
69 | PricePerUnit = pricePerUnit;
70 | }
71 | }
72 | }
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/Vadavo.NEscPos/Printable/Font.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Vadavo.NEscPos.Helpers;
3 |
4 | namespace Vadavo.NEscPos.Printable
5 | {
6 | [Flags]
7 | public enum FontMode
8 | {
9 | FontA = 0,
10 | FontB = 1,
11 | Emphasized = 8,
12 | DoubleHeight = 16,
13 | DoubleWidth = 32,
14 | Underline = 128,
15 | }
16 |
17 | public class SetFont : IPrintable
18 | {
19 | private FontMode _mode;
20 |
21 | public SetFont(FontMode mode = FontMode.FontA)
22 | {
23 | _mode = mode;
24 | }
25 |
26 | public byte[] GetBytes() =>
27 | new[] { (byte) Control.Escape, (byte) '!', (byte) _mode };
28 | }
29 |
30 | public static class FontExtensions
31 | {
32 | public static void SetFont(this IPrinter printer, FontMode fontMode = FontMode.FontA)
33 | {
34 | if (printer == null)
35 | throw new ArgumentNullException(nameof(printer));
36 |
37 | printer.Print(new SetFont(fontMode));
38 | }
39 |
40 | public static void SetFontA(this IPrinter printer) => printer.SetFont();
41 | public static void SetFontB(this IPrinter printer) => printer.SetFont(FontMode.FontB);
42 | public static void SetEmphasizedFont(this IPrinter printer) => printer.SetFont(FontMode.Emphasized);
43 | public static void SetDoubleHeightFont(this IPrinter printer) => printer.SetFont(FontMode.DoubleHeight);
44 | public static void SetDoubleWidthFont(this IPrinter printer) => printer.SetFont(FontMode.DoubleWidth);
45 |
46 | public static void SetDoubleFont(this IPrinter printer) =>
47 | printer.SetFont(FontMode.DoubleWidth | FontMode.DoubleHeight);
48 |
49 | public static void SetUnderlineFont(this IPrinter printer) => printer.SetFont(FontMode.Underline);
50 |
51 | public static PrintableBuilder SetFont(this PrintableBuilder builder, FontMode fontMode = FontMode.FontA)
52 | {
53 | if (builder == null)
54 | throw new ArgumentNullException(nameof(builder));
55 |
56 | return builder.Add(new SetFont(fontMode));
57 | }
58 |
59 | public static PrintableBuilder SetFontA(this PrintableBuilder builder) => builder.SetFont();
60 |
61 | public static PrintableBuilder SetFontB(this PrintableBuilder builder) => builder.SetFont(FontMode.FontB);
62 |
63 | public static PrintableBuilder SetEmphasizedFont(this PrintableBuilder builder) =>
64 | builder.SetFont(FontMode.Emphasized);
65 |
66 | public static PrintableBuilder SetDoubleHeightFont(this PrintableBuilder builder) =>
67 | builder.SetFont(FontMode.DoubleHeight);
68 |
69 | public static PrintableBuilder SetDoubleWidthFont(this PrintableBuilder builder) =>
70 | builder.SetFont(FontMode.DoubleWidth);
71 |
72 | public static PrintableBuilder SetDoubleFont(this PrintableBuilder builder) =>
73 | builder.SetFont(FontMode.DoubleWidth | FontMode.DoubleHeight);
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/Vadavo.NEscPos/Printable/TextLine.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Linq;
3 | using System.Text;
4 | using Vadavo.NEscPos.Helpers;
5 |
6 | namespace Vadavo.NEscPos.Printable
7 | {
8 | public class TextLine : IPrintable
9 | {
10 | private readonly string _content;
11 | private readonly bool _feed;
12 | private readonly byte _codePage;
13 | private readonly Encoding _encoding;
14 |
15 | public TextLine(string content = "", CodePage codePage = CodePage.Default, Encoding encoding = null, bool feed = true)
16 | {
17 | _content = content ?? throw new ArgumentNullException(nameof(content));
18 | _codePage = (byte) codePage;
19 | _encoding = encoding ?? DefaultEncoding;
20 | _feed = feed;
21 | }
22 |
23 | public TextLine(string content = "", byte codePage = 0, Encoding encoding = null, bool feed = true)
24 | {
25 | _content = content ?? throw new ArgumentNullException(nameof(content));
26 | _feed = feed;
27 | _codePage = codePage;
28 | _encoding = encoding ?? DefaultEncoding;
29 | }
30 |
31 | public byte[] GetBytes()
32 | {
33 | var builder = new PrintableBuilder();
34 |
35 | var contentBytes = _encoding.GetBytes(_content);
36 |
37 | builder
38 | .Add(new SetCodePage(_codePage))
39 | .Add(contentBytes);
40 |
41 | if (_feed)
42 | builder.Add(new Feed());
43 |
44 | builder.Add(new SetCodePage(CodePage.Default));
45 |
46 | return builder.ToArray();
47 | }
48 |
49 | public static Encoding DefaultEncoding => Encoding.GetEncoding("ISO-8859-1");
50 | }
51 |
52 | public static class TextLineExtensions
53 | {
54 | ///
55 | /// Print a line of text.
56 | ///
57 | public static void PrintLine(this IPrinter printer, string content = "", CodePage codePage = CodePage.Default,
58 | Encoding encoding = null, bool feed = true)
59 | {
60 | if (printer == null)
61 | throw new ArgumentNullException(nameof(printer));
62 |
63 | if (encoding == null)
64 | encoding = TextLine.DefaultEncoding;
65 |
66 | printer.Print(new TextLine(content, codePage, encoding, feed));
67 | }
68 |
69 | public static void PrintLine(this IPrinter printer, string content, byte codePage, Encoding encoding,
70 | bool feed = true)
71 | {
72 | if (printer == null)
73 | throw new ArgumentNullException(nameof(printer));
74 |
75 | if (encoding == null)
76 | encoding = TextLine.DefaultEncoding;
77 |
78 | printer.Print(new TextLine(content, codePage, encoding, feed));
79 | }
80 |
81 | public static PrintableBuilder AddTextLine(this PrintableBuilder builder, string content = "",
82 | CodePage codePage = CodePage.Default, Encoding encoding = null, bool feed = true)
83 | {
84 | if (builder == null)
85 | throw new ArgumentNullException(nameof(builder));
86 |
87 | return builder.Add(new TextLine(content, codePage, encoding, feed));
88 | }
89 |
90 | public static PrintableBuilder AddTextLine(this PrintableBuilder builder, string content, byte codePage,
91 | Encoding encoding, bool feed = true)
92 | {
93 | if (builder == null)
94 | throw new ArgumentNullException(nameof(builder));
95 |
96 | return builder.Add(new TextLine(content, codePage, encoding, feed));
97 | }
98 | }
99 | }
--------------------------------------------------------------------------------
/Vadavo.NEscPos.Test/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Net;
3 | using Vadavo.NEscPos.Connectors;
4 | using Vadavo.NEscPos.Printable;
5 |
6 | namespace Vadavo.NEscPos.Test
7 | {
8 | class Program
9 | {
10 | static void Main()
11 | {
12 | Console.WriteLine("VADAVO NEscPos test program.");
13 | Console.WriteLine();
14 |
15 | using (var printer = _printMenu())
16 | {
17 | printer.PrintLine("===Start fake ticket===");
18 | printer.Feed();
19 | printer.Feed();
20 |
21 | var ticket = new Ticket("Tech store!", "X123456789", new []
22 | {
23 | new Product("SmartPhone", 2, 120.95m),
24 | new Product("Smart TV", 1, 250.95m),
25 | new Product("Computer game", 2, 19.95m),
26 | new Product("Graphic card", 1, 650.49m),
27 | new Product("SIM Card", 5, 14.99m),
28 | });
29 |
30 | printer.Print(ticket);
31 |
32 | printer.Reset();
33 | printer.Feed();
34 | printer.Feed();
35 | printer.PrintLine("===End fake ticket===");
36 |
37 | printer.Cut();
38 | }
39 | }
40 |
41 | private static IPrinter _printMenu()
42 | {
43 | while (true)
44 | {
45 | Console.WriteLine("1. Connect to printer via USB");
46 | Console.WriteLine("2. Connect to printer via serial port");
47 | Console.WriteLine("3. Connect to printer via TCP network");
48 | ConsoleHelpers.WriteErrorLine("0. Exit");
49 |
50 | var option = ConsoleHelpers.PromptKey("Select option:");
51 | Console.WriteLine();
52 |
53 | IPrinterConnector connector;
54 |
55 | switch (option.Key)
56 | {
57 | case ConsoleKey.D1:
58 | connector = _printUsbMenu();
59 | break;
60 | case ConsoleKey.D2:
61 | connector = _printSerialMenu();
62 | break;
63 | case ConsoleKey.D3:
64 | connector = _printNetworkMenu();
65 | break;
66 | case ConsoleKey.D0:
67 | Environment.Exit(0);
68 | continue;
69 | default:
70 | ConsoleHelpers.WriteErrorLine("Invalid option, try again.");
71 | Console.WriteLine();
72 | continue;
73 | }
74 |
75 | return new Printer(connector);
76 | }
77 | }
78 |
79 | private static IPrinterConnector _printUsbMenu()
80 | {
81 | throw new NotImplementedException();
82 | }
83 |
84 | private static IPrinterConnector _printSerialMenu()
85 | {
86 | var portName = ConsoleHelpers.PromptLine("Port name:");
87 |
88 | var baudRate = 0;
89 | var baudRateIsValid = false;
90 | while (!baudRateIsValid)
91 | {
92 | baudRateIsValid = int.TryParse(ConsoleHelpers.PromptLine("Baud rate:"), out baudRate);
93 |
94 | if (!baudRateIsValid)
95 | ConsoleHelpers.WriteErrorLine("Baud rate must be an integer number, try again.");
96 | }
97 |
98 | return new SerialPortConnector(portName, baudRate);
99 | }
100 |
101 | private static IPrinterConnector _printNetworkMenu()
102 | {
103 | var addressIsValid = false;
104 | IPAddress ipAddress = null;
105 | while (!addressIsValid)
106 | {
107 | addressIsValid = IPAddress.TryParse(ConsoleHelpers.PromptLine("IP Address:"), out ipAddress);
108 |
109 | if (!addressIsValid)
110 | ConsoleHelpers.WriteErrorLine("IP Address is not valid, try again.");
111 | }
112 |
113 | var portIsValid = false;
114 | int port = 0;
115 | while (!portIsValid)
116 | {
117 | if (int.TryParse(ConsoleHelpers.PromptLine("TCP Port (ej 9100):"), out port))
118 | if (port >= 0 && port < 65535)
119 | portIsValid = true;
120 |
121 | if (!portIsValid)
122 | ConsoleHelpers.WriteErrorLine("Port number is not valid, try again.");
123 | }
124 |
125 | return new NetworkPrinterConnector(ipAddress, port);
126 | }
127 | }
128 | }
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.userosscache
8 | *.sln.docstates
9 |
10 | # User-specific files (MonoDevelop/Xamarin Studio)
11 | *.userprefs
12 |
13 | # Build results
14 | [Dd]ebug/
15 | [Dd]ebugPublic/
16 | [Rr]elease/
17 | [Rr]eleases/
18 | x64/
19 | x86/
20 | bld/
21 | [Bb]in/
22 | [Oo]bj/
23 | [Ll]og/
24 |
25 | # Visual Studio 2015 cache/options directory
26 | .vs/
27 | # Uncomment if you have tasks that create the project's static files in wwwroot
28 | #wwwroot/
29 |
30 | # MSTest test Results
31 | [Tt]est[Rr]esult*/
32 | [Bb]uild[Ll]og.*
33 |
34 | # NUNIT
35 | *.VisualState.xml
36 | TestResult.xml
37 |
38 | # Build Results of an ATL Project
39 | [Dd]ebugPS/
40 | [Rr]eleasePS/
41 | dlldata.c
42 |
43 | # DNX
44 | project.lock.json
45 | project.fragment.lock.json
46 | artifacts/
47 |
48 | *_i.c
49 | *_p.c
50 | *_i.h
51 | *.ilk
52 | *.meta
53 | *.obj
54 | *.pch
55 | *.pdb
56 | *.pgc
57 | *.pgd
58 | *.rsp
59 | *.sbr
60 | *.tlb
61 | *.tli
62 | *.tlh
63 | *.tmp
64 | *.tmp_proj
65 | *.log
66 | *.vspscc
67 | *.vssscc
68 | .builds
69 | *.pidb
70 | *.svclog
71 | *.scc
72 |
73 | # Chutzpah Test files
74 | _Chutzpah*
75 |
76 | # Visual C++ cache files
77 | ipch/
78 | *.aps
79 | *.ncb
80 | *.opendb
81 | *.opensdf
82 | *.sdf
83 | *.cachefile
84 | *.VC.db
85 | *.VC.VC.opendb
86 |
87 | # Visual Studio profiler
88 | *.psess
89 | *.vsp
90 | *.vspx
91 | *.sap
92 |
93 | # TFS 2012 Local Workspace
94 | $tf/
95 |
96 | # Guidance Automation Toolkit
97 | *.gpState
98 |
99 | # ReSharper is a .NET coding add-in
100 | _ReSharper*/
101 | *.[Rr]e[Ss]harper
102 | *.DotSettings.user
103 |
104 | # JustCode is a .NET coding add-in
105 | .JustCode
106 |
107 | # TeamCity is a build add-in
108 | _TeamCity*
109 |
110 | # DotCover is a Code Coverage Tool
111 | *.dotCover
112 |
113 | # NCrunch
114 | _NCrunch_*
115 | .*crunch*.local.xml
116 | nCrunchTemp_*
117 |
118 | # MightyMoose
119 | *.mm.*
120 | AutoTest.Net/
121 |
122 | # Web workbench (sass)
123 | .sass-cache/
124 |
125 | # Installshield output folder
126 | [Ee]xpress/
127 |
128 | # DocProject is a documentation generator add-in
129 | DocProject/buildhelp/
130 | DocProject/Help/*.HxT
131 | DocProject/Help/*.HxC
132 | DocProject/Help/*.hhc
133 | DocProject/Help/*.hhk
134 | DocProject/Help/*.hhp
135 | DocProject/Help/Html2
136 | DocProject/Help/html
137 |
138 | # Click-Once directory
139 | publish/
140 |
141 | # Publish Web Output
142 | *.[Pp]ublish.xml
143 | *.azurePubxml
144 | # TODO: Comment the next line if you want to checkin your web deploy settings
145 | # but database connection strings (with potential passwords) will be unencrypted
146 | #*.pubxml
147 | *.publishproj
148 |
149 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
150 | # checkin your Azure Web App publish settings, but sensitive information contained
151 | # in these scripts will be unencrypted
152 | PublishScripts/
153 |
154 | # NuGet Packages
155 | *.nupkg
156 | # The packages folder can be ignored because of Package Restore
157 | **/packages/*
158 | # except build/, which is used as an MSBuild target.
159 | !**/packages/build/
160 | # Uncomment if necessary however generally it will be regenerated when needed
161 | #!**/packages/repositories.config
162 | # NuGet v3's project.json files produces more ignoreable files
163 | *.nuget.props
164 | *.nuget.targets
165 |
166 | # Microsoft Azure Build Output
167 | csx/
168 | *.build.csdef
169 |
170 | # Microsoft Azure Emulator
171 | ecf/
172 | rcf/
173 |
174 | # Windows Store app package directories and files
175 | AppPackages/
176 | BundleArtifacts/
177 | Package.StoreAssociation.xml
178 | _pkginfo.txt
179 |
180 | # Visual Studio cache files
181 | # files ending in .cache can be ignored
182 | *.[Cc]ache
183 | # but keep track of directories ending in .cache
184 | !*.[Cc]ache/
185 |
186 | # Others
187 | ClientBin/
188 | ~$*
189 | *~
190 | *.dbmdl
191 | *.dbproj.schemaview
192 | *.jfm
193 | *.pfx
194 | *.publishsettings
195 | node_modules/
196 | orleans.codegen.cs
197 |
198 | # Since there are multiple workflows, uncomment next line to ignore bower_components
199 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
200 | #bower_components/
201 |
202 | # RIA/Silverlight projects
203 | Generated_Code/
204 |
205 | # Backup & report files from converting an old project file
206 | # to a newer Visual Studio version. Backup files are not needed,
207 | # because we have git ;-)
208 | _UpgradeReport_Files/
209 | Backup*/
210 | UpgradeLog*.XML
211 | UpgradeLog*.htm
212 |
213 | # SQL Server files
214 | *.mdf
215 | *.ldf
216 |
217 | # Business Intelligence projects
218 | *.rdl.data
219 | *.bim.layout
220 | *.bim_*.settings
221 |
222 | # Microsoft Fakes
223 | FakesAssemblies/
224 |
225 | # GhostDoc plugin setting file
226 | *.GhostDoc.xml
227 |
228 | # Node.js Tools for Visual Studio
229 | .ntvs_analysis.dat
230 |
231 | # Visual Studio 6 build log
232 | *.plg
233 |
234 | # Visual Studio 6 workspace options file
235 | *.opt
236 |
237 | # Visual Studio LightSwitch build output
238 | **/*.HTMLClient/GeneratedArtifacts
239 | **/*.DesktopClient/GeneratedArtifacts
240 | **/*.DesktopClient/ModelManifest.xml
241 | **/*.Server/GeneratedArtifacts
242 | **/*.Server/ModelManifest.xml
243 | _Pvt_Extensions
244 |
245 | # Paket dependency manager
246 | .paket/paket.exe
247 | paket-files/
248 |
249 | # FAKE - F# Make
250 | .fake/
251 |
252 | # JetBrains Rider
253 | .idea/
254 | *.sln.iml
255 |
256 | # CodeRush
257 | .cr/
258 |
259 | # Python Tools for Visual Studio (PTVS)
260 | __pycache__/
261 | *.pyc
--------------------------------------------------------------------------------