Skip to content

Commit

Permalink
refactor(DaedalusInstance): don't allow caching instances
Browse files Browse the repository at this point in the history
  • Loading branch information
lmichaelis committed Dec 28, 2023
1 parent f275a35 commit c6b7164
Showing 1 changed file with 1 addition and 40 deletions.
41 changes: 1 addition & 40 deletions ZenKit/DaedalusInstance.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using ZenKit.Daedalus;
using ZenKit.Util;

namespace ZenKit
{
Expand Down Expand Up @@ -31,31 +30,7 @@ public enum DaedalusInstanceType
Invalid = 21
}

public interface IDaedalusInstance : ICacheable<IDaedalusInstance>
{
public DaedalusInstanceType Type { get; }
public uint Index { get; }
}

[Serializable]
public class CachedDaedalusInstance : IDaedalusInstance
{
public DaedalusInstanceType Type { get; set; }
public uint Index { get; set; }

public IDaedalusInstance Cache()
{
return this;
}

public bool IsCached()
{
return true;
}
}


public class DaedalusInstance : IDaedalusInstance
public class DaedalusInstance
{
protected DaedalusInstance(UIntPtr handle)
{
Expand All @@ -67,20 +42,6 @@ protected DaedalusInstance(UIntPtr handle)
public DaedalusInstanceType Type => Native.ZkDaedalusInstance_getType(Handle);
public uint Index => Native.ZkDaedalusInstance_getIndex(Handle);

public IDaedalusInstance Cache()
{
return new CachedDaedalusInstance
{
Type = Type,
Index = Index
};
}

public bool IsCached()
{
return false;
}

public static DaedalusInstance? FromNative(UIntPtr handle)
{
if (handle == UIntPtr.Zero) return null;
Expand Down

0 comments on commit c6b7164

Please sign in to comment.