Ejemplo n.º 1
0
    /// <summary>
    /// Extract und save all standard information of all ProzessDevices.
    /// </summary>
    /// <returns><c>true</c>, if all module process devices was gotten, <c>false</c> otherwise.</returns>
    /// <param name="requestAnswer">HTTP request in a string</param>
    public List <LinkedDataObject> getAllModuleProcessDevices(string module)
    {
        List <LinkedDataObject> linkedDataModule = new List <LinkedDataObject>();

        // Aus Überschichtsgründen!
        string      requestURL    = getAllModuleProcessDevicesSPARQLRequest(module);
        string      requestAnswer = getHTTPReq(preURL + System.Uri.EscapeDataString(requestURL) + endURL);
        XmlDocument xml           = new XmlDocument();

        xml.LoadXml(requestAnswer);
        // Alternative: xml.LoadXml(getHTTP(getAllProcessDevicesSPARQLRequest()));
        XmlNodeList dataNode = xml.SelectNodes("/table/tr/td");

        if ((dataNode.Count % 5) == 0)
        {
            for (int i = 0; i < dataNode.Count; i = i + 5)
            {
                LinkedDataObject processDevice = new LinkedDataObject();
                //Debug.Log("Setting all general variables!");
                processDevice.setGeneralVariable(dataNode.Item(i).InnerText, dataNode.Item(i + 1).InnerText, dataNode.Item(i + 2).InnerText, dataNode.Item(i + 3).InnerText, dataNode.Item(i + 4).InnerText);
                // TODO: Backbone ausgeschlossen, da sich hier prozesselemente wiederholen: Q1
                if (dataNode.Item(i + 1).InnerText != "Backbone")
                {
                    linkedDataModule.Add(processDevice);
                }
            }
            return(linkedDataModule);
        }
        else
        {
            Debug.Log("Error in XML!");
            return(linkedDataModule);
        }
    }