1 // -----------------------------------------------------------------------
2 // <copyright file="ShellExtensionController.cs" company="Microsoft">
3 // TODO: Update copyright text.
5 // -----------------------------------------------------------------------
7 using System.Collections;
9 using System.IO.IsolatedStorage;
10 using System.Runtime.Serialization;
11 using Pithos.ShellExtensions;
13 namespace Pithos.Client.WPF
16 using System.Collections.Generic;
21 /// TODO: Update summary.
23 public class ShellExtensionController
25 #region Shell Extensions
26 public void UnregisterExtensions()
28 using (var installer = new ProjectInstaller())
30 IDictionary state = LoadState();
31 installer.Uninstall(state);
35 public void RegisterExtensions()
37 using (var installer = new ProjectInstaller())
39 IDictionary state = new Dictionary<object, object>();
40 installer.Install(state);
46 private static void SaveState(IDictionary state)
48 using (var store = IsolatedStorageFile.GetUserStoreForAssembly())
49 using (var file = store.CreateFile("PithosManualInstallFile"))
51 var serializer = new NetDataContractSerializer();
52 serializer.Serialize(file, state);
56 private static IDictionary LoadState()
58 using (var store = IsolatedStorageFile.GetUserStoreForAssembly())
60 if (!store.FileExists("PithosManualInstallFile"))
61 return new Dictionary<object, object>();
63 using (var file = store.OpenFile("PithosManualInstallFile", FileMode.Open))
65 var serializer = new NetDataContractSerializer();
66 var state = serializer.Deserialize(file);
67 return (IDictionary)state;