// Decompiled with JetBrains decompiler
// Type: Borland.Delphi.System.@TClass
// Assembly: Project1, Version=1.0.1859.4414, Culture=neutral, PublicKeyToken=null
// MVID: 387A0727-86C4-4744-A694-CF2F2E0F060B
// Assembly location: C:\Users\Administrateur\Downloads\Virusshare-00000-msil\Trojan.MSIL.WMC.10-fd5e584bd80ce552c9df6b54aeb5b165ab53ae3852db7b074873a0872cf5dc56.exe

using System;
using System.Runtime.CompilerServices;

namespace Borland.Delphi.System
{
  public class \u0040TClass
  {
    protected RuntimeTypeHandle FInstanceTypeHandle;
    protected Type FInstanceType;
    protected \u0040TClass FClassParent;

    protected internal void SetInstanceType(RuntimeTypeHandle ATypeHandle)
    {
      if (this.FInstanceTypeHandle.Equals((object) ATypeHandle))
        return;
      this.FInstanceTypeHandle = ATypeHandle;
      this.FClassParent = (\u0040TClass) null;
    }

    protected internal void SetDelegator(Type ATypeDelegator)
    {
      this.FClassParent = (\u0040TClass) null;
      this.FInstanceType = ATypeDelegator;
    }

    public \u0040TClass()
    {
    }

    public \u0040TClass(RuntimeTypeHandle ATypeHandle) => this.FInstanceTypeHandle = ATypeHandle;

    public \u0040TClass(Type AType)
      : this(AType.TypeHandle)
    {
    }

    [return: TAliasType(typeof (TClass))]
    public \u0040TClass ClassParent()
    {
      if (this.FClassParent == null)
      {
        Type baseType = this.InstanceType().BaseType;
        if ((object) baseType != null)
          this.FClassParent = Unit.\u0040GetMetaFromHandle(baseType.TypeHandle);
      }
      return this.FClassParent;
    }

    public RuntimeTypeHandle InstanceTypeHandle() => (object) this.FInstanceType == null ? this.FInstanceTypeHandle : this.FInstanceType.TypeHandle;

    public Type InstanceType() => (object) this.FInstanceType == null ? Type.GetTypeFromHandle(this.FInstanceTypeHandle) : this.FInstanceType;

    public override bool Equals(object AObj)
    {
      bool flag = false;
      if (AObj != null && AObj is \u0040TClass tclass && this.FInstanceTypeHandle.Equals((object) tclass.FInstanceTypeHandle))
        flag = true;
      return flag;
    }

    public override int GetHashCode() => this.FInstanceTypeHandle.GetHashCode();

    static \u0040TClass() => RuntimeHelpers.RunClassConstructor(__typeref (Unit));
  }
}
