v50 Steam/Premium information for editors
  • v50 information can now be added to pages in the main namespace. v0.47 information can still be found in the DF2014 namespace. See here for more details on the new versioning policy.
  • Use this page to report any issues related to the migration.
This notice may be cached—the current version can be found here.

User:Ikkonoishi

From Dwarf Fortress Wiki
Revision as of 03:06, 24 December 2007 by Ikkonoishi (talk | contribs) (New page: ==Init Merger== 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 ...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Init Merger

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.

	//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;
        }