public static Color[] GetColorRenge(int length, MiMFa_SelectFromRange selectLow = MiMFa_SelectFromRange.Random, params Color[] colorRange) { Color[] arrc = new Color[length]; int j = 0; for (int i = 0; i < length; i++) { if (colorRange.Length > j) { arrc[i] = colorRange[j++]; } else { j = 0; arrc[i] = colorRange[j++]; } } switch (selectLow) { case MiMFa_SelectFromRange.OrderBy: return(arrc); case MiMFa_SelectFromRange.Random: return(MiMFa_CollectionService.Shake(arrc)); case MiMFa_SelectFromRange.Special: return(MiMFa_CollectionService.Shake(MiMFa_CollectionService.Shake(arrc))); default: return(arrc); } }
public List <T> Sort(List <T> inputList, ConstraintCollection constraints, params object[] conditions) { if (Shaked) { inputList = MiMFa_CollectionService.Shake(inputList); } List <KeyValuePair <T, InferenceCollection> > lold = new List <KeyValuePair <T, InferenceCollection> >(); for (int i = 0; i < inputList.Count; i++) { lold.Add(new KeyValuePair <T, InferenceCollection>(inputList[i], new InferenceCollection())); } constraints.Sort(); Constraint constraint = null; Type t = inputList.First().GetType(); FieldInfo[] fi = null; PropertyInfo[] pi = null; if (SendT) { for (int index = 0; index < constraints.Count; index++) { for (int i = 0; i < inputList.Count; i++) { lold[i].Value.Add(constraints[index].Solver(inputList[i], conditions)); } } } else { for (int index = 0; index < constraints.Count; index++) { constraint = constraints[index]; fi = MiMFa_GetDetail.GetFields(inputList.First(), constraint.Name, false); if (fi.Length > 0) { for (int i = 0; i < inputList.Count; i++) { lold[i].Value.Add(constraint.Solver(fi.First().GetValue(inputList[i]), conditions)); } } else { pi = MiMFa_GetDetail.GetProperties(inputList.First(), constraint.Name, false); if (pi.Length > 0) { for (int i = 0; i < inputList.Count; i++) { lold[i].Value.Add(constraint.Solver(pi.First().GetValue(inputList[i]), conditions)); } } } } } lold = Sort(lold); return(AllowanceMember(lold)); }