internal void WriteXml(string filePath, string fileName, bool saveWithLineBreaks = true)
        {
            Stream fileStream = new FileStream(EMPath.AddSlash(filePath) + fileName, FileMode.Create);

            using (XmlTextCDATAWriter xmlWriter = new XmlTextCDATAWriter(fileStream,
                                                                         DefGeneral.DEFAULT_ENCODING, CountryConfigFacade._cDataElements, saveWithLineBreaks))
                _dataConfig.WriteXml(xmlWriter);
        }
 internal bool WriteXML()
 {
     try
     {
         _exchangeRatesConfig.AcceptChanges();
         Stream fileStream = new FileStream(new EMPath(EM_AppContext.FolderEuromodFiles).GetExRatesFilePath(true), FileMode.Create);
         using (XmlTextCDATAWriter xmlWriter = new XmlTextCDATAWriter(fileStream, DefGeneral.DEFAULT_ENCODING, _cDataElements))
             _exchangeRatesConfig.WriteXml(xmlWriter);
         return(true);
     }
     catch (Exception exception) { UserInfoHandler.ShowException(exception); return(false); }
 }
 internal bool WriteXML(string filePath = null)
 {
     try
     {
         AcceptChanges();
         Stream fileStream = new FileStream(filePath ?? _pathSwitchablePolicyConfig, FileMode.Create);
         using (XmlTextCDATAWriter xmlWriter = new XmlTextCDATAWriter(fileStream, DefGeneral.DEFAULT_ENCODING, _cDataElements))
             _switchablePolicyConfig.WriteXml(xmlWriter);
         return(true);
     }
     catch (Exception exception) { UserInfoHandler.ShowException(exception); return(false); }
 }
 internal void WriteXML(string alternativePath = "")
 {
     try
     {
         if (alternativePath == string.Empty)
         {
             alternativePath = new EMPath(EM_AppContext.FolderEuromodFiles).GetVarFilePath(true);
         }
         Stream fileStream = new FileStream(alternativePath, FileMode.Create);
         using (XmlTextCDATAWriter xmlWriter = new XmlTextCDATAWriter(fileStream, DefGeneral.DEFAULT_ENCODING, _cDataElements))
             _varConfig.WriteXml(xmlWriter);
     }
     catch (Exception exception)
     {
         Tools.UserInfoHandler.ShowException(exception);
     }
 }
Example #5
0
        static void SaveSettings(UserSettings settings, string settingsPath)
        {
            try
            {
                if (!Directory.Exists(EnvironmentInfo.GetUserSettingsFolder()))
                {
                    Directory.CreateDirectory(EnvironmentInfo.GetUserSettingsFolder()); //EUROMOD folder does not yet exist
                }
                Stream fileStream = new FileStream(settingsPath, FileMode.Create);

                UserSettings encSettings = settings.Copy() as UserSettings;
                using (XmlTextCDATAWriter xmlWriter = new XmlTextCDATAWriter(fileStream, DefGeneral.DEFAULT_ENCODING))
                    encSettings.WriteXml(xmlWriter);
                //MessageBox.Show("File created");
            }
            catch (Exception exception)
            {
                Tools.UserInfoHandler.ShowException(exception);
            }
        }