public void run() { while (true) { String input = inputs.getNextInput(); if (input == null) { break; } if (File.Exists(input)) { try { if (config.Multi) { Result[] results = decodeMulti(new Uri(input), config.Hints); if (results != null) { successful++; if (config.DumpResults) { dumpResultMulti(input, results); } } } else { Result result = decode(new Uri(input), config.Hints); if (result != null) { successful++; if (config.DumpResults) { dumpResult(input, result); } } } } catch (IOException) { } } else { try { if (decode(new Uri(input), config.Hints) != null) { successful++; } } catch (Exception) { } } } }
public void run() { ResultString = String.Empty; while (true) { String input = inputs.getNextInput(); if (input == null) { break; } try { Result[] results = decodeMulti(new Uri(Path.GetFullPath(input)), input, config.Hints); if (results != null) { successful++; } } catch (IOException exc) { Console.WriteLine(exc.ToString()); } } }
public void run() { ResultString = String.Empty; while (true) { String input = inputs.getNextInput(); if (input == null) { break; } if (File.Exists(input)) { try { if (config.Multi) { Result[] results = decodeMulti(new Uri(Path.GetFullPath(input)), input, config.Hints); if (results != null) { successful++; if (config.DumpResults) { dumpResultMulti(input, results); } } } else { Result result = decode(new Uri(Path.GetFullPath(input)), input, config.Hints); if (result != null) { successful++; if (config.DumpResults) { dumpResult(input, result); } } } } catch (IOException exc) { Console.WriteLine(exc.ToString()); } } else { try { var tempFile = Path.GetTempFileName(); var uri = new Uri(input); var client = new WebClient(); client.DownloadFile(uri, tempFile); try { Result result = decode(new Uri(tempFile), input, config.Hints); if (result != null) { successful++; if (config.DumpResults) { dumpResult(input, result); } } } finally { File.Delete(tempFile); } } catch (Exception exc) { Console.WriteLine(exc.ToString()); } } } }