public void ScanForGMetrix_NoTelemetryTypeAssociations_Null() { var xml = @"<?xml version=""1.0"" encoding=""utf-8""?> <RawMovie_t xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance""> <TelemetryTypeAssociations /> </RawMovie_t>"; var result = _videoXml.ScanForGMetrix(xml); Assert.Null(result); }
static async Task Main(string[] args) { string appData = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); var virbDatabase = Path.Combine(appData, "GARMIN\\VIRB Edit\\Database\\7"); var rawMovies = Path.Combine(virbDatabase, "RawMovies"); var videoXml = new VideoXml(); string scanResultToUse = null; foreach (var clipDirectory in Directory.EnumerateDirectories(rawMovies)) { var videoXmlPath = Path.Combine(clipDirectory, "video.xml"); var videoXmlFile = await File.ReadAllTextAsync(videoXmlPath); var scanResult = videoXml.ScanForGMetrix(videoXmlFile); if (scanResult != null) { scanResultToUse = scanResult; } } if (scanResultToUse == null) { throw new ScanException("Did not find any video clip with G-Metrix connected."); } Console.WriteLine($"Will use the following G-Metrix data on all clips:\n{scanResultToUse}\n"); foreach (var clipDirectory in Directory.EnumerateDirectories(rawMovies)) { var videoXmlPath = Path.Combine(clipDirectory, "video.xml"); var videoXmlFile = await File.ReadAllTextAsync(videoXmlPath); var updatedFile = videoXml.SetGMetrix(videoXmlFile, scanResultToUse); updatedFile = videoXml.UpdateTimings(updatedFile); await File.WriteAllTextAsync(videoXmlPath, updatedFile); } Console.WriteLine("Updated all clips."); }