41 lines
1.1 KiB
Go
41 lines
1.1 KiB
Go
package models
|
|
|
|
import (
|
|
"encoding/xml"
|
|
)
|
|
|
|
type Project struct {
|
|
XMLName xml.Name `xml:"project"`
|
|
Xmlns string `xml:"xmlns,attr"`
|
|
FileHeader FileHeader `xml:"fileHeader"`
|
|
ContentHeader ContentHeader `xml:"contentHeader"`
|
|
Types Types `xml:"types"`
|
|
Instances Instances `xml:"instances"`
|
|
AddData *AddData `xml:"addData"`
|
|
}
|
|
|
|
func (p *Project) AddFileHeader(companyName, productName, productversion string) {
|
|
p.FileHeader = FileHeader{
|
|
CompanyName: companyName,
|
|
ProductName: productName,
|
|
ProductVersion: productversion,
|
|
}
|
|
p.FileHeader.SetCurrentCreationDateTime()
|
|
}
|
|
|
|
func (p *Project) AddContentHeader(projectName string) {
|
|
p.ContentHeader = ContentHeader{
|
|
Name: projectName,
|
|
}
|
|
p.FileHeader.SetCurrentCreationDateTime()
|
|
p.ContentHeader.SetCoordinateDefault()
|
|
p.ContentHeader.AddAddData().AddProjectInformation(URL_PLCOPENXML, HANDLE_IMPLEMENTATION)
|
|
}
|
|
|
|
func (p *Project) AddApplication(url, handleUnknown string) *Data {
|
|
if p.AddData == nil {
|
|
p.AddData = NewAddData()
|
|
}
|
|
return p.AddData.AddApplication(url, handleUnknown)
|
|
}
|