A cross-platform UI framework for .NET
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

32 lines
757 B

using System;
using System.IO;
namespace XamlNameReferenceGenerator
{
internal class NameReferenceDebugger
{
private readonly string _path;
public NameReferenceDebugger(string path) => _path = path;
public string Debug(Func<string> function)
{
if (File.Exists(_path))
File.Delete(_path);
string sourceCode;
try
{
sourceCode = function();
File.WriteAllText(_path, sourceCode);
}
catch (Exception exception)
{
File.WriteAllText(_path, exception.ToString());
sourceCode = string.Empty;
}
return sourceCode;
}
}
}