public int CompareTo(NamedSolidColorBrush other) { if (other == null) { return(1); } long lV, rV; switch (howCompare) { case HowCompare.R: if (this.R < other.R) { return(-1 * reverse); } else if (this.R > other.R) { return(1 * reverse); } else if (CompareR(other) == 0) { goto case HowCompare.G; } break; case HowCompare.G: if (this.G < other.G) { return(-1 * reverse); } else if (this.G > other.G) { return(1 * reverse); } else if (CompareG(other) == 0) { goto case HowCompare.B; } break; case HowCompare.B: if (this.B < other.B) { return(-1 * reverse); } else if (this.B > other.B) { return(1 * reverse); } else { return(CompareB(other)); } //break; case HowCompare.nR: lV = (this.G << 8) | this.B; rV = (other.G << 8) | other.B; if (lV < rV) { return(-1 * reverse); } if (lV > rV) { return(1 * reverse); } goto case HowCompare.R; case HowCompare.nG: lV = (this.R << 16) | this.B; rV = (other.R << 16) | other.B; if (lV < rV) { return(-1 * reverse); } if (lV > rV) { return(1 * reverse); } goto case HowCompare.G; case HowCompare.nB: lV = (this.R << 16) | (this.G << 8); rV = (other.R << 16) | (other.G << 8); if (lV < rV) { return(-1 * reverse); } if (lV > rV) { return(1 * reverse); } goto case HowCompare.B; case HowCompare.RGB: lV = (this.R << 16) | (this.G << 8) | this.B; rV = (other.R << 16) | (other.G << 8) | other.B; if (lV < rV) { return(-1 * reverse); } if (lV > rV) { return(1 * reverse); } break; case HowCompare.CMYK: CMYK L = new CMYK(this.Brush.Color); CMYK R = new CMYK(other.Brush.Color); return(L.CompareTo(R)); //break; case HowCompare.HSL: HSL hL = new HSL(this.Brush.Color); HSL hR = new HSL(other.Brush.Color); return(hL.CompareTo(hR)); //break; case HowCompare.HSV: HSV vL = new HSV(this.Brush.Color); HSV vR = new HSV(other.Brush.Color); return(vL.CompareTo(vR)); //break; case HowCompare.Kanji: return(this.Kanji.CompareTo(other.Kanji) * reverse); //break; case HowCompare.Yomi: int ii = this.Name.CompareTo(other.Name) * reverse; if (ii == 0) { if (!String.IsNullOrEmpty(this.Kanji) && !String.IsNullOrEmpty(other.Kanji)) { goto case HowCompare.Kanji; } } return(ii); } return(0); }