BarCodeFactory.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. namespace Bowin.Common.BarCode
  6. {
  7. /// <summary>
  8. /// 条码类工厂
  9. /// </summary>
  10. public class BarCodeFactory
  11. {
  12. public static BarCodeBase CreateBarCard(BarCodeType type, string rawData)
  13. {
  14. BarCodeBase barCode = null;
  15. switch (type)
  16. {
  17. case BarCodeType.Code128:
  18. barCode = new Code128(rawData);
  19. break;
  20. case BarCodeType.Code128A:
  21. barCode = new Code128(rawData, Code128Type.A);
  22. break;
  23. case BarCodeType.Code128B:
  24. barCode = new Code128(rawData, Code128Type.B);
  25. break;
  26. case BarCodeType.Code128C:
  27. barCode = new Code128(rawData, Code128Type.C);
  28. break;
  29. //case BarCodeType.Code39:
  30. // barCode = new Code39(rawData);
  31. // break;
  32. //case BarCodeType.Code39Extended:
  33. // barCode = new Code39(rawData, true);
  34. // break;
  35. //case BarCodeType.Code93:
  36. // barCode = new Code93(rawData);
  37. // break;
  38. //case BarCodeType.EAN13:
  39. // barCode = new EAN13(rawData);
  40. // break;
  41. //case BarCodeType.EAN8:
  42. // barCode = new EAN8(rawData);
  43. // break;
  44. //case BarCodeType.ISBN:
  45. // barCode = new ISBN(rawData);
  46. // break;
  47. //case BarCodeType.CodeBar:
  48. // barCode = new CodaBar(rawData);
  49. // break;
  50. default:
  51. throw new Exception("未知");
  52. }
  53. return barCode;
  54. }
  55. }
  56. }