当前位置: 首页>>代码示例>>C#>>正文


C# FileItem.LoadInfo方法代码示例

本文整理汇总了C#中CameraControl.Core.Classes.FileItem.LoadInfo方法的典型用法代码示例。如果您正苦于以下问题:C# FileItem.LoadInfo方法的具体用法?C# FileItem.LoadInfo怎么用?C# FileItem.LoadInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CameraControl.Core.Classes.FileItem的用法示例。


在下文中一共展示了FileItem.LoadInfo方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetData

        public void SetData(BitmapFile file, FileItem fileItem)
        {
            if (fileItem == null || fileItem.FileInfo == null)
                return;
            fileItem.LoadInfo();
            file.FileName = Path.GetFileNameWithoutExtension(fileItem.FileName);
            file.Comment = "";
            if (fileItem.FileInfo.ExifTags.ContainName("Iptc.Application2.Caption"))
                file.Comment = fileItem.FileInfo.ExifTags["Iptc.Application2.Caption"];

            file.Metadata.Clear();
            foreach (ValuePair item in fileItem.FileInfo.ExifTags.Items)
            {
                file.Metadata.Add(new DictionaryItem() { Name = item.Name, Value = item.Value });
            }
            file.BlueColorHistogramPoints = ConvertToPointCollection(fileItem.FileInfo.HistogramBlue);
            file.RedColorHistogramPoints = ConvertToPointCollection(fileItem.FileInfo.HistogramRed);
            file.GreenColorHistogramPoints = ConvertToPointCollection(fileItem.FileInfo.HistogramGreen);
            file.LuminanceHistogramPoints = ConvertToPointCollection(fileItem.FileInfo.HistogramLuminance);

            // file.InfoLabel = Path.GetFileName(file.FileItem.FileName);
            file.InfoLabel = "";
            //file.InfoLabel += String.Format(" | {0}x{1}", fileItem.FileInfo.Width, fileItem.FileInfo.Height);
            if (fileItem.FileInfo.ExifTags.ContainName("Exif.Photo.ExposureTime"))
            {
                file.InfoLabel += "E " + fileItem.FileInfo.ExifTags["Exif.Photo.ExposureTime"];
            }
            if (fileItem.FileInfo.ExifTags.ContainName("Exif.Photo.FNumber"))
            {
                file.InfoLabel += " | " + fileItem.FileInfo.ExifTags["Exif.Photo.FNumber"];
            }
            if (fileItem.FileInfo.ExifTags.ContainName("Exif.Photo.ISOSpeedRatings"))
            {
                file.InfoLabel += " | ISO " + fileItem.FileInfo.ExifTags["Exif.Photo.ISOSpeedRatings"];
            }
            if (fileItem.FileInfo.ExifTags.ContainName("Exif.Photo.FocalLength"))
            {
                file.InfoLabel += " | " + fileItem.FileInfo.ExifTags["Exif.Photo.FocalLength"];
            }
            SetImageInfo(fileItem);
        }
开发者ID:CadeLaRen,项目名称:digiCamControl,代码行数:41,代码来源:BitmapLoader.cs

