예제 #1
0
        private FileIndexItem ReadExifAndXmpFromFileDirect(string subPath)
        {
            if (_iStorage.ExistFile(subPath) &&
                ExtensionRolesHelper.IsExtensionForceGpx(subPath))
            {
                return(ReadMetaGpx.ReadGpxFromFileReturnAfterFirstField(_iStorage.ReadStream(subPath), subPath));
            }

            var fileIndexItemWithPath = new FileIndexItem(subPath);

            // Read first the sidecar file
            var xmpFileIndexItem = _readXmp.XmpGetSidecarFile(fileIndexItemWithPath.Clone());

            if (xmpFileIndexItem.IsoSpeed == 0 ||
                string.IsNullOrEmpty(xmpFileIndexItem.Make) ||
                xmpFileIndexItem.DateTime.Year == 0 || xmpFileIndexItem.ImageHeight == 0)
            {
                // so the sidecar file is not used
                var fileExifItemFile = _readExif.ReadExifFromFile(subPath, fileIndexItemWithPath);

                // overwrite content with incomplete sidecar file (this file can contain tags)
                FileIndexCompareHelper.Compare(fileExifItemFile, xmpFileIndexItem);
                return(fileExifItemFile);
            }

            return(xmpFileIndexItem);
        }
예제 #2
0
        private List <GeoListItem> GetGpxFile(List <FileIndexItem> metaFilesInDirectory)
        {
            var geoList = new List <GeoListItem>();

            foreach (var metaFileItem in metaFilesInDirectory)
            {
                if (!ExtensionRolesHelper.IsExtensionForceGpx(metaFileItem.FileName))
                {
                    continue;
                }

                if (!_iStorage.ExistFile(metaFileItem.FilePath))
                {
                    continue;
                }

                using (var stream = _iStorage.ReadStream(metaFileItem.FilePath))
                {
                    geoList.AddRange(ReadMetaGpx.ReadGpxFile(stream, geoList));
                }
            }
            return(geoList);
        }