Exemple #1
0
        public IDictionary <Guid, string> GetSavedUrls()
        {
            RRTracer.Trace("LocalDiskStore Looking for previously saved content.");
            var dic = new Dictionary <Guid, string>();

            if (configuration == null || string.IsNullOrEmpty(configuration.SpritePhysicalPath))
            {
                return(dic);
            }

            var activeFiles = FileWrapper.GetDatedFiles(configuration.SpritePhysicalPath, "*RequestReduce*");

            return((from files in activeFiles
                    where !files.FileName.Contains("-Expired-") && uriBuilder.ParseKey(files.FileName.Replace("\\", "/")) != Guid.Empty
                    group files by uriBuilder.ParseKey(files.FileName.Replace("\\", "/"))
                    into filegroup
                    join files2 in activeFiles on new { k = filegroup.Key, u = filegroup.Max(m => m.CreatedDate) } equals
                    new { k = uriBuilder.ParseKey(files2.FileName.Replace("\\", "/")), u = files2.CreatedDate }
                    select files2.FileName)
                   .ToDictionary(file => uriBuilder.ParseKey(file.Replace("\\", "/")),
                                 file =>
                                 uriBuilder.BuildResourceUrl(uriBuilder.ParseKey(file.Replace("\\", "/")),
                                                             uriBuilder.ParseSignature(file.Replace("\\", "/")),
                                                             RRContainer.Current.GetAllInstances <IResourceType>().
                                                             SingleOrDefault(x => file.EndsWith(x.FileName, true, CultureInfo.InvariantCulture)).GetType())));
        }