internal Deflater(object deflaterInstance) { Type type = deflaterInstance.GetType(); setLevelMethod = (SetLevelDelegate)Delegate.CreateDelegate( typeof(SetLevelDelegate), deflaterInstance, type.GetMethod("SetLevel", new Type[] { typeof(int) })); setInputMethod = (SetInputDelegate)Delegate.CreateDelegate( typeof(SetInputDelegate), deflaterInstance, type.GetMethod("SetInput", new Type[] { typeof(byte[]), typeof(int), typeof(int) })); finishMethod = (FinishDelegate)Delegate.CreateDelegate( typeof(FinishDelegate), deflaterInstance, type.GetMethod("Finish", Type.EmptyTypes)); getIsFinishedMethod = (GetIsFinishedDelegate)Delegate.CreateDelegate( typeof(GetIsFinishedDelegate), deflaterInstance, type.GetMethod("get_IsFinished", Type.EmptyTypes)); deflateMethod = (DeflateDelegate)Delegate.CreateDelegate( typeof(DeflateDelegate), deflaterInstance, type.GetMethod("Deflate", new Type[] { typeof(byte[]) })); }
internal Inflater(object inflaterInstance) { Type type = inflaterInstance.GetType(); setInputMethod = (SetInputDelegate)Delegate.CreateDelegate( typeof(SetInputDelegate), inflaterInstance, type.GetMethod("SetInput", new Type[] { typeof(byte[]) })); getIsFinishedMethod = (GetIsFinishedDelegate)Delegate.CreateDelegate( typeof(GetIsFinishedDelegate), inflaterInstance, type.GetMethod("get_IsFinished", Type.EmptyTypes)); inflateMethod = (InflateDelegate)Delegate.CreateDelegate( typeof(InflateDelegate), inflaterInstance, type.GetMethod("Inflate", new Type[] { typeof(byte[]) })); resetMethod = (ResetDelegate)Delegate.CreateDelegate( typeof(ResetDelegate), inflaterInstance, type.GetMethod("Reset", Type.EmptyTypes)); setInput3Method = (SetInputDelegate3)Delegate.CreateDelegate( typeof(SetInputDelegate3), inflaterInstance, type.GetMethod("SetInput", new Type[] { typeof(byte[]), typeof(int), typeof(int) })); inflate3Method = (InflateDelegate3)Delegate.CreateDelegate( typeof(InflateDelegate3), inflaterInstance, type.GetMethod("Inflate", new Type[] { typeof(byte[]), typeof(int), typeof(int) })); }