示例2: LoadImage

        public WriteableBitmap LoadImage(FileItem fileItem, bool fullres, bool showfocuspoints)
        {
            if (fileItem == null)
                return null;
            if (!File.Exists(fileItem.LargeThumb) && !fullres)
                return null;
            if (File.Exists(fileItem.InfoFile))
                fileItem.LoadInfo();
            if (fileItem.FileInfo == null)
                fileItem.FileInfo = new FileInfo();

            try
            {
                BitmapDecoder bmpDec = null;
                if (fullres && fileItem.IsRaw)
                {
                    try
                    {
                        string dcraw_exe = Path.Combine(Settings.ApplicationFolder, "dcraw.exe");
                        if (File.Exists(dcraw_exe))
                        {
                            string thumb = Path.Combine(Path.GetTempPath(),
                                Path.GetFileNameWithoutExtension(fileItem.FileName) + ".thumb.jpg");
                            PhotoUtils.RunAndWait(dcraw_exe,
                                string.Format(" -e -O \"{0}\" \"{1}\"", thumb, fileItem.FileName));
                            if (File.Exists(thumb))
                            {
                                bmpDec = BitmapDecoder.Create(new Uri(thumb), BitmapCreateOptions.None, BitmapCacheOption.OnLoad);
                                File.Delete(thumb);
                            }
                        }
                    }
                    catch (Exception exception)
                    {
                        Log.Error("Error get dcraw thumb", exception);
                    }
                }

                PhotoUtils.WaitForFile(fullres ? fileItem.FileName : fileItem.LargeThumb);
                if (bmpDec == null)
                    bmpDec = BitmapDecoder.Create(new Uri(fullres ? fileItem.FileName : fileItem.LargeThumb),
                        BitmapCreateOptions.None,
                        BitmapCacheOption.OnLoad);
                // if no future processing required
                if (!showfocuspoints && ServiceProvider.Settings.RotateIndex == 0 && !ServiceProvider.Settings.FlipPreview)
                {
                    fileItem.Loading = false;
                    var b = new WriteableBitmap(bmpDec.Frames[0]);
                    b.Freeze();
                    return b;
                }

                var bitmap = BitmapFactory.ConvertToPbgra32Format(bmpDec.Frames[0]);

                if (showfocuspoints && !fileItem.Transformed)
                    DrawFocusPoints(fileItem, bitmap);

                if (ServiceProvider.Settings.RotateIndex != 0)
                {
                    switch (ServiceProvider.Settings.RotateIndex)
                    {
                        case 1:
                            bitmap = bitmap.Rotate(90);
                            break;
                        case 2:
                            bitmap = bitmap.Rotate(180);
                            break;
                        case 3:
                            bitmap = bitmap.Rotate(270);
                            break;
                    }
                }

                if (ServiceProvider.Settings.FlipPreview)
                {
                    bitmap = bitmap.Flip(WriteableBitmapExtensions.FlipMode.Vertical);
                }

                bitmap.Freeze();
                return bitmap;
            }
            catch (Exception exception)
            {
                Log.Error("Error loading image", exception);
                if (exception.GetType() == typeof(OutOfMemoryException) && fullres)
                {
                    return LoadImage(fileItem, false);
                }
            }
            return null;
        }
开发者ID:CadeLaRen,项目名称:digiCamControl,代码行数:91,代码来源:BitmapLoader.cs

示例3: LoadImage

        public WriteableBitmap LoadImage(FileItem fileItem, bool fullres)
        {
            if (ServiceProvider.Settings.LowMemoryUsage)
                fullres = false;

            if (fileItem == null)
                return null;
            if (!File.Exists(fileItem.LargeThumb) && !fullres)
                return null;

            if (File.Exists(fileItem.InfoFile))
                fileItem.LoadInfo();
            else
                fileItem.FileInfo = new FileInfo();

            try
            {
                BitmapDecoder bmpDec = null;
                if (fullres && fileItem.IsRaw)
                {
                    try
                    {
                        string dcraw_exe = Path.Combine(Settings.ApplicationFolder, "dcraw.exe");
                        if (File.Exists(dcraw_exe))
                        {
                            PhotoUtils.RunAndWait(dcraw_exe, string.Format(" -e {0}", fileItem.FileName));
                            string thumb = Path.Combine(Path.GetDirectoryName(fileItem.FileName),
                                Path.GetFileNameWithoutExtension(fileItem.FileName) + ".thumb.jpg");
                            if (File.Exists(thumb))
                            {
                                bmpDec = BitmapDecoder.Create(new Uri(thumb),BitmapCreateOptions.None,BitmapCacheOption.OnLoad);
                                File.Delete(thumb);
                            }
                        }
                    }
                    catch (Exception exception)
                    {
                        Log.Error("Error get dcraw thumb", exception);
                    }
                }

                if (bmpDec == null)
                    bmpDec = BitmapDecoder.Create(new Uri(fullres ? fileItem.FileName : fileItem.LargeThumb),
                        BitmapCreateOptions.None,
                        BitmapCacheOption.OnLoad);

                double dw = (double) MaxThumbSize/bmpDec.Frames[0].PixelWidth;
                WriteableBitmap bitmap;
                if (fullres)
                    bitmap =
                        BitmapFactory.ConvertToPbgra32Format(GetBitmapFrame(bmpDec.Frames[0],
                                                                            (int) (bmpDec.Frames[0].PixelWidth*dw),
                                                                            (int) (bmpDec.Frames[0].PixelHeight*dw),
                                                                            BitmapScalingMode.NearestNeighbor));
                else
                    bitmap = BitmapFactory.ConvertToPbgra32Format(bmpDec.Frames[0]);

                if (ServiceProvider.Settings.ShowFocusPoints)
                    DrawFocusPoints(fileItem, bitmap);

                if (fileItem.FileInfo !=null && fileItem.FileInfo.ExifTags.ContainName("Exif.Image.Orientation") )
                {
                    if (fileItem.FileInfo.ExifTags["Exif.Image.Orientation"] == "bottom, right")
                        bitmap = bitmap.Rotate(180);

                    //if (fileItem.FileInfo.ExifTags["Exif.Image.Orientation"] == "top, left")
                    //    bitmap = bitmap.Rotate(180);

                    if (fileItem.FileInfo.ExifTags["Exif.Image.Orientation"] == "right, top")
                        bitmap = bitmap.Rotate(90);

                    if (fileItem.FileInfo.ExifTags["Exif.Image.Orientation"] == "left, bottom")
                        bitmap = bitmap.Rotate(270);
                }

                if (ServiceProvider.Settings.RotateIndex != 0)
                {
                    switch (ServiceProvider.Settings.RotateIndex)
                    {
                        case 1:
                            bitmap = bitmap.Rotate(90);
                            break;
                        case 2:
                            bitmap = bitmap.Rotate(180);
                            break;
                        case 3:
                            bitmap = bitmap.Rotate(270);
                            break;
                    }
                }

                bitmap.Freeze();
                return bitmap;
            }
            catch (Exception exception)
            {
                Log.Error("Error loading image", exception);
            }
            return null;
        }
