private static int CompareGraphicsStreams(
TSGraphicsStream x,
TSGraphicsStream y)
{
if (x == y)
{
return 0;
}
else if (x == null && y == null)
{
return 0;
}
else if (x == null && y != null)
{
return -1;
}
else if (x != null && y == null)
{
return 1;
}
else
{
int sortX = GetStreamTypeSortIndex(x.StreamType);
int sortY = GetStreamTypeSortIndex(y.StreamType);
if (sortX > sortY)
{
return -1;
}
else if (sortY > sortX)
{
return 1;
}
else if (x.LanguageCode == "eng")
{
return -1;
}
else if (y.LanguageCode == "eng")
{
return 1;
}
else
{
if (x.LanguageCode == y.LanguageCode)
{
if (x.PID > y.PID)
{
return 1;
}
else if (y.PID > x.PID)
{
return -1;
}
else
{
return 0;
}
}
else
{
return string.Compare(x.LanguageName, y.LanguageName);
}
}
}
}