Editor/Dock/TodoDock.Export.cs
using Editor;
using System.IO;
using System.Text.Json;

namespace Todo;

public sealed partial class TodoDock : Widget
{
	public void Export()
	{
		string defaultPath = Editor.FileSystem.Root.GetFullPath( "" );
		string filePath = EditorUtility.SaveFileDialog( "Export Todo Entries", "txt", defaultPath + "\\TodoEntries.txt" );

		if ( string.IsNullOrWhiteSpace( filePath ) )
		{
			Log.Error( "An invalid or empty path had been provided!" );
			return;
		}

		string json = JsonSerializer.Serialize( Cookies.Datas );

		StreamWriter file = System.IO.File.CreateText( filePath );
		file.Write( json );
		file.Close();
	}
}