2 * Copyright 2008 ZXing authors
\r
4 * Licensed under the Apache License, Version 2.0 (the "License");
\r
5 * you may not use this file except in compliance with the License.
\r
6 * You may obtain a copy of the License at
\r
8 * http://www.apache.org/licenses/LICENSE-2.0
\r
10 * Unless required by applicable law or agreed to in writing, software
\r
11 * distributed under the License is distributed on an "AS IS" BASIS,
\r
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
13 * See the License for the specific language governing permissions and
\r
14 * limitations under the License.
\r
17 using BarcodeFormat = com.google.zxing.BarcodeFormat;
\r
18 using Result = com.google.zxing.Result;
\r
19 namespace com.google.zxing.client.result
\r
22 /// <summary> Parses strings of digits that represent a ISBN.
\r
25 /// <author> jbreiden@google.com (Jeff Breidenbach)
\r
27 /// <author>www.Redivivus.in (suraj.supekar@redivivus.in) - Ported from ZXING Java Source
\r
29 public class ISBNResultParser:ResultParser
\r
32 private ISBNResultParser()
\r
36 // ISBN-13 For Dummies
\r
37 // http://www.bisg.org/isbn-13/for.dummies.html
\r
38 public static ISBNParsedResult parse(Result result)
\r
40 BarcodeFormat format = result.BarcodeFormat;
\r
41 if (!BarcodeFormat.EAN_13.Equals(format))
\r
45 System.String rawText = result.Text;
\r
46 if (rawText == null)
\r
50 int length = rawText.Length;
\r
55 if (!rawText.StartsWith("978") && !rawText.StartsWith("979"))
\r
60 return new ISBNParsedResult(rawText);
\r