Esempio n. 1
0
        public void Apply(List <bool[, ]> rawdatas)
        {
            if (Simulation)
            {
                return;
            }

            if (_havebeeninit == false)
            {
                Init();
            }

            Dictionary <int, List <int> > dico = new Dictionary <int, List <int> >();


            List <bool[, ]> transposed = new List <bool[, ]>();

            //TODO remplacer un for int i= 0  et pour les 5 premiers faires 90 et les 5 autres 270
            //int indice = 1;
            //foreach (var rawdata in rawdatas)
            for (int indice = (rawdatas.Count - 1); indice >= 0; indice--)
            {
                bool[,] t = new bool[8, 8];
                int x = rawdatas[indice].GetLength(0);

                if (indice >= 5)
                {
                    for (int i = 0; i < x; i++)
                    {
                        for (int j = 0; j < x; j++)
                        {
                            t[i, j] = rawdatas[indice][x - 1 - j, i];
                        }
                    }
                }
                else
                {
                    for (int i = 0; i < x; i++)
                    {
                        for (int j = 0; j < x; j++)
                        {
                            t[i, j] = rawdatas[indice][j, x - 1 - i];
                        }
                    }
                }
                transposed.Add(t);
                //   indice++;
            }
            rawdatas = transposed;

            for (int index = 0; index < rawdatas.Count; index++)
            {
                bool[,] matrix = rawdatas[index];
                var data = HelperMatriceInteger.BuildList(matrix);

                dico.Add(index, data);
            }

            Write(dico);
        }
        public void SaveToFile()
        {
            List <int> final = new List <int>();

            foreach (var data in Datas)
            {
                //var x = ViewModelMain.ConverToList(data.rawData);
                foreach (var y in data.rawData)
                {
                    var z = HelperMatriceInteger.BuildList(y);
                    final.AddRange(z);
                }
            }

            SerializeObject(final, file);
        }