Ejemplo n.º 1
0
        /// <summary>
        /// Saves the provided controllers info to file.
        /// </summary>
        /// <param name="controllers">An array of the controllers to save to file.</param>
        public void SaveInfoToFile(ControllerInfo[] controllers)
        {
            // Logging disabled to boost performance
            //using (LogGroup logGroup = LogGroup.StartDebug("Saving the provided controllers to XML file."))
            //{
            string path = FileNamer.ControllersInfoFilePath;

            //LogWriter.Debug("Path : " + path);

            if (!Directory.Exists(Path.GetDirectoryName(path)))
                Directory.CreateDirectory(Path.GetDirectoryName(path));

            using (StreamWriter writer = File.CreateText(path))
            {
                XmlSerializer serializer = new XmlSerializer(controllers.GetType());
                serializer.Serialize(writer, controllers);
                writer.Close();
            }
            //}
        }