开发者ID:tomriddle1234,项目名称:digiCamControl,代码行数:100,代码来源:BitmapLoader.cs

示例4: LoadImage

        public WriteableBitmap LoadImage(FileItem fileItem, bool fullres, bool showfocuspoints)
        {
            int rotation = 0;
            if (fileItem == null)
                return null;
            if (!File.Exists(fileItem.LargeThumb) && !fullres)
                return null;

            if (File.Exists(fileItem.InfoFile))
                fileItem.LoadInfo();
            else
                fileItem.FileInfo = new FileInfo();

            try
            {
                BitmapDecoder bmpDec = null;
                if (fullres && fileItem.IsRaw)
                {
                    try
                    {
                        string dcraw_exe = Path.Combine(Settings.ApplicationFolder, "dcraw.exe");
                        if (File.Exists(dcraw_exe))
                        {
                            PhotoUtils.RunAndWait(dcraw_exe, string.Format(" -e \"{0}\"", fileItem.FileName));
                            string thumb = Path.Combine(Path.GetDirectoryName(fileItem.FileName),
                                Path.GetFileNameWithoutExtension(fileItem.FileName) + ".thumb.jpg");
                            if (File.Exists(thumb))
                            {
                                bmpDec = BitmapDecoder.Create(new Uri(thumb),BitmapCreateOptions.None,BitmapCacheOption.OnLoad);
                                File.Delete(thumb);
                            }
                        }
                    }
                    catch (Exception exception)
                    {
                        Log.Error("Error get dcraw thumb", exception);
                    }
                }

                if (ServiceProvider.Settings.Autorotate && fileItem.FileInfo != null && fileItem.FileInfo.ExifTags.ContainName("Exif.Image.Orientation"))
                {
                    if (fileItem.FileInfo.ExifTags["Exif.Image.Orientation"] == "bottom, right")
                        rotation = 180;

                    //if (fileItem.FileInfo.ExifTags["Exif.Image.Orientation"] == "top, left")
                    //    bitmap = bitmap.Rotate(180);

                    if (fileItem.FileInfo.ExifTags["Exif.Image.Orientation"] == "right, top")
                        rotation = 90;

                    if (fileItem.FileInfo.ExifTags["Exif.Image.Orientation"] == "left, bottom")
                        rotation = 270;

                }

                if (bmpDec == null)
                    bmpDec = BitmapDecoder.Create(new Uri(fullres ? fileItem.FileName : fileItem.LargeThumb),
                        BitmapCreateOptions.None,
                        BitmapCacheOption.OnLoad);
                // if no future processing required
                if (rotation == 0 && !showfocuspoints && ServiceProvider.Settings.RotateIndex == 0 && ServiceProvider.Settings.FlipPreview)
                {
                    return new WriteableBitmap(bmpDec.Frames[0]);
                }

                var bitmap = BitmapFactory.ConvertToPbgra32Format(bmpDec.Frames[0]);

                if (showfocuspoints)
                    DrawFocusPoints(fileItem, bitmap);

                if (rotation != 0)
                    bitmap = bitmap.Rotate(rotation);

                if (ServiceProvider.Settings.RotateIndex != 0)
                {
                    switch (ServiceProvider.Settings.RotateIndex)
                    {
                        case 1:
                            bitmap = bitmap.Rotate(90);
                            break;
                        case 2:
                            bitmap = bitmap.Rotate(180);
                            break;
                        case 3:
                            bitmap = bitmap.Rotate(270);
                            break;
                    }
                }

                if (ServiceProvider.Settings.FlipPreview)
                {
                    bitmap = bitmap.Flip(WriteableBitmapExtensions.FlipMode.Vertical);
                }

                bitmap.Freeze();
                return bitmap;
            }
            catch (Exception exception)
            {
                Log.Error("Error loading image", exception);
//.........这里部分代码省略.........
开发者ID:btugade,项目名称:digiCamControl,代码行数:101,代码来源:BitmapLoader.cs

示例5: LoadImage

        public WriteableBitmap LoadImage(FileItem fileItem, bool fullres)
        {
            if (ServiceProvider.Settings.LowMemoryUsage)
                fullres = false;

            if (fileItem == null)
                return null;
            if (!File.Exists(fileItem.LargeThumb) && !fullres)
                return null;

            if (File.Exists(fileItem.InfoFile))
                fileItem.LoadInfo();
            else
                fileItem.FileInfo = new FileInfo();

            try
            {
                BitmapDecoder bmpDec = BitmapDecoder.Create(new Uri(fullres ? fileItem.FileName : fileItem.LargeThumb),
                                                            BitmapCreateOptions.None,
                                                            BitmapCacheOption.OnLoad);

                double dw = (double)MaxThumbSize / bmpDec.Frames[0].PixelWidth;
                WriteableBitmap bitmap;
                if(fullres)
                bitmap =
                    BitmapFactory.ConvertToPbgra32Format(GetBitmapFrame(bmpDec.Frames[0],
                                                                        (int)(bmpDec.Frames[0].PixelWidth * dw),
                                                                        (int)(bmpDec.Frames[0].PixelHeight * dw),
                                                                        BitmapScalingMode.NearestNeighbor));
                else
                    bitmap = BitmapFactory.ConvertToPbgra32Format(bmpDec.Frames[0]);

                if (ServiceProvider.Settings.ShowFocusPoints)
                    DrawFocusPoints(fileItem, bitmap);

                if (fileItem.FileInfo.ExifTags.ContainName("Exif.Image.Orientation") && !fileItem.IsRaw)
                {
                    if (fileItem.FileInfo.ExifTags["Exif.Image.Orientation"] == "bottom, right")
                        bitmap =  bitmap.Rotate(180);

                    //if (fileItem.FileInfo.ExifTags["Exif.Image.Orientation"] == "top, left")
                    //    bitmap = bitmap.Rotate(180);

                    if (fileItem.FileInfo.ExifTags["Exif.Image.Orientation"] == "right, top")
                        bitmap = bitmap.Rotate(90);

                    if (fileItem.FileInfo.ExifTags["Exif.Image.Orientation"] == "left, bottom")
                        bitmap = bitmap.Rotate(270);
                }

                if (ServiceProvider.Settings.RotateIndex != 0)
                {
                    switch (ServiceProvider.Settings.RotateIndex)
                    {
                        case 1:
                            bitmap = bitmap.Rotate(90);
                            break;
                        case 2:
                            bitmap = bitmap.Rotate(180);
                            break;
                        case 3:
                            bitmap = bitmap.Rotate(270);
                            break;
                    }
                }

                bitmap.Freeze();
                return bitmap;
            }
            catch (Exception exception)
            {
                Log.Error("Error loading image", exception);
            }
            return null;
        }
开发者ID:brunoklein99,项目名称:nikon-camera-control,代码行数:75,代码来源:BitmapLoader.cs


注:本文中的CameraControl.Core.Classes.FileItem.LoadInfo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。