Пример #1
0
        private void ReadFile(string filename)
        {
            using (var file = File.OpenRead(filename))
            {
                //data = ExifFile.Read(filename);
                data = ExifFile.Read(file);
            }

            Settings.Default.Lastfile = filename;
            Settings.Default.Save();
            lvExif.Items.Clear();
            foreach (ExifProperty item in data.Properties.Values)
            {
                ListViewItem lvitem = new ListViewItem(item.Name);
                lvitem.SubItems.Add(item.ToString());
                lvitem.SubItems.Add(Enum.GetName(typeof(IFD), ExifTagFactory.GetTagIFD(item.Tag)));
                lvitem.Tag = item;
                lvExif.Items.Add(lvitem);
            }
            if (data.Thumbnail == null)
                pbThumb.Image = null;
            else
                pbThumb.Image = new Bitmap(data.Thumbnail);
#if DEBUG
            binaryMapViewer1.Map = data.Map;
#endif

            this.Text = Path.GetFileName(filename) + " - Exif Test";
            lblStatus.Text = Path.GetFileName(filename);
            lblByteOrder.Text = "Byte Order: " + (data.ByteOrder == BitConverterEx.ByteOrder.LittleEndian ? "Little-Endian" : "Big-Endian");
            lblThumbnail.Text = "Thumbnail: " + (data.Thumbnail == null ? "None" : pbThumb.Image.Width.ToString() + "x" + pbThumb.Image.Height.ToString());

            lvExif.Sort();
        }
Пример #2
0
        private void ReadFile(string filename)
        {
            data = ExifFile.Read(filename);
            Settings.Default.Lastfile = filename;
            Settings.Default.Save();
            lvExif.Items.Clear();
            foreach (ExifProperty item in data.Properties.Values)
            {
                ListViewItem lvitem = new ListViewItem(item.Name);
                lvitem.SubItems.Add(item.ToString());
                lvitem.SubItems.Add(Enum.GetName(typeof(IFD), ExifTagFactory.GetTagIFD(item.Tag)));
                lvitem.Tag = item;
                lvExif.Items.Add(lvitem);
            }
            if (data.Thumbnail == null)
            {
                pbThumb.Image = null;
            }
            else
            {
                pbThumb.Image = data.Thumbnail.ToBitmap();
            }
#if DEBUG
            binaryMapViewer1.Map = data.Map;
#endif

            this.Text         = Path.GetFileName(filename) + " - Exif Test";
            lblStatus.Text    = Path.GetFileName(filename);
            lblByteOrder.Text = "Byte Order: " + (data.ByteOrder == BitConverterEx.ByteOrder.LittleEndian ? "Little-Endian" : "Big-Endian");
            lblThumbnail.Text = "Thumbnail: " + (data.Thumbnail == null ? "None" : data.Thumbnail.ToBitmap().Width.ToString() + "x" + data.Thumbnail.ToBitmap().Height.ToString());

            lvExif.Sort();
        }
Пример #3
0
        /// <summary>
        /// Creates a new ExifFile from the given JPEG/Exif image file.
        /// </summary>
        /// <param name="filename">Path to the JPEJ/Exif image file.</param>
        /// <returns>An ExifFile class initialized from the specified JPEG/Exif image file.</returns>
        public static ExifFile Read(string filename)
        {
            ExifFile exif = new ExifFile();

            // Read the JPEG file and process the APP1 section
            exif.Properties = new Dictionary <ExifTag, ExifProperty>();
            exif.file       = new JPEGFile(filename);
            exif.ReadAPP1();

            // Process the maker note
            exif.makerNoteProcessed = false;

            return(exif);
        }
Пример #4
0
        public static ExifFile Read(Stream fileStream)
        {
            ExifFile exif = new ExifFile();

            // Read the JPEG file and process the APP1 section
            exif.Properties = new Dictionary <ExifTag, ExifProperty>();
            exif.file       = new JPEGFile();
            if (!exif.file.Read(fileStream))
            {
                exif.file = null;
                exif      = null;
                return(null);
            }
            exif.ReadAPP1();

            // Process the maker note
            exif.makerNoteProcessed = false;

            return(exif);
        }
Пример #5
0
        /// <summary>
        /// Creates a new ExifFile from the given JPEG/Exif image file.
        /// </summary>
        /// <param name="filename">Path to the JPEJ/Exif image file.</param>
        /// <returns>An ExifFile class initialized from the specified JPEG/Exif image file.</returns>
        public static ExifFile Read(string filename)
        {
            ExifFile exif = new ExifFile();

            // Read the JPEG file and process the APP1 section
            exif.Properties = new Dictionary<ExifTag, ExifProperty>();
            exif.file = new JPEGFile(filename);
            exif.ReadAPP1();

            // Process the maker note
            exif.makerNoteProcessed = false;

            return exif;
        }
Пример #6
0
		public static ExifFile Read(Stream fileStream)
        {
            ExifFile exif = new ExifFile();

            // Read the JPEG file and process the APP1 section
            exif.Properties = new Dictionary<ExifTag, ExifProperty>();
            exif.file = new JPEGFile();
			if(!exif.file.Read(fileStream))
			{
				exif.file = null;
				exif = null;
				return null;
			}
            exif.ReadAPP1();

            // Process the maker note
            exif.makerNoteProcessed = false;

            return exif;
        }
Пример #7
0
        /// <summary>
        /// JPEG/Exif image file을 이용해서 새로운 ExifFile객체를 생성합니다.
        /// </summary>
        /// <param name="buffer">JPEG/Exif 파일의 데이터가 들어있는 배열입니다.</param>
        /// <returns>JPEG/Exif 데이터로 초기화된 ExifFile 클래스입니다.</returns>
        public static ExifFile Read(byte[] buffer)
        {
            ExifFile exif = new ExifFile();

            // Read the JPEG file and process the APP1 section
            exif.Properties = new Dictionary<ExifTag, ExifProperty>();

            using (var stream = new MemoryStream(buffer))
                exif.file = new JPEGFile(stream);

            exif.ReadAPP1();

            // Process the maker note
            exif.makerNoteProcessed = false;
            return exif;
        }