public float SnapToGuides(float value, float snapDistance)
{
if (this.guides.Count != 0)
{
KeyValuePair<float, List<SnapGuide>> pair = new KeyValuePair<float, List<SnapGuide>>();
float positiveInfinity = float.PositiveInfinity;
foreach (KeyValuePair<float, List<SnapGuide>> pair2 in this.guides)
{
float num3 = Mathf.Abs((float) (value - pair2.Key));
if (num3 < positiveInfinity)
{
pair = pair2;
positiveInfinity = num3;
}
}
if (positiveInfinity <= snapDistance)
{
value = pair.Key;
this.currentGuides = pair.Value;
}
else
{
this.currentGuides = null;
}
}
return value;
}
}