Getting files

Dec 14, 2009 at 6:50 PM

Is it me, or is there no method to get the files in a StorageContainer? It appears you have to know the name of a file to get it, but if you have player named files, that's going to be difficult. Maybe something like:

        public virtual string[] GetFiles(string extension)
            return GetFiles(extension, "");

        public virtual string[] GetFiles(string extension, string path)
            if (!HasValidStorageDevice)
                throw new InvalidOperationException("StorageDevice is not valid.");

            // make sure a container is open and resets the expiration timer

            return Directory.GetFiles(Path.Combine(storageContainer.Path, path), extension);



Dec 14, 2009 at 7:05 PM


That does make sense. Just need to tweak it a little:

Makes sense. Just need to tweak it to add timers.Add(containerExpiration) before returning from the method. I might clean some of this up as an update over the next few weeks and I'll be sure to include some GetFiles methods as well as simplify the timing system.


Dec 15, 2009 at 2:14 AM

Added a few GetFiles methods to the SaveDevice class in the latest source check in. Also moved the timing stuff to OpenContainer and added a few safety checks on all the string properties to keep them in the 256 character limit.