private static void WorkWithISBN(string input) { isbn.OnMalformedISBN += IsbnOnOnMalformedIsbn; if (!string.IsNullOrWhiteSpace(input)) { try { var version = isbn.GetISBNVersion(input); var sw = Stopwatch.StartNew(); string converted = ""; if (version == VERSION.INVALID) { Console.Write( "ISBN Version wurde nicht erkannt! Wollen Sie nach der ISBN für einen Buchtitel suchen? [J/n]"); var i = Console.ReadLine(); if (string.IsNullOrEmpty(i) || i.ToLower() == "j") { Console.Write("Fetching ISBN for \"{0}\"...", input); var task = isbn.GetISBNFromSearch(input); DisplayLoading(task); var isbns = task.Result; if (isbns.Length > 1) { WrapLine( "Mehrere zutreffende Bücher gefunden! Versuche, präzisere Suchen zu machen."); Console.WriteLine(); } else if (isbns.Length == 0) { WrapLine("Keine Bücher gefunden, die mit \"{0}\" übereinstimmen!", input); Console.WriteLine(); return; } input = isbns[0]; version = isbn.GetISBNVersion(input); converted = isbn.ConvertISBN(input).ToUpper(); } } else { converted = isbn.ConvertISBN(input).ToUpper(); } sw.Stop(); var elapsedSeconds = (sw.ElapsedTicks / (TimeSpan.TicksPerMillisecond / 1000f) / 1000f / 1000f) .ToString("F99").TrimEnd('0'); if (converted != "") { input = isbn.HyphenateISBN(input); if (version == VERSION.ISBN10) { history.Insert(0, new Tuple <string, string, string>(input, converted, elapsedSeconds)); Console.Write("Die ISBN10 "); PrintISBN10(input); Console.Write(" ist in ISBN13 "); PrintISBN13(converted); Console.WriteLine(" und wurde in {0} Sek. berechnet.", elapsedSeconds); } else { history.Insert(0, new Tuple <string, string, string>(converted, input, elapsedSeconds)); Console.Write("Die ISBN13 "); PrintISBN13(input); Console.Write(" ist in ISBN10 "); PrintISBN10(converted); Console.WriteLine(" und wurde in {0} Sek. berechnet.", elapsedSeconds); } } Console.WriteLine(); } catch (FormatException e) { Console.WriteLine(e.Message); Console.WriteLine(); } } isbn.OnMalformedISBN -= IsbnOnOnMalformedIsbn; }