private static GeometricParity GetGeometricParity(IStereoEncoder encoder) { if (encoder is GeometryEncoder) { FieldInfo field = null; field = encoder.GetType().GetField("geometric", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); if (field == null) { Console.Error.WriteLine("Error on accessing geometric field."); return(null); } return((GeometricParity)field.GetValue(encoder)); } return(null); }
private static IList <IStereoEncoder> ExtractEncoders(IStereoEncoder encoder) { if (encoder is MultiStereoEncoder) { FieldInfo field = null; field = encoder.GetType().GetField("encoders", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); if (field == null) { Console.Error.WriteLine("Error on accessing encoders field."); return(null); } return((IList <IStereoEncoder>)field.GetValue(encoder)); } return(new IStereoEncoder[0]); }
private static GeometricParity GetGeometricParity(IStereoEncoder encoder) { if (encoder is MultiStereoEncoder) { return(GetGeometricParity(ExtractEncoders(encoder)[0])); } else if (encoder is GeometryEncoder) { FieldInfo field = null; field = encoder.GetType().GetField("geometric", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); if (field == null) { Console.Error.WriteLine("No geometric field found."); return(null); } return((GeometricParity)field.GetValue(encoder)); } return(null); }