/// <summary> /// Sync two types up /// </summary> /// <param name="fromType">Type to convert from that is already synced</param> /// <param name="toType">Type to convert to that will be synced to the from type</param> public void ConvertFrom(ColorRepresentation fromType, ColorRepresentation toType) { // should never happen if (!this[fromType]) { throw new InvalidOperationException(); } // if they're already synced up, no worries if (this[toType]) { return; } switch (toType) { case ColorRepresentation.RGB: switch (fromType) { case ColorRepresentation.HSL: rgb.ConvertFrom(ref hsl); break; } break; case ColorRepresentation.HSL: switch (fromType) { case ColorRepresentation.RGB: hsl.ConvertFrom(ref rgb); break; } break; } // synced this[toType] = true; }