diff --git a/MatroskaLib/MatroskaLib/MatroskaWriter.cs b/MatroskaLib/MatroskaLib/MatroskaWriter.cs index 8806a97..4b148d7 100644 --- a/MatroskaLib/MatroskaLib/MatroskaWriter.cs +++ b/MatroskaLib/MatroskaLib/MatroskaWriter.cs @@ -8,7 +8,7 @@ namespace MatroskaLib; public static class MatroskaWriter { - public static void WriteMkvFile(MkvFile mkfFile) + public static void WriteMkvFile(MkvFile mkfFile, bool dryRun = false) { using var dataStream = File.Open(mkfFile.filePath, FileMode.Open); dataStream.Seek(0, SeekOrigin.Begin); @@ -25,6 +25,7 @@ public static void WriteMkvFile(MkvFile mkfFile) offset, lsBytes); // Write modified changes to file + if (dryRun) return; dataStream.Seek(0, SeekOrigin.Begin); dataStream.Write(lsBytes.ToArray(), 0, lsBytes.Count); } diff --git a/MkvReadCrawler/Program.cs b/MkvReadCrawler/Program.cs index c778a0a..30bf708 100644 --- a/MkvReadCrawler/Program.cs +++ b/MkvReadCrawler/Program.cs @@ -28,7 +28,7 @@ static void Main(string[] args) try { var lsFiles = MatroskaReader.ReadMkvFiles([mkvFile]); - MatroskaWriter.WriteMkvFile(lsFiles[0], true); + MatroskaWriter.WriteMkvFile(lsFiles[0], dryRun:true); stringBuilder.AppendLine("Track count:" + lsFiles[0].tracks.Count); } catch (Exception e)