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


C# Classes.FileItem类代码示例

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


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

示例1: Execute

        public string Execute(FileItem item, string infile, string dest, ValuePairEnumerator configData)
        {
            var conf = new RotateTransformViewModel(configData);
            // Read from file
            using (MagickImage image = new MagickImage(infile))
            {

                image.BackgroundColor = new MagickColor(Color.Black);
                if (conf.AutoRotate)
                {
                    ExifProfile profile = image.GetExifProfile();
                    image.AutoOrient();
                    profile.SetValue(ExifTag.Orientation, (UInt16)0);
                }
                if (conf.Angle > 0)
                    image.Rotate(conf.Angle);

                if(conf.FlipHorizontal)
                    image.Flop();

                if (conf.FlipVertical)
                    image.Flip();

                image.Format = MagickFormat.Jpeg;
                // Save the result
                image.Write(dest);
            }
            return dest;
        }
开发者ID:btugade,项目名称:digiCamControl,代码行数:29,代码来源:RotateTransform.cs

示例2: Execute

        public string Execute(FileItem item, string infile, string dest, ValuePairEnumerator configData)
        {
            var conf = new CropTransformViewModel(configData);
            using (MagickImage image = new MagickImage(infile))
            {
                if (conf.FromLiveView && ServiceProvider.DeviceManager.SelectedCameraDevice != null)
                {
                    var prop = ServiceProvider.DeviceManager.SelectedCameraDevice.LoadProperties();
                    conf.Left = (int) (image.Width*prop.LiveviewSettings.HorizontalMin/100);
                    conf.Width = (image.Width*
                                  (prop.LiveviewSettings.HorizontalMax - prop.LiveviewSettings.HorizontalMin)/100);
                    conf.Top = (image.Height*prop.LiveviewSettings.VerticalMin/100);
                    conf.Height = (image.Height*(prop.LiveviewSettings.VerticalMax - prop.LiveviewSettings.VerticalMin)/
                                   100);
                }
                if (conf.CropMargins)
                {
                    conf.Left = image.Width * conf.WidthProcent / 100;
                    conf.Width = image.Width - (conf.Left*2);
                    conf.Top = image.Height * conf.HeightProcent / 100;
                    conf.Height = image.Height - (conf.Top*2);
                }

                MagickGeometry geometry = new MagickGeometry();
                geometry.Width = conf.Width;
                geometry.Height = conf.Height;
                geometry.X = conf.Left;
                geometry.Y = conf.Top;
                image.Crop(geometry);
                image.Format = MagickFormat.Jpeg;
                image.Write(dest);
            }
            return dest;
        }
开发者ID:btugade,项目名称:digiCamControl,代码行数:34,代码来源:CropTransform.cs

示例3: Execute

        public bool Execute(FileItem item, AutoExportPluginConfig configData)
        {
            configData.IsRedy = false;
            configData.IsError = false;
            var filename = item.FileName;
            var conf = new ExecuteFilePluginViewModel(configData);
            if (string.IsNullOrEmpty(conf.PathToExe) || !File.Exists(conf.PathToExe))
            {
                configData.IsRedy = true;
                configData.IsError = true;
                configData.Error = "No executable path was set or executable not found";
                return false;
            }
            var outfile = Path.Combine(Path.GetTempPath(), Path.GetFileName(filename));

            outfile = AutoExportPluginHelper.ExecuteTransformPlugins(item, configData, outfile);

            if (File.Exists(outfile))
            {
                PhotoUtils.Run(conf.PathToExe,
                    string.IsNullOrEmpty(conf.Params) ? outfile : conf.Params.Replace("%1", outfile), ProcessWindowStyle.Normal);
            }
            else
            {
                configData.IsError = true;
                configData.Error = "Output file not found !";
            }

            configData.IsRedy = true;
            return true;  
        }
开发者ID:avencherus,项目名称:digiCamControl,代码行数:31,代码来源:ExecuteFilePlugin.cs

示例4: TransformTemplate

        public string TransformTemplate(FileItem item, string text)
        {
            Regex regPattern = new Regex(@"\[(.*?)\]", RegexOptions.Singleline);
            MatchCollection matchX = regPattern.Matches(text);
            return matchX.Cast<Match>().Aggregate(text, (current1, match) => item.FileNameTemplates.Where(template => System.String.Compare(template.Name, match.Value, System.StringComparison.InvariantCultureIgnoreCase) == 0).Aggregate(current1, (current, template) => current.Replace(match.Value, template.Value)));

        }
开发者ID:CadeLaRen,项目名称:digiCamControl,代码行数:7,代码来源:BasePluginViewModel.cs

示例5: Send

        public void Send(FileItem item, AutoExportPluginConfig configData)
        {
            try
            {
                var filename = item.FileName;
                configData.IsRedy = false;
                configData.IsError = false;
                var conf = new DropboxViewModel(configData);

                var outfile = PhotoUtils.ReplaceExtension(Path.GetTempFileName(), Path.GetExtension(item.Name));
                outfile = AutoExportPluginHelper.ExecuteTransformPlugins(item, configData, outfile);

                conf.Upload(outfile, ServiceProvider.Settings.DefaultSession.Name, item.Name);

                // remove unused file
                if (outfile != item.FileName)
                {
                    PhotoUtils.WaitForFile(outfile);
                    File.Delete(outfile);
                }
            }
            catch (Exception exception)
            {
                Log.Error("Error send dropbox file", exception);
                configData.IsError = true;
                configData.Error = exception.Message;
            }
            configData.IsRedy = true;
        }
开发者ID:CadeLaRen,项目名称:digiCamControl,代码行数:29,代码来源:DropboxPlugin.cs

示例6: Execute

        public string Execute(FileItem item, string infile, string dest, ValuePairEnumerator configData)
        {
            var conf = new ChromakeyViewModel(configData);
            dest = Path.Combine(Path.GetDirectoryName(dest), Path.GetFileNameWithoutExtension(dest) + ".jpg");

            KalikoImage image = new KalikoImage(infile);
            var x = (System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString(conf.BackgroundColor);
            var filter = new ChromaKeyFilter();
            filter.KeyColor = Color.FromArgb(x.R, x.G, x.B);
            filter.ToleranceHue = conf.Hue;
            filter.ToleranceSaturnation = conf.Saturnation/100f;
            filter.ToleranceBrightness = conf.Brigthness / 100f;
            image.ApplyFilter(filter);
            var res = image.Clone();
            
            if (conf.UnsharpMask)
                res.ApplyFilter(new UnsharpMaskFilter(1.4f, 1.32f, 5));

            var backdrop = new KalikoImage(conf.BackgroundFile);
            backdrop = backdrop.Scale(new FitScaling(image.Width, image.Height));
            backdrop.BlitImage(res);

            backdrop.SaveJpg(dest, 90);
            return dest;
        }
开发者ID:CadeLaRen,项目名称:digiCamControl,代码行数:25,代码来源:Chromakey.cs

示例7: DbFile

 public DbFile(FileItem item, string serial="", string camera="", string session="")
 {
     Copy(item);
     CameraSerial = serial;
     Camera = camera;
     Session = session;
 }
开发者ID:CadeLaRen,项目名称:digiCamControl,代码行数:7,代码来源:DbFile.cs

示例8: Execute

 public bool Execute(FileItem item, AutoExportPluginConfig configData)
 {
     Thread thread = new Thread(() => Send(item, configData));
     thread.Start();
     return true;
     return true;
 }
开发者ID:felixtrusheim,项目名称:digiCamControl,代码行数:7,代码来源:DropboxPlugin.cs

示例9: Send

        public void Send(FileItem item, AutoExportPluginConfig configData)
        {
            try
            {
                var filename = item.FileName;
                configData.IsRedy = false;
                configData.IsError = false;
                var conf = new FacebookPluginViewModel(configData, false);

                var outfile = Path.Combine(Path.GetTempPath(), Path.GetFileName(filename));
                outfile = AutoExportPluginHelper.ExecuteTransformPlugins(item, configData, outfile);

                conf.UploadFile(outfile);

                // remove unused file
                if (outfile != item.FileName)
                {
                    PhotoUtils.WaitForFile(outfile);
                    File.Delete(outfile);
                }
            }
            catch (Exception exception)
            {
                Log.Error("Error send facebook file", exception);
                configData.IsError = true;
                configData.Error = exception.Message;
            }
            configData.IsRedy = true;
        }
开发者ID:avencherus,项目名称:digiCamControl,代码行数:29,代码来源:FacebookPlugin.cs

示例10: Execute

        public string Execute(FileItem item,string infile, string dest, ValuePairEnumerator configData)
        {
            var conf = new CropTransformViewModel(configData);
            using (var fileStream = new MemoryStream(File.ReadAllBytes(infile)))
            {
                BitmapDecoder bmpDec = BitmapDecoder.Create(fileStream,
                    BitmapCreateOptions.PreservePixelFormat,
                    BitmapCacheOption.OnLoad);
                WriteableBitmap writeableBitmap = BitmapFactory.ConvertToPbgra32Format(bmpDec.Frames[0]);
                if (conf.FromLiveView && ServiceProvider.DeviceManager.SelectedCameraDevice != null)
                {
                    var prop = ServiceProvider.DeviceManager.SelectedCameraDevice.LoadProperties();
                    conf.Left = (int) (writeableBitmap.PixelWidth*prop.LiveviewSettings.HorizontalMin/100);
                    conf.Width =
                        (int)
                            (writeableBitmap.PixelWidth*
                             (prop.LiveviewSettings.HorizontalMax - prop.LiveviewSettings.HorizontalMin)/100);
                    conf.Top = (int) (writeableBitmap.Height*prop.LiveviewSettings.VerticalMin/100);
                    conf.Height =
                        (int)
                            (writeableBitmap.Height*
                             (prop.LiveviewSettings.VerticalMax - prop.LiveviewSettings.VerticalMin)/100);
                }

                BitmapLoader.Save2Jpg(writeableBitmap.Crop(conf.Left,conf.Top,conf.Width,conf.Height), dest);
            }
            return dest;
        }
开发者ID:show027,项目名称:digiCamControl,代码行数:28,代码来源:CropTransform.cs

示例11: Execute

        public bool Execute(FileItem item, AutoExportPluginConfig configData)
        {
            configData.IsRedy = false;
            configData.IsError = false;
            var filename = item.FileName;
            var conf = new CopyFilePluginViewModel(configData);
            if (string.IsNullOrEmpty(conf.Path))
            {
                configData.IsRedy = true;
                configData.IsError = true;
                configData.Error = "No export path was set";
                return false;
            }
            if (!Directory.Exists(conf.Path))
                Directory.CreateDirectory(conf.Path);
            string name = item.Name;

            if (!string.IsNullOrEmpty(conf.FileName))
            {
                name = conf.FileName;
                if (name.Contains("%1"))
                    name = name.Replace("%1", Path.GetFileNameWithoutExtension(item.Name));
                if (!name.Contains("."))
                    name = name + Path.GetExtension(item.Name);
            }

            var outfile = Path.Combine(conf.Path, name);
            AutoExportPluginHelper.ExecuteTransformPlugins(item, configData, outfile);

            configData.IsRedy = true;
            return true;
        }
开发者ID:CadeLaRen,项目名称:digiCamControl,代码行数:32,代码来源:CopyFilePlugin.cs

示例12: Execute

 public string Execute(FileItem item, string infile, string dest, ValuePairEnumerator configData)
 {
     Thread thread = new Thread(() => ExecuteThread(item, infile, dest, configData));
     thread.SetApartmentState(ApartmentState.STA);
     thread.Start();
     thread.Join();
     return dest;
 }
开发者ID:vmlorenzi,项目名称:digiCamControl,代码行数:8,代码来源:OverlayTransform.cs

示例13: Execute

 public bool Execute(FileItem item, AutoExportPluginConfig configData)
 {
     //if (!configData.IsRedy)
     //    return false;
     //Print(filename, configData);
     Thread thread = new Thread(() => Print(item, configData));
     thread.SetApartmentState(ApartmentState.STA);
     thread.Start();
     return true;
 }
开发者ID:avencherus,项目名称:digiCamControl,代码行数:10,代码来源:PrintPlugin.cs

示例14: Pharse

 public string Pharse(string template, PhotoSession session, ICameraDevice device, string fileName, string tempfileName)
 {
     if (!File.Exists(tempfileName))
         return "";
     FileItem item = new FileItem(tempfileName);
     BitmapLoader.Instance.GetMetadata(item);
     string tag = template.Replace("[", "").Replace("]", "");
     if (item.FileInfo.ExifTags.ContainName(tag))
         return item.FileInfo.ExifTags[tag].Replace(":", "_").Replace("?", "_").Replace("*", "_").Replace("\\", "_"); ;
     return template;
 }
开发者ID:CadeLaRen,项目名称:digiCamControl,代码行数:11,代码来源:ExifTemplate.cs

示例15: Execute

        public bool Execute(FileItem item, AutoExportPluginConfig configData)
        {
            configData.IsRedy = false;
            configData.IsError = false;
            var filename = item.FileName;
            var conf = new TransformPluginViewModel(configData);
            var outfile = Path.GetTempFileName();
            outfile = PhotoUtils.ReplaceExtension(outfile, Path.GetExtension(filename));
            outfile = AutoExportPluginHelper.ExecuteTransformPlugins(item, configData, outfile);
            if (conf.CreateNew)
            {
                string newFile = Path.Combine(Path.GetDirectoryName(filename),
                    Path.GetFileNameWithoutExtension(filename) + "_transformed" + ".jpg");
                newFile = PhotoUtils.GetNextFileName(newFile);

                File.Copy(outfile, newFile, true);

                if (ServiceProvider.Settings.DefaultSession.GetFile(newFile) == null)
                {
                    Application.Current.Dispatcher.Invoke(new Action(() =>
                    {
                        FileItem im = new FileItem(newFile);
                        im.Transformed = true;
                        var i = ServiceProvider.Settings.DefaultSession.Files.IndexOf(item);
                        if (ServiceProvider.Settings.DefaultSession.Files.Count - 1 == i)
                        {
                            ServiceProvider.Settings.DefaultSession.Files.Add(im);
                        }
                        else
                        {
                            ServiceProvider.Settings.DefaultSession.Files.Insert(i + 1, im);
                        }
                    }));
                }
            }
            else
            {
                // wait for file to be not locked
                PhotoUtils.WaitForFile(filename);
                File.Copy(outfile, filename, true);
                item.IsLoaded = false;
                item.RemoveThumbs();
                item.Transformed = true;
            }
            // remove unused file
            if (outfile != item.FileName)
            {
                PhotoUtils.WaitForFile(outfile);
                File.Delete(outfile);
            }
            configData.IsRedy = true;
            return true;
        }
开发者ID:CadeLaRen,项目名称:digiCamControl,代码行数:53,代码来源:TransformPlugin.cs


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