// This writes the list to configuration internal void WriteToConfig(Configuration cfg, string path) { // Fill structure IDictionary resinfo = new ListDictionary(); for (int i = 0; i < this.Count; i++) { // Create structure for resource IDictionary rlinfo = new ListDictionary(); rlinfo.Add("type", this[i].type); rlinfo.Add("location", this[i].location); rlinfo.Add("option1", General.Bool2Int(this[i].option1)); rlinfo.Add("option2", General.Bool2Int(this[i].option2)); rlinfo.Add("notfortesting", General.Bool2Int(this[i].notfortesting)); // Add structure resinfo.Add("resource" + i.ToString(CultureInfo.InvariantCulture), rlinfo); } // Write to config cfg.WriteSetting(path, resinfo); }
// This stores the map options in a configuration internal void WriteConfiguration(string settingsfile) { Configuration wadcfg; // Write resources to config resources.WriteToConfig(mapconfig, "resources"); // Write grid settings General.Map.Grid.WriteToConfig(mapconfig, "grid"); // Write scripts to config mapconfig.DeleteSetting("scripts"); for (int i = 0; i < scriptfiles.Count; i++) { mapconfig.WriteSetting("scripts." + "file" + i.ToString(CultureInfo.InvariantCulture), scriptfiles[i]); } // Load the file or make a new file if (File.Exists(settingsfile)) { wadcfg = new Configuration(settingsfile, true); } else { wadcfg = new Configuration(true); } // Write configuration type information wadcfg.WriteSetting("type", "Doom Builder Map Settings Configuration"); wadcfg.WriteSetting("gameconfig", configfile); wadcfg.WriteSetting("strictpatches", General.Bool2Int(strictpatches)); // Update the settings file with this map configuration wadcfg.WriteSetting("maps." + currentname, mapconfig.Root); // Save file wadcfg.SaveConfiguration(settingsfile); }
// This stores the map options in a configuration internal void WriteConfiguration(string settingsfile) { Configuration wadcfg; // Write resources to config resources.WriteToConfig(mapconfig, "resources"); //mxd. Save selection groups General.Map.Map.WriteSelectionGroups(mapconfig); //mxd. Save Tag Labels if (tagLabels.Count > 0) { ListDictionary tagLabelsData = new ListDictionary(); int counter = 1; foreach (KeyValuePair <int, string> group in tagLabels) { ListDictionary data = new ListDictionary(); data.Add("tag", group.Key); data.Add("label", group.Value); tagLabelsData.Add("taglabel" + counter, data); counter++; } mapconfig.WriteSetting("taglabels", tagLabelsData); } //mxd. Write Sector drawing options mapconfig.WriteSetting("defaultfloortexture", defaultfloortexture); mapconfig.WriteSetting("defaultceiltexture", defaultceiltexture); mapconfig.WriteSetting("defaulttoptexture", defaulttoptexture); mapconfig.WriteSetting("defaultwalltexture", defaultwalltexture); mapconfig.WriteSetting("defaultbottomtexture", defaultbottomtexture); mapconfig.WriteSetting("custombrightness", custombrightness); mapconfig.WriteSetting("customfloorheight", customfloorheight); mapconfig.WriteSetting("customceilheight", customceilheight); //mxd. Write Sector drawing overrides mapconfig.WriteSetting("overridefloortexture", overridefloortexture); mapconfig.WriteSetting("overrideceiltexture", overrideceiltexture); mapconfig.WriteSetting("overridetoptexture", overridetoptexture); mapconfig.WriteSetting("overridemiddletexture", overridemiddletexture); mapconfig.WriteSetting("overridebottomtexture", overridebottomtexture); mapconfig.WriteSetting("overridefloorheight", overridefloorheight); mapconfig.WriteSetting("overrideceilheight", overrideceilheight); mapconfig.WriteSetting("overridebrightness", overridebrightness); //mxd mapconfig.WriteSetting("uselongtexturenames", uselongtexturenames); mapconfig.WriteSetting("useresourcesinreadonlymode", useresourcesinreadonlymode); //mxd. Position and scale mapconfig.WriteSetting("viewpositionx", General.Map.Renderer2D.OffsetX); mapconfig.WriteSetting("viewpositiony", General.Map.Renderer2D.OffsetY); mapconfig.WriteSetting("viewscale", General.Map.Renderer2D.Scale); //mxd. Write script compiler if (!string.IsNullOrEmpty(scriptcompiler)) { mapconfig.WriteSetting("scriptcompiler", scriptcompiler); } // Write grid settings General.Map.Grid.WriteToConfig(mapconfig, "grid"); //mxd. Write script document settings to config int sdcounter = 0; mapconfig.DeleteSetting("scriptdocuments"); foreach (ScriptDocumentSettings settings in scriptsettings.Values) { WriteScriptDocumentSettings(mapconfig, "scriptdocuments.document" + (sdcounter++), settings); } // Load the file or make a new file if (File.Exists(settingsfile)) { wadcfg = new Configuration(settingsfile, true); } else { wadcfg = new Configuration(true); } // Write configuration type information wadcfg.WriteSetting("type", "Doom Builder Map Settings Configuration"); wadcfg.WriteSetting("gameconfig", configfile); wadcfg.WriteSetting("strictpatches", General.Bool2Int(strictpatches)); // Update the settings file with this map configuration wadcfg.WriteSetting("maps." + currentname, mapconfig.Root); // Save file wadcfg.SaveConfiguration(settingsfile); }