public Agent() { data = new Data(); this.exeFilePath = Assembly.GetExecutingAssembly().Location; config = new Configuration(true); //LOAD_DEFAULT_CONFIGURATION = true LogToFile.Initialize(config.UseLogFile); data.currentXSLTHREF = config.CurrentXSLTHREF; data.probeXSLTHREF = config.ProbeXSLTHREF; data.errorXSLTHREF = config.ErrorXSLTHREF; }
internal static XElement createError(Data _data, int _errorCode, String _extra) { XElement mtxst = Util.createErrorXST(); String[] errorDescription = getErrorCode(_errorCode); XElement error = new XElement(MTConnectNameSpace.mtError+"Error", new XAttribute("errorCode", errorDescription[0]), errorDescription[1] + " " + _extra); XElement errors = new XElement(MTConnectNameSpace.mtError + "Errors"); errors.Add(error); mtxst.Add(errors); XElement header = _data.getErrorHeader(); mtxst.AddFirst(header); return mtxst; }
internal static String[] return_INVALID_URI_Error(Data data, StreamWriter writer, String extra_info) { Error.createError(data, Error.INVALID_URI, extra_info).Save(writer); return null; }
internal static XElement getDevice(XElement probe, String deviceId, StreamWriter writer, Data data, XmlNamespaceManager namespaceManager) { XElement devices = probe.Element(MTConnectNameSpace.mtDevices+"Devices"); if (devices != null) { IEnumerable<XElement> deviceset = devices.Elements(MTConnectNameSpace.mtDevices + "Device"); XElement device = null; foreach (XElement de in deviceset) { if (de.Attribute("name").Value == deviceId) device=de; } if (device == null) { Error.createError(data, Error.NO_DEVICE).Save(writer); return null; } else return device; } else //Devices were not found from Devices.xml load at initialization { Error.createError(data, Error.INTERNAL_ERROR).Save(writer); return null; } }
internal HttpServer(Data _shared) { sharedData = _shared; }