Exemple #1
0
        /// <summary>
        /// save parameter settings to a file
        /// </summary>
        /// <param name="pathFile"></param>
        public void Save(string paramFile)
        {
            ParameterSettings parameters    = this;
            XmlSerializer     xmlSerializer = new XmlSerializer(typeof(ParameterSettings));
            TextWriter        paramWriter   = new StreamWriter(paramFile);

            xmlSerializer.Serialize(paramWriter, parameters);
            paramWriter.Close();
        }
Exemple #2
0
        /// <summary>
        /// load settings from a file
        /// </summary>
        /// <param name="pathFile"></param>
        public void Load(string pathFile)
        {
            XmlSerializer     xmlSerializer = new XmlSerializer(typeof(ParameterSettings));
            FileStream        xmlFileStream = new FileStream(pathFile, FileMode.Open);
            ParameterSettings paramSettings = (ParameterSettings)xmlSerializer.Deserialize(xmlFileStream);

            xmlFileStream.Close();
            this.contactParams    = paramSettings.contactParams;
            this.kDopsParam       = paramSettings.kDopsParam;
            this.simInteractParam = paramSettings.simInteractParam;
        }
Exemple #3
0
        /// <summary>
        /// load all parameters
        /// </summary>
        public static void LoadParameters()
        {
            if (!File.Exists(paramFile))
            {
                throw new Exception("Parameters file not exist");
            }
            parameters = new ParameterSettings();
            XmlSerializer xmlSerializer = new XmlSerializer(typeof(ParameterSettings));
            FileStream    xmlFileStream = new FileStream(paramFile, FileMode.Open);

            parameters = (ParameterSettings)xmlSerializer.Deserialize(xmlFileStream);
            xmlFileStream.Close();

            kVector    = new KVector(parameters.kDopsParam.kParam);
            kVectors3D = new KVector();
        }