podsleuth r69 - in trunk: . src/PodSleuth.Hal/PodSleuth.HalFrontend
- From: gburt svn gnome org
- To: svn-commits-list gnome org
- Subject: podsleuth r69 - in trunk: . src/PodSleuth.Hal/PodSleuth.HalFrontend
- Date: Fri, 19 Dec 2008 17:58:59 +0000 (UTC)
Author: gburt
Date: Fri Dec 19 17:58:58 2008
New Revision: 69
URL: http://svn.gnome.org/viewvc/podsleuth?rev=69&view=rev
Log:
2008-12-19 Gabriel Burt <gabriel burt gmail com>
* src/PodSleuth.Hal/PodSleuth.HalFrontend/HalClient.cs: Fix crasher caused
by production info not being where we expect it (BGO #564658)
Modified:
trunk/ChangeLog
trunk/src/PodSleuth.Hal/PodSleuth.HalFrontend/HalClient.cs
Modified: trunk/src/PodSleuth.Hal/PodSleuth.HalFrontend/HalClient.cs
==============================================================================
--- trunk/src/PodSleuth.Hal/PodSleuth.HalFrontend/HalClient.cs (original)
+++ trunk/src/PodSleuth.Hal/PodSleuth.HalFrontend/HalClient.cs Fri Dec 19 17:58:58 2008
@@ -200,17 +200,21 @@
private static string GetProductionInfo(Hal.Volume volume)
{
- string factory_id = volume[HalNamespace + "ipod.production.factory_id"];
- int year = volume.GetPropertyInteger(HalNamespace + "ipod.production.year");
- int week = volume.GetPropertyInteger(HalNamespace + "ipod.production.week");
- int number = volume.GetPropertyInteger(HalNamespace + "ipod.production.number");
-
- CultureInfo culture = CultureInfo.CurrentCulture;
- DateTime production_date = culture.Calendar.AddWeeks(new DateTime(year, 1, 1), week);
-
- return String.Format("{0} in {1}, {2} from factory {3}",
- number, culture.DateTimeFormat.GetMonthName(production_date.Month),
- year, factory_id);
+ try {
+ string factory_id = volume[HalNamespace + "ipod.production.factory_id"];
+ int year = volume.GetPropertyInteger(HalNamespace + "ipod.production.year");
+ int week = volume.GetPropertyInteger(HalNamespace + "ipod.production.week");
+ int number = volume.GetPropertyInteger(HalNamespace + "ipod.production.number");
+
+ CultureInfo culture = CultureInfo.CurrentCulture;
+ DateTime production_date = culture.Calendar.AddWeeks(new DateTime(year, 1, 1), week);
+
+ return String.Format("{0} in {1}, {2} from factory {3}",
+ number, culture.DateTimeFormat.GetMonthName(production_date.Month),
+ year, factory_id);
+ } catch (Exception) {
+ return "Unknown";
+ }
}
private static void DumpSleuthableIpod(Hal.Volume volume)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]