public bool XClose() { bool bRes = true; foreach (KeyValuePair <string, XProgram> pair in XPrograms) { bRes = pair.Value.XClose(); } XPrograms.Clear(); if (XInput != null) { bRes = XInput.XOutput.XClose(); } if (XOutput != null) { bRes = XOutput.XInput.XClose(); } if (XError != null) { bRes = XError.XInput.XClose(); } if (XLog != null) { bRes = XLog.XInput.XClose(); } return(bRes); }
protected bool _XProgram(XInput xinput, XOutput xoutput, XOutput xerror, XOutput xlog) { bool bRes = XPrograms.ContainsKey(xinput.XFirst); if (bRes) { XProgram xprogram = XPrograms[xinput.XFirst]; bRes = xprogram.XMain(false, xprogram.XInput, xprogram.XOutput, xprogram.XError, xprogram.XLog); } else { string childInputRead = null; XOutput xchildInputWrite = null; bRes = XCreateOutput(out xchildInputWrite, out childInputRead); string childOutputWrite = null; XInput xchildOutputRead = null; bRes = XCreateInput(out xchildOutputRead, out childOutputWrite); if (bRes) { string[] args = new string[] { xinput.XFirst, XIN, childInputRead, XOUT, childOutputWrite }; XArgs xargs = new XArgs(args); XProgram xprogram = null; bRes = XStartProgram(xargs, out xprogram); if (bRes) { XPrograms[xinput.XFirst] = xprogram; bRes = xchildOutputRead.XRead(); if (bRes) { string childOutputRead = xchildOutputRead.XRead(XOUT); XInput xremoteChildOutput = null; bRes = XCreateRemoteInput(childOutputRead, out xremoteChildOutput); if (bRes) { string childErrorRead = xchildOutputRead.XRead(XERR); XInput xremoteChildError = null; bRes = XCreateRemoteInput(childErrorRead, out xremoteChildError); if (bRes) { string childLogRead = xchildOutputRead.XRead(XLOG); XInput xremoteChildLog = null; bRes = XCreateRemoteInput(childLogRead, out xremoteChildLog); if (bRes) { xprogram.XInput = new XRemoteInput(xinput, xchildInputWrite); xprogram.XOutput = new XRemoteOutput(xoutput, xremoteChildOutput); xprogram.XError = new XRemoteOutput(xerror, xremoteChildError); xprogram.XLog = new XRemoteOutput(xlog, xremoteChildLog); bRes = XMain(false, xprogram.XInput, xprogram.XOutput, xprogram.XError, xprogram.XLog); } } } } } } } return(bRes); }