Exemplo n.º 1
0
 public void GenerateConfigFile(string fileName, bool replaceMacroValues)
 {
     using (var outstream = new StreamWriter(fileName))
     {
         foreach (var key in this.KnownSettings.Where(k => !k.StartsWith("MatterControl.")))
         {
             string activeValue = GetValue(key);
             if (replaceMacroValues)
             {
                 activeValue = GCodeProcessing.ReplaceMacroValues(activeValue);
             }
             outstream.Write(string.Format("{0} = {1}\n", key, activeValue));
             activeValue = GCodeProcessing.ReplaceMacroValues(activeValue);
         }
     }
 }
Exemplo n.º 2
0
 public void GenerateConfigFile(string fileName, bool replaceMacroValues)
 {
     using (var outstream = new StreamWriter(fileName))
     {
         foreach (var keyValue in this.BaseLayer)
         {
             string activeValue = ActiveValue(keyValue.Key);
             if (replaceMacroValues)
             {
                 activeValue = GCodeProcessing.ReplaceMacroValues(activeValue);
             }
             outstream.Write(string.Format("{0} = {1}\n", keyValue.Key, activeValue));
             activeValue = GCodeProcessing.ReplaceMacroValues(activeValue);
         }
     }
 }
        public void GenerateConfigFile(string fileName)
        {
            List <string> configFileAsList = new List <string>();

            foreach (KeyValuePair <String, DataStorage.SliceSetting> setting in this.DefaultSettings)
            {
                string activeValue = GetActiveValue(setting.Key);
                activeValue = GCodeProcessing.ReplaceMacroValues(activeValue);
                string settingString = string.Format("{0} = {1}", setting.Key, activeValue);
                configFileAsList.Add(settingString);
            }
            string configFileAsString = string.Join("\n", configFileAsList.ToArray());

            //To do - add file extension if it doesn't exist

            FileStream   fs = new FileStream(fileName, FileMode.Create);
            StreamWriter sw = new System.IO.StreamWriter(fs);

            sw.Write(configFileAsString);
            sw.Close();
        }