You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

DecoderResult.cs 2.5 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*
  2. * Copyright 2007 ZXing authors
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. using System;
  17. using System.Collections.Generic;
  18. namespace ZXing.Common
  19. {
  20. /// <summary>
  21. /// Encapsulates the result of decoding a matrix of bits. This typically
  22. /// applies to 2D barcode formats. For now it contains the raw bytes obtained,
  23. /// as well as a String interpretation of those bytes, if applicable.
  24. /// <author>Sean Owen</author>
  25. /// </summary>
  26. public sealed class DecoderResult
  27. {
  28. public byte[] RawBytes { get; private set; }
  29. public String Text { get; private set; }
  30. public IList<byte[]> ByteSegments { get; private set; }
  31. public String ECLevel { get; private set; }
  32. public bool StructuredAppend
  33. {
  34. get { return StructuredAppendParity >= 0 && StructuredAppendSequenceNumber >= 0; }
  35. }
  36. public int ErrorsCorrected { get; set; }
  37. public int StructuredAppendSequenceNumber { get; private set; }
  38. public int Erasures { get; set; }
  39. public int StructuredAppendParity { get; private set; }
  40. /// <summary>
  41. /// Miscellanseous data value for the various decoders
  42. /// </summary>
  43. /// <value>The other.</value>
  44. public object Other { get; set; }
  45. public DecoderResult(byte[] rawBytes, String text, IList<byte[]> byteSegments, String ecLevel)
  46. : this(rawBytes, text, byteSegments, ecLevel, -1, -1)
  47. {
  48. }
  49. public DecoderResult(byte[] rawBytes, String text, IList<byte[]> byteSegments, String ecLevel, int saSequence, int saParity)
  50. {
  51. if (rawBytes == null && text == null)
  52. {
  53. throw new ArgumentException();
  54. }
  55. RawBytes = rawBytes;
  56. Text = text;
  57. ByteSegments = byteSegments;
  58. ECLevel = ecLevel;
  59. StructuredAppendParity = saParity;
  60. StructuredAppendSequenceNumber = saSequence;
  61. }
  62. }
  63. }