예제 #1
0
        void IPlugin.Export(ApplicationDataModel.ADM.ApplicationDataModel dataModel, string exportPath, Properties properties)
        {
            //Convert the ADAPT model into the ISO model
            string            outputPath     = exportPath.WithTaskDataPath();
            TaskDataMapper    taskDataMapper = new TaskDataMapper(outputPath, properties);
            ISO11783_TaskData taskData       = taskDataMapper.Export(dataModel);

            //Serialize the ISO model to XML
            TaskDocumentWriter writer = new TaskDocumentWriter();

            writer.WriteTaskData(exportPath, taskData);

            //Serialize the Link List
            writer.WriteLinkList(exportPath, taskData.LinkList);
        }
예제 #2
0
        public void Export(ApplicationDataModel.ADM.ApplicationDataModel dataModel, string exportPath, Properties properties = null)
        {
            using (var taskWriter = new TaskDocumentWriter())
            {
                var taskDataPath     = Path.Combine(exportPath, "TASKDATA");
                var iso11783TaskData = _exporter.Export(dataModel, taskDataPath, taskWriter);

                var filePath = Path.Combine(taskDataPath, FileName);
                if (iso11783TaskData != null)
                {
                    var xml = Encoding.UTF8.GetString(taskWriter.XmlStream.ToArray());
                    File.WriteAllText(filePath, xml);
                    LinkListWriter.Write(taskDataPath, taskWriter.Ids);
                }
            }
        }
예제 #3
0
        public XmlWriter Export(ApplicationDataModel.ADM.ApplicationDataModel applicationDataModel, string taskDataPath, TaskDocumentWriter writer)
        {
            var isoTaskData = writer.Write(taskDataPath, applicationDataModel);

            if (applicationDataModel != null)
            {
                var numberOfExistingTasks = GetNumberOfExistingTasks(isoTaskData, writer);
                var tasks = applicationDataModel.Documents == null
                    ? null
                    : _taskMapper.Map(applicationDataModel.Documents.LoggedData, applicationDataModel.Catalog,
                                      taskDataPath, numberOfExistingTasks, writer, false);
                if (tasks != null)
                {
                    var taskList = tasks.ToList();
                    taskList.ForEach(t => t.WriteXML(isoTaskData));
                }
            }

            //Close the root element with </ISO11783_TaskData>
            isoTaskData.WriteEndElement();
            isoTaskData.Close();
            return(isoTaskData);
        }