public LocalResourceLoader(IResourceProvider provider, string rootPath, string resourcePath,
                            IRawConverter <TResource> converter, Action <string> logAction) : base(provider, resourcePath)
 {
     RootPath       = rootPath;
     this.logAction = logAction;
     this.converter = converter;
 }
예제 #2
0
 public PhotoProcessor(PhotoPathHelper pathHelper, 
                       IPhotoOptimizer photoOptimizer, 
                       IRawConverter rawConverter, 
                       IExifReader exifReader,
                       IQualitySearcher qualitySearcher,
                       ProcessingTarget sourceTarget,
                       ProcessingTarget printTarget,  
                       ProcessingTarget xsTarget, 
                       ProcessingTarget smTarget, 
                       ProcessingTarget mdTarget, 
                       ProcessingTarget lgTarget, 
                       bool quiet)
 {
     _quiet = quiet;
     _pathHelper = pathHelper;
     _optimizer = photoOptimizer;
     _rawConverter = rawConverter;
     _exifReader = exifReader;
     _qualitySearcher = qualitySearcher;
     
     SourceTarget = sourceTarget;
     PrintTarget = printTarget;
     XsTarget = xsTarget;
     SmTarget = smTarget;
     MdTarget = mdTarget;
     LgTarget = lgTarget;
 }
예제 #3
0
 /// <summary>
 /// Adds a resource type converter.
 /// </summary>
 public void AddConverter <T> (IRawConverter <T> converter)
 {
     if (converters.ContainsKey(typeof(T)))
     {
         return;
     }
     converters.Add(typeof(T), converter);
 }
 public LocalResourceLoader(string rootPath, Resource <TResource> resource,
                            IRawConverter <TResource> converter, Action <string> logAction)
 {
     RootPath       = rootPath;
     Resource       = resource;
     this.logAction = logAction;
     this.converter = converter;
 }
 /// <summary>
 /// Adds a resource type converter.
 /// </summary>
 public void AddConverter <T> (IRawConverter <T> converter)
 {
     if (converters.ContainsKey(typeof(T)))
     {
         return;
     }
     converters.Add(typeof(T), converter);
     LogMessage($"Converter '{typeof(T).Name}' added.");
 }
예제 #6
0
 public RAWExposureData(
     IRawConverter rawConverter,
     byte[] rawBytes,
     string rawType,
     int bitDepth,
     ImageMetaData metaData)
     : base(bitDepth, metaData)
 {
     this.rawConverter = rawConverter;
     this.rawBytes     = rawBytes;
     this.rawType      = rawType;
 }
예제 #7
0
        public GoogleDriveResourceLoader(IResourceProvider provider, string rootPath, string resourcePath,
                                         IRawConverter <TResource> converter, Action <string> logAction) : base(provider, resourcePath)
        {
            RootPath          = rootPath;
            useNativeRequests = nativeRequestTypes.Contains(typeof(TResource));
            this.logAction    = logAction;

            // MP3 is not supported in native requests on the standalone platforms. Fallback to raw converters.
            #if UNITY_STANDALONE || UNITY_EDITOR
            foreach (var r in converter.Representations)
            {
                if (WebUtils.EvaluateAudioTypeFromMime(r.MimeType) == AudioType.MPEG)
                {
                    useNativeRequests = false;
                }
            }
            #endif

            this.converter = converter;
        }
예제 #8
0
        public static List <string> LocateResources(string rootPath, string resourcesPath, IRawConverter <TResource> converter)
        {
            var locatedResources = new List <string>();

            // 1. Resolving parent folder.
            var folderPath = Application.dataPath;

            if (!string.IsNullOrEmpty(rootPath) && !string.IsNullOrEmpty(resourcesPath))
            {
                folderPath += string.Concat('/', rootPath, '/', resourcesPath);
            }
            else if (string.IsNullOrEmpty(rootPath))
            {
                folderPath += string.Concat('/', resourcesPath);
            }
            else
            {
                folderPath += string.Concat('/', rootPath);
            }
            var parendFolder = new DirectoryInfo(folderPath);

            if (!parendFolder.Exists)
            {
                return(locatedResources);
            }

            // 2. Searching for the files in the folder.
            var results = new Dictionary <RawDataRepresentation, List <FileInfo> >();

            foreach (var representation in converter.Representations.DistinctBy(r => r.Extension))
            {
                var files = parendFolder.GetFiles(string.Concat("*", representation.Extension)).ToList();
                if (files != null && files.Count > 0)
                {
                    results.Add(representation, files);
                }
            }

            // 3. Create resources using located files.
            foreach (var result in results)
            {
                foreach (var file in result.Value)
                {
                    var fileName = string.IsNullOrEmpty(result.Key.Extension) ? file.Name : file.Name.GetBeforeLast(".");
                    var filePath = string.IsNullOrEmpty(resourcesPath) ? fileName : string.Concat(resourcesPath, '/', fileName);
                    locatedResources.Add(filePath);
                }
            }

            return(locatedResources);
        }
예제 #9
0
 public LocalResourceLocator(IResourceProvider provider, string rootPath, string resourcesPath,
                             IRawConverter <TResource> converter) : base(provider, resourcesPath)
 {
     RootPath       = rootPath;
     this.converter = converter;
 }
 public LocalResourceLocator(string rootPath, string resourcesPath, IRawConverter <TResource> converter)
 {
     RootPath       = rootPath;
     ResourcesPath  = resourcesPath;
     this.converter = converter;
 }
 public FastReviewPhotoProcessor(PhotoPathHelper pathHelper,
     IRawConverter rawConverter)
 {
     _pathHelper = pathHelper;
     _rawConverter = rawConverter;
 }