private void UnRender(IPin pinOutOrigin)
{
int hr;
//hr = pinOutOrigin.Disconnect();
IPin pinOutEnd = null;
hr = pinOutOrigin.ConnectedTo(out pinOutEnd);
if (pinOutEnd != null)
{
try
{
PinInfo pInfo = new PinInfo();
hr = pinOutEnd.QueryPinInfo(out pInfo);
if (hr >= 0)
{
if (pInfo.filter != null)
{
try
{
IEnumPins ppEnum;
hr = pInfo.filter.EnumPins(out ppEnum);
if (hr >= 0)
{
try
{
// Walk the pins looking for a match
IPin[] pPins = new IPin[1];
//22 int lFetched;
//22 while ((ppEnum.Next(1, pPins, out lFetched) >= 0) && (lFetched == 1))
while (ppEnum.Next(1, pPins, IntPtr.Zero) >= 0)
{
try
{
// Read the direction
PinDirection ppindir;
hr = pPins[0].QueryDirection(out ppindir);
if (hr >= 0)
{
// Is it the right direction?
if (ppindir == PinDirection.Output)
{
if (pPins[0] != null)
{
UnRender(pPins[0]);
}
}
}
}
finally
{
Marshal.ReleaseComObject(pPins[0]);
}
}
}
finally
{
Marshal.ReleaseComObject(ppEnum);
}
}
hr = graphBuilder.RemoveFilter(pInfo.filter);
}
finally
{
Marshal.ReleaseComObject(pInfo.filter);
}
}
}
}
finally
{
Marshal.ReleaseComObject(pinOutEnd);
}
}
}