mirror of
https://github.com/haven1433/HexManiacAdvance.git
synced 2026-10-20 05:37:14 -05:00
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:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user