Пример #1
0
        public IResource FindResource(string virtualPath)
        {
            if (CompiledResourcePair.MatchesMode(virtualPath, _resourceMode))
            {
                return(_inner.FindResource(virtualPath));
            }

            RelatedResourceInfo otherResourceInfo;

            if (CompiledResourcePair.TryGetRelatedResource(virtualPath, _resourceMode, potentialPath => _inner.FindResource(potentialPath) != null, out otherResourceInfo))
            {
                var resource        = _inner.FindResource(virtualPath);
                var relatedResource = _inner.FindResource(otherResourceInfo.RelatedPath);
                CompiledResourcePair pair;
                if (otherResourceInfo.ModeOfRelatedPath == ResourceMode.Release)
                {
                    pair = new CompiledResourcePair {
                        DebugResource = resource, ReleaseResource = relatedResource
                    }
                }
                ;
                else
                {
                    pair = new CompiledResourcePair {
                        DebugResource = relatedResource, ReleaseResource = resource
                    }
                };

                return(new ExternallyCompiledResource(pair, pair.WithMode(_resourceMode)));
            }

            return(_inner.FindResource(virtualPath));
        }
    }
Пример #2
0
 public static CompiledResourcePairCollection ExternallyCompiled(this IResource[] resources)
 {
     return((from resource1 in resources
             from resource2 in resources
             where CompiledResourcePair.IsExternallyCompiledPair(resource1, resource2)
             select new CompiledResourcePair {
         DebugResource = resource2, ReleaseResource = resource1
     })
            .ToResourcePairCollection());
 }
Пример #3
0
        public IResource FindResource(string virtualPath)
        {
            if (CompiledResourcePair.MatchesMode(virtualPath, _resourceMode))
                return _inner.FindResource(virtualPath);

            RelatedResourceInfo otherResourceInfo;
            if(CompiledResourcePair.TryGetRelatedResource(virtualPath, _resourceMode, potentialPath => _inner.FindResource(potentialPath) != null, out otherResourceInfo))
            {
                var resource = _inner.FindResource(virtualPath);
                var relatedResource = _inner.FindResource(otherResourceInfo.RelatedPath);
                CompiledResourcePair pair;
                if(otherResourceInfo.ModeOfRelatedPath == ResourceMode.Release)
                    pair = new CompiledResourcePair { DebugResource = resource, ReleaseResource = relatedResource };
                else
                    pair = new CompiledResourcePair { DebugResource = relatedResource, ReleaseResource = resource };

                return new ExternallyCompiledResource(pair, pair.WithMode(_resourceMode));
            }

            return _inner.FindResource(virtualPath);
        }
Пример #4
0
 public ExternallyCompiledResource(CompiledResourcePair pair, IResource inner)
 {
     _pair  = pair;
     _inner = inner;
 }
Пример #5
0
 public ExternallyCompiledResource(CompiledResourcePair pair, IResource inner)
 {
     _pair = pair;
     _inner = inner;
 }