Exemplo n.º 1
0
 public AppShellImpl(
     IAppServices aFullPrivilegeAppServices,
     IConfigFileCollection aConfiguration,
     IAddinManager aAddinManager,
     IAppsDirectory aAppsDirectory,
     IStoreDirectory aStoreDirectory,
     Func<DvDevice, string, string, string, IDvProviderOpenhomeOrgApp1> aAppProviderConstructor,
     IZipReader aZipReader,
     IAppMetadataStore aMetadataStore,
     IZipVerifier aZipVerifier,
     ISystemAppsConfiguration aSystemAppsConfiguration,
     IXappServer aXappServer,
     bool aAutoStart)
 {
     iFullPrivilegeAppServices = aFullPrivilegeAppServices;
     iZipVerifier = aZipVerifier;
     iXappServer = aXappServer;
     //iZipReader = aZipReader;
     iMetadataStore = aMetadataStore;
     iConfiguration = aConfiguration;
     iAddinManager = aAddinManager;
     iAppsDirectory = aAppsDirectory;
     iStoreDirectory = aStoreDirectory;
     iAppProviderConstructor = aAppProviderConstructor;
     iNodeRebooter = iFullPrivilegeAppServices.NodeRebooter;
     //iApps = new Dictionary<string, PublishedApp>();
     iHistory = new List<HistoryItem>();
     // !!!! restore previous history from disk
     iKnownApps = new Dictionary<string, KnownApp>();
     foreach (var app in iMetadataStore.LoadAppsFromStore())
     {
         GetOrCreateKnownApp(app.AppName);
     }
     foreach (string dirname in iAppsDirectory.GetAppSubdirectories())
     {
         GetOrCreateKnownApp(dirname);
     }
     MarkSystemApps(aSystemAppsConfiguration);
     if (aAutoStart)
     {
         Start();
     }
 }
Exemplo n.º 2
0
 public KnownApp(string aAppName, IAppMetadataStore aMetadataStore, IAppsDirectory aAppsDirectory, IZipVerifier aZipVerifier)
 {
     AppName = aAppName;
     iMetadataStore = aMetadataStore;
     iZipVerifier = aZipVerifier;
     iAppsDirectory = aAppsDirectory;
     IconUrl = "";
 }
Exemplo n.º 3
0
 /// <summary>
 /// Create an app shell. Hosted apps are not automatically started.
 /// </summary>
 /// <param name="aFullPrivilegeAppServices">
 /// Services that will be provided to apps granted permissions.
 /// (If we implement restricted permissions, such apps would
 /// receive only a subset of these services.)
 /// </param>
 /// <param name="aConfiguration">
 /// Parsed config files. Some pre-installed apps need to read
 /// configuration  information (such as location of serial devices)
 /// from these files.
 /// </param>
 /// <param name="aAddinManager">
 /// Interface to the addin manager that handles actual loading of
 /// plugins. (Currently we use MEF.)
 /// </param>
 /// <param name="aAppsDirectory">
 /// Interface to inspect and manipulate the apps directory, where
 /// we put app binaries and their static data.
 /// </param>
 /// <param name="aStoreDirectory">
 /// Interface to inspect and manipulate the store directory, where
 /// apps store their dynamic, persistent data.
 /// </param>
 /// <param name="aAppProviderConstructor">
 /// Constructor to create an AppProvider. The AppShell is responsible
 /// for creating a device for each app and publishing the app service
 /// on that device on behalf of the app, and it uses this to construct
 /// such a provider. (Unit tests need to be able to pass in a
 /// substitute here.
 /// </param>
 /// <param name="aZipReader">
 /// Reads entries from a zip file.
 /// </param>
 /// <param name="aAppMetadataStore">
 /// Stores persistent data about apps, such as deferred deletions or
 /// upgrades.
 /// </param>
 /// <param name="aZipVerifier">
 /// Verifies that a zip file contains a valid OpenHome app.
 /// </param>
 /// <param name="aAutoStart">
 /// If true, start the AppShell immediately. Otherwise, caller needs
 /// to call Start() when they want to start apps.
 /// </param>
 public AppShell(
     IAppServices aFullPrivilegeAppServices,
     IConfigFileCollection aConfiguration,
     IAddinManager aAddinManager,
     IAppsDirectory aAppsDirectory,
     IStoreDirectory aStoreDirectory,
     Func<DvDevice, string, string, string, IDvProviderOpenhomeOrgApp1> aAppProviderConstructor,
     IZipReader aZipReader,
     IAppMetadataStore aAppMetadataStore, IZipVerifier aZipVerifier,
     ISystemAppsConfiguration aSystemAppsConfiguration,
     IXappServer aXappServer,
     bool aAutoStart)
 {
     lock (iLock)
     {
         iImpl = new AppShellImpl(
             aFullPrivilegeAppServices,
             aConfiguration,
             aAddinManager,
             aAppsDirectory,
             aStoreDirectory,
             aAppProviderConstructor,
             aZipReader,
             aAppMetadataStore,
             aZipVerifier,
             aSystemAppsConfiguration,
             aXappServer,
             aAutoStart);
         iImpl.AppStatusChanged += OnAppStatusChanged;
     }
 }