Prefer to use events directly, rather than through "On" methods

This commit is contained in:
Adrian Conlon
2025-03-29 11:31:47 +00:00
parent 87abbaa75e
commit b461eb97d6
9 changed files with 92 additions and 108 deletions
+4 -12
View File
@@ -42,9 +42,9 @@ namespace EightBit
public byte Read()
{
this.OnReadingByte();
this.ReadingByte?.Invoke(this, EventArgs.Empty);
var returned = this.Data = this.Reference();
this.OnReadByte();
ReadByte?.Invoke(this, EventArgs.Empty);
return returned;
}
@@ -67,9 +67,9 @@ namespace EightBit
public void Write()
{
this.OnWritingByte();
this.WritingByte?.Invoke(this, EventArgs.Empty);
this.Reference() = this.Data;
this.OnWrittenByte();
this.WrittenByte?.Invoke(this, EventArgs.Empty);
}
public void Write(byte value)
@@ -106,14 +106,6 @@ namespace EightBit
public abstract void Initialize();
protected virtual void OnWritingByte() => WritingByte?.Invoke(this, EventArgs.Empty);
protected virtual void OnWrittenByte() => WrittenByte?.Invoke(this, EventArgs.Empty);
protected virtual void OnReadingByte() => ReadingByte?.Invoke(this, EventArgs.Empty);
protected virtual void OnReadByte() => ReadByte?.Invoke(this, EventArgs.Empty);
protected ref byte Reference(ushort absolute)
{
var mapped = this.Mapping(absolute);