Exemplo n.º 1
0
        public string Read(Stream imageStream, int propId)
        {
            if (imageStream == null || !imageStream.CanRead)
            {
                throw new ArgumentException("imageStream isn't validate", "imageStream");
            }
            Image  image = Image.FromStream(imageStream);
            string empty = EXIFMetaDataService.GetValueOfType(image.GetPropertyItem(propId));

            return(empty);
        }
Exemplo n.º 2
0
        private static string GetValueOfType(PropertyItem propItem)
        {
            switch (propItem.Type)
            {
            case 1:
            {
                return(EXIFMetaDataService.GetValueOfType1(propItem.Value));
            }

            case 2:
            {
                return(EXIFMetaDataService.GetValueOfType2(propItem.Value));
            }

            case 3:
            {
                return(EXIFMetaDataService.GetValueOfType3(propItem.Value));
            }

            case 4:
            {
                return(EXIFMetaDataService.GetValueOfType4(propItem.Value));
            }

            case 5:
            {
                return(EXIFMetaDataService.GetValueOfType5(propItem.Value));
            }

            case 6:
            {
                return(string.Empty);
            }

            case 7:
            {
                return(EXIFMetaDataService.GetValueOfType7(propItem.Value, propItem.Id));
            }

            default:
            {
                return(string.Empty);
            }
            }
        }
Exemplo n.º 3
0
        public Dictionary <int, string> Read(Stream imageStream)
        {
            if (imageStream == null || !imageStream.CanRead)
            {
                throw new ArgumentException("imageStream isn't validate", "imageStream");
            }
            Image image = Image.FromStream(imageStream);
            Dictionary <int, string> nums = null;

            if (image.PropertyItems != null)
            {
                nums = new Dictionary <int, string>();
                int[] enabledEXIFIds = this.EnabledEXIFIds;
                for (int i = 0; i < (int)enabledEXIFIds.Length; i++)
                {
                    int num = enabledEXIFIds[i];
                    if (image.PropertyIdList.Contains <int>(num))
                    {
                        nums[num] = EXIFMetaDataService.GetValueOfType(image.GetPropertyItem(num));
                    }
                }
            }
            return(nums);
        }