2022-06-26 23:26:42 +01:00
|
|
|
import { XmlComponent } from "@file/xml-components";
|
2024-10-21 03:57:15 +01:00
|
|
|
|
2020-08-03 14:58:30 +12:00
|
|
|
import { CustomPropertyAttributes } from "./custom-property-attributes";
|
|
|
|
|
2024-10-21 03:57:15 +01:00
|
|
|
export type ICustomPropertyOptions = {
|
2020-08-03 14:58:30 +12:00
|
|
|
readonly name: string;
|
|
|
|
readonly value: string;
|
2024-10-21 03:57:15 +01:00
|
|
|
};
|
2020-08-03 14:58:30 +12:00
|
|
|
|
|
|
|
export class CustomProperty extends XmlComponent {
|
2022-08-31 07:52:27 +01:00
|
|
|
public constructor(id: number, properties: ICustomPropertyOptions) {
|
2020-08-03 14:58:30 +12:00
|
|
|
super("property");
|
2020-08-04 08:50:56 +12:00
|
|
|
this.root.push(
|
|
|
|
new CustomPropertyAttributes({
|
|
|
|
fmtid: "{D5CDD505-2E9C-101B-9397-08002B2CF9AE}",
|
|
|
|
pid: id.toString(),
|
|
|
|
name: properties.name,
|
|
|
|
}),
|
|
|
|
);
|
2020-08-03 14:58:30 +12:00
|
|
|
this.root.push(new CustomPropertyValue(properties.value));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export class CustomPropertyValue extends XmlComponent {
|
2022-08-31 07:52:27 +01:00
|
|
|
public constructor(value: string) {
|
2020-08-03 14:58:30 +12:00
|
|
|
super("vt:lpwstr");
|
|
|
|
this.root.push(value);
|
|
|
|
}
|
|
|
|
}
|