Beispiel #1
0
        private TIPSImageInfo[] GetImageInfos(params int[] indices)
        {
            if (indices.Length != ImageInfos.Max(x => x.Index) + 1)
            {
                throw new Exception();
            }

            TIPSImageInfo[] infos = new TIPSImageInfo[indices.Length];
            for (int i = 0; i < infos.Length; i++)
            {
                // TODO: hacky!
                infos[i] = ImageInfos.Where(x => x.Index == i).Skip(indices[i]).FirstOrDefault();
                if (infos[i] == null)
                {
                    infos[i] = ImageInfos.LastOrDefault(x => x.Index == i);
                }
            }
            return(infos);
        }
Beispiel #2
0
        private void GetImagePermutations(ref int[] indices, int t)
        {
            int numValues = ImageInfos.Where(x => x.Index == t).Count();

            for (int v = 0; v < numValues; v++)
            {
                int[] stored = new int[indices.Length];
                Array.Copy(indices, stored, indices.Length);
                ImagePermutations.Add(stored);
                indices[t]++;
            }

            if (t > 0 && indices[t - 1] != ImageInfos.Where(x => x.Index == t - 1).Count())
            {
                indices[t - 1]++;
                indices[t] = 0;
                GetImagePermutations(ref indices, t);
            }
        }