@manuth/woltlab-compiler
Version:
A compiler for generating WoltLab-Package `.tar` Archives and other WoltLab-Package Components
46 lines • 1.5 kB
JavaScript
import { XMLEditor } from "../../Serialization/XMLEditor.js";
import { OptionFileCompiler } from "./OptionFileCompiler.js";
/**
* Provides the functionality to compile group-option files.
*/
export class GroupOptionFileCompiler extends OptionFileCompiler {
/**
* Initializes a new instance of the {@link GroupOptionFileCompiler `GroupOptionFileCompiler`} class.
*
* @param item
* The item to compile.
*/
constructor(item) {
super(item);
}
/**
* @inheritdoc
*/
get SchemaLocation() {
return "http://www.woltlab.com/XSD/tornado/userGroupOption.xsd";
}
/**
* @inheritdoc
*
* @param option
* The option to serialize.
*
* @returns
* The serialized option.
*/
CreateOption(option) {
let editor = new XMLEditor(super.CreateOption(option));
if (option.UserDefaultValue) {
editor.Add(editor.CreateTextElement("userdefaultvalue", `${option.UserDefaultValue}`));
}
if (option.ModDefaultValue) {
editor.Add(editor.CreateTextElement("moddefaultvalue", `${option.ModDefaultValue}`));
}
if (option.AdminDefaultValue) {
editor.Add(editor.CreateTextElement("admindefaultvalue", `${option.AdminDefaultValue}`));
}
editor.Add(editor.CreateTextElement("usersonly", option.RegisteredOnly ? "1" : "0"));
return editor.Element;
}
}
//# sourceMappingURL=GroupOptionFileCompiler.js.map