Exemplo n.º 1
0
        public static FrameInfo CreateFrameInfo(FrameInfoType infoType, FormatVersion version, BinaryReader reader = null)
        {
            Type factoryType = GetVersionFrameInfoFactory(version);

            MethodInfo method = factoryType.GetMethod("CreateInfo", BindingFlags.Static | BindingFlags.Public);

            object[] args = new object[] { infoType, reader };
            return((FrameInfo)method.Invoke(null, args));
        }
Exemplo n.º 2
0
 internal override void Read(BinaryReader reader)
 {
     InfoType   = (FrameInfoType)reader.ReadInt16();
     FrameStart = reader.ReadUInt16();
     Length     = reader.ReadUInt16();
     NameIndex  = reader.ReadInt16();
     FrameInfo  = FrameInfoFactory.CreateFrameInfo(InfoType, Version, reader);
     return;
 }
        public static Type GetFrameInfoFromType(FrameInfoType infoType)
        {
            Type frameInfoType = infoType switch
            {
                _ => typeof(Nocturne.Unknown)
            };

            return(frameInfoType);
        }
        public static Type GetFrameInfoFromType(FrameInfoType infoType)
        {
            Type frameInfoType = infoType switch
            {
                FrameInfoType.Message => typeof(Message),
                _ => typeof(Unknown)
            };

            return(frameInfoType);
        }
        public static FrameInfo CreateInfo(FrameInfoType infoType, BinaryReader reader = null)
        {
            Type frameInfoType = GetFrameInfoFromType(infoType);


            if (reader != null)
            {
                return((FrameInfo)Activator.CreateInstance(frameInfoType, reader));
            }
            else
            {
                return((FrameInfo)Activator.CreateInstance(frameInfoType));
            }
        }