// /** // * File: ODBTypedValue.cs // * Author: haraldwolff // * // * This file and it's content is copyrighted by the Author and / or copyright holder. // * Any use wihtout proper permission is illegal and may lead to legal actions. // * // * // **/ using System; using System.IO; namespace ln.objects.catalog { //public class ODBTypedValue : ODBEntity //{ // public ODBEntity ODBValue { get; private set; } // public Type TargetType { get; private set; } // public override uint AsUInt => ODBValue.AsUInt; // internal ODBTypedValue() // : base(0x0020) // { // } // public ODBTypedValue(Type targetType,ODBEntity value) // : this() // { // TargetType = targetType; // ODBValue = value; // } // public ODBTypedValue(byte[] bytes,int offset,int length) // : this() // { // String aname = ODBEntity.Deserialize(bytes, ref offset).AsString; // String tname = ODBEntity.Deserialize(bytes, ref offset).AsString; // ODBValue = ODBEntity.Deserialize(bytes, ref offset); // TargetType = Type.GetType(String.Format("{0}, {1}", tname, aname)); // } // public override int CompareLevel => 126; // public override int CompareInType(ODBEntity other) // { // ODBTypedValue typedValue = other as ODBTypedValue; // return ODBValue.CompareTo(typedValue.ODBValue); // } // public override byte[] GetStorageBytes() // { // MemoryStream stream = new MemoryStream(); // BinaryWriter writer = new BinaryWriter(stream); // ODBStringValue aname = TargetType.Assembly.GetName().Name; // ODBStringValue tname = TargetType.FullName; // aname.Write(writer); // tname.Write(writer); // ODBValue.Write(writer); // return stream.ToArray(); // } // public override int GetHashCode() // { // return ODBValue.GetHashCode(); // } // public override bool Equals(object obj) // { // if (obj is ODBTypedValue) // { // ODBTypedValue typedValue = obj as ODBTypedValue; // return ODBValue.Equals(typedValue.ODBValue); // } // return false; // } // static ODBTypedValue() // { // RegisterDeserializer(0x0020, (b, o, l) => new ODBTypedValue(b,o,l)); // } //} }