public void AutoGenerateSettingsCode()
        {
            // First grab all the versions
            VersionGeneratorArgs versionsArgs = GameSettingsGenerator.GetAllVersions();

            // Setup namespaces and arguments
            int index = 0;
            NamespaceGeneratorArgs usingsArgs   = new NamespaceGeneratorArgs();
            SettingsGeneratorArgs  settingsArgs = new SettingsGeneratorArgs();

            foreach (ISettingsVersionGenerator version in versionsArgs)
            {
                version.UpdateNamespaceArgs(usingsArgs);
                version.UpdateSettingArgs(index, settingsArgs);
                ++index;
            }

            // Next, write to a file
            GameSettingsGenerator.WriteCode(versionsArgs, usingsArgs, settingsArgs);
        }
        public static void WriteCode(VersionGeneratorArgs versionsArgs, NamespaceGeneratorArgs usingsArgs, SettingsGeneratorArgs settingsArgs)
        {
            int numTabs = 0;

            using (TextWriter writer = new StreamWriter(GameSettingsFullPath, false, Encoding.UTF8))
            {
                // List out the namespace we're using
                WriteAllUsings(writer, numTabs, usingsArgs);

                // Declare the current namespace
                numTabs = WriteStartEncapsulation(writer, numTabs, "namespace OmiyaGames.Settings");

                // Start the class
                WriteTooltipComment(writer, numTabs, "This code is auto-generated. All changes will be overwritten!");
                numTabs = WriteStartEncapsulation(writer, numTabs, "public partial class GameSettings : Global.ISingletonScript");

                // Write out the array of versions
                WriteLine(writer, numTabs, "#region Private Arrays");
                WriteAllSettingsVersions(writer, numTabs, versionsArgs);
                writer.WriteLine();

                // Write out the array of single settings
                WriteAllSingleSettings(writer, numTabs, settingsArgs);
                WriteLine(writer, numTabs, "#endregion");
                writer.WriteLine();

                // Write AppVersion property
                WriteAppVersionProperty(writer, numTabs);

                // Write out the list of settings
                WriteAllSettingsProperties(writer, numTabs, settingsArgs);

                // End the class
                numTabs = WriteEndEncapsulation(writer, numTabs);

                // End the namespace
                numTabs = WriteEndEncapsulation(writer, numTabs);
            }
            AssetDatabase.ImportAsset(GameSettingsUnityPath, ImportAssetOptions.ForceUpdate);
        }
        private static void WriteAllUsings(TextWriter writer, int numTabs, NamespaceGeneratorArgs namespaceArgs)
        {
            bool appendNewline = false;

            foreach (string namespaceName in namespaceArgs)
            {
                // Write tabs
                WriteTabs(writer, numTabs);

                // Write the "using namespace;" lines
                writer.Write("using ");
                writer.Write(namespaceName);
                writer.WriteLine(';');
                appendNewline = true;
            }

            // Write a newline below all the usings
            if (appendNewline == true)
            {
                writer.WriteLine();
            }
        }
 /// <summary>
 /// Adds no new namespaces to <see cref="NamespaceGeneratorArgs"/>.
 /// </summary>
 public virtual void UpdateNamespaceArgs(NamespaceGeneratorArgs args)
 {
     // By default, do nothing!
 }