public EditorModelV4() { Montage = new MontageModelV4(); Locations = new LocationsV4(this); WindowState = new WindowStateV4(); Global = new GlobalDataV4(); }
static void SaveV1(DirectoryInfo rootFolder, DirectoryInfo videoFolder, MontageModelV4 model) { using (var stream = new StreamWriter(videoFolder.FullName + "\\montage.editor")) { stream.WriteLine(new JavaScriptSerializer().Serialize(model)); } ExportV0(rootFolder, videoFolder, model); }
static void SaveV1(DirectoryInfo rootFolder, DirectoryInfo videoFolder, MontageModelV4 model) { using (var stream = new StreamWriter(videoFolder.FullName+"\\montage.editor")) { stream.WriteLine(new JavaScriptSerializer().Serialize(model)); } ExportV0(rootFolder, videoFolder, model); }
static void ExportV0(DirectoryInfo rootFolder, DirectoryInfo videoFolder, MontageModelV4 model) { File.WriteAllLines(videoFolder.FullName+"\\titles.txt", model.Information.Episodes.Select(z => z.Name).Where(z => z != null).ToArray(), Encoding.UTF8); var file = videoFolder.FullName+"\\log.txt"; MontageCommandIO.Clear(file); MontageCommandIO.AppendCommand(new MontageCommand { Action = MontageAction.StartFace, Id = 1, Time = 0 }, file); MontageCommandIO.AppendCommand(new MontageCommand { Action = MontageAction.StartScreen, Id = 2, Time = model.Shift }, file); int id = 3; var list = model.Chunks.ToList(); list.Add(new ChunkDataV4 { StartTime = list[list.Count - 1].StartTime + list[list.Count - 1].Length, Length = 0, Mode = Mode.Undefined }); var oldMode = Mode.Drop; for (int i = 0; i < list.Count; i++) { var e = list[i]; bool newEp = false; if (e.Mode != oldMode || e.StartsNewEpisode || i == list.Count - 1) { var cmd = new MontageCommand(); cmd.Id = id++; cmd.Time = e.StartTime; switch (oldMode) { case Mode.Drop: cmd.Action = MontageAction.Delete; break; case Mode.Face: cmd.Action = MontageAction.Commit; break; case Mode.Screen: cmd.Action = MontageAction.Commit; break; case Mode.Undefined: cmd.Action = MontageAction.Delete; break; } MontageCommandIO.AppendCommand(cmd, file); oldMode = e.Mode; newEp = true; } if (e.StartsNewEpisode) { MontageCommandIO.AppendCommand( new MontageCommand { Id = id++, Action = MontageAction.CommitAndSplit, Time = e.StartTime }, file ); newEp = true; } if (newEp) { if (e.Mode == Mode.Face || e.Mode == Mode.Screen) { var cmd = new MontageCommand(); cmd.Id = id++; cmd.Time = e.StartTime; switch (e.Mode) { case Mode.Face: cmd.Action = MontageAction.Face; break; case Mode.Screen: cmd.Action = MontageAction.Screen; break; } MontageCommandIO.AppendCommand(cmd, file); } } } }
static void ExportV0(DirectoryInfo rootFolder, DirectoryInfo videoFolder, MontageModelV4 model) { File.WriteAllLines(videoFolder.FullName + "\\titles.txt", model.Information.Episodes.Select(z => z.Name).Where(z => z != null).ToArray(), Encoding.UTF8); var file = videoFolder.FullName + "\\log.txt"; MontageCommandIO.Clear(file); MontageCommandIO.AppendCommand(new MontageCommand { Action = MontageAction.StartFace, Id = 1, Time = 0 }, file); MontageCommandIO.AppendCommand(new MontageCommand { Action = MontageAction.StartScreen, Id = 2, Time = model.Shift }, file); int id = 3; var list = model.Chunks.ToList(); list.Add(new ChunkDataV4 { StartTime = list[list.Count - 1].StartTime + list[list.Count - 1].Length, Length = 0, Mode = Mode.Undefined }); var oldMode = Mode.Drop; for (int i = 0; i < list.Count; i++) { var e = list[i]; bool newEp = false; if (e.Mode != oldMode || e.StartsNewEpisode || i == list.Count - 1) { var cmd = new MontageCommand(); cmd.Id = id++; cmd.Time = e.StartTime; switch (oldMode) { case Mode.Drop: cmd.Action = MontageAction.Delete; break; case Mode.Face: cmd.Action = MontageAction.Commit; break; case Mode.Screen: cmd.Action = MontageAction.Commit; break; case Mode.Undefined: cmd.Action = MontageAction.Delete; break; } MontageCommandIO.AppendCommand(cmd, file); oldMode = e.Mode; newEp = true; } if (e.StartsNewEpisode) { MontageCommandIO.AppendCommand( new MontageCommand { Id = id++, Action = MontageAction.CommitAndSplit, Time = e.StartTime }, file ); newEp = true; } if (newEp) { if (e.Mode == Mode.Face || e.Mode == Mode.Screen) { var cmd = new MontageCommand(); cmd.Id = id++; cmd.Time = e.StartTime; switch (e.Mode) { case Mode.Face: cmd.Action = MontageAction.Face; break; case Mode.Screen: cmd.Action = MontageAction.Screen; break; } MontageCommandIO.AppendCommand(cmd, file); } } } }