Save Dump object to file

Hi,

Is there a good way to save any Dumped object out to a file? My ideal would be an extra item in the Export menu of the output window, but perhaps I could just serialize instead?

As an example, I'd like to take a snapshot of the certificates on my machine with something like this:
void Main()
{
	StoreLocation[] storelocations = {StoreLocation.LocalMachine, StoreLocation.CurrentUser};
	
	X509Store store;
	
	for (int i = 0; i < storelocations.Length; i++)
	{
		store = new X509Store(StoreName.My, storelocations[i]);
		store.Open(OpenFlags.ReadOnly);
		
		var q = from cert in store.Certificates.Cast()
				orderby cert.NotBefore descending
				select cert;

		q.Dump($"{storelocations[i].ToString()} / {store.Name} ({q.Count()})", 1);
	}
}
It would be great to just save this to a file, so that later I could open and view the file as it appeared in the output window and, potentially, compare (Util.Dif) it with a more recent version.

This isn't certificate specific, it's just one of my current scenarios.

Best regards

John
Sign In or Register to comment.