adding ability for IFileSystem to tell me when something changes on disk.

first pass at implementing the windows version of the new interface methods
IViewPort now has a public method to call whenever you want to notify it that its underlying file has been changed.
Added 3 tests showing how the Editor and ViewPort should behave with this new functionality.
- Editor should hook up ViewPorts whenever a new tab is opened
- Editor should clear out ViewPorts whenever a tab is closed
- ViewPort should reload when the file is changed and it is not.

Note that the model isn't implemented yet. This is just some failing tests.
This commit is contained in:
Benjamin Popp
2018-11-28 22:16:43 -06:00
parent c8542fb32c
commit 0b60953ecc
7 changed files with 109 additions and 6 deletions

View File

@@ -1,4 +1,6 @@
namespace HavenSoft.Gen3Hex.Model {
using System;
namespace HavenSoft.Gen3Hex.Model {
public interface IFileSystem {
string CopyText { get; set; }
@@ -34,6 +36,22 @@
/// </returns>
LoadedFile OpenFile(params string[] extensionOptions);
/// <summary>
/// Have the filesystem open a specific file.
/// </summary>
/// <returns>
/// If the file exists, it is loaded and returned.
/// If it doesn't exist, returns null.
/// </returns>
LoadedFile LoadFile(string fileName);
/// <summary>
/// When a file changes, the filesystem will call all listeners for that file.
/// </summary>
void AddListenerToFile(string fileName, Action<IFileSystem> listener);
void RemoveAllListenersForFile(string fileName);
/// <summary>
/// Saves the file without prompting the user for permission.
/// </summary>