public static Bk2Movie ToBk2(this IMovie old, bool copy = false, bool backup = false) { var bk2 = new Bk2Movie(old.Filename.Replace(old.PreferredExtension, Bk2Movie.Extension)); for (var i = 0; i < old.InputLogLength; i++) { var input = old.GetInputState(i); bk2.AppendFrame(input); } if (!copy) { old.Truncate(0); // Trying to minimize ram usage } bk2.HeaderEntries.Clear(); foreach (var kvp in old.HeaderEntries) { bk2.HeaderEntries[kvp.Key] = kvp.Value; } bk2.SyncSettingsJson = old.SyncSettingsJson; bk2.Comments.Clear(); foreach (var comment in old.Comments) { bk2.Comments.Add(comment); } bk2.Subtitles.Clear(); foreach (var sub in old.Subtitles) { bk2.Subtitles.Add(sub); } bk2.TextSavestate = old.TextSavestate; bk2.BinarySavestate = old.BinarySavestate; bk2.SaveRam = old.SaveRam; if (!backup) { bk2.Save(); } return(bk2); }
public static Bk2Movie ToBk2(this IMovie old, bool copy = false) { var newFilename = old.Filename + "." + Bk2Movie.Extension; var bk2 = new Bk2Movie(newFilename); for (var i = 0; i < old.InputLogLength; i++) { var input = old.GetInputState(i); bk2.AppendFrame(input); } if (!copy) { old.Truncate(0); // Trying to minimize ram usage } bk2.HeaderEntries.Clear(); foreach (var kvp in old.HeaderEntries) { bk2.HeaderEntries[kvp.Key] = kvp.Value; } bk2.SyncSettingsJson = old.SyncSettingsJson; bk2.Comments.Clear(); foreach (var comment in old.Comments) { bk2.Comments.Add(comment); } bk2.Subtitles.Clear(); foreach (var sub in old.Subtitles) { bk2.Subtitles.Add(sub); } bk2.TextSavestate = old.TextSavestate; bk2.BinarySavestate = old.BinarySavestate; bk2.SaveRam = old.SaveRam; bk2.Save(); return bk2; }
public static Bk2Movie ToBk2(BkmMovie old) { var bk2 = new Bk2Movie(old.Filename.Replace(old.PreferredExtension, Bk2Movie.Extension)); for (var i = 0; i < old.InputLogLength; i++) { var input = old.GetInputState(i); bk2.AppendFrame(input); } bk2.HeaderEntries.Clear(); foreach (var kvp in old.HeaderEntries) { bk2.HeaderEntries[kvp.Key] = kvp.Value; } bk2.SyncSettingsJson = old.SyncSettingsJson; bk2.Comments.Clear(); foreach (var comment in old.Comments) { bk2.Comments.Add(comment); } bk2.Subtitles.Clear(); foreach (var sub in old.Subtitles) { bk2.Subtitles.Add(sub); } bk2.TextSavestate = old.TextSavestate; bk2.BinarySavestate = old.BinarySavestate; bk2.Save(); return(bk2); }