From 844121acc96f0280d9f527175e56e77b4dac8d71 Mon Sep 17 00:00:00 2001 From: Eric Reed Date: Mon, 25 Feb 2013 20:11:51 -0500 Subject: More uninstaller/installer incrementals Gonna need separate installers for server and mbt due to CO limitations --- MediaBrowser.Installer/Code/ModelExtensions.cs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'MediaBrowser.Installer/Code/ModelExtensions.cs') diff --git a/MediaBrowser.Installer/Code/ModelExtensions.cs b/MediaBrowser.Installer/Code/ModelExtensions.cs index 5a3051164..66e51ec11 100644 --- a/MediaBrowser.Installer/Code/ModelExtensions.cs +++ b/MediaBrowser.Installer/Code/ModelExtensions.cs @@ -1,4 +1,6 @@  +using System.Collections.Generic; + namespace MediaBrowser.Installer.Code { /// @@ -16,5 +18,26 @@ namespace MediaBrowser.Installer.Code { return string.IsNullOrEmpty(str) ? def : str; } + + /// + /// Helper method for Dictionaries since they throw on not-found keys + /// + /// + /// + /// The dictionary. + /// The key. + /// The default value. + /// ``1. + public static U GetValueOrDefault(this Dictionary dictionary, T key, U defaultValue) + { + U val; + if (!dictionary.TryGetValue(key, out val)) + { + val = defaultValue; + } + return val; + + } + } } -- cgit v1.2.3