From Dwarf Fortress Wiki
Jump to navigation Jump to search

Init Merger[edit]

I made a C# utility to merge init files, but I just have the C# express program so I can't actually release the program in a usable manner. Here is the core routine though if someone wants it. Not much to look at really. The init files are simple, making something that could do this to raw files would need a content aware system.

C# Express can easily compile executable files. Blacken 00:02, 24 December 2007 (EST)
Only for debug. I'm not sure how well they would fare on their own. Or at least thats how I heard it. --Ikkonoishi 00:32, 24 December 2007 (EST)
	//Takes as input the contents of two Dwarf Fortress init.txt files, and returns the result of copying the source values into the destination slots.
        public string Merge (string sSource, string sDest)
            Merge = sDest;
            MatchCollection mcSource = Regex.Matches(sSource,"\\[(.*):(.*)\\]");
            foreach (Match m in mcSource)
                Merge = Regex.Replace(Merge,"\\[" + m.Groups[1].ToString() + ":(.*)\\]",m.ToString());
            return Merge;