FlatRedBall.Glue.BehaviorManager.CreateNewBehavior C# (CSharp) Method

CreateNewBehavior() public static method

public static CreateNewBehavior ( string behaviorName ) : void
behaviorName string
return void
        public static void CreateNewBehavior(string behaviorName)
        {
            string directory = BehaviorFolder;

            if (!Directory.Exists(directory))
            {
                Directory.CreateDirectory(directory);
            }

            string behaviorFileName = directory + behaviorName + ".cs";

            if (File.Exists(behaviorFileName))
            {
#if GLUE
                System.Windows.Forms.MessageBox.Show("The behavior " + behaviorName + " already exists.");
#endif
            }
            else
            {
                // Create a brand new file with the name.
                string newBehaviorContents = mBehaviorTemplateCode.Replace("METHOD_NAME", behaviorName);

                FileManager.SaveText(newBehaviorContents,
                    behaviorFileName);


            }
        }