private void btnOpen_Click(object sender, EventArgs e) { using (OpenFileDialog ofd = new OpenFileDialog()) { ofd.Filter = "Lytro Files (*.lfp)|*.lfp|All Files (*.*)|*.*"; if (ofd.ShowDialog(this) == System.Windows.Forms.DialogResult.OK) { if (File.Exists(ofd.FileName)) { try { lfp = new LytroFile(ofd.FileName); lfp.Load(); } catch (Exception ex) { ShowError("Could not load Lytro file:" + Environment.NewLine + ex.Message); return; } ComboItem[] items = new ComboItem[lfp.JpegSections.Count]; for (int i = 0; i < items.Length; i++) { items[i] = new ComboItem(string.Format("{0}_{1}", lfp.Filename, i), i); } cbImages.DataSource = items; cbImages.DisplayMember = "Text"; cbImages.ValueMember = "Value"; } } } }
static void Main(string[] args) { if (args.Length < 1) { WL("Usage: lytrosplitter file[.lfp] [... fileN[.lfp]]"); return; } foreach (string arg in args) { try { FileInfo fi = new FileInfo(arg); if (!fi.Exists) { throw new FileNotFoundException("Could not find file", arg); } string dir = Directory.GetParent(arg).FullName; LytroFile lfp = new LytroFile(arg); lfp.Load(); lfp.Export(dir); } catch (Exception ex) { WL(ex.Message); } } Console.WriteLine("Press any key to exit..."); Console.ReadKey(); }