From b808623ca942b80f5f9308c252813caae07b0d3a Mon Sep 17 00:00:00 2001 From: Michael Becker Date: Fri, 14 May 2021 23:58:07 -0400 Subject: [PATCH] add back UE5 Compiler (create ZIP packages of Universal Editor content plugins), still WIP --- .../UniversalEditor.Compiler/Program.cs | 87 +++++++++++++++++++ .../Properties/AssemblyInfo.cs | 46 ++++++++++ .../UniversalEditor.Compiler.csproj | 47 ++++++++++ UniversalEditor.sln | 7 ++ 4 files changed, 187 insertions(+) create mode 100644 Applications/UniversalEditor.Compiler/Program.cs create mode 100644 Applications/UniversalEditor.Compiler/Properties/AssemblyInfo.cs create mode 100644 Applications/UniversalEditor.Compiler/UniversalEditor.Compiler.csproj diff --git a/Applications/UniversalEditor.Compiler/Program.cs b/Applications/UniversalEditor.Compiler/Program.cs new file mode 100644 index 00000000..f83a9d56 --- /dev/null +++ b/Applications/UniversalEditor.Compiler/Program.cs @@ -0,0 +1,87 @@ +// +// Program.cs - the main entry point for the Universal Editor Extension Compiler +// +// Author: +// Michael Becker +// +// Copyright (c) 2020 Mike Becker's Software +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +using System; +using System.Collections.Generic; +using UniversalEditor; +using UniversalEditor.Accessors; +using UniversalEditor.DataFormats.Package.OpenDocument; +using UniversalEditor.DataFormats.UEPackage; +using UniversalEditor.DataFormats.UEPackage.Binary; +using UniversalEditor.ObjectModels.Package; +using UniversalEditor.ObjectModels.UEPackage; + +namespace UniversalEditor.Compiler +{ + public class Program + { + public static void Main(string[] args) + { + Console.Error.WriteLine("uex started..."); + List listFileNames = new List(); + + string outputFileName = "output.uex"; + bool foundFileName = false; + for (int i = 0; i < args.Length; i++) + { + if (args[i].StartsWith("/") && !foundFileName) + { + if (args[i].StartsWith("/out:")) + { + outputFileName = args[i].Substring(5); + } + } + else + { + // is file name + foundFileName = true; + + listFileNames.Add(args[i]); + } + } + + PackageObjectModel ue = new PackageObjectModel(); + OpenDocumentDataFormat odf = new OpenDocumentDataFormat(); + + System.Text.StringBuilder sb = new System.Text.StringBuilder(); + int totalInstances = 0; + + string exefilename = System.Environment.GetCommandLineArgs()[0]; + string workingdir = System.IO.Path.GetDirectoryName(exefilename); + + for (int i = 0; i < listFileNames.Count; i++) + { + string relpath = listFileNames[i]; + if (relpath.StartsWith(workingdir)) + { + relpath = relpath.Substring(workingdir.Length); + } + relpath = "Content/" + relpath; + + byte[] filedata = System.IO.File.ReadAllBytes(listFileNames[i]); + ue.FileSystem.AddFile(relpath, filedata); + } + + FileAccessor faout = new FileAccessor(outputFileName, true, true); + Document.Save(ue, odf, faout); + Console.Error.WriteLine("uex written to {0}!", outputFileName); + } + } +} diff --git a/Applications/UniversalEditor.Compiler/Properties/AssemblyInfo.cs b/Applications/UniversalEditor.Compiler/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..81603d90 --- /dev/null +++ b/Applications/UniversalEditor.Compiler/Properties/AssemblyInfo.cs @@ -0,0 +1,46 @@ +// +// AssemblyInfo.cs +// +// Author: +// Michael Becker +// +// Copyright (c) 2020 Mike Becker's Software +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +using System.Reflection; +using System.Runtime.CompilerServices; + +// Information about this assembly is defined by the following attributes. +// Change them to the values specific to your project. + +[assembly: AssemblyTitle("Mocha.Compiler")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Mike Becker's Software")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("Mike Becker's Software")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". +// The form "{Major}.{Minor}.*" will automatically update the build and revision, +// and "{Major}.{Minor}.{Build}.*" will update just the revision. + +[assembly: AssemblyVersion("1.0.*")] + +// The following attributes are used to specify the signing key for the assembly, +// if desired. See the Mono documentation for more information about signing. + +//[assembly: AssemblyDelaySign(false)] +//[assembly: AssemblyKeyFile("")] diff --git a/Applications/UniversalEditor.Compiler/UniversalEditor.Compiler.csproj b/Applications/UniversalEditor.Compiler/UniversalEditor.Compiler.csproj new file mode 100644 index 00000000..ba1587ea --- /dev/null +++ b/Applications/UniversalEditor.Compiler/UniversalEditor.Compiler.csproj @@ -0,0 +1,47 @@ + + + + Debug + AnyCPU + {5E639F63-97B0-4B34-8928-29A5A3C661F4} + Exe + UniversalEditor.Compiler + uecc + 4.0.2019.12 + + + true + full + false + ..\..\Output\Debug + DEBUG; + prompt + 4 + false + + + true + ..\..\Output\Release + prompt + 4 + false + + + + + + + + + + + {2D4737E6-6D95-408A-90DB-8DFF38147E85} + UniversalEditor.Core + + + {30467E5C-05BC-4856-AADC-13906EF4CADD} + UniversalEditor.Essential + + + + diff --git a/UniversalEditor.sln b/UniversalEditor.sln index 615efe89..2b5e1af1 100644 --- a/UniversalEditor.sln +++ b/UniversalEditor.sln @@ -207,6 +207,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UniversalEditor.Plugins.Blo EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UniversalEditor.Plugins.AutoSave", "Plugins\UniversalEditor.Plugins.AutoSave\UniversalEditor.Plugins.AutoSave.csproj", "{385AB5A6-3EB6-4DF6-A7BF-DF9FFE43F192}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UniversalEditor.Compiler", "Applications\UniversalEditor.Compiler\UniversalEditor.Compiler.csproj", "{5E639F63-97B0-4B34-8928-29A5A3C661F4}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -599,6 +601,10 @@ Global {385AB5A6-3EB6-4DF6-A7BF-DF9FFE43F192}.Debug|Any CPU.Build.0 = Debug|Any CPU {385AB5A6-3EB6-4DF6-A7BF-DF9FFE43F192}.Release|Any CPU.ActiveCfg = Release|Any CPU {385AB5A6-3EB6-4DF6-A7BF-DF9FFE43F192}.Release|Any CPU.Build.0 = Release|Any CPU + {5E639F63-97B0-4B34-8928-29A5A3C661F4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5E639F63-97B0-4B34-8928-29A5A3C661F4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5E639F63-97B0-4B34-8928-29A5A3C661F4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5E639F63-97B0-4B34-8928-29A5A3C661F4}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(NestedProjects) = preSolution {6F0AB1AF-E1A1-4D19-B19C-05BBB15C94B2} = {05D15661-E684-4EC9-8FBD-C014BA433CC5} @@ -697,6 +703,7 @@ Global {C54F6BCD-60CD-4603-B0C9-CD0864455CB1} = {2ED32D16-6C06-4450-909A-40D32DA67FB4} {B6E600F5-E5BC-4DC2-8B41-7B11EB0A11B3} = {7B535D74-5496-4802-B809-89ED88274A91} {385AB5A6-3EB6-4DF6-A7BF-DF9FFE43F192} = {2ED32D16-6C06-4450-909A-40D32DA67FB4} + {5E639F63-97B0-4B34-8928-29A5A3C661F4} = {05D15661-E684-4EC9-8FBD-C014BA433CC5} EndGlobalSection GlobalSection(MonoDevelopProperties) = preSolution Policies = $0