public string Generate(string outputDirectory, ProjectSubstitutions projectSubstitutions, FileSubstitutions fileSubstitutions, PListSubstitutions plistReplacements = null, bool includeAssets = false)
        {
            plistReplacements = plistReplacements ?? PListSubstitutions.None;
            FileCopier templateEngine = CreateEngine(outputDirectory);

            if (includeAssets)
            {
                templateEngine.CopyDirectory("Icons/Assets.xcassets");

                projectSubstitutions.ItemGroup += @"<ItemGroup>
    <ImageAsset Include=""Assets.xcassets\AppIcon.appiconset\Contents.json"" />
    <ImageAsset Include=""Assets.xcassets\AppIcon.appiconset\AppIcon-128.png"" />
    <ImageAsset Include=""Assets.xcassets\AppIcon.appiconset\AppIcon-128%402x.png"" />
    <ImageAsset Include=""Assets.xcassets\AppIcon.appiconset\AppIcon-16.png"" />
    <ImageAsset Include=""Assets.xcassets\AppIcon.appiconset\AppIcon-16%402x.png"" />
    <ImageAsset Include=""Assets.xcassets\AppIcon.appiconset\AppIcon-256%402x.png"" />
    <ImageAsset Include=""Assets.xcassets\AppIcon.appiconset\AppIcon-32.png"" />
    <ImageAsset Include=""Assets.xcassets\AppIcon.appiconset\AppIcon-32%402x.png"" />
    <ImageAsset Include=""Assets.xcassets\Contents.json"" />
  </ItemGroup>";

                // HACK - Should process using CopyFileWithSubstitutions
                plistReplacements.Replacements.Add("</dict>", @"<key>XSAppIconAssets</key><string>Assets.xcassets/AppIcon.appiconset</string></dict>");
            }

            ReplacementGroup replacements = ReplacementGroup.Create(Replacement.Create("%CODE%", fileSubstitutions.TestCode), Replacement.Create("%DECL%", fileSubstitutions.TestDecl));

            templateEngine.CopyTextWithSubstitutions(GetAppMainSourceText(TemplateInfo.Language), TemplateInfo.SourceName, replacements);

            templateEngine.CopyFileWithSubstitutions("Info-Unified.plist", plistReplacements.CreateReplacementAction(), "Info.plist");

            return(templateEngine.CopyFileWithSubstitutions(TemplateInfo.ProjectName, GetStandardProjectReplacement(projectSubstitutions)));
        }
Ejemplo n.º 2
0
        public string Generate(string outputDirectory, ProjectSubstitutions projectSubstitutions, FileSubstitutions fileSubstitutions, bool includeMonoRuntime = false)
        {
            const string TestCode       = @"using MonoMac.Foundation;
using MonoMac.AppKit;

namespace TestCase
{
	class MainClass
	{
		%DECL%

		static void Main (string[] args)
		{
			NSApplication.Init ();
			%CODE%
		}
	}
}";
            FileCopier   templateEngine = CreateEngine(outputDirectory);

            ReplacementGroup replacements = ReplacementGroup.Create(Replacement.Create("%CODE%", fileSubstitutions.TestCode), Replacement.Create("%DECL%", fileSubstitutions.TestDecl));

            templateEngine.CopyTextWithSubstitutions(TestCode, TemplateInfo.SourceName, replacements);

            templateEngine.CopyFile("Info-Classic.plist", "Info.plist");

            ReplacementGroup replacementGroup = ReplacementGroup.Create(Replacement.Create("%CODE%", projectSubstitutions.CSProjConfig), Replacement.Create("%INCLUDE_MONO_RUNTIME%", includeMonoRuntime.ToString()));

            return(templateEngine.CopyFileWithSubstitutions(TemplateInfo.ProjectName, replacementGroup));
        }
        public string Generate(string outputDirectory, ProjectSubstitutions projectSubstitutions, FileSubstitutions fileSubstitutions)
        {
            FileCopier templateEngine = CreateEngine(outputDirectory);

            templateEngine.CopyFileWithSubstitutions(TemplateInfo.SourceName, Replacement.Create("%CODE%", fileSubstitutions.TestCode));

            return(templateEngine.CopyFileWithSubstitutions(TemplateInfo.ProjectName, GetStandardProjectReplacement(projectSubstitutions)));
        }
        public string Generate(string outputDirectory, ProjectSubstitutions projectSubstitutions, FileSubstitutions fileSubstitutions)
        {
            FileCopier templateEngine = CreateEngine(outputDirectory);

            templateEngine.CopyFileWithSubstitutions("ApiDefinition.cs", Replacement.Create("%CODE%", fileSubstitutions.ApiDefinition));
            templateEngine.CopyFileWithSubstitutions("StructsAndEnums.cs", Replacement.Create("%CODE%", fileSubstitutions.StructsAndEnums));

            return(templateEngine.CopyFileWithSubstitutions(TemplateInfo.ProjectName, GetStandardProjectReplacement(projectSubstitutions)));
        }
Ejemplo n.º 5
0
        public string Generate(string outputDirectory, ProjectSubstitutions projectSubstitutions, FileSubstitutions fileSubstitutions)
        {
            FileCopier templateEngine = CreateEngine(outputDirectory);

            ReplacementGroup replacements = ReplacementGroup.Create(Replacement.Create("%CODE%", fileSubstitutions.TestCode), Replacement.Create("%DECL%", fileSubstitutions.TestDecl));

            templateEngine.CopyTextWithSubstitutions(MacAppTemplateEngine.GetAppMainSourceText(ProjectLanguage.CSharp), TemplateInfo.SourceName, replacements);

            templateEngine.CopyFile("Info-Unified.plist", "Info.plist");

            return(templateEngine.CopyFileWithSubstitutions(TemplateInfo.ProjectName, GetStandardProjectReplacement(projectSubstitutions)));
        }
Ejemplo n.º 6
0
 public void Append(Replacement replacement) => Replacements.Add(replacement);