Esempio n. 1
0
 /// <summary>
 /// Retrieves a value if this provider matches the specified
 /// requirements.
 /// </summary>
 /// <param name="requirements">The requirements to test.</param>
 /// <returns>true if the provider satisfies the requirements; otherwise, false.</returns>
 internal bool MatchesRequirements(StorageRequirements requirements)
 {
     return
         (Requirements.Player == requirements.Player &&
          ((device != null && device.FreeSpace > requirements.SizeInBytes) ||
           (Requirements.SizeInBytes >= requirements.SizeInBytes &&
            Requirements.DirectoryCount >= requirements.DirectoryCount)));
 }
Esempio n. 2
0
        /// <summary>
        /// Retrieves a provider satisfying the specified requirements.
        /// </summary>
        /// <param name="requirements">The requirements.</param>
        /// <returns>The StorageProvider instance.</returns>
        public StorageProvider GetProvider(StorageRequirements requirements)
        {
            var provider = providers.Find(s => s.MatchesRequirements(requirements));

            if (provider == null)
            {
                provider = new StorageProvider(titleName, requirements);
                providers.Add(provider);
            }

            return(provider);
        }
Esempio n. 3
0
 /// <summary>
 /// Initializes a new instance of the StorageProvider class.
 /// </summary>
 /// <param name="titleName">The title name to use for sessions.</param>
 /// <param name="requirements">The requirements.</param>
 internal StorageProvider(string titleName, StorageRequirements requirements)
 {
     this.titleName    = titleName;
     this.Requirements = requirements;
 }