internal BaseTiaExpandoAttributeSet(TiaObjectStructure tiaObjectStructure) : base(tiaObjectStructure) { }
internal CoreAttributes(TiaObjectStructure tiaObjectStructure) : base(tiaObjectStructure) { }
public static BaseTiaAttributeSet CreateBaseTiaAttribute(TiaObjectStructure tiaObjectStructure, int id) { return(new BaseTiaAttributeSet(tiaObjectStructure)); }
internal override void LoadProject() { _projectLoaded = true; return; //Stream stream = new FileStream("c:\\tia.xml", FileMode.OpenOrCreate); // new ChunkedMemoryStream(); //StreamWriter streamWriter = new StreamWriter(stream); //XmlWriter xmlWriter = XmlWriter.Create(streamWriter, new XmlWriterSettings { Indent = true, CheckCharacters = false }); var tiaObjectStructure = new TiaObjectStructure(); var xmlWriter = new TiaXmlWriter(tiaObjectStructure); //xmlWriter.WriteStartDocument(); //xmlWriter.WriteStartElement("root"); if (tiaExport == null) { tiaExportType = Type.GetType("Siemens.Automation.ObjectFrame.FileStorage.Conversion.Export, Siemens.Automation.ObjectFrame.FileStorage"); if (TiaVersion < TiaVersionTypes.V13) { tiaExport = tiaExportType.InvokeMember("CreateInstance", BindingFlags.Static | BindingFlags.Public | BindingFlags.InvokeMethod, null, null, new object[] { DataFile, true }); } else { //V13 var helper = Type.GetType("Siemens.Automation.ObjectFrame.FileStorage.Base.Client.DataStoreClientHelper, Siemens.Automation.ObjectFrame.FileStorage.Base"); var metaManagerMth = helper.GetMethods(BindingFlags.NonPublic | BindingFlags.Static).FirstOrDefault(x => x.Name == "GetMetaManager"); var metaManager = metaManagerMth.Invoke(null, null); var crInst = tiaExportType.GetMethods().FirstOrDefault(x => x.Name == "CreateInstance"); tiaExport = crInst.Invoke(null, new object[] { DataFile, null, true, metaManager }); } var memMgrType = Type.GetType("Siemens.Automation.ObjectFrame.Kernel.MemoryManager, Siemens.Automation.ObjectFrame.Kernel"); try { memMgrType.InvokeMember("Initialize", BindingFlags.Static | BindingFlags.Public | BindingFlags.InvokeMethod, null, null, new object[] { 104857600 }); } catch (Exception) { } } //tiaExportType.InvokeMember("WriteCultures", BindingFlags.InvokeMethod | BindingFlags.NonPublic | BindingFlags.Instance, null, tiaExport, new object[] { xmlWriter }); //tiaExportType.InvokeMember("StartExport", BindingFlags.InvokeMethod | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance, null, tiaExport, new object[] { xmlWriter }); //tiaExportType.InvokeMember("WriteRootObjectList", BindingFlags.InvokeMethod | BindingFlags.NonPublic | BindingFlags.Instance, null, tiaExport, new object[] { xmlWriter }); if (TiaVersion >= TiaVersionTypes.V13) { var bgWorker = tiaExportType.GetField("m_BgWorker", BindingFlags.Instance | BindingFlags.NonPublic); bgWorker.SetValue(tiaExport, new BackgroundWorker() { WorkerReportsProgress = true, WorkerSupportsCancellation = true }); } var serializeObjects = tiaExportType.GetMethod("SerializeObjects", BindingFlags.InvokeMethod | BindingFlags.NonPublic | BindingFlags.Instance, null, new Type[] { typeof(XmlWriter) }, null); serializeObjects.Invoke(tiaExport, new object[] { xmlWriter }); xmlWriter.Flush(); xmlWriter.Close(); //streamWriter.Close(); //stream.Close(); //stream.Position = 0; //ParseProject(stream); }
public static BaseTiaAttributeSet CreateBaseTiaAttribute(TiaObjectStructure tiaObjectStructure, int id) { return new BaseTiaAttributeSet(tiaObjectStructure); }