//Command for Drag and Drop void DragAndDrop(DragEventArgs e) { string[] handles = (string[])e.Data.GetData(DataFormats.FileDrop, false); foreach (var item in handles) { FileInfo fileInfo = new FileInfo(item); imageList.AddPhoto(fileInfo.Name, fileInfo.FullName, fileInfo.Extension); ListFiles(); } }
void TestSave() { PS8 ps8 = new PS8(); ps8.Speed = 500; for (int i = 1; i <= 3; i++) { ps8.AddPhoto("this is a test" + i, "path" + i); } PS8Writer.Save(ps8, Application.StartupPath + @"/playlist2.txt"); }
public static PS8 Read(string ps8file) { string ps8strnig = PS8String(ps8file); using (StringReader reader = new StringReader(ps8strnig)) { try{ PS8 ps8 = new PS8(); string[] header = reader.ReadLine().Split('|'); if (header[0] != "PS8") { throw new PS8Exception("Invalid Photo Slide playlist format."); } else { if (header[1] == string.Empty) { throw new PS8Exception("Invalid Photo Slide playlist format. Interval not defined"); } else { if (Convert.ToInt32(header[1]) <= 100) { ps8.Speed = 1000; } else { ps8.Speed = Convert.ToInt32(header[1]); } } while (reader.Peek() != -1) { string[] d = reader.ReadLine().Split('|'); ps8.AddPhoto(d[0], d[1], d[2]); } return(ps8); } } catch (Exception ex) { throw new PS8Exception("Invalid Photo Slide playlist format\n" + ex.Message); } } }