v1.16 — Remove PowerShell edition, restore flat project structure
PowerShell version removed — will use OV code signing certificate instead. Files moved back from src/ to project root. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
79
Services/OdtXmlGenerator.cs
Normal file
79
Services/OdtXmlGenerator.cs
Normal file
@@ -0,0 +1,79 @@
|
||||
using System.Xml.Linq;
|
||||
using InstaSoftOfficeTool.Models;
|
||||
|
||||
namespace InstaSoftOfficeTool.Services
|
||||
{
|
||||
public static class OdtXmlGenerator
|
||||
{
|
||||
public static string Generate(InstallConfig config)
|
||||
{
|
||||
var product = new XElement("Product",
|
||||
new XAttribute("ID", config.Edition.ProductId));
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(config.ProductKey))
|
||||
{
|
||||
product.Add(new XAttribute("PIDKEY", config.ProductKey.Replace("-", "").Trim()));
|
||||
}
|
||||
|
||||
product.Add(new XElement("Language", new XAttribute("ID", config.Language)));
|
||||
|
||||
foreach (var app in config.ExcludedApps)
|
||||
{
|
||||
product.Add(new XElement("ExcludeApp", new XAttribute("ID", app)));
|
||||
}
|
||||
|
||||
var add = new XElement("Add",
|
||||
new XAttribute("OfficeClientEdition", config.Architecture),
|
||||
new XAttribute("Channel", config.Edition.Channel),
|
||||
product);
|
||||
|
||||
var configuration = new XElement("Configuration",
|
||||
add,
|
||||
new XElement("Display",
|
||||
new XAttribute("Level", "Full"),
|
||||
new XAttribute("AcceptEULA", "TRUE")),
|
||||
new XElement("Property",
|
||||
new XAttribute("Name", "FORCEAPPSHUTDOWN"),
|
||||
new XAttribute("Value", "TRUE")));
|
||||
|
||||
var doc = new XDocument(new XDeclaration("1.0", "utf-8", null), configuration);
|
||||
return doc.Declaration + "\n" + doc.Root;
|
||||
}
|
||||
|
||||
public static string GenerateRemoveAll()
|
||||
{
|
||||
var configuration = new XElement("Configuration",
|
||||
new XElement("Remove", new XAttribute("All", "TRUE")),
|
||||
new XElement("Display",
|
||||
new XAttribute("Level", "Full"),
|
||||
new XAttribute("AcceptEULA", "TRUE")),
|
||||
new XElement("Property",
|
||||
new XAttribute("Name", "FORCEAPPSHUTDOWN"),
|
||||
new XAttribute("Value", "TRUE")));
|
||||
|
||||
var doc = new XDocument(new XDeclaration("1.0", "utf-8", null), configuration);
|
||||
return doc.Declaration + "\n" + doc.Root;
|
||||
}
|
||||
|
||||
public static string GenerateRemoveProducts(string[] productIds)
|
||||
{
|
||||
var remove = new XElement("Remove");
|
||||
foreach (var id in productIds)
|
||||
{
|
||||
remove.Add(new XElement("Product", new XAttribute("ID", id)));
|
||||
}
|
||||
|
||||
var configuration = new XElement("Configuration",
|
||||
remove,
|
||||
new XElement("Display",
|
||||
new XAttribute("Level", "Full"),
|
||||
new XAttribute("AcceptEULA", "TRUE")),
|
||||
new XElement("Property",
|
||||
new XAttribute("Name", "FORCEAPPSHUTDOWN"),
|
||||
new XAttribute("Value", "TRUE")));
|
||||
|
||||
var doc = new XDocument(new XDeclaration("1.0", "utf-8", null), configuration);
|
||||
return doc.Declaration + "\n" + doc.Root;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user