aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Reed <ebr@mediabrowser3.com>2013-02-26 10:07:58 -0500
committerEric Reed <ebr@mediabrowser3.com>2013-02-26 10:07:58 -0500
commit81974c44d2f446a95304bcdf56b23feb93fe58f7 (patch)
tree74d08dff0a484c2d5e681fc22a190fcc42158d6e
parentcf17b01387268280b14653c4b7238ceac93dfc30 (diff)
Implement delete on uninstall
-rw-r--r--MediaBrowser.Installer/MediaBrowser.Installer.csproj2
-rw-r--r--MediaBrowser.Uninstaller.Execute/MainWindow.xaml1
-rw-r--r--MediaBrowser.Uninstaller.Execute/MainWindow.xaml.cs58
3 files changed, 59 insertions, 2 deletions
diff --git a/MediaBrowser.Installer/MediaBrowser.Installer.csproj b/MediaBrowser.Installer/MediaBrowser.Installer.csproj
index 93f1e9f1b..3193a2d86 100644
--- a/MediaBrowser.Installer/MediaBrowser.Installer.csproj
+++ b/MediaBrowser.Installer/MediaBrowser.Installer.csproj
@@ -29,7 +29,7 @@
<PublisherName>Media Browser Team</PublisherName>
<SuiteName>Media Browser</SuiteName>
<OpenBrowserOnPublish>false</OpenBrowserOnPublish>
- <ApplicationRevision>15</ApplicationRevision>
+ <ApplicationRevision>16</ApplicationRevision>
<ApplicationVersion>0.1.1.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<PublishWizardCompleted>true</PublishWizardCompleted>
diff --git a/MediaBrowser.Uninstaller.Execute/MainWindow.xaml b/MediaBrowser.Uninstaller.Execute/MainWindow.xaml
index c1466f9a4..0874b5c3a 100644
--- a/MediaBrowser.Uninstaller.Execute/MainWindow.xaml
+++ b/MediaBrowser.Uninstaller.Execute/MainWindow.xaml
@@ -14,6 +14,7 @@
<CheckBox x:Name="cbxRemovePlugins" Content="Delete Plug-ins" HorizontalAlignment="Left" Margin="16,68,0,0" VerticalAlignment="Top"/>
</Grid>
+ <Button x:Name="btnFinished" Content="Uninstall" HorizontalAlignment="Left" Margin="505,341,0,0" VerticalAlignment="Top" Width="75" IsDefault="True" RenderTransformOrigin="0.991,-1.041" Click="BtnFinished_OnClick" Visibility="Hidden"/>
</Grid>
</Window>
diff --git a/MediaBrowser.Uninstaller.Execute/MainWindow.xaml.cs b/MediaBrowser.Uninstaller.Execute/MainWindow.xaml.cs
index 7f82d1840..fb6ff6c89 100644
--- a/MediaBrowser.Uninstaller.Execute/MainWindow.xaml.cs
+++ b/MediaBrowser.Uninstaller.Execute/MainWindow.xaml.cs
@@ -13,6 +13,7 @@ namespace MediaBrowser.Uninstaller.Execute
public partial class MainWindow : Window
{
protected string Product = "Server";
+ protected string RootSuffix = "-Server";
public MainWindow()
{
@@ -27,10 +28,12 @@ namespace MediaBrowser.Uninstaller.Execute
{
case "server":
Product = "Server";
+ RootSuffix = "-Server";
break;
case "mbt":
Product = "Theater";
+ RootSuffix = "-UI";
break;
default:
@@ -93,10 +96,42 @@ namespace MediaBrowser.Uninstaller.Execute
}
}
+ var rootPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "MediaBrowser" + RootSuffix);
+
+ if (cbxRemoveAll.IsChecked == true)
+ {
+ // Just remove our whole directory
+ RemovePath(rootPath);
+ }
+ else
+ {
+ // First remove the system
+ lblHeading.Content = "Removing System Files...";
+ RemovePath(Path.Combine(rootPath, "System"));
+
+ // And then the others specified
+ if (cbxRemoveCache.IsChecked == true)
+ {
+ lblHeading.Content = "Removing Cache and Data Files...";
+ RemovePath(Path.Combine(rootPath, "cache"));
+ RemovePath(Path.Combine(rootPath, "data"));
+ }
+ if (cbxRemoveConfig.IsChecked == true)
+ {
+ lblHeading.Content = "Removing Config Files...";
+ RemovePath(Path.Combine(rootPath, "config"));
+ }
+ if (cbxRemovePlugins.IsChecked == true)
+ {
+ lblHeading.Content = "Removing Plugin Files...";
+ RemovePath(Path.Combine(rootPath, "plugins"));
+ }
+ }
// and done
lblHeading.Content = string.Format("Media Browser {0} Uninstalled.", Product);
- btnUninstall.Content = "Finish";
+ btnUninstall.Visibility = Visibility.Hidden;
+ btnFinished.Visibility = Visibility.Visible;
}
private static void RemoveShortcut(string path)
@@ -112,7 +147,28 @@ namespace MediaBrowser.Uninstaller.Execute
{
MessageBox.Show(string.Format("Error attempting to remove shortcut {0}\n\n {1}", path, ex.Message), "Error");
}
+
+ }
+
+ private static void RemovePath(string path)
+ {
+ try
+ {
+ Directory.Delete(path, true);
+ }
+ catch (DirectoryNotFoundException)
+ {
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(string.Format("Error attempting to remove progam folder {0}\n\n {1}", path, ex.Message), "Error");
+ }
}
+
+ private void BtnFinished_OnClick(object sender, RoutedEventArgs e)
+ {
+ Close();
+ }
}
}