public static string GetSVHeaderName(this EsiType type)
 {
     return(type switch {
         EsiNamedType named when(!string.IsNullOrWhiteSpace(named.Name))
         => $"{named.GetFilename()}.esi.svh",
         EsiCompound compound => "EsiCompundTypes.esi.svh",
         _ => null
     });
        public virtual bool StructuralEquals(
            EsiType that,
            bool includeNames = false,
            IDictionary <EsiType, EsiType?>?objMap = null)
        {
            if (that == null)
            {
                return(false);
            }
            objMap = objMap ?? new Dictionary <EsiType, EsiType?>();

            Type thisType = this.GetType();
            Type thatType = that.GetType();

            if (thisType != thatType)
            {
                return(false);
            }

            foreach (var prop in thisType.GetProperties())
            {
                var thisValue = prop.GetValue(this);
                var thatValue = prop.GetValue(that);

                if (thisValue is EsiTypeParent thisFieldEsi &&
                    thatValue is EsiTypeParent thatFieldEsi)
                {
                    if (objMap.TryGetValue(thisFieldEsi, out var expectedThatField))
                    {
                        if (thatValue != expectedThatField)
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        if (thisFieldEsi == null)
                        {
                            if (thatFieldEsi != null)
                            {
                                return(false);
                            }
                        }
                        else
                        {
                            objMap[thisFieldEsi] = thatFieldEsi;
                            if (!thisFieldEsi.StructuralEquals(thatFieldEsi, includeNames, objMap))
                            {
                                return(false);
                            }
                        }
                    }
                }
 public static string GetSVHeaderName(EsiType type) => type.GetSVHeaderName();