internal HardwireCodeGenerationContext(string namespaceName, string entryClassName, ICodeGenerationLogger logger,
                                               HardwireCodeGenerationLanguage language)
        {
            TargetLanguage = language;

            m_Logger = logger;

            CompileUnit = new CodeCompileUnit();


            m_Namespace = new CodeNamespace(namespaceName);
            CompileUnit.Namespaces.Add(m_Namespace);

            Comment("----------------------------------------------------------");
            Comment("Generated by MoonSharp.Hardwire v.{0}", Assembly.GetExecutingAssembly().GetName().Version);
            Comment("Compatible with MoonSharp v.{0} or equivalent", Script.VERSION);
            Comment("----------------------------------------------------------");

            string[] extraComments = language.GetInitialComment();

            if (extraComments != null)
            {
                foreach (string str in extraComments)
                {
                    Comment("{0}", str);
                }

                Comment("----------------------------------------------------------");
            }

            Comment("Code generated on {0}", DateTime.Now.ToString("O"));
            Comment("----------------------------------------------------------");



            Comment("");
            Comment("");
            Comment("");

            GenerateKickstarter(entryClassName);
        }
		internal HardwireCodeGenerationContext(string namespaceName, string entryClassName, ICodeGenerationLogger logger,
			HardwireCodeGenerationLanguage language)
		{
			TargetLanguage = language;

			m_Logger = logger;

			CompileUnit = new CodeCompileUnit();


			m_Namespace = new CodeNamespace(namespaceName);
			CompileUnit.Namespaces.Add(m_Namespace);

			Comment("----------------------------------------------------------");
			Comment("Generated by MoonSharp.Hardwire v.{0}", Assembly.GetExecutingAssembly().GetName().Version);
			Comment("Compatible with MoonSharp v.{0} or equivalent", Script.VERSION);
			Comment("----------------------------------------------------------");

			string[] extraComments = language.GetInitialComment();

			if (extraComments != null)
			{
				foreach(string str in extraComments)
					Comment("{0}", str);
			
				Comment("----------------------------------------------------------");
			}
			
			Comment("Code generated on {0}", DateTime.Now.ToString("O"));
			Comment("----------------------------------------------------------");




			Comment("");
			Comment("");
			Comment("");

			GenerateKickstarter(entryClassName);
		}
		public HardwireGenerator(string namespaceName, string entryClassName, ICodeGenerationLogger logger,
			HardwireCodeGenerationLanguage language = null)
		{
			m_Language = language ?? HardwireCodeGenerationLanguage.CSharp;
			m_Context = new HardwireCodeGenerationContext(namespaceName, entryClassName, logger, language);
		}
示例#4
0
 public HardwireGenerator(string namespaceName, string entryClassName, ICodeGenerationLogger logger,
                          HardwireCodeGenerationLanguage language = null)
 {
     m_Language = language ?? HardwireCodeGenerationLanguage.CSharp;
     m_Context  = new HardwireCodeGenerationContext(namespaceName, entryClassName, logger, language);
 }