Ejemplo n.º 1
0
        private void SaveTargetIgnitionMap(string filename, float[] map)
        {
            int columns = 18;
            int rows    = 16;


            if (m_TrionicFile.Exists())
            {
                string foldername = Path.Combine(Path.GetDirectoryName(m_TrionicFile.GetFileInfo().Filename), "IgnitionMaps");
                if (!Directory.Exists(foldername))
                {
                    Directory.CreateDirectory(foldername);
                }
                filename = Path.Combine(foldername, filename);
                //m_TrionicFile.GetMapMatrixWitdhByName(m_TrionicFile.GetFileInfo().GetIgnitionMap(), out columns, out rows);
                if (map.Length == columns * rows)
                {
                    using (StreamWriter sw = new StreamWriter(filename, false))
                    {
                        for (int rt = 0; rt < rows; rt++)
                        {
                            for (int ct = 0; ct < columns; ct++)
                            {
                                float value = (float)map.GetValue((rt * columns) + ct);
                                sw.Write(value.ToString("F2") + ";");
                            }
                            sw.Write(Environment.NewLine);
                        }
                    }
                }
                else
                {
                    //  MessageBox.Show("Target IGN map has different length than main VE map");
                }
            }
        }