Пример #1
0
        /// <summary>
        /// Generate the base config file. This may require UAC, and may require a visual interface,
        /// unlike the rest of the program, which is why it's partitioned off by itself.
        /// </summary>
        public static void Main()
        {
            // Force-generate a clean config file
            KV.KeyValue root    = new KV.KeyValue("config");
            KV.KeyValue dotadir = new KV.KeyValue("dotaDir");
            dotadir.Set(getDotaDir());
            root.AddChild(dotadir);
            string contents = root.ToString();
            // This is system-wide
            string path = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);

            using (StreamWriter writeto = new StreamWriter(path + "/config.txt"))
            {
                writeto.Write(contents);
            }
        }