QVD file metadata

I’ve quickly made a command line utility to extract xml metadata from QVD files: QVD_Metadata.zip (4.0 KB)

Put it next to morph.exe (it needs FSharp.Core.dll).

Usage:
QVD_Metadata.exe file.qvd

It creates file.xml with the metadata header.

The source code (F#):

open System.IO

[<EntryPoint>]
let main argv = 
	try
		if argv.Length <> 1 then
			failwith "Invalid arguments. Usage: QVD_Metadata.exe file.qvd"

		let pathQVD = argv.[0]
		let pathXML = pathQVD.Replace(".qvd", ".xml")

		use fileXML = new BinaryWriter(File.Create pathXML)

		seq {
			use fileQVD = new BinaryReader(File.Open(pathQVD, FileMode.Open, FileAccess.Read))

			// A QVD file must have a zero byte therefore the end of file will never be reached.
			while 1=1 do
				yield fileQVD.ReadByte()
		}
		|> Seq.takeWhile (fun b -> b <> (byte 0))
		|> Seq.iter fileXML.Write

		0
	with
	| ex ->
		printfn "Error:%s" ex.Message
		1