Office deployment wizard for InstaSoft customers: - Install Office 2019/2021/2024 (Standard, Professional Plus, Home & Business) - Auto-download ODT from Microsoft, generate config XML, run setup - Remove existing Office installations (C2R + MSI) - License troubleshooting via ospp.vbs (dstatus, unpkey) - Fluent Design UI (WPF .NET Framework 4.8, Win7+ compatible) - Hungarian interface, multi-language Office installation - Product key input with auto-activation support Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
56 sor
2.0 KiB
C#
56 sor
2.0 KiB
C#
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")));
|
|
|
|
var doc = new XDocument(new XDeclaration("1.0", "utf-8", null), configuration);
|
|
return doc.Declaration + "\n" + doc.Root;
|
|
}
|
|
}
|
|
}
|