private void ImportCsv(string filename)
            {
                try {
                    if (_wrapper == null)
                    {
                        throw new InformativeException("Can’t import CSV-file",
                                                       "LUTLibrary.dll missing or can’t be loaded.");
                    }

                    var name = Prompt.Show("Choose a name for the new LUT setting:", "New LUT",
                                           Path.GetFileNameWithoutExtension(filename) + ".lut", "?", required: true, maxLength: 120);
                    if (string.IsNullOrWhiteSpace(name))
                    {
                        return;
                    }

                    if (!name.EndsWith(@".lut", StringComparison.OrdinalIgnoreCase))
                    {
                        name += @".lut";
                    }

                    var lutData = new LutDataFile();
                    var lut     = _wrapper.ToLut(filename);
                    if (lut == null)
                    {
                        throw new Exception(@"Expected field or method is missing");
                    }

                    lutData.Values.AddRange(lut);
                    lutData.Save(Path.Combine(AcPaths.GetDocumentsCfgDirectory(), name));
                    SwitchFfPostProcessLutName(name);
                } catch (Exception e) {
                    NonfatalError.Notify("Can’t import CSV-file", e);
                }
            }
Esempio n. 2
0
 private void ReloadLut()
 {
     _lutLoading.DoDelay(() => {
         try {
             if (string.IsNullOrWhiteSpace(LutName))
             {
                 LutGraphData = null;
             }
             else
             {
                 var filename = Path.Combine(FileUtils.GetDocumentsCfgDirectory(), LutName);
                 if (File.Exists(filename))
                 {
                     var lut = new LutDataFile(filename).Values;
                     lut.TransformSelf(x => new LutPoint(x.X * 100, x.Y * 100));
                     LutGraphData = new GraphData(lut);
                 }
                 else
                 {
                     LutGraphData = null;
                 }
             }
         } catch (Exception e) {
             Logging.Warning(e);
             LutGraphData = null;
         }
     }, 50);
